printMissing(): Print derivations in approximate build order

This commit is contained in:
Eelco Dolstra 2014-09-26 14:09:20 +02:00
parent 9b146a52f1
commit f77be20c16

View file

@ -9,6 +9,7 @@
#include <iostream> #include <iostream>
#include <cctype> #include <cctype>
#include <exception> #include <exception>
#include <algorithm>
#include <sys/time.h> #include <sys/time.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -58,23 +59,25 @@ void printMissing(const PathSet & willBuild,
{ {
if (!willBuild.empty()) { if (!willBuild.empty()) {
printMsg(lvlInfo, format("these derivations will be built:")); printMsg(lvlInfo, format("these derivations will be built:"));
foreach (PathSet::iterator, i, willBuild) Paths sorted = topoSortPaths(*store, willBuild);
printMsg(lvlInfo, format(" %1%") % *i); reverse(sorted.begin(), sorted.end());
for (auto & i : sorted)
printMsg(lvlInfo, format(" %1%") % i);
} }
if (!willSubstitute.empty()) { if (!willSubstitute.empty()) {
printMsg(lvlInfo, format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):") printMsg(lvlInfo, format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
% (downloadSize / (1024.0 * 1024.0)) % (downloadSize / (1024.0 * 1024.0))
% (narSize / (1024.0 * 1024.0))); % (narSize / (1024.0 * 1024.0)));
foreach (PathSet::iterator, i, willSubstitute) for (auto & i : willSubstitute)
printMsg(lvlInfo, format(" %1%") % *i); printMsg(lvlInfo, format(" %1%") % i);
} }
if (!unknown.empty()) { if (!unknown.empty()) {
printMsg(lvlInfo, format("don't know how to build these paths%1%:") printMsg(lvlInfo, format("don't know how to build these paths%1%:")
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : "")); % (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
foreach (PathSet::iterator, i, unknown) for (auto & i : unknown)
printMsg(lvlInfo, format(" %1%") % *i); printMsg(lvlInfo, format(" %1%") % i);
} }
} }