summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-11-05 15:26:57 +0100
committerLudovic Courtès <ludo@gnu.org>2020-11-05 16:13:50 +0100
commite6934c0429ed94c9d9e61f81520d11153bbb3f64 (patch)
tree1dcc9003ac70f81c57d48cce54ee779cd350b80a /gnu/build
parentca465a9c8454289b7aded22719cd5d919e441780 (diff)
shepherd: Remove dependency on (guix utils).
Since commit 8ce6f4dc2879919c12bc76a2f4b01200af97e019, importing this module in a gexp would pull in (guix config) from the host, thereby leading to non-reproducible derivations. Users in (gnu services ...) do not expect that so simply remove the (guix utils) dependency for now. * gnu/build/shepherd.scm (fork+exec-command/container)[strip-pid]: New procedure. Use it instead of 'strip-keyword-arguments'.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/shepherd.scm16
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm
index 91646288d5..d7b858dea4 100644
--- a/gnu/build/shepherd.scm
+++ b/gnu/build/shepherd.scm
@@ -21,7 +21,6 @@
#:use-module (gnu system file-systems)
#:use-module (gnu build linux-container)
#:use-module (guix build utils)
- #:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (ice-9 match)
@@ -199,11 +198,24 @@ namespace, in addition to essential bind-mounts such /proc."
"This is a variant of 'fork+exec-command' procedure, that joins the
namespaces of process PID beforehand. If there is no support for containers,
on Hurd systems for instance, fallback to direct forking."
+ (define (strip-pid args)
+ ;; TODO: Replace with 'strip-keyword-arguments' when that no longer pulls
+ ;; in (guix config).
+ (let loop ((args args)
+ (result '()))
+ (match args
+ (()
+ (reverse result))
+ ((#:pid _ . rest)
+ (loop rest result))
+ ((head . rest)
+ (loop rest (cons head result))))))
+
(let ((container-support?
(file-exists? "/proc/self/ns"))
(fork-proc (lambda ()
(apply fork+exec-command command
- (strip-keyword-arguments '(#:pid) args)))))
+ (strip-pid args)))))
(if container-support?
(container-excursion* pid fork-proc)
(fork-proc))))