about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-18T09·46+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-18T09·46+0100
commit8129cf33d959db44344fbffc34a981cc27b29bfb (patch)
tree1f7246a2f25e9f2c2109f2291bf646aaf91f8d32 /src/libstore/build.cc
parent1aa19b24b27c6bbf4d46cdd7f6d06b534dd67c19 (diff)
Slight simplification
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc27
1 files 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<Path, PathSet> allReferences;
-    map<Path, HashResult> 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);
 }