diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2020-08-04 06:52:56 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2021-01-14 20:00:58 +0100 |
commit | 6e3f4c90790f112f6b6da54b9f1eb0e85310ee64 (patch) | |
tree | a1e0e029aa9af6dd4fc94f6b8007cc69902cfeeb /pkgs/build-support | |
parent | cb1654ff92299eb8b7ab3ee609e1555fae117097 (diff) | |
download | nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar.gz nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar.bz2 nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar.lz nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar.xz nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.tar.zst nixpkgs-6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.zip |
stdenv/patchShebangs: avoid temporary time reference file
less commands -> faster
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index bd254be24f9..d0efe039ced 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -88,17 +88,15 @@ patchShebangs() { newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}} if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then - if [[ -n "$newPath" ]] && [[ "$newPath" != "$oldPath" ]]; then + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"" # escape the escape chars so that sed doesn't interpret them escapedInterpreterLine=${newInterpreterLine//\\/\\\\} # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281 - timestamp=$(mktemp) - touch -r "$f" "$timestamp" + timestamp=$(stat --printf "%y" "$f") sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f" - touch -r "$timestamp" "$f" - rm "$timestamp" + touch --date "$timestamp" "$f" fi fi done < <(find "$@" -type f -perm -0100 -print0) |