guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: daemon: Add '--rounds'.


From: Ludovic Courtès
Subject: 02/02: daemon: Add '--rounds'.
Date: Sun, 13 Dec 2015 18:20:09 +0000

civodul pushed a commit to branch master
in repository guix.

commit ecf84b7c482e4ab0d001b0121b76f1ae11a5482b
Author: Ludovic Courtès <address@hidden>
Date:   Sun Dec 13 19:08:20 2015 +0100

    daemon: Add '--rounds'.
    
    * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_BUILD_ROUNDS): New macro.
    (options): Add --rounds.
    (parse_opt): Honor it.
    * doc/guix.texi (Invoking guix-daemon): Document it.
---
 doc/guix.texi                 |    6 ++++++
 nix/nix-daemon/guix-daemon.cc |   15 +++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e0235b9..29cea5c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -864,6 +864,12 @@ Allow at most @var{n} build jobs in parallel.  The default 
value is
 locally; instead, the daemon will offload builds (@pxref{Daemon Offload
 Setup}), or simply fail.
 
address@hidden address@hidden
+Build each derivation @var{n} times in a row, and raise an error if
+consecutive build results are not bit-for-bit identical.  Note that this
+setting can be overridden by clients such as @command{guix build}
+(@pxref{Invoking guix build}).
+
 @item --debug
 Produce debugging output.
 
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 1934487..20a0732 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -80,6 +80,7 @@ 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_BUILD_ROUNDS 17
 
 static const struct argp_option options[] =
   {
@@ -104,6 +105,8 @@ 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") },
+    { "rounds", GUIX_OPT_BUILD_ROUNDS, "N", 0,
+      n_("build each derivation N times in a row") },
     { "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 +192,18 @@ parse_opt (int key, char *arg, struct argp_state *state)
     case GUIX_OPT_CACHE_FAILURES:
       settings.cacheFailure = true;
       break;
+    case GUIX_OPT_BUILD_ROUNDS:
+      {
+       char *end;
+       unsigned long n = strtoul (arg, &end, 10);
+       if (end != arg + strlen (arg))
+         {
+           fprintf (stderr, _("error: %s: invalid number of rounds\n"), arg);
+           exit (EXIT_FAILURE);
+         }
+       settings.set ("build-repeat", std::to_string (std::max (0UL, n - 1)));
+       break;
+      }
     case GUIX_OPT_IMPERSONATE_LINUX_26:
       settings.impersonateLinux26 = true;
       break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]