diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-03-07 11:58:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 11:58:10 +0100 |
commit | ba0486f045d4f7f304bd8c4a939ca2e658affcc8 (patch) | |
tree | 31ad197ca16cc642c5fd4ae2f45b47c6290b8bd7 /src | |
parent | 02bf5219685fcbd762188fa39946495293e6ce5f (diff) | |
parent | 427555861b871aba02753bdb88a45b3b710a213b (diff) |
Merge pull request #7889 from sidkshatriya/sorted-fetch-paths
Print the store paths to be fetched sorted by StorePath name()
Diffstat (limited to 'src')
-rw-r--r-- | src/libmain/shared.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 27552d5bf..37664c065 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -84,8 +84,18 @@ void printMissing(ref<Store> store, const StorePathSet & willBuild, downloadSizeMiB, narSizeMiB); } - for (auto & i : willSubstitute) - printMsg(lvl, " %s", store->printStorePath(i)); + std::vector<const StorePath *> willSubstituteSorted = {}; + std::for_each(willSubstitute.begin(), willSubstitute.end(), + [&](const StorePath &p) { willSubstituteSorted.push_back(&p); }); + std::sort(willSubstituteSorted.begin(), willSubstituteSorted.end(), + [](const StorePath *lhs, const StorePath *rhs) { + if (lhs->name() == rhs->name()) + return lhs->to_string() < rhs->to_string(); + else + return lhs->name() < rhs->name(); + }); + for (auto p : willSubstituteSorted) + printMsg(lvl, " %s", store->printStorePath(*p)); } if (!unknown.empty()) { |