replace-dependency: Don't strictly require that drv, old-dependency, and new-dependency be derivations
This commit is contained in:
parent
779c74f795
commit
5dd1b8f204
@ -45,7 +45,7 @@ let
|
|||||||
|
|
||||||
discard = builtins.unsafeDiscardStringContext;
|
discard = builtins.unsafeDiscardStringContext;
|
||||||
|
|
||||||
old-storepath = builtins.storePath (discard old-dependency.outPath);
|
old-storepath = builtins.storePath (discard (toString old-dependency));
|
||||||
|
|
||||||
references-of = drv: getAttr (discard (toString drv)) references;
|
references-of = drv: getAttr (discard (toString drv)) references;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ let
|
|||||||
} | $nixStore --restore $out
|
} | $nixStore --restore $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
rewritten-deps = listToAttrs [ {name = discard old-dependency.outPath; value = new-dependency;} ];
|
rewritten-deps = listToAttrs [ {name = discard (toString old-dependency); value = new-dependency;} ];
|
||||||
|
|
||||||
fn = drv:
|
fn = drv:
|
||||||
if depends-on-old drv
|
if depends-on-old drv
|
||||||
@ -75,5 +75,5 @@ let
|
|||||||
) {} (references-of drv)));
|
) {} (references-of drv)));
|
||||||
} ]
|
} ]
|
||||||
else {};
|
else {};
|
||||||
in assert (stringLength old-dependency.name == stringLength new-dependency.name);
|
in assert (stringLength (drv-name (toString old-dependency)) == stringLength (drv-name (toString new-dependency)));
|
||||||
getAttr (discard drv.outPath) (fn drv)
|
getAttr (discard (toString drv)) (fn drv)
|
||||||
|
Loading…
Reference in New Issue
Block a user