about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-29T20·42-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-29T20·42-0400
commit2c26985835cf82ed5d2979c3a400f72f6aeba32f (patch)
tree364273cc2613dab8ab578c7cb27e468dcfbe9f86
parent8058dab26e90db54708d4c698db843dd703ecbb2 (diff)
Add option ‘build-keep-log’ to enable/disable writing of build logs
Fixes #26.
-rw-r--r--doc/manual/conf-file.xml12
-rw-r--r--doc/manual/release-notes.xml20
-rw-r--r--src/libstore/build.cc5
3 files changed, 36 insertions, 1 deletions
diff --git a/doc/manual/conf-file.xml b/doc/manual/conf-file.xml
index 1e164b8234af..25a009de9d45 100644
--- a/doc/manual/conf-file.xml
+++ b/doc/manual/conf-file.xml
@@ -276,6 +276,18 @@ build-use-chroot = /dev /proc /bin</programlisting>
   </varlistentry>
 
 
+  <varlistentry><term><literal>build-keep-log</literal></term>
+
+    <listitem><para>If set to <literal>true</literal> (the default),
+    Nix will write the build log of a derivation (i.e. the standard
+    output and error of its builder) to the directory
+    <filename>/nix/var/log/nix/drvs</filename>.  The build log can be
+    retrieved using the command <command>nix-store -l
+    <replaceable>path</replaceable></command>.</para></listitem>
+
+  </varlistentry>
+
+
   <varlistentry><term><literal>system</literal></term>
 
     <listitem><para>This option specifies the canonical Nix system
diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml
index 1c2a52d56725..3250c81a4bb0 100644
--- a/doc/manual/release-notes.xml
+++ b/doc/manual/release-notes.xml
@@ -8,6 +8,26 @@
 
 <!--==================================================================-->
 
+<section xml:id="ssec-relnotes-1.1"><title>Release 1.1 (TBA)</title>
+
+<para>This release has the following improvements:</para>
+
+<itemizedlist>
+
+  <listitem>
+    <para>The creation of build logs in
+    <filename>/nix/var/log/nix/drvs</filename> can be disabled by
+    setting the new option <literal>build-keep-log</literal> to
+    <literal>false</literal></para>
+  </listitem>    
+
+</itemizedlist>
+
+</section>
+
+
+<!--==================================================================-->
+
 <section xml:id="ssec-relnotes-1.0"><title>Release 1.0 (May 11, 2012)</title>
 
 <para>There have been numerous improvements and bug fixes since the
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 789a7f617c2c..985ea5e98e05 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)