summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
commit18af6870370226b4d502d7372844e7f2aded5887 (patch)
tree749d93209bd0cb9710ccaae2207df670f37eaa36 /guix/build
parent0ab8ad46322bea331ed5f5592843ba35e7f38b37 (diff)
parent3089b70d766bd9ec70e1464867130b7b864fbe17 (diff)
downloadguix-patches-18af6870370226b4d502d7372844e7f2aded5887.tar
guix-patches-18af6870370226b4d502d7372844e7f2aded5887.tar.gz
Merge branch 'master' into core-updates
Conflicts: gnu/packages/icu4c.scm gnu/packages/man.scm gnu/packages/python-xyz.scm guix/scripts/environment.scm guix/scripts/pack.scm guix/scripts/package.scm guix/scripts/pull.scm guix/store.scm
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/download.scm7
-rw-r--r--guix/build/emacs-utils.scm13
-rw-r--r--guix/build/linux-module-build-system.scm17
-rw-r--r--guix/build/syscalls.scm64
4 files changed, 57 insertions, 44 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm
index c647d00f6b..46af149b2f 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -693,6 +693,13 @@ otherwise simply ignore them."
(()
(format (current-error-port) "failed to download ~s from ~s~%"
file url)
+
+ ;; Remove FILE in case we made an incomplete download, for example due
+ ;; to ENOSPC.
+ (catch 'system-error
+ (lambda ()
+ (delete-file file))
+ (const #f))
#f))))
;;; download.scm ends here
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index ab64e3714c..5f7ba71244 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
;;;
;;; This file is part of GNU Guix.
@@ -21,6 +21,7 @@
(define-module (guix build emacs-utils)
#:use-module (guix build utils)
+ #:use-module (ice-9 format)
#:export (%emacs
emacs-batch-eval
emacs-batch-edit-file
@@ -47,10 +48,12 @@
expr
(format #f "~s" expr)))
-(define (emacs-batch-eval expr)
- "Run Emacs in batch mode, and execute the elisp code EXPR."
+(define* (emacs-batch-eval expr #:key dynamic?)
+ "Run Emacs in batch mode, and execute the Elisp code EXPR. If DYNAMIC? is
+true, evaluate using dynamic scoping."
(invoke (%emacs) "--quick" "--batch"
- (string-append "--eval=" (expr->string expr))))
+ (format #f "--eval=(eval '~a ~:[t~;nil~])"
+ (expr->string expr) dynamic?)))
(define (emacs-batch-edit-file file expr)
"Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
@@ -70,7 +73,7 @@
(expr `(let ((backup-inhibited t)
(generated-autoload-file ,file))
(update-directory-autoloads ,directory))))
- (emacs-batch-eval expr)))
+ (emacs-batch-eval expr #:dynamic? #t)))
(define* (emacs-byte-compile-directory dir)
"Byte compile all files in DIR and its sub-directories."
diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm
index 8145d5a724..73d6b101f6 100644
--- a/guix/build/linux-module-build-system.scm
+++ b/guix/build/linux-module-build-system.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org>
+;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -33,14 +34,13 @@
;; Code:
;; Copied from make-linux-libre's "configure" phase.
-(define* (configure #:key inputs target #:allow-other-keys)
+(define* (configure #:key inputs target arch #:allow-other-keys)
(setenv "KCONFIG_NOTIMESTAMP" "1")
(setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
- ;(let ((arch ,(system->linux-architecture
- ; (or (%current-target-system)
- ; (%current-system)))))
- ; (setenv "ARCH" arch)
- ; (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
+
+ (setenv "ARCH" arch)
+ (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
+
(when target
(setenv "CROSS_COMPILE" (string-append target "-"))
(format #t "`CROSS_COMPILE' set to `~a'~%"
@@ -85,8 +85,9 @@
(replace 'install install)))
(define* (linux-module-build #:key inputs (phases %standard-phases)
- #:allow-other-keys #:rest args)
- "Build the given package, applying all of PHASES in order, with a Linux kernel in attendance."
+ #:allow-other-keys #:rest args)
+ "Build the given package, applying all of PHASES in order, with a Linux
+kernel in attendance."
(apply gnu:gnu-build
#:inputs inputs #:phases phases
args))
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index ae79a9708f..0938ec0ff1 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1104,47 +1104,49 @@ exception if it's already taken."
#t)
(define (call-with-file-lock file thunk)
- (let ((port (catch 'system-error
- (lambda ()
- (lock-file file))
- (lambda args
- ;; 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 args))
- #f
- (apply throw args))))))
+ (let ((port #f))
(dynamic-wind
(lambda ()
- #t)
+ (set! port
+ (catch 'system-error
+ (lambda ()
+ (lock-file file))
+ (lambda args
+ ;; 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 args))
+ #f
+ (apply throw args))))))
thunk
(lambda ()
(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
- (apply handler args)
- ;; No open port to the lock, so return #f.
- #f)
- ('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 key args)))
- (_ (apply throw key args)))))))
+ (let ((port #f))
(dynamic-wind
(lambda ()
- #t)
+ (set! port
+ (catch #t
+ (lambda ()
+ (lock-file file #:wait? #f))
+ (lambda (key . args)
+ (match key
+ ('flock-error
+ (apply handler args)
+ ;; No open port to the lock, so return #f.
+ #f)
+ ('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 key args)))
+ (_ (apply throw key args)))))))
thunk
(lambda ()
(when port