From 969e678ed9f907764e6412386432dfbddf493f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 20 May 2013 18:14:55 +0200 Subject: Add `--max-silent-time' to `guix build' and `guix package'. * guix/scripts/build.scm (%default-options): Add default `max-silent-time' value. (show-help, %options): Add `--max-silent-time'. (guix-build): Pass `max-silent-time' to `set-build-options'. * guix/scripts/package.scm (%default-options): Add default `max-silent-time' value. (show-help, %options): Add `--max-silent-time'. (guix-package): Pass `max-silent-time' to `set-build-options'. * guix/ui.scm (string->number*): New procedure. * tests/derivations.scm ("build-expression->derivation and max-silent-time"): New test. * doc/guix.texi (Invoking guix package, Invoking guix build): Document `--max-silent-time'. --- guix/scripts/build.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'guix/scripts/build.scm') diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 4464d84dfc..ca2fe46e98 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -59,6 +59,7 @@ When SOURCE? is true, return the derivations of the package sources." ;; Alist of default option values. `((system . ,(%current-system)) (substitutes? . #t) + (max-silent-time . 3600) (verbosity . 0))) (define (show-help) @@ -78,6 +79,9 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n")) -n, --dry-run do not build the derivations")) (display (_ " --no-substitutes build instead of resorting to pre-built substitutes")) + (display (_ " + --max-silent-time=SECONDS + mark the build as failed after SECONDS of silence")) (display (_ " -c, --cores=N allow the use of up to N CPU cores for the build")) (display (_ " @@ -132,6 +136,10 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n")) (lambda (opt name arg result) (alist-cons 'substitutes? #f (alist-delete 'substitutes? result)))) + (option '("max-silent-time") #t #f + (lambda (opt name arg result) + (alist-cons 'max-silent-time (string->number* arg) + result))) (option '(#\r "root") #t #f (lambda (opt name arg result) (alist-cons 'gc-root arg result))) @@ -246,6 +254,7 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n")) #:keep-failed? (assoc-ref opts 'keep-failed?) #:build-cores (or (assoc-ref opts 'cores) 0) #:use-substitutes? (assoc-ref opts 'substitutes?) + #:max-silent-time (assoc-ref opts 'max-silent-time) #:verbosity (assoc-ref opts 'verbosity)) (if (assoc-ref opts 'derivations-only?) -- cgit v1.2.3