about summary refs log tree commit diff
path: root/src/libmain/shared.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-26T12·09+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-26T12·09+0200
commitf77be20c16621a8e6b91f95cad9711b87d113485 (patch)
treea8c6b06b76df13a079f05f2d0f0758c3ac7e62a7 /src/libmain/shared.cc
parent9b146a52f1395633e0ef319cfbe0bc452a796330 (diff)
printMissing(): Print derivations in approximate build order
Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r--src/libmain/shared.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 6f2f8c5e47..8a6b7a9c2f 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -9,6 +9,7 @@
 #include <iostream>
 #include <cctype>
 #include <exception>
+#include <algorithm>
 
 #include <sys/time.h>
 #include <sys/stat.h>
@@ -58,23 +59,25 @@ void printMissing(const PathSet & willBuild,
 {
     if (!willBuild.empty()) {
         printMsg(lvlInfo, format("these derivations will be built:"));
-        foreach (PathSet::iterator, i, willBuild)
-            printMsg(lvlInfo, format("  %1%") % *i);
+        Paths sorted = topoSortPaths(*store, willBuild);
+        reverse(sorted.begin(), sorted.end());
+        for (auto & i : sorted)
+            printMsg(lvlInfo, format("  %1%") % i);
     }
 
     if (!willSubstitute.empty()) {
         printMsg(lvlInfo, format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
             % (downloadSize / (1024.0 * 1024.0))
             % (narSize / (1024.0 * 1024.0)));
-        foreach (PathSet::iterator, i, willSubstitute)
-            printMsg(lvlInfo, format("  %1%") % *i);
+        for (auto & i : willSubstitute)
+            printMsg(lvlInfo, format("  %1%") % i);
     }
 
     if (!unknown.empty()) {
         printMsg(lvlInfo, format("don't know how to build these paths%1%:")
             % (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
-        foreach (PathSet::iterator, i, unknown)
-            printMsg(lvlInfo, format("  %1%") % *i);
+        for (auto & i : unknown)
+            printMsg(lvlInfo, format("  %1%") % i);
     }
 }