* Delete the temporary directories of failed builds by default, and an

option `--keep-failed' to override this behaviour.
This commit is contained in:
Eelco Dolstra 2003-08-19 09:04:47 +00:00
parent 31e4aa6439
commit 2de8504791
6 changed files with 34 additions and 1 deletions

View file

@ -15,6 +15,10 @@
<arg><option>--verbose</option></arg>
<arg><option>-v</option></arg>
</group>
<group choice='opt' rep='repeat'>
<arg><option>--keep-failed</option></arg>
<arg><option>-K</option></arg>
</group>
<arg choice='plain'><replaceable>operation</replaceable></arg>
<arg rep='repeat'><replaceable>options</replaceable></arg>
<arg rep='repeat'><replaceable>arguments</replaceable></arg>
@ -121,6 +125,19 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--keep-failed</option></term>
<listitem>
<para>
Specifies that in case of a build failure, the temporary directory
(usually in <filename>/tmp</filename>) in which the build takes
place should not be deleted. The path of the build directory is
printed as an informational message.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -122,7 +122,11 @@ void runProgram(const string & program,
throw Error("unable to wait for child");
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
if (keepFailed) {
msg(lvlTalkative,
format("build failed; keeping build directory `%1%'") % tmpDir);
delTmpDir.cancel();
}
throw Error("unable to build package");
}
}

View file

@ -17,6 +17,9 @@ string nixLogDir = "/UNINIT";
string nixDBPath = "/UNINIT";
bool keepFailed = false;
void openDB()
{
nixDB.open(nixDBPath);

View file

@ -69,6 +69,12 @@ extern string nixLogDir;
extern string nixDBPath;
/* Misc. global flags. */
/* Whether to keep temporary directories of failed builds. */
extern bool keepFailed;
/* Open the database environment. */
void openDB();

View file

@ -34,3 +34,4 @@ Query flags:
Options:
--verbose / -v: verbose operation (may be repeated)
--keep-failed / -K: keep temporary directories of failed builds

View file

@ -372,6 +372,8 @@ void run(Strings args)
pathArgs = true;
else if (arg == "--verbose" || arg == "-v")
verbosity = (Verbosity) ((int) verbosity + 1);
else if (arg == "--keep-failed" || arg == "-K")
keepFailed = true;
else if (arg == "--help")
printHelp();
else if (arg[0] == '-')