Add option ‘build-keep-log’ to enable/disable writing of build logs
Fixes #26.
This commit is contained in:
		
							parent
							
								
									8058dab26e
								
							
						
					
					
						commit
						2c26985835
					
				
					 3 changed files with 36 additions and 1 deletions
				
			
		| 
						 | 
					@ -276,6 +276,18 @@ build-use-chroot = /dev /proc /bin</programlisting>
 | 
				
			||||||
  </varlistentry>
 | 
					  </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>
 | 
					  <varlistentry><term><literal>system</literal></term>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <listitem><para>This option specifies the canonical Nix system
 | 
					    <listitem><para>This option specifies the canonical Nix system
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,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>
 | 
					<section xml:id="ssec-relnotes-1.0"><title>Release 1.0 (May 11, 2012)</title>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2032,6 +2032,8 @@ string drvsLogDir = "drvs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Path DerivationGoal::openLogFile()
 | 
					Path DerivationGoal::openLogFile()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if (!queryBoolSetting("build-keep-log", true)) return "";
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    /* Create a log file. */
 | 
					    /* Create a log file. */
 | 
				
			||||||
    Path dir = (format("%1%/%2%") % nixLogDir % drvsLogDir).str();
 | 
					    Path dir = (format("%1%/%2%") % nixLogDir % drvsLogDir).str();
 | 
				
			||||||
    createDirs(dir);
 | 
					    createDirs(dir);
 | 
				
			||||||
| 
						 | 
					@ -2071,7 +2073,8 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (verbosity >= buildVerbosity)
 | 
					        if (verbosity >= buildVerbosity)
 | 
				
			||||||
            writeToStderr((unsigned char *) data.data(), data.size());
 | 
					            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)
 | 
					    if (hook && fd == hook->fromHook.readSide)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue