forked from lix-project/lix
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 {
|
else {
|
||||||
|
|
||||||
std::vector<StorePathWithOutputs> pathsToBuild;
|
std::vector<StorePathWithOutputs> pathsToBuild;
|
||||||
|
std::vector<std::pair<StorePath, std::string>> pathsToBuildOrdered;
|
||||||
|
|
||||||
std::map<StorePath, std::pair<size_t, StringSet>> drvMap;
|
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));
|
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
|
||||||
|
|
||||||
pathsToBuild.push_back({drvPath, {outputName}});
|
pathsToBuild.push_back({drvPath, {outputName}});
|
||||||
|
pathsToBuildOrdered.push_back({drvPath, {outputName}});
|
||||||
|
|
||||||
auto i = drvMap.find(drvPath);
|
auto i = drvMap.find(drvPath);
|
||||||
if (i != drvMap.end())
|
if (i != drvMap.end())
|
||||||
|
@ -513,15 +515,14 @@ static void main_nix_build(int argc, char * * argv)
|
||||||
|
|
||||||
std::vector<StorePath> outPaths;
|
std::vector<StorePath> outPaths;
|
||||||
|
|
||||||
for (auto & [drvPath, info] : drvMap) {
|
for (auto & [drvPath, outputName] : pathsToBuildOrdered) {
|
||||||
auto & [counter, wantedOutputs] = info;
|
auto & [counter, _wantedOutputs] = drvMap.at({drvPath});
|
||||||
std::string drvPrefix = outLink;
|
std::string drvPrefix = outLink;
|
||||||
if (counter)
|
if (counter)
|
||||||
drvPrefix += fmt("-%d", counter + 1);
|
drvPrefix += fmt("-%d", counter + 1);
|
||||||
|
|
||||||
auto builtOutputs = store->queryDerivationOutputMap(drvPath);
|
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>()) {
|
if (auto store2 = store.dynamic_pointer_cast<LocalFSStore>()) {
|
||||||
|
@ -532,7 +533,6 @@ static void main_nix_build(int argc, char * * argv)
|
||||||
|
|
||||||
outPaths.push_back(outputPath);
|
outPaths.push_back(outputPath);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logger->stop();
|
logger->stop();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue