Skip to content

Commit 7a108d9

Browse files
committed
Fix verbosity level for nix build --dry-run
1 parent fe38fce commit 7a108d9

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/libmain/shared.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,40 @@ void printGCWarning()
3434
}
3535

3636

37-
void printMissing(ref<Store> store, const PathSet & paths)
37+
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl)
3838
{
3939
unsigned long long downloadSize, narSize;
4040
PathSet willBuild, willSubstitute, unknown;
4141
store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
42-
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize);
42+
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize, lvl);
4343
}
4444

4545

4646
void printMissing(ref<Store> store, const PathSet & willBuild,
4747
const PathSet & willSubstitute, const PathSet & unknown,
48-
unsigned long long downloadSize, unsigned long long narSize)
48+
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl)
4949
{
5050
if (!willBuild.empty()) {
51-
printInfo(format("these derivations will be built:"));
51+
printMsg(lvl, "these derivations will be built:");
5252
Paths sorted = store->topoSortPaths(willBuild);
5353
reverse(sorted.begin(), sorted.end());
5454
for (auto & i : sorted)
55-
printInfo(format(" %1%") % i);
55+
printMsg(lvl, fmt(" %s", i));
5656
}
5757

5858
if (!willSubstitute.empty()) {
59-
printInfo(format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
60-
% (downloadSize / (1024.0 * 1024.0))
61-
% (narSize / (1024.0 * 1024.0)));
59+
printMsg(lvl, fmt("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):",
60+
downloadSize / (1024.0 * 1024.0),
61+
narSize / (1024.0 * 1024.0)));
6262
for (auto & i : willSubstitute)
63-
printInfo(format(" %1%") % i);
63+
printMsg(lvl, fmt(" %s", i));
6464
}
6565

6666
if (!unknown.empty()) {
67-
printInfo(format("don't know how to build these paths%1%:")
68-
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
67+
printMsg(lvl, fmt("don't know how to build these paths%s:",
68+
(settings.readOnlyMode ? " (may be caused by read-only store access)" : "")));
6969
for (auto & i : unknown)
70-
printInfo(format(" %1%") % i);
70+
printMsg(lvl, fmt(" %s", i));
7171
}
7272
}
7373

src/libmain/shared.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ void printGCWarning();
3535

3636
class Store;
3737

38-
void printMissing(ref<Store> store, const PathSet & paths);
38+
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl = lvlInfo);
3939

4040
void printMissing(ref<Store> store, const PathSet & willBuild,
4141
const PathSet & willSubstitute, const PathSet & unknown,
42-
unsigned long long downloadSize, unsigned long long narSize);
42+
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = lvlInfo);
4343

4444
string getArg(const string & opt,
4545
Strings::iterator & i, const Strings::iterator & end);

src/nix/build.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
2525
{
2626
auto paths = toStorePaths(store, dryRun ? DryRun : Build);
2727

28-
printInfo("build result: %s", showPaths(paths));
28+
printError("build result: %s", showPaths(paths));
2929
}
3030
};
3131

src/nix/installables.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ PathSet InstallablesCommand::toStorePaths(ref<Store> store, ToStorePathsMode mod
228228
}
229229

230230
if (mode == DryRun)
231-
printMissing(store, buildables);
231+
printMissing(store, buildables, lvlError);
232232
else if (mode == Build)
233233
store->buildPaths(buildables);
234234

0 commit comments

Comments
 (0)