aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/misc.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:18:47 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-17 13:32:29 -0400
commit7bd88cc1dc746ed2883e1eaebb3230ec2c2bb035 (patch)
tree804e3731a5f6b4a370ac7f79c03c6fa0233ccc79 /src/libstore/misc.cc
parent6438ba1e990ddf76602a70d5c1143b73ed31855c (diff)
parent2f51cd8dc95231b2e2f5b3bd75ac6d8d2dece361 (diff)
Merge remote-tracking branch 'origin/master' into substitute-other-storedir
Diffstat (limited to 'src/libstore/misc.cc')
-rw-r--r--src/libstore/misc.cc37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index 109e9e473..6902dfa0c 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -103,7 +103,7 @@ void Store::computeFSClosure(const StorePath & startPath,
StorePathSet & paths_, bool flipDirection, bool includeOutputs, bool includeDerivers)
{
StorePathSet paths;
- paths.insert(startPath.clone());
+ paths.insert(startPath);
computeFSClosure(paths, paths_, flipDirection, includeOutputs, includeDerivers);
}
@@ -162,11 +162,11 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
auto mustBuildDrv = [&](const StorePath & drvPath, const Derivation & drv) {
{
auto state(state_.lock());
- state->willBuild.insert(drvPath.clone());
+ state->willBuild.insert(drvPath);
}
for (auto & i : drv.inputDrvs)
- pool.enqueue(std::bind(doPath, StorePathWithOutputs(i.first, i.second)));
+ pool.enqueue(std::bind(doPath, StorePathWithOutputs { i.first, i.second }));
};
auto checkOutput = [&](
@@ -178,13 +178,10 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
auto outPath = parseStorePath(outPathS);
SubstitutablePathInfos infos;
- StorePathSet paths; // FIXME
- paths.insert(outPath.clone());
-
std::map<std::string, std::string> pathsCA = {};
if (auto ca = getDerivationCA(*drv))
pathsCA.insert({outPathS, *ca});
- querySubstitutablePathInfos(paths, infos, pathsCA);
+ querySubstitutablePathInfos({outPath}, infos, pathsCA);
if (infos.empty()) {
drvState_->lock()->done = true;
@@ -195,10 +192,10 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
if (drvState->done) return;
assert(drvState->left);
drvState->left--;
- drvState->outPaths.insert(outPath.clone());
+ drvState->outPaths.insert(outPath);
if (!drvState->left) {
for (auto & path : drvState->outPaths)
- pool.enqueue(std::bind(doPath, StorePathWithOutputs(path.clone())));
+ pool.enqueue(std::bind(doPath, StorePathWithOutputs { path } ));
}
}
}
@@ -215,12 +212,12 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
if (!isValidPath(path.path)) {
// FIXME: we could try to substitute the derivation.
auto state(state_.lock());
- state->unknown.insert(path.path.clone());
+ state->unknown.insert(path.path);
return;
}
auto drv = make_ref<Derivation>(derivationFromPath(path.path));
- ParsedDerivation parsedDrv(path.path.clone(), *drv);
+ ParsedDerivation parsedDrv(StorePath(path.path), *drv);
PathSet invalid;
for (auto & j : drv->outputs)
@@ -241,13 +238,11 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
if (isValidPath(path.path)) return;
SubstitutablePathInfos infos;
- StorePathSet paths; // FIXME
- paths.insert(path.path.clone());
- querySubstitutablePathInfos(paths, infos);
+ querySubstitutablePathInfos({path.path}, infos);
if (infos.empty()) {
auto state(state_.lock());
- state->unknown.insert(path.path.clone());
+ state->unknown.insert(path.path);
return;
}
@@ -256,13 +251,13 @@ void Store::queryMissing(const std::vector<StorePathWithOutputs> & targets,
{
auto state(state_.lock());
- state->willSubstitute.insert(path.path.clone());
+ state->willSubstitute.insert(path.path);
state->downloadSize += info->second.downloadSize;
state->narSize += info->second.narSize;
}
for (auto & ref : info->second.references)
- pool.enqueue(std::bind(doPath, StorePathWithOutputs(ref)));
+ pool.enqueue(std::bind(doPath, StorePathWithOutputs { ref }));
}
};
@@ -285,12 +280,12 @@ StorePaths Store::topoSortPaths(const StorePathSet & paths)
throw BuildError("cycle detected in the references of '%s' from '%s'",
printStorePath(path), printStorePath(*parent));
- if (!visited.insert(path.clone()).second) return;
- parents.insert(path.clone());
+ if (!visited.insert(path).second) return;
+ parents.insert(path);
StorePathSet references;
try {
- references = cloneStorePathSet(queryPathInfo(path)->references);
+ references = queryPathInfo(path)->references;
} catch (InvalidPath &) {
}
@@ -300,7 +295,7 @@ StorePaths Store::topoSortPaths(const StorePathSet & paths)
if (i != path && paths.count(i))
dfsVisit(i, &path);
- sorted.push_back(path.clone());
+ sorted.push_back(path);
parents.erase(path);
};