guix-commits
[Top][All Lists]
Advanced

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

03/03: linux-container: Remove dependency on (guix utils).


From: guix-commits
Subject: 03/03: linux-container: Remove dependency on (guix utils).
Date: Sun, 23 Jun 2019 13:53:10 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 40c369b23442ace588d8c85f62f1741c17ed65c0
Author: Ludovic Court├Ęs <address@hidden>
Date:   Sun Jun 23 19:43:39 2019 +0200

    linux-container: Remove dependency on (guix utils).
    
    Fixes a bug whereby derivations importing (gnu build linux-container),
    such as the 'bitlbee' and 'tor' services, would depend on the
    user's (guix config) file, which was pulled as a dependency of (guix
    utils).  As a result, those derivations would vary from user to user.
    
    * gnu/build/linux-container.scm (call-with-temporary-directory): New
    procedure.
---
 gnu/build/linux-container.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 3d7b52f..e86ac60 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -22,7 +22,6 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 rdelim)
   #:use-module (srfi srfi-98)
-  #:use-module (guix utils)
   #:use-module (guix build utils)
   #:use-module (guix build syscalls)
   #:use-module (gnu system file-systems)          ;<file-system>
@@ -279,6 +278,21 @@ that host UIDs (respectively GIDs) map to in the 
namespace."
               (_                                  ;unexpected termination
                #f)))))))))
 
+;; FIXME: This is copied from (guix utils), which we cannot use because it
+;; would pull (guix config) and all.
+(define (call-with-temporary-directory proc)
+  "Call PROC with a name of a temporary directory; close the directory and
+delete it when leaving the dynamic extent of this call."
+  (let* ((directory (or (getenv "TMPDIR") "/tmp"))
+         (template  (string-append directory "/guix-directory.XXXXXX"))
+         (tmp-dir   (mkdtemp! template)))
+    (dynamic-wind
+      (const #t)
+      (lambda ()
+        (proc tmp-dir))
+      (lambda ()
+        (false-if-exception (delete-file-recursively tmp-dir))))))
+
 (define* (call-with-container mounts thunk #:key (namespaces %namespaces)
                               (host-uids 1) (guest-uid 0) (guest-gid 0))
   "Run THUNK in a new container process and return its exit status.



reply via email to

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