summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-29 14:53:22 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-29 15:54:20 +0100
commit55e1dfa4dd189e010c541e3997b65434c702b4a5 (patch)
tree24cfeb92c7778694f1c61d1e231afeaf43d37453 /guix/scripts
parent403604c31e1a914d338f62d222081be5f62e0520 (diff)
downloadpatches-55e1dfa4dd189e010c541e3997b65434c702b4a5.tar
patches-55e1dfa4dd189e010c541e3997b65434c702b4a5.tar.gz
ui: Factorize 'with-profile-lock'.
* guix/ui.scm (profile-lock-handler, profile-lock-file): New procedures. (with-profile-lock): New macro. * guix/scripts/package.scm (process-actions): Use 'with-profile-lock' instead of 'with-file-lock/no-wait'. * guix/scripts/pull.scm (guix-pull): Likewise.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/package.scm6
-rw-r--r--guix/scripts/pull.scm6
2 files changed, 2 insertions, 10 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 97436feee7..92c6e34194 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -866,11 +866,7 @@ processed, #f otherwise."
;; First, acquire a lock on the profile, to ensure only one guix process
;; is modifying it at a time.
- (with-file-lock/no-wait (string-append profile ".lock")
- (lambda (key . args)
- (leave (G_ "profile ~a is locked by another process~%")
- profile))
-
+ (with-profile-lock profile
;; Then, process roll-backs, generation removals, etc.
(for-each (match-lambda
((key . arg)
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 7f37c156e8..19410ad141 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -866,11 +866,7 @@ Use '~/.config/guix/channels.scm' instead."))
(if (assoc-ref opts 'bootstrap?)
%bootstrap-guile
(canonical-package guile-2.2)))))
- (with-file-lock/no-wait (string-append profile ".lock")
- (lambda (key . args)
- (leave (G_ "profile ~a is locked by another process~%")
- profile))
-
+ (with-profile-lock profile
(run-with-store store
(build-and-install instances profile
#:dry-run?