aboutsummaryrefslogtreecommitdiff
path: root/guix/inferior.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-08 12:25:25 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-08 12:31:38 +0100
commit4035fcba93aaf551f4b5698045f025aa61287e17 (patch)
tree313f6b30c575a2078c306ba86635b65110994228 /guix/inferior.scm
parent910aaa3b8646b6dfea5cab6ed8da3fc549a2dd70 (diff)
downloadguix-4035fcba93aaf551f4b5698045f025aa61287e17.tar
guix-4035fcba93aaf551f4b5698045f025aa61287e17.tar.gz
channels: Do not fail when the inferior lacks 'guix repl'.
Fixes <https://bugs.gnu.org/34637>. Reported by Martin Flack <martin.flack@gmail.com>. Previously we'd fail to build the package cache for old versions of Guix that lack 'guix repl'. Now we simply ignore the issue and keep going without a cache. * guix/inferior.scm (gexp->derivation-in-inferior): Add #:silent-failure? and honor it. [drop-extra-keyword]: New procedure. Use it. * guix/channels.scm (package-cache-file): Pass #:silent-failure? #t.
Diffstat (limited to 'guix/inferior.scm')
-rw-r--r--guix/inferior.scm27
1 files changed, 23 insertions, 4 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 027418a98d..63c95141d7 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -513,10 +513,15 @@ PACKAGE must be live."
(inferior-package->derivation package system #:target target))
(define* (gexp->derivation-in-inferior name exp guix
+ #:key silent-failure?
+ #:allow-other-keys
#:rest rest)
"Return a derivation that evaluates EXP with GUIX, an instance of Guix as
returned for example by 'channel-instances->derivation'. Other arguments are
-passed as-is to 'gexp->derivation'."
+passed as-is to 'gexp->derivation'.
+
+When SILENT-FAILURE? is true, create an empty output directory instead of
+failing when GUIX is too old and lacks the 'guix repl' command."
(define script
;; EXP wrapped with a proper (set! %load-path …) prologue.
(scheme-file "inferior-script.scm" exp))
@@ -539,9 +544,23 @@ passed as-is to 'gexp->derivation'."
(write `(primitive-load #$script) pipe)
(unless (zero? (close-pipe pipe))
- (error "inferior failed" #+guix)))))
-
- (apply gexp->derivation name trampoline rest))
+ (if #$silent-failure?
+ (mkdir #$output)
+ (error "inferior failed" #+guix))))))
+
+ (define (drop-extra-keyword lst)
+ (let loop ((lst lst)
+ (result '()))
+ (match lst
+ (()
+ (reverse result))
+ ((#:silent-failure? _ . rest)
+ (loop rest result))
+ ((kw value . tail)
+ (loop tail (cons* value kw result))))))
+
+ (apply gexp->derivation name trampoline
+ (drop-extra-keyword rest)))
;;;