aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
commitbd96403da6a1181e46a52be7befade0c00f9e743 (patch)
tree0f66b119acd03c11e2cad776087889b7827261dc /src/nix-build
parentbdc772022766e65fa8ea6d29fff0735529ab47f3 (diff)
parentec3e20283216374c15843c403363a890221d3fcb (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
Diffstat (limited to 'src/nix-build')
-rwxr-xr-xsrc/nix-build/nix-build.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index f60e0706c..74fafd426 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -487,6 +487,7 @@ static void main_nix_build(int argc, char * * argv)
else {
std::vector<StorePathWithOutputs> pathsToBuild;
+ std::vector<std::pair<StorePath, std::string>> pathsToBuildOrdered;
std::map<StorePath, std::pair<size_t, StringSet>> drvMap;
@@ -498,6 +499,7 @@ static void main_nix_build(int argc, char * * argv)
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
pathsToBuild.push_back({drvPath, {outputName}});
+ pathsToBuildOrdered.push_back({drvPath, {outputName}});
auto i = drvMap.find(drvPath);
if (i != drvMap.end())
@@ -513,25 +515,23 @@ static void main_nix_build(int argc, char * * argv)
std::vector<StorePath> outPaths;
- for (auto & [drvPath, info] : drvMap) {
- auto & [counter, wantedOutputs] = info;
+ for (auto & [drvPath, outputName] : pathsToBuildOrdered) {
+ auto & [counter, _wantedOutputs] = drvMap.at({drvPath});
std::string drvPrefix = outLink;
if (counter)
drvPrefix += fmt("-%d", counter + 1);
auto builtOutputs = store->queryDerivationOutputMap(drvPath);
- for (auto & outputName : wantedOutputs) {
- auto outputPath = builtOutputs.at(outputName);
+ auto outputPath = builtOutputs.at(outputName);
- if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) {
- std::string symlink = drvPrefix;
- if (outputName != "out") symlink += "-" + outputName;
- store2->addPermRoot(outputPath, absPath(symlink));
- }
-
- outPaths.push_back(outputPath);
+ if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) {
+ std::string symlink = drvPrefix;
+ if (outputName != "out") symlink += "-" + outputName;
+ store2->addPermRoot(outputPath, absPath(symlink));
}
+
+ outPaths.push_back(outputPath);
}
logger->stop();