diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-11-18 22:22:59 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-11-19 10:51:52 +0100 |
commit | 6fbd8fde2fad113dbfc90c8b1b55f7ead919a90a (patch) | |
tree | 7a4bb0832f83e48e16cfecace0d1cfeb92f975ca /guix/scripts | |
parent | 10e73bbc5e2a3f62dc07c5c94309c5105c435dc6 (diff) |
pull: Acquire a lock for the target profile.
This is a followup to b1fb663404894268b5ee92c040f12c52c0bee425.
* guix/scripts/pull.scm (guix-pull): Wrap 'run-with-store' call in
'with-file-lock/no-wait'.
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/pull.scm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 0ab688ac24..ef8d5c8fd9 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -36,6 +36,8 @@ #:autoload (guix inferior) (open-inferior) #:use-module (guix scripts build) #:autoload (guix build utils) (which) + #:use-module ((guix build syscalls) + #:select (with-file-lock/no-wait)) #:use-module (guix git) #:use-module (git) #:use-module (gnu packages) @@ -815,11 +817,16 @@ Use '~/.config/guix/channels.scm' instead.")) (if (assoc-ref opts 'bootstrap?) %bootstrap-guile (canonical-package guile-2.2))))) - (run-with-store store - (build-and-install instances profile - #:dry-run? - (assoc-ref opts 'dry-run?) - #:use-substitutes? - (assoc-ref opts 'substitutes?)))))))))))))) + (with-file-lock/no-wait (string-append profile ".lock") + (lambda (key . args) + (leave (G_ "profile ~a is locked by another process~%") + profile)) + + (run-with-store store + (build-and-install instances profile + #:dry-run? + (assoc-ref opts 'dry-run?) + #:use-substitutes? + (assoc-ref opts 'substitutes?))))))))))))))) ;;; pull.scm ends here |