nix-build: Fix #4197 output order regression
This commit is contained in:
parent
258e5338d6
commit
ac5081d280
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue