How much would have to be rebuild when using this reimplementation of
nukeReferences ?
It only replaces hashes beeing 32 characters long. That's why it's more
correct. also using "$@" is better than using $* because it doesn't
depend on IFS.. and $* doesn't handle filepaths containing spaces.

replacement:

        nukeReferences = writeTextFile {
          name = "nuke-references"; executable = true; destination = 
"/bin/nuke-refs";
          text = ''
              #! $SHELL -e
              exec sed -i 
's|/nix/store/[a-z0-9]\{32\}-|/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g' 
"$@" '';
        };


is now:
  derivation running this builder.sh

      source $stdenv/setup

      ensureDir $out/bin
      cat > $out/bin/nuke-refs <<EOF
      #! $SHELL -e
      for i in \$*; do
          cat \$i | sed 
"s|/nix/store/[a-z0-9]*-|/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" > 
\$i.tmp
          if test -x \$i; then chmod +x \$i.tmp; fi
          mv \$i.tmp \$i
      done
      EOF
      chmod +x $out/bin/nuke-refs

Marc Weber
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to