From 8129cf33d959db44344fbffc34a981cc27b29bfb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Feb 2014 10:46:30 +0100 Subject: [PATCH] Slight simplification --- src/libstore/build.cc | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 166de1c32a..e2115bc802 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -2163,9 +2163,6 @@ PathSet parseReferenceSpecifiers(const Derivation & drv, string attr) void DerivationGoal::registerOutputs() { - map allReferences; - map contentHashes; - /* When using a build hook, the build hook can register the output as valid (by doing `nix-store --import'). If so we don't have to do anything here. */ @@ -2176,6 +2173,8 @@ void DerivationGoal::registerOutputs() if (allValid) return; } + ValidPathInfos infos; + /* Check whether the output paths were created, and grep each output path to determine what other paths it references. Also make all output paths read-only. */ @@ -2291,8 +2290,6 @@ void DerivationGoal::registerOutputs() continue; } - contentHashes[path] = hash; - /* For debugging, print out the referenced and unreferenced paths. */ foreach (PathSet::iterator, i, inputPaths) { @@ -2303,8 +2300,6 @@ void DerivationGoal::registerOutputs() debug(format("referenced input: `%1%'") % *i); } - allReferences[path] = references; - /* If the derivation specifies an `allowedReferences' attribute (containing a list of paths that the output may refer to), check that all references are in that list. !!! @@ -2319,6 +2314,14 @@ void DerivationGoal::registerOutputs() worker.store.optimisePath(path); // FIXME: combine with scanForReferences() worker.store.markContentsGood(path); + + ValidPathInfo info; + info.path = path; + info.hash = hash.first; + info.narSize = hash.second; + info.references = references; + info.deriver = drvPath; + infos.push_back(info); } if (buildMode == bmCheck) return; @@ -2326,16 +2329,6 @@ void DerivationGoal::registerOutputs() /* Register each output path as valid, and register the sets of paths referenced by each of them. If there are cycles in the outputs, this will fail. */ - ValidPathInfos infos; - foreach (PathSet::iterator, i, missingPaths) { - ValidPathInfo info; - info.path = *i; - info.hash = contentHashes[*i].first; - info.narSize = contentHashes[*i].second; - info.references = allReferences[*i]; - info.deriver = drvPath; - infos.push_back(info); - } worker.store.registerValidPaths(infos); }