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, drvPath,
hashDerivationModulo( hashDerivationModulo(
store, store,
parseDerivation( store.readInvalidDerivation(drvPath),
store,
readFile(store.toRealPath(drvPath)),
Derivation::nameFromPath(drvPath)),
false)).first; false)).first;
} }
return h->second; 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 efficiently query whether a path is an output of some
derivation. */ derivation. */
if (info.path.isDerivation()) { if (info.path.isDerivation()) {
auto drv = parseDerivation( auto drv = readInvalidDerivation(info.path);
*this,
readFile(Store::toRealPath(info.path)),
Derivation::nameFromPath(info.path));
/* Verify that the output paths in the derivation are correct /* Verify that the output paths in the derivation are correct
(i.e., follow the scheme for computing output paths from (i.e., follow the scheme for computing output paths from
@ -1003,10 +1000,7 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
if (i.path.isDerivation()) { if (i.path.isDerivation()) {
// FIXME: inefficient; we already loaded the derivation in addValidPath(). // FIXME: inefficient; we already loaded the derivation in addValidPath().
checkDerivationOutputs(i.path, checkDerivationOutputs(i.path,
parseDerivation( readInvalidDerivation(i.path));
*this,
readFile(Store::toRealPath(i.path)),
Derivation::nameFromPath(i.path)));
} }
/* Do a topological sort of the paths. This will throw an /* 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). */ /* Read a derivation (which must already be valid). */
Derivation readDerivation(const StorePath & drvPath); 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 /* Place in `out' the set of all store paths in the file system
closure of `storePath'; that is, all paths than can be directly closure of `storePath'; that is, all paths than can be directly
or indirectly reached from it. `out' is not cleared. If or indirectly reached from it. `out' is not cleared. If