diff options
| author | Ludovic Courtès <ludovic.courtes@inria.fr> | 2018-03-29 16:56:00 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-03-30 23:42:07 +0200 |
| commit | c7589cce8d3f9fcb7769e424f341dba8fb3545d0 (patch) | |
| tree | 157c37d5933152efc20e2aa268a573b0ddad1bdc /nix/libstore/misc.cc | |
| parent | dffd077c59e0faf8200422572b7d3aab611f0348 (diff) | |
daemon: Remove dead code.
* nix/libstore/globals.cc (Settings::loadConfFile, Settings::unpack):
Remove.
* nix/libstore/globals.hh: Adjust accordingly.
* nix/libstore/misc.cc (queryMissing): Remove.
* nix/libstore/misc.hh: Adjust accordingly.
* nix/libstore/store-api.cc (followLinksToStore)
(followLinksToStorePath, computeStorePathForHash): Remove.
* nix/libstore/store-api.hh: Adjust accordingly.
Diffstat (limited to 'nix/libstore/misc.cc')
| -rw-r--r-- | nix/libstore/misc.cc | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/nix/libstore/misc.cc b/nix/libstore/misc.cc index 22363af1264..97618089bdf 100644 --- a/nix/libstore/misc.cc +++ b/nix/libstore/misc.cc | |||
| @@ -67,120 +67,6 @@ Path findOutput(const Derivation & drv, string id) | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | void queryMissing(StoreAPI & store, const PathSet & targets, | ||
| 71 | PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown, | ||
| 72 | unsigned long long & downloadSize, unsigned long long & narSize) | ||
| 73 | { | ||
| 74 | downloadSize = narSize = 0; | ||
| 75 | |||
| 76 | PathSet todo(targets.begin(), targets.end()), done; | ||
| 77 | |||
| 78 | /* Getting substitute info has high latency when using the binary | ||
| 79 | cache substituter. Thus it's essential to do substitute | ||
| 80 | queries in parallel as much as possible. To accomplish this | ||
| 81 | we do the following: | ||
| 82 | |||
| 83 | - For all paths still to be processed (‘todo’), we add all | ||
| 84 | paths for which we need info to the set ‘query’. For an | ||
| 85 | unbuilt derivation this is the output paths; otherwise, it's | ||
| 86 | the path itself. | ||
| 87 | |||
| 88 | - We get info about all paths in ‘query’ in parallel. | ||
| 89 | |||
| 90 | - We process the results and add new items to ‘todo’ if | ||
| 91 | necessary. E.g. if a path is substitutable, then we need to | ||
| 92 | get info on its references. | ||
| 93 | |||
| 94 | - Repeat until ‘todo’ is empty. | ||
| 95 | */ | ||
| 96 | |||
| 97 | while (!todo.empty()) { | ||
| 98 | |||
| 99 | PathSet query, todoDrv, todoNonDrv; | ||
| 100 | |||
| 101 | foreach (PathSet::iterator, i, todo) { | ||
| 102 | if (done.find(*i) != done.end()) continue; | ||
| 103 | done.insert(*i); | ||
| 104 | |||
| 105 | DrvPathWithOutputs i2 = parseDrvPathWithOutputs(*i); | ||
| 106 | |||
| 107 | if (isDerivation(i2.first)) { | ||
| 108 | if (!store.isValidPath(i2.first)) { | ||
| 109 | // FIXME: we could try to substitute p. | ||
| 110 | unknown.insert(*i); | ||
| 111 | continue; | ||
| 112 | } | ||
| 113 | Derivation drv = derivationFromPath(store, i2.first); | ||
| 114 | |||
| 115 | PathSet invalid; | ||
| 116 | foreach (DerivationOutputs::iterator, j, drv.outputs) | ||
| 117 | if (wantOutput(j->first, i2.second) | ||
| 118 | && !store.isValidPath(j->second.path)) | ||
| 119 | invalid.insert(j->second.path); | ||
| 120 | if (invalid.empty()) continue; | ||
| 121 | |||
| 122 | todoDrv.insert(*i); | ||
| 123 | if (settings.useSubstitutes && substitutesAllowed(drv)) | ||
| 124 | query.insert(invalid.begin(), invalid.end()); | ||
| 125 | } | ||
| 126 | |||
| 127 | else { | ||
| 128 | if (store.isValidPath(*i)) continue; | ||
| 129 | query.insert(*i); | ||
| 130 | todoNonDrv.insert(*i); | ||
| 131 | } | ||
| 132 | } | ||
| 133 | |||
| 134 | todo.clear(); | ||
| 135 | |||
| 136 | SubstitutablePathInfos infos; | ||
| 137 | store.querySubstitutablePathInfos(query, infos); | ||
| 138 | |||
| 139 | foreach (PathSet::iterator, i, todoDrv) { | ||
| 140 | DrvPathWithOutputs i2 = parseDrvPathWithOutputs(*i); | ||
| 141 | |||
| 142 | // FIXME: cache this | ||
| 143 | Derivation drv = derivationFromPath(store, i2.first); | ||
| 144 | |||
| 145 | PathSet outputs; | ||
| 146 | bool mustBuild = false; | ||
| 147 | if (settings.useSubstitutes && substitutesAllowed(drv)) { | ||
| 148 | foreach (DerivationOutputs::iterator, j, drv.outputs) { | ||
| 149 | if (!wantOutput(j->first, i2.second)) continue; | ||
| 150 | if (!store.isValidPath(j->second.path)) { | ||
| 151 | if (infos.find(j->second.path) == infos.end()) | ||
| 152 | mustBuild = true; | ||
| 153 | else | ||
| 154 | outputs.insert(j->second.path); | ||
| 155 | } | ||
| 156 | } | ||
| 157 | } else | ||
| 158 | mustBuild = true; | ||
| 159 | |||
| 160 | if (mustBuild) { | ||
| 161 | willBuild.insert(i2.first); | ||
| 162 | todo.insert(drv.inputSrcs.begin(), drv.inputSrcs.end()); | ||
| 163 | foreach (DerivationInputs::iterator, j, drv.inputDrvs) | ||
| 164 | todo.insert(makeDrvPathWithOutputs(j->first, j->second)); | ||
| 165 | } else | ||
| 166 | todoNonDrv.insert(outputs.begin(), outputs.end()); | ||
| 167 | } | ||
| 168 | |||
| 169 | foreach (PathSet::iterator, i, todoNonDrv) { | ||
| 170 | done.insert(*i); | ||
| 171 | SubstitutablePathInfos::iterator info = infos.find(*i); | ||
| 172 | if (info != infos.end()) { | ||
| 173 | willSubstitute.insert(*i); | ||
| 174 | downloadSize += info->second.downloadSize; | ||
| 175 | narSize += info->second.narSize; | ||
| 176 | todo.insert(info->second.references.begin(), info->second.references.end()); | ||
| 177 | } else | ||
| 178 | unknown.insert(*i); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | |||
| 184 | static void dfsVisit(StoreAPI & store, const PathSet & paths, | 70 | static void dfsVisit(StoreAPI & store, const PathSet & paths, |
| 185 | const Path & path, PathSet & visited, Paths & sorted, | 71 | const Path & path, PathSet & visited, Paths & sorted, |
| 186 | PathSet & parents) | 72 | PathSet & parents) |
