aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore/misc.cc
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-04-10 00:42:22 -0400
committerMark H Weaver <mhw@netris.org>2018-04-10 00:42:22 -0400
commitf89aa1521af69b0e1a1350c2380579788b0f8945 (patch)
tree5009cca687ac669ef846920877cbfb6fffdd9893 /nix/libstore/misc.cc
parent169c658f7f286efae397fa3eda55b1c56fa92a01 (diff)
parent60e1de6d95bd32b4996c199708541781b8f828fd (diff)
downloadpatches-f89aa1521af69b0e1a1350c2380579788b0f8945.tar
patches-f89aa1521af69b0e1a1350c2380579788b0f8945.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/libstore/misc.cc')
-rw-r--r--nix/libstore/misc.cc114
1 files changed, 0 insertions, 114 deletions
diff --git a/nix/libstore/misc.cc b/nix/libstore/misc.cc
index 22363af126..97618089bd 100644
--- a/nix/libstore/misc.cc
+++ b/nix/libstore/misc.cc
@@ -67,120 +67,6 @@ Path findOutput(const Derivation & drv, string id)
}
-void queryMissing(StoreAPI & store, const PathSet & targets,
- PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown,
- unsigned long long & downloadSize, unsigned long long & narSize)
-{
- downloadSize = narSize = 0;
-
- PathSet todo(targets.begin(), targets.end()), done;
-
- /* Getting substitute info has high latency when using the binary
- cache substituter. Thus it's essential to do substitute
- queries in parallel as much as possible. To accomplish this
- we do the following:
-
- - For all paths still to be processed (‘todo’), we add all
- paths for which we need info to the set ‘query’. For an
- unbuilt derivation this is the output paths; otherwise, it's
- the path itself.
-
- - We get info about all paths in ‘query’ in parallel.
-
- - We process the results and add new items to ‘todo’ if
- necessary. E.g. if a path is substitutable, then we need to
- get info on its references.
-
- - Repeat until ‘todo’ is empty.
- */
-
- while (!todo.empty()) {
-
- PathSet query, todoDrv, todoNonDrv;
-
- foreach (PathSet::iterator, i, todo) {
- if (done.find(*i) != done.end()) continue;
- done.insert(*i);
-
- DrvPathWithOutputs i2 = parseDrvPathWithOutputs(*i);
-
- if (isDerivation(i2.first)) {
- if (!store.isValidPath(i2.first)) {
- // FIXME: we could try to substitute p.
- unknown.insert(*i);
- continue;
- }
- Derivation drv = derivationFromPath(store, i2.first);
-
- PathSet invalid;
- foreach (DerivationOutputs::iterator, j, drv.outputs)
- if (wantOutput(j->first, i2.second)
- && !store.isValidPath(j->second.path))
- invalid.insert(j->second.path);
- if (invalid.empty()) continue;
-
- todoDrv.insert(*i);
- if (settings.useSubstitutes && substitutesAllowed(drv))
- query.insert(invalid.begin(), invalid.end());
- }
-
- else {
- if (store.isValidPath(*i)) continue;
- query.insert(*i);
- todoNonDrv.insert(*i);
- }
- }
-
- todo.clear();
-
- SubstitutablePathInfos infos;
- store.querySubstitutablePathInfos(query, infos);
-
- foreach (PathSet::iterator, i, todoDrv) {
- DrvPathWithOutputs i2 = parseDrvPathWithOutputs(*i);
-
- // FIXME: cache this
- Derivation drv = derivationFromPath(store, i2.first);
-
- PathSet outputs;
- bool mustBuild = false;
- if (settings.useSubstitutes && substitutesAllowed(drv)) {
- foreach (DerivationOutputs::iterator, j, drv.outputs) {
- if (!wantOutput(j->first, i2.second)) continue;
- if (!store.isValidPath(j->second.path)) {
- if (infos.find(j->second.path) == infos.end())
- mustBuild = true;
- else
- outputs.insert(j->second.path);
- }
- }
- } else
- mustBuild = true;
-
- if (mustBuild) {
- willBuild.insert(i2.first);
- todo.insert(drv.inputSrcs.begin(), drv.inputSrcs.end());
- foreach (DerivationInputs::iterator, j, drv.inputDrvs)
- todo.insert(makeDrvPathWithOutputs(j->first, j->second));
- } else
- todoNonDrv.insert(outputs.begin(), outputs.end());
- }
-
- foreach (PathSet::iterator, i, todoNonDrv) {
- done.insert(*i);
- SubstitutablePathInfos::iterator info = infos.find(*i);
- if (info != infos.end()) {
- willSubstitute.insert(*i);
- downloadSize += info->second.downloadSize;
- narSize += info->second.narSize;
- todo.insert(info->second.references.begin(), info->second.references.end());
- } else
- unknown.insert(*i);
- }
- }
-}
-
-
static void dfsVisit(StoreAPI & store, const PathSet & paths,
const Path & path, PathSet & visited, Paths & sorted,
PathSet & parents)