From e877c69d78fe75ae3531b3ed3cb4a4d7b390ccec Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Jul 2003 15:15:15 +0000 Subject: * Substitutes now should produce a path with the same id as they are substituting for (obvious, really). * For greater efficiency, nix-pull/unnar will place the output in a path that is probably the same as what is actually needed, thus preventing a path copy. * Even if a output id is given in a Fix package expression, ensure that the resulting Nix derive expression has a different id. This is because Nix expressions that are semantically equivalent (i.e., build the same result) might be different w.r.t. efficiency or divergence. It is absolutely vital for the substitute mechanism that such expressions are not used interchangeably. --- src/normalise.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/normalise.cc') diff --git a/src/normalise.cc b/src/normalise.cc index 8da940aa67ce..f463457e4ab5 100644 --- a/src/normalise.cc +++ b/src/normalise.cc @@ -24,7 +24,7 @@ static FSId storeSuccessor(const FSId & id1, ATerm sc) typedef set FSIdSet; -Slice normaliseFState(FSId id) +Slice normaliseFState(FSId id, FSIdSet pending) { debug(format("normalising fstate %1%") % (string) id); Nest nest(true); @@ -57,8 +57,8 @@ Slice normaliseFState(FSId id) for (FSIds::iterator i = fs.derive.inputs.begin(); i != fs.derive.inputs.end(); i++) { - Slice slice = normaliseFState(*i); - realiseSlice(slice); + Slice slice = normaliseFState(*i, pending); + realiseSlice(slice, pending); for (SliceElems::iterator j = slice.elems.begin(); j != slice.elems.end(); j++) @@ -93,7 +93,7 @@ Slice normaliseFState(FSId id) i != outPaths.end(); i++) { try { - expandId(i->second, i->first); + expandId(i->second, i->first, "/", pending); } catch (Error & e) { debug(format("fast build failed: %1%") % e.what()); fastBuild = false; @@ -175,7 +175,7 @@ Slice normaliseFState(FSId id) } -void realiseSlice(const Slice & slice) +void realiseSlice(const Slice & slice, FSIdSet pending) { debug(format("realising slice")); Nest nest(true); @@ -209,7 +209,7 @@ void realiseSlice(const Slice & slice) { SliceElem elem = *i; debug(format("expanding %1% in %2%") % (string) elem.id % elem.path); - expandId(elem.id, elem.path); + expandId(elem.id, elem.path, "/", pending); } } -- cgit 1.4.1