This commit is contained in:
Eelco Dolstra 2020-11-17 13:58:55 +01:00
parent bccff827dc
commit e6b7c7b79c
4 changed files with 14 additions and 12 deletions

View file

@ -468,10 +468,7 @@ static const DrvHashModulo & pathDerivationModulo(Store & store, const StorePath
drvPath,
hashDerivationModulo(
store,
parseDerivation(
store,
readFile(store.toRealPath(drvPath)),
Derivation::nameFromPath(drvPath)),
store.readInvalidDerivation(drvPath),
false)).first;
}
return h->second;

View file

@ -624,10 +624,7 @@ uint64_t LocalStore::addValidPath(State & state,
efficiently query whether a path is an output of some
derivation. */
if (info.path.isDerivation()) {
auto drv = parseDerivation(
*this,
readFile(Store::toRealPath(info.path)),
Derivation::nameFromPath(info.path));
auto drv = readInvalidDerivation(info.path);
/* Verify that the output paths in the derivation are correct
(i.e., follow the scheme for computing output paths from
@ -1003,10 +1000,7 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
if (i.path.isDerivation()) {
// FIXME: inefficient; we already loaded the derivation in addValidPath().
checkDerivationOutputs(i.path,
parseDerivation(
*this,
readFile(Store::toRealPath(i.path)),
Derivation::nameFromPath(i.path)));
readInvalidDerivation(i.path));
}
/* Do a topological sort of the paths. This will throw an

View file

@ -1007,6 +1007,14 @@ Derivation Store::readDerivation(const StorePath & drvPath)
}
}
Derivation Store::readInvalidDerivation(const StorePath & drvPath)
{
return parseDerivation(
*this,
readFile(Store::toRealPath(drvPath)),
Derivation::nameFromPath(drvPath));
}
}

View file

@ -611,6 +611,9 @@ public:
/* Read a derivation (which must already be valid). */
Derivation readDerivation(const StorePath & drvPath);
/* Read a derivation from a potentially invalid path. */
Derivation readInvalidDerivation(const StorePath & drvPath);
/* Place in `out' the set of all store paths in the file system
closure of `storePath'; that is, all paths than can be directly
or indirectly reached from it. `out' is not cleared. If