Slight simplification

This commit is contained in:
Eelco Dolstra 2014-02-18 10:46:30 +01:00
parent 1aa19b24b2
commit 8129cf33d9

View file

@ -2163,9 +2163,6 @@ PathSet parseReferenceSpecifiers(const Derivation & drv, string attr)
void DerivationGoal::registerOutputs() void DerivationGoal::registerOutputs()
{ {
map<Path, PathSet> allReferences;
map<Path, HashResult> contentHashes;
/* When using a build hook, the build hook can register the output /* 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 as valid (by doing `nix-store --import'). If so we don't have
to do anything here. */ to do anything here. */
@ -2176,6 +2173,8 @@ void DerivationGoal::registerOutputs()
if (allValid) return; if (allValid) return;
} }
ValidPathInfos infos;
/* Check whether the output paths were created, and grep each /* Check whether the output paths were created, and grep each
output path to determine what other paths it references. Also make all output path to determine what other paths it references. Also make all
output paths read-only. */ output paths read-only. */
@ -2291,8 +2290,6 @@ void DerivationGoal::registerOutputs()
continue; continue;
} }
contentHashes[path] = hash;
/* For debugging, print out the referenced and unreferenced /* For debugging, print out the referenced and unreferenced
paths. */ paths. */
foreach (PathSet::iterator, i, inputPaths) { foreach (PathSet::iterator, i, inputPaths) {
@ -2303,8 +2300,6 @@ void DerivationGoal::registerOutputs()
debug(format("referenced input: `%1%'") % *i); debug(format("referenced input: `%1%'") % *i);
} }
allReferences[path] = references;
/* If the derivation specifies an `allowedReferences' /* If the derivation specifies an `allowedReferences'
attribute (containing a list of paths that the output may attribute (containing a list of paths that the output may
refer to), check that all references are in that list. !!! 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.optimisePath(path); // FIXME: combine with scanForReferences()
worker.store.markContentsGood(path); 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; if (buildMode == bmCheck) return;
@ -2326,16 +2329,6 @@ void DerivationGoal::registerOutputs()
/* Register each output path as valid, and register the sets of /* Register each output path as valid, and register the sets of
paths referenced by each of them. If there are cycles in the paths referenced by each of them. If there are cycles in the
outputs, this will fail. */ 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); worker.store.registerValidPaths(infos);
} }