diff --git a/doc/manual/nix-env.xml b/doc/manual/nix-env.xml index 702faa62115618559eaf53a66a01b8e7519ccf34..c73716381f4dca798ea5d66cabb3214c807cbc3a 100644 --- a/doc/manual/nix-env.xml +++ b/doc/manual/nix-env.xml @@ -9,6 +9,8 @@ <command>nix-env</command> <arg rep='repeat'><option>--verbose</option></arg> <arg rep='repeat'><option>-v</option></arg> + <arg><option>--build-output</option></arg> + <arg><option>-B</option></arg> <arg><option>--keep-failed</option></arg> <arg><option>-K</option></arg> <arg> diff --git a/doc/manual/nix-store.xml b/doc/manual/nix-store.xml index 479c1c3b09a5209d272d04da108b792927875e59..8c6bcfe3737d11e7c43e2a51cf39978ed3c77825 100644 --- a/doc/manual/nix-store.xml +++ b/doc/manual/nix-store.xml @@ -9,6 +9,8 @@ <command>nix-store</command> <arg rep='repeat'><option>--verbose</option></arg> <arg rep='repeat'><option>-v</option></arg> + <arg><option>--build-output</option></arg> + <arg><option>-B</option></arg> <arg><option>--keep-failed</option></arg> <arg><option>-K</option></arg> <arg choice='plain'><replaceable>operation</replaceable></arg> diff --git a/doc/manual/opt-verbose.xml b/doc/manual/opt-verbose.xml index 3868acf308528cf5b6fe43c891308f48283db37e..53fe07ae76b8791de043d94588870295ad814fd1 100644 --- a/doc/manual/opt-verbose.xml +++ b/doc/manual/opt-verbose.xml @@ -71,3 +71,17 @@ </listitem> </varlistentry> + +<varlistentry> + <term><option>--build-output</option> / <option>-B</option></term> + <listitem> + <para> + Causes the output written by build actions to standard output + and standard error to be echoed to standard error, regardless of + verbosity level. By default, it is only echoed at a verbosity + level of at least 4 (<quote>Debug</quote>), and is suppressed at + lower levels. Note that it is always written to a log file in + <filename><replaceable>prefix</replaceable>/nix/var/log/nix</filename>. + </para> + </listitem> +</varlistentry> diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 92349488e7611eb2230e1d1bd6e3c3c7b36af604..24bedb3fb63bea15c568c55838307ba2f59feab8 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -51,6 +51,8 @@ static void initAndRun(int argc, char * * argv) string arg = *i; if (arg == "--verbose" || arg == "-v") verbosity = (Verbosity) ((int) verbosity + 1); + else if (arg == "--build-output" || arg == "-B") + buildVerbosity = lvlError; /* lowest */ else if (arg == "--help") { printHelp(); return; diff --git a/src/libstore/exec.cc b/src/libstore/exec.cc index 2adf03841c4fc9cd3384b05c91a6e0d96b8de210..b25423b4449a1ce2a83a2a73d4db22290f887d15 100644 --- a/src/libstore/exec.cc +++ b/src/libstore/exec.cc @@ -22,7 +22,7 @@ void runProgram(const string & program, { /* Create a log file. */ string logCommand = - verbosity >= lvlDebug + verbosity >= buildVerbosity ? "tee " + logFileName + " >&2" : "cat > " + logFileName; /* !!! auto-pclose on exit */ diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index e5d76ff48563ea36f8f2780cab59c6597d8abe6b..b3c658c2956215d2aa00e78df8b87e84d09c6f02 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -7,3 +7,5 @@ string nixStateDir = "/UNINIT"; string nixDBPath = "/UNINIT"; bool keepFailed = false; + +Verbosity buildVerbosity = lvlDebug; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 3da294cc829aa478c4acfe0c049a6793e1445b97..5d5e9efcfec5e1b7d5b4cff385eaf01030c47b3a 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -2,6 +2,7 @@ #define __GLOBALS_H #include <string> +#include "util.hh" using namespace std; @@ -28,5 +29,8 @@ extern string nixDBPath; /* Whether to keep temporary directories of failed builds. */ extern bool keepFailed; +/* Verbosity level for build output. */ +extern Verbosity buildVerbosity; + #endif /* !__GLOBALS_H */