Implementing a fix allowing deepOverride without changing dependency-tree-leaf packages

svn path=/nixpkgs/trunk/; revision=22533
This commit is contained in:
Michael Raskin 2010-07-08 15:31:59 +00:00
parent e89dbf1184
commit aadb898a0b
3 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, static ? false, ...}:
{stdenv, fetchurl, static ? false}:
stdenv.mkDerivation {
name = "zlib-1.2.3";

View file

@ -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));
}

View file

@ -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