summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-11-15 20:11:35 +0100
committerMarius Bakke <mbakke@fastmail.com>2019-11-15 20:11:35 +0100
commitf056553c6b8ffa36f4ce9fb1c3602a8f4b1de242 (patch)
tree80c815216a3717cf00b615c9cb8840c113eaf79f /guix/build
parent2c9d34166983565120f831284df57a07e2edd2f9 (diff)
parent528b52390d216d8a8cd13dfcd1e6e40a6448e6c2 (diff)
downloadguix-patches-f056553c6b8ffa36f4ce9fb1c3602a8f4b1de242.tar
guix-patches-f056553c6b8ffa36f4ce9fb1c3602a8f4b1de242.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/make-bootstrap.scm1
-rw-r--r--guix/build/svn.scm4
-rw-r--r--guix/build/syscalls.scm35
3 files changed, 37 insertions, 3 deletions
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
index e5ef1d6d2b..0d29338ce3 100644
--- a/guix/build/make-bootstrap.scm
+++ b/guix/build/make-bootstrap.scm
@@ -47,7 +47,6 @@ bootstrap libc."
(install-file (pk 'src (string-append kernel-headers "/include/linux/" file))
(pk 'dest (string-append incdir "/linux"))))
'(
- "a.out.h" ; for 2.2.5
"atalk.h" ; for 2.2.5
"errno.h"
"falloc.h"
diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index e3188add3e..33783f3056 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -31,6 +31,7 @@
(define* (svn-fetch url revision directory
#:key (svn-command "svn")
+ (recursive? #t)
(user-name #f)
(password #f))
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
@@ -45,6 +46,9 @@ valid Subversion revision. Return #t on success, #f otherwise."
(list (string-append "--username=" user-name)
(string-append "--password=" password))
'())
+ ,@(if recursive?
+ '()
+ (list "--ignore-externals"))
,url ,directory))
#t)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index bbf2531c79..a5a9c92a42 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -80,6 +80,7 @@
lock-file
unlock-file
with-file-lock
+ with-file-lock/no-wait
set-thread-name
thread-name
@@ -1087,10 +1088,10 @@ exception if it's already taken."
;; Presumably we got EAGAIN or so.
(throw 'flock-error err))))))
-(define (lock-file file)
+(define* (lock-file file #:key (wait? #t))
"Wait and acquire an exclusive lock on FILE. Return an open port."
(let ((port (open-file file "w0")))
- (fcntl-flock port 'write-lock)
+ (fcntl-flock port 'write-lock #:wait? wait?)
port))
(define (unlock-file port)
@@ -1119,10 +1120,40 @@ exception if it's already taken."
(when port
(unlock-file port))))))
+(define (call-with-file-lock/no-wait file thunk handler)
+ (let ((port (catch #t
+ (lambda ()
+ (lock-file file #:wait? #f))
+ (lambda (key . args)
+ (match key
+ ('flock-error
+ (handler args))
+ ('system-error
+ ;; When using the statically-linked Guile in the initrd,
+ ;; 'fcntl-flock' returns ENOSYS unconditionally. Ignore
+ ;; that error since we're typically the only process running
+ ;; at this point.
+ (if (= ENOSYS (system-error-errno (cons key args)))
+ #f
+ (apply throw args)))
+ (_ (apply throw key args)))))))
+ (dynamic-wind
+ (lambda ()
+ #t)
+ thunk
+ (lambda ()
+ (when port
+ (unlock-file port))))))
+
(define-syntax-rule (with-file-lock file exp ...)
"Wait to acquire a lock on FILE and evaluate EXP in that context."
(call-with-file-lock file (lambda () exp ...)))
+(define-syntax-rule (with-file-lock/no-wait file handler exp ...)
+ "Try to acquire a lock on FILE and evaluate EXP in that context. Execute
+handler if the lock is already held by another process."
+ (call-with-file-lock/no-wait file (lambda () exp ...) handler))
+
;;;
;;; Miscellaneous, aka. 'prctl'.