diff options
author | Russell O'Connor <oconnorr@google.com> | 2015-11-15 19:52:30 -0500 |
---|---|---|
committer | Russell O'Connor <roconnor@theorem.ca> | 2015-11-15 19:52:30 -0500 |
commit | 782cfe94b09914fbd2f62a26f19db3ebdc6701ca (patch) | |
tree | 2e5973ad77f5505059907f59c60d025cdf2a5d1b | |
parent | 7ae05edcdd14f6ace83ead9bf0d114e97c89a83a (diff) | |
download | nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar.gz nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar.bz2 nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar.lz nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar.xz nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.tar.zst nixpkgs-782cfe94b09914fbd2f62a26f19db3ebdc6701ca.zip |
replace-dependency.nix: new feature
When replace-dependency is given a drv that doesn't actually depend on oldDependency, then just return back the original drv but also issue a warning.
-rw-r--r-- | pkgs/build-support/replace-dependency.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/build-support/replace-dependency.nix b/pkgs/build-support/replace-dependency.nix index ed65b9dad1d..4138397f795 100644 --- a/pkgs/build-support/replace-dependency.nix +++ b/pkgs/build-support/replace-dependency.nix @@ -17,11 +17,12 @@ # }; # This will rebuild glibc with your security patch, then copy over firefox # (and all of its dependencies) without rebuilding further. -{ drv, oldDependency, newDependency }: +{ drv, oldDependency, newDependency, verbose ? true }: with lib; let + warn = if verbose then builtins.trace else (x:y:y); references = import (runCommand "references.nix" { exportReferencesGraph = [ "graph" drv ]; } '' (echo { while read path @@ -78,4 +79,6 @@ let (filter dependsOnOld (builtins.attrNames references))) // rewrittenDeps; in assert (stringLength (drvName (toString oldDependency)) == stringLength (drvName (toString newDependency))); -getAttr (discard (toString drv)) rewriteMemo +if hasAttr (discard (toString drv)) rewriteMemo +then getAttr (discard (toString drv)) rewriteMemo +else warn "replace-dependency.nix: derivation ${discard (toString drv)} does not depend on ${discard (toString oldDependency)}\n" drv |