From 674e143cf8e7dff7d62a29c63e43839efc23edba Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 21 Oct 2019 15:33:32 +0200 Subject: download: Honor /etc/ssl/certs when 'SSL_CERT_DIR' is not set. * guix/build/download.scm (%x509-certificate-directory): Use "/etc/ssl/certs" as a last resort. This ensures, for instance, that 'guix download' honors system-wide certificates when SSL_CERT_DIR is unset. --- guix/build/download.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/build') diff --git a/guix/build/download.scm b/guix/build/download.scm index 0c9c61de4b..a4c91550a6 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -172,7 +172,8 @@ session record port using PORT as its underlying communication port." (define %x509-certificate-directory ;; The directory where X.509 authority PEM certificates are stored. (make-parameter (or (getenv "GUIX_TLS_CERTIFICATE_DIRECTORY") - (getenv "SSL_CERT_DIR")))) ;like OpenSSL + (getenv "SSL_CERT_DIR") ;like OpenSSL + "/etc/ssl/certs"))) (define (set-certificate-credentials-x509-trust-file!* cred file format) "Like 'set-certificate-credentials-x509-trust-file!', but without the file -- cgit v1.2.3 From 51395c84fdbf8daed6392951a973ad750cf3eefa Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Mon, 21 Oct 2019 21:48:31 +0200 Subject: guix: svn: Allow dropping externals. * guix/build/svn.scm (svn-fetch): Allow to ignore externals. * guix/svn-download.scm (svn-reference, svn-multi-reference): Add recursive? field. --- guix/build/svn.scm | 4 ++++ guix/svn-download.scm | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'guix/build') 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/svn-download.scm b/guix/svn-download.scm index 4139cbc2e2..d912474aa2 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -31,6 +31,7 @@ svn-reference? svn-reference-url svn-reference-revision + svn-reference-recursive? svn-fetch download-svn-to-store @@ -39,6 +40,7 @@ svn-multi-reference-url svn-multi-reference-revision svn-multi-reference-locations + svn-multi-reference-recursive? svn-multi-fetch)) ;;; Commentary: @@ -52,10 +54,11 @@ (define-record-type* svn-reference make-svn-reference svn-reference? - (url svn-reference-url) ; string - (revision svn-reference-revision) ; number - (user-name svn-reference-user-name (default #f)) - (password svn-reference-password (default #f))) + (url svn-reference-url) ; string + (revision svn-reference-revision) ; number + (recursive? svn-reference-recursive? (default #t)) + (user-name svn-reference-user-name (default #f)) + (password svn-reference-password (default #f))) (define (subversion-package) "Return the default Subversion package." @@ -78,6 +81,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." '#$(svn-reference-revision ref) #$output #:svn-command (string-append #+svn "/bin/svn") + #:recursive? #$(svn-reference-recursive? ref) #:user-name #$(svn-reference-user-name ref) #:password #$(svn-reference-password ref))))) @@ -96,6 +100,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (url svn-multi-reference-url) ; string (revision svn-multi-reference-revision) ; number (locations svn-multi-reference-locations) ; list of strings + (recursive? svn-multi-reference-recursive? (default #t)) (user-name svn-multi-reference-user-name (default #f)) (password svn-multi-reference-password (default #f))) @@ -125,6 +130,8 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (string-append #$output "/" location) (string-append #$output "/" (dirname location))) #:svn-command (string-append #+svn "/bin/svn") + #:recursive? + #$(svn-reference-recursive? ref) #:user-name #$(svn-multi-reference-user-name ref) #:password #$(svn-multi-reference-password ref))) '#$(svn-multi-reference-locations ref))))) -- cgit v1.2.3 From 8a2b23178274127dac07e1163267d623790ce36a Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Thu, 24 Oct 2019 00:57:23 +0200 Subject: Revert "guix: svn: Allow dropping externals." This reverts commit 51395c84fdbf8daed6392951a973ad750cf3eefa, fixing . Reported by . --- guix/build/svn.scm | 4 ---- guix/svn-download.scm | 15 ++++----------- 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'guix/build') diff --git a/guix/build/svn.scm b/guix/build/svn.scm index 33783f3056..e3188add3e 100644 --- a/guix/build/svn.scm +++ b/guix/build/svn.scm @@ -31,7 +31,6 @@ (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 @@ -46,9 +45,6 @@ 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/svn-download.scm b/guix/svn-download.scm index d912474aa2..4139cbc2e2 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -31,7 +31,6 @@ svn-reference? svn-reference-url svn-reference-revision - svn-reference-recursive? svn-fetch download-svn-to-store @@ -40,7 +39,6 @@ svn-multi-reference-url svn-multi-reference-revision svn-multi-reference-locations - svn-multi-reference-recursive? svn-multi-fetch)) ;;; Commentary: @@ -54,11 +52,10 @@ (define-record-type* svn-reference make-svn-reference svn-reference? - (url svn-reference-url) ; string - (revision svn-reference-revision) ; number - (recursive? svn-reference-recursive? (default #t)) - (user-name svn-reference-user-name (default #f)) - (password svn-reference-password (default #f))) + (url svn-reference-url) ; string + (revision svn-reference-revision) ; number + (user-name svn-reference-user-name (default #f)) + (password svn-reference-password (default #f))) (define (subversion-package) "Return the default Subversion package." @@ -81,7 +78,6 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." '#$(svn-reference-revision ref) #$output #:svn-command (string-append #+svn "/bin/svn") - #:recursive? #$(svn-reference-recursive? ref) #:user-name #$(svn-reference-user-name ref) #:password #$(svn-reference-password ref))))) @@ -100,7 +96,6 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (url svn-multi-reference-url) ; string (revision svn-multi-reference-revision) ; number (locations svn-multi-reference-locations) ; list of strings - (recursive? svn-multi-reference-recursive? (default #t)) (user-name svn-multi-reference-user-name (default #f)) (password svn-multi-reference-password (default #f))) @@ -130,8 +125,6 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (string-append #$output "/" location) (string-append #$output "/" (dirname location))) #:svn-command (string-append #+svn "/bin/svn") - #:recursive? - #$(svn-reference-recursive? ref) #:user-name #$(svn-multi-reference-user-name ref) #:password #$(svn-multi-reference-password ref))) '#$(svn-multi-reference-locations ref))))) -- cgit v1.2.3 From f49e9131889775a74a85c1f9b29f108030337b8b Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 7 Nov 2019 21:50:54 +0100 Subject: guix: Add file-locking with no wait. * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. (lock-file): Take a #:wait? key. --- guix/build/syscalls.scm | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'guix/build') 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'. -- cgit v1.2.3 From 277ba1d4f841dcc57a259caeed298567d5143eae Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Mon, 21 Oct 2019 21:48:31 +0200 Subject: guix: svn: Allow dropping externals. * guix/build/svn.scm (svn-fetch): Allow to ignore externals. * guix/svn-download.scm (svn-reference, svn-multi-reference): Add recursive? field. --- guix/build/svn.scm | 4 ++++ guix/svn-download.scm | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'guix/build') 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/svn-download.scm b/guix/svn-download.scm index 4139cbc2e2..59e2eb8d07 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -31,6 +31,7 @@ svn-reference? svn-reference-url svn-reference-revision + svn-reference-recursive? svn-fetch download-svn-to-store @@ -39,6 +40,7 @@ svn-multi-reference-url svn-multi-reference-revision svn-multi-reference-locations + svn-multi-reference-recursive? svn-multi-fetch)) ;;; Commentary: @@ -52,10 +54,11 @@ (define-record-type* svn-reference make-svn-reference svn-reference? - (url svn-reference-url) ; string - (revision svn-reference-revision) ; number - (user-name svn-reference-user-name (default #f)) - (password svn-reference-password (default #f))) + (url svn-reference-url) ; string + (revision svn-reference-revision) ; number + (recursive? svn-reference-recursive? (default #t)) + (user-name svn-reference-user-name (default #f)) + (password svn-reference-password (default #f))) (define (subversion-package) "Return the default Subversion package." @@ -78,6 +81,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." '#$(svn-reference-revision ref) #$output #:svn-command (string-append #+svn "/bin/svn") + #:recursive? #$(svn-reference-recursive? ref) #:user-name #$(svn-reference-user-name ref) #:password #$(svn-reference-password ref))))) @@ -96,6 +100,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (url svn-multi-reference-url) ; string (revision svn-multi-reference-revision) ; number (locations svn-multi-reference-locations) ; list of strings + (recursive? svn-multi-reference-recursive? (default #t)) (user-name svn-multi-reference-user-name (default #f)) (password svn-multi-reference-password (default #f))) @@ -125,6 +130,8 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (string-append #$output "/" location) (string-append #$output "/" (dirname location))) #:svn-command (string-append #+svn "/bin/svn") + #:recursive? + #$(svn-multi-reference-recursive? ref) #:user-name #$(svn-multi-reference-user-name ref) #:password #$(svn-multi-reference-password ref))) '#$(svn-multi-reference-locations ref))))) -- cgit v1.2.3 From cda79c7cc938ae3d9e77d09e8ebd7cbdf7f4d20c Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 5 Nov 2019 14:55:05 +0200 Subject: make-bootstrap: Adjust copied linux headers. * guix/build/make-bootstrap.scm (copy-linux-headers): Remove header file 'a.out.h' is no longer part of the linux kernel headers. --- guix/build/make-bootstrap.scm | 1 - 1 file changed, 1 deletion(-) (limited to 'guix/build') 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" -- cgit v1.2.3