forked from mirrors/nixpkgs
Implementing a fix allowing deepOverride without changing dependency-tree-leaf packages
svn path=/nixpkgs/trunk/; revision=22533
This commit is contained in:
parent
e89dbf1184
commit
aadb898a0b
|
@ -1,4 +1,4 @@
|
|||
{stdenv, fetchurl, static ? false, ...}:
|
||||
{stdenv, fetchurl, static ? false}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "zlib-1.2.3";
|
||||
|
|
|
@ -270,4 +270,9 @@ rec {
|
|||
else eqStrict pat val
|
||||
) [pattern attrs]));
|
||||
|
||||
# override only the attributes that are already present in the old set
|
||||
# useful for deep-overriding
|
||||
overrideExisting = old: new:
|
||||
old // listToAttrs (map (attr: nameValuePair attr (attrByPath [attr] (getAttr attr old) new)) (attrNames old));
|
||||
|
||||
}
|
||||
|
|
|
@ -53,11 +53,10 @@ rec {
|
|||
{ override = newArgs:
|
||||
makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
|
||||
deepOverride = newArgs:
|
||||
makeOverridable f ((lib.mapAttrs (deepOverrider newArgs) origArgs) // newArgs);
|
||||
makeOverridable f (lib.overrideExisting (lib.mapAttrs (deepOverrider newArgs) origArgs) newArgs);
|
||||
origArgs = origArgs;
|
||||
};
|
||||
|
||||
|
||||
deepOverrider = newArgs: name: x: if builtins.isAttrs x then (
|
||||
if x ? deepOverride then (x.deepOverride newArgs) else
|
||||
if x ? override then (x.override newArgs) else
|
||||
|
|
Loading…
Reference in a new issue