Skip to content

Commit

Permalink
Better detect when buildPaths would be a no-op
Browse files Browse the repository at this point in the history
`buildPaths` can be called even for stores where it's not defined in case it's
bound to be a no-op.
The “no-op detection” mechanism was only detecting the case wher `buildPaths`
was called on a set of (non-drv) paths that were already present on the store.

This commit extends this mechanism to also detect the case where `buildPaths`
is called on a set of derivation outputs which are already built on the store.
  • Loading branch information
thufschmitt committed Nov 17, 2020
1 parent 933c769 commit 2a3707d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,13 @@ void Store::buildPaths(const std::vector<StorePathWithOutputs> & paths, BuildMod
StorePathSet paths2;

for (auto & path : paths) {
if (path.path.isDerivation())
unsupported("buildPaths");
paths2.insert(path.path);
if (path.path.isDerivation()) {
for (auto & outputName : path.outputs) {
if (!queryDrvOutputInfo({path.path, outputName}))
unsupported("buildPaths");
}
} else
paths2.insert(path.path);
}

if (queryValidPaths(paths2).size() != paths2.size())
Expand Down

0 comments on commit 2a3707d

Please sign in to comment.