aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/accounts.scm14
-rw-r--r--gnu/build/linux-container.scm16
2 files changed, 16 insertions, 14 deletions
diff --git a/gnu/build/accounts.scm b/gnu/build/accounts.scm
index b90149565f..5094456ab1 100644
--- a/gnu/build/accounts.scm
+++ b/gnu/build/accounts.scm
@@ -19,7 +19,6 @@
(define-module (gnu build accounts)
#:use-module (guix records)
#:use-module (guix combinators)
- #:use-module ((guix build syscalls) #:select (fdatasync))
#:use-module (gnu system accounts)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
@@ -231,14 +230,6 @@ each field."
;; grab this lock with 'with-file-lock' when they access the databases.
"/etc/.pwd.lock")
-(define-syntax-rule (catch-ENOSYS exp)
- (catch 'system-error
- (lambda () exp)
- (lambda args
- (if (= ENOSYS (system-error-errno args))
- #f
- (apply throw args)))))
-
(define (database-writer file mode entry->string)
(lambda* (entries #:optional (file-or-port file))
"Write ENTRIES to FILE-OR-PORT. When FILE-OR-PORT is a file name, write
@@ -259,10 +250,7 @@ to it atomically and set the appropriate permissions."
(chmod port mode)
(write-entries port)
- ;; XXX: When booting with the statically-linked Guile,
- ;; 'fdatasync' is unavailable.
- (catch-ENOSYS (fdatasync port))
-
+ (fsync port)
(close-port port)
(rename-file template file-or-port))
(lambda ()
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 3d7b52f098..e86ac606c0 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.