Fix verbosity level for nix build --dry-run
This commit is contained in:
parent
fe38fce2d8
commit
7a108d904e
4 changed files with 16 additions and 16 deletions
|
@ -34,40 +34,40 @@ void printGCWarning()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printMissing(ref<Store> store, const PathSet & paths)
|
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl)
|
||||||
{
|
{
|
||||||
unsigned long long downloadSize, narSize;
|
unsigned long long downloadSize, narSize;
|
||||||
PathSet willBuild, willSubstitute, unknown;
|
PathSet willBuild, willSubstitute, unknown;
|
||||||
store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
|
store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
|
||||||
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize);
|
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize, lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printMissing(ref<Store> store, const PathSet & willBuild,
|
void printMissing(ref<Store> store, const PathSet & willBuild,
|
||||||
const PathSet & willSubstitute, const PathSet & unknown,
|
const PathSet & willSubstitute, const PathSet & unknown,
|
||||||
unsigned long long downloadSize, unsigned long long narSize)
|
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl)
|
||||||
{
|
{
|
||||||
if (!willBuild.empty()) {
|
if (!willBuild.empty()) {
|
||||||
printInfo(format("these derivations will be built:"));
|
printMsg(lvl, "these derivations will be built:");
|
||||||
Paths sorted = store->topoSortPaths(willBuild);
|
Paths sorted = store->topoSortPaths(willBuild);
|
||||||
reverse(sorted.begin(), sorted.end());
|
reverse(sorted.begin(), sorted.end());
|
||||||
for (auto & i : sorted)
|
for (auto & i : sorted)
|
||||||
printInfo(format(" %1%") % i);
|
printMsg(lvl, fmt(" %s", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!willSubstitute.empty()) {
|
if (!willSubstitute.empty()) {
|
||||||
printInfo(format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
|
printMsg(lvl, fmt("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)));
|
||||||
for (auto & i : willSubstitute)
|
for (auto & i : willSubstitute)
|
||||||
printInfo(format(" %1%") % i);
|
printMsg(lvl, fmt(" %s", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unknown.empty()) {
|
if (!unknown.empty()) {
|
||||||
printInfo(format("don't know how to build these paths%1%:")
|
printMsg(lvl, fmt("don't know how to build these paths%s:",
|
||||||
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
|
(settings.readOnlyMode ? " (may be caused by read-only store access)" : "")));
|
||||||
for (auto & i : unknown)
|
for (auto & i : unknown)
|
||||||
printInfo(format(" %1%") % i);
|
printMsg(lvl, fmt(" %s", i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ void printGCWarning();
|
||||||
|
|
||||||
class Store;
|
class Store;
|
||||||
|
|
||||||
void printMissing(ref<Store> store, const PathSet & paths);
|
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl = lvlInfo);
|
||||||
|
|
||||||
void printMissing(ref<Store> store, const PathSet & willBuild,
|
void printMissing(ref<Store> store, const PathSet & willBuild,
|
||||||
const PathSet & willSubstitute, const PathSet & unknown,
|
const PathSet & willSubstitute, const PathSet & unknown,
|
||||||
unsigned long long downloadSize, unsigned long long narSize);
|
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = lvlInfo);
|
||||||
|
|
||||||
string getArg(const string & opt,
|
string getArg(const string & opt,
|
||||||
Strings::iterator & i, const Strings::iterator & end);
|
Strings::iterator & i, const Strings::iterator & end);
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
{
|
{
|
||||||
auto paths = toStorePaths(store, dryRun ? DryRun : Build);
|
auto paths = toStorePaths(store, dryRun ? DryRun : Build);
|
||||||
|
|
||||||
printInfo("build result: %s", showPaths(paths));
|
printError("build result: %s", showPaths(paths));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ PathSet InstallablesCommand::toStorePaths(ref<Store> store, ToStorePathsMode mod
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == DryRun)
|
if (mode == DryRun)
|
||||||
printMissing(store, buildables);
|
printMissing(store, buildables, lvlError);
|
||||||
else if (mode == Build)
|
else if (mode == Build)
|
||||||
store->buildPaths(buildables);
|
store->buildPaths(buildables);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue