nixpkgs/pkgs/build-support
aszlig 19e83bc2ba
Merge autoPatchelfHook improvements (#47222)
This includes the initialy commit was done by @Mic92 plus a few fixes
from my side. So essentially this avoids patching statically linked
executables and also speeds up searching for ELF files altogether.

I've tested this by comparing the outputs of all the derivations which
make use of this hook using the following Nix expression:

  let
    getPackagesForRev = rev: with import (builtins.fetchGit {
      url = ./.;
      inherit rev;
    }) { config.allowUnfree = true; }; [
      cups-kyodialog3 elasticsearch franz gurobi javacard-devkit
      masterpdfeditor maxx oracle-instantclient powershell reaper
      teamviewer unixODBCDrivers.msodbcsql17 virtlyst wavebox zoom-us
    ];

    pkgs = import <nixpkgs> {};
    baseRev = "ef764eb0d8314b81a012dae04642b4766199956d";

  in pkgs.runCommand "diff-contents" {
    chset = pkgs.lib.zipListsWith (old: new: pkgs.runCommand "diff" {
      inherit old new;
      nativeBuildInputs = [ pkgs.nukeReferences ];
    } ''
      mkdir -p "''${NIX_STORE#/}"
      cp --no-preserve=all -r "$old" "''${NIX_STORE#/}"
      cp --no-preserve=all -r "$new" "''${NIX_STORE#/}"
      find "''${old#/}" "''${new#/}" \
        \( -type f -exec nuke-refs {} + \) -o \( -type l -delete \)
      mkdir "$out"
      echo "$old" > "$out/old-path"
      echo "$new" > "$out/new-path"
      diff -Nur "''${old#/}" "''${new#/}" > "$out/diff" || :
    '') (getPackagesForRev baseRev) (getPackagesForRev "");
  } ''
    err=0
    for c in $chset; do
      if [ -s "$c/diff" ]; then
        echo "$(< "$c/old-path") -> $(< "$c/new-path")" \
             "differs, report: $c/diff" >&2
        err=1
      fi
    done
    [ $err -eq 0 ] && touch "$out"
  ''

With these changes there is only one derivation which has altered
contents, which is "franz". However the reason why it has differing
contents is not directly because of the autoPatchelfHook changes, but
because the "env-vars" file from the builder is in
"$out/opt/franz/env-vars" (Cc: @gnidorah) and we now have different
contents for NIX_CFLAGS_COMPILE and other environment variables.

I also tested this against a random static binary and the hook no longer
tries to patch it.

Merges: #47222
2018-09-25 05:21:01 +02:00
..
agda
bintools-wrapper Revert "Merge pull request #44767 from obsidiansystems/wrapper-env-var-path" 2018-08-22 01:14:53 +02:00
build-bazel-package bazel-deps: init at 2018-05-31 (#43018) 2018-07-09 22:38:45 +00:00
build-dotnet-package
build-fhs-userenv reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
build-setupcfg Revert "buildSetupcfg: Include unzip for zip sources." 2018-04-14 20:12:22 -04:00
buildenv
cc-wrapper treewide: cleanup some references to bash 2018-09-04 22:05:02 +00:00
docker dockerTools.buildImage: test that created=now makes an unstable date 2018-09-20 13:06:14 -04:00
dotnetbuildhelpers
dotnetenv [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
emacs lib: Make overrideScope' which takes arguments in the conventional order 2018-09-24 17:50:11 -04:00
expand-response-params
fetchbower Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchbzr treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchcvs bsd: init netbsd & openbsd userland 2018-04-24 14:16:35 -05:00
fetchdarcs pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchdocker Merge branch 'no-toPath' 2018-09-06 08:09:53 -04:00
fetchegg treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchfossil treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchgit pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgitlocal pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgx Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchhg pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchipfs treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchmavenartifact
fetchmtn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchnuget pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchpatch fetchpatch: patchutils -> buildPackages.patchutils 2018-08-21 17:21:25 -04:00
fetchrepoproject treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchs3 pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchsvn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchsvnrevision
fetchsvnssh treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchurl fetchurl: add sageupstream mirror 2018-06-30 01:20:44 +02:00
fetchzip fetchzip: Use unzip from buildPackages 2018-09-21 12:55:32 -04:00
icon-conv-tools
kernel treewide: Remove usage of remaining redundant platform compatability stuff 2018-08-30 17:20:32 -04:00
libredirect libredirect: add description 2017-12-14 19:03:35 +00:00
make-desktopitem
make-startupitem
make-symlinks
mkshell mkShell: add builder (#30975) 2017-12-20 23:42:07 +00:00
mono-dll-fixer
nix-prefetch-github nix-prefetch-github: init -> 1.3 2018-05-22 20:55:07 +02:00
nuke-references
ocaml
release reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
remove-references-to
rust buildRustCrate: added some edge cases with binaries 2018-09-13 22:00:29 +02:00
setup-hooks autoPatchelfHook: Silence errors in isExecutable 2018-09-25 04:48:12 +02:00
singularity-tools pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
skaware skaware: switch from git repos to tarballs 2018-09-06 11:53:22 +02:00
src-only
substitute
substitute-files
templaterpm
upstream-updater
vm virtualization/qemu-vm: fix and improve virtio/scsi switching 2018-09-22 23:29:19 +02:00
wrapper-common {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
build-maven.nix buildMaven: Check for authenticated attribute 2018-07-25 16:00:52 +02:00
build-pecl.nix Revert "fix phpPackages memcache,memcached,xdebug" 2017-12-10 12:12:43 +01:00
closure-info.nix Cleanup 2018-02-27 19:59:26 +01:00
dhall-to-nix.nix
plugins.nix
replace-dependency.nix
setup-systemd-units.nix
source-from-head-fun.nix
trivial-builders.nix lib: ensure directories of linkFarm links exist (#45628) 2018-09-01 14:53:23 +02:00