From 2c26985835cf82ed5d2979c3a400f72f6aeba32f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 May 2012 16:42:05 -0400 Subject: [PATCH] =?UTF-8?q?Add=20option=20=E2=80=98build-keep-log=E2=80=99?= =?UTF-8?q?=20to=20enable/disable=20writing=20of=20build=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #26. --- doc/manual/conf-file.xml | 12 ++++++++++++ doc/manual/release-notes.xml | 20 ++++++++++++++++++++ src/libstore/build.cc | 5 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/manual/conf-file.xml b/doc/manual/conf-file.xml index 1e164b823..25a009de9 100644 --- a/doc/manual/conf-file.xml +++ b/doc/manual/conf-file.xml @@ -276,6 +276,18 @@ build-use-chroot = /dev /proc /bin + build-keep-log + + If set to true (the default), + Nix will write the build log of a derivation (i.e. the standard + output and error of its builder) to the directory + /nix/var/log/nix/drvs. The build log can be + retrieved using the command nix-store -l + path. + + + + system This option specifies the canonical Nix system diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml index 1c2a52d56..3250c81a4 100644 --- a/doc/manual/release-notes.xml +++ b/doc/manual/release-notes.xml @@ -6,6 +6,26 @@ + + +
Release 1.1 (TBA) + +This release has the following improvements: + + + + + The creation of build logs in + /nix/var/log/nix/drvs can be disabled by + setting the new option build-keep-log to + false + + + + +
+ +
Release 1.0 (May 11, 2012) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 789a7f617..985ea5e98 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -2032,6 +2032,8 @@ string drvsLogDir = "drvs"; Path DerivationGoal::openLogFile() { + if (!queryBoolSetting("build-keep-log", true)) return ""; + /* Create a log file. */ Path dir = (format("%1%/%2%") % nixLogDir % drvsLogDir).str(); createDirs(dir); @@ -2071,7 +2073,8 @@ void DerivationGoal::handleChildOutput(int fd, const string & data) { if (verbosity >= buildVerbosity) writeToStderr((unsigned char *) data.data(), data.size()); - writeFull(fdLogFile, (unsigned char *) data.data(), data.size()); + if (fdLogFile != -1) + writeFull(fdLogFile, (unsigned char *) data.data(), data.size()); } if (hook && fd == hook->fromHook.readSide)