Toggle diff (103 lines)
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index efe1ab2..48936f9 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1483,12 +1483,20 @@ void DerivationGoal::buildDone()
if (settings.printBuildTrace)
printMsg(lvlError, format("@ build-failed %1% - timeout") % drvPath);
worker.timedOut = true;
+
+ if (settings.cacheFailure && settings.cacheTimeoutFailure)
+ foreach (DerivationOutputs::iterator, i, drv.outputs)
+ worker.store.registerFailedPath(i->second.path);
}
else if (hook && (!WIFEXITED(status) || WEXITSTATUS(status) != 100)) {
if (settings.printBuildTrace)
printMsg(lvlError, format("@ hook-failed %1% - %2% %3%")
% drvPath % status % e.msg());
+
+ if (settings.cacheFailure && settings.cacheHookFailure)
+ foreach (DerivationOutputs::iterator, i, drv.outputs)
+ worker.store.registerFailedPath(i->second.path);
}
else {
diff --git a/nix/libstore/globals.cc b/nix/libstore/globals.cc
index 07f23d4..7829c1c 100644
--- a/nix/libstore/globals.cc
+++ b/nix/libstore/globals.cc
@@ -48,6 +48,8 @@ Settings::Settings()
compressLog = true;
maxLogSize = 0;
cacheFailure = false;
+ cacheTimeoutFailure = false;
+ cacheHookFailure = false;
pollInterval = 5;
checkRootReachability = false;
gcKeepOutputs = false;
@@ -158,6 +160,8 @@ void Settings::update()
_get(compressLog, "build-compress-log");
_get(maxLogSize, "build-max-log-size");
_get(cacheFailure, "build-cache-failure");
+ _get(cacheTimeoutFailure, "build-cache-timeout-failure");
+ _get(cacheHookFailure, "build-cache-hook-failure");
_get(pollInterval, "build-poll-interval");
_get(checkRootReachability, "gc-check-reachability");
_get(gcKeepOutputs, "gc-keep-outputs");
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index c17e10d..bf8666a 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -170,6 +170,12 @@ struct Settings {
/* Whether to cache build failures. */
bool cacheFailure;
+ /* Whether to cache timeout failures */
+ bool cacheTimeoutFailure;
+
+ /* Whether to cache hook failures */
+ bool cacheHookFailure;
+
/* How often (in seconds) to poll for locks. */
unsigned int pollInterval;
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 1934487..f613de9 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -80,6 +80,8 @@ builds derivations on behalf of its clients.");
#define GUIX_OPT_NO_BUILD_HOOK 14
#define GUIX_OPT_GC_KEEP_OUTPUTS 15
#define GUIX_OPT_GC_KEEP_DERIVATIONS 16
+#define GUIX_OPT_CACHE_TIMEOUT_FAILURES 17
+#define GUIX_OPT_CACHE_HOOK_FAILURES 18
static const struct argp_option options[] =
{
@@ -104,6 +106,10 @@ static const struct argp_option options[] =
n_("do not use the 'build hook'") },
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
n_("cache build failures") },
+ { "cache-timeout-failures", GUIX_OPT_CACHE_TIMEOUT_FAILURES, 0, 0,
+ n_("cache build failures due to timeouts (depends on cache-failures)") },
+ { "cache-hook-failures", GUIX_OPT_CACHE_HOOK_FAILURES, 0, 0,
+ n_("cache build failures due to hook failures (depends on cache-failures)") },
{ "lose-logs", GUIX_OPT_LOSE_LOGS, 0, 0,
n_("do not keep build logs") },
{ "disable-log-compression", GUIX_OPT_DISABLE_LOG_COMPRESSION, 0, 0,
@@ -189,6 +195,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
case GUIX_OPT_CACHE_FAILURES:
settings.cacheFailure = true;
break;
+ case GUIX_OPT_CACHE_TIMEOUT_FAILURES:
+ settings.cacheTimeoutFailure = true;
+ break;
+ case GUIX_OPT_CACHE_HOOK_FAILURES:
+ settings.cacheHookFailure = true;
+ break;
case GUIX_OPT_IMPERSONATE_LINUX_26:
settings.impersonateLinux26 = true;
break;
--
2.5.0