separateDebugInfo: don't create broken symlinks (#378316)

This commit is contained in:
K900
2025-02-02 21:49:07 +03:00
committed by GitHub
2 changed files with 5 additions and 7 deletions
@@ -226,9 +226,6 @@ stdenv.mkDerivation (finalAttrs: {
# injected by the pkgsStatic stdenv
# <https://github.com/NixOS/nixpkgs/issues/83667>
rm -f $out/nix-support/propagated-build-inputs
'' + lib.optionalString finalAttrs.separateDebugInfo ''
# HACK: remove broken symlink created by hook
rm $debug/lib/debug/s390-ccw.img
'';
preBuild = "cd build";
@@ -43,10 +43,11 @@ _separateDebugInfo() {
then
echo "separate-debug-info: warning: multiple files with build id $id found, overwriting"
fi
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
(
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" &&
# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
)
) || rmdir -p "$dst/${id:0:2}"
done < <(find "$prefix" -type f -print0 | sort -z)
}