summaryrefslogtreecommitdiff
path: root/guix/scripts/package.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-31 23:14:56 +0200
committerLudovic Courtès <ludo@gnu.org>2018-03-31 23:30:50 +0200
commitfc95dc4c34bf88ebd8c21752bf6d54b5cf752d1a (patch)
tree7ebef949fc6268dcbdae3664db9b67f5fcc3bee8 /guix/scripts/package.scm
parente1bff5a75c9b9806509a90428b8a87c03cc67248 (diff)
downloadgnu-guix-fc95dc4c34bf88ebd8c21752bf6d54b5cf752d1a.tar
gnu-guix-fc95dc4c34bf88ebd8c21752bf6d54b5cf752d1a.tar.gz
guix package: Add '--allow-collisions'.
Fixes <https://bugs.gnu.org/30830>. Suggested by Ricardo Wurmus <rekado@elephly.net>. * guix/scripts/package.scm (build-and-use-profile): Add #:allow-collisions? and pass it to 'profile-derivation'. (show-help, %options): Add '--allow-collisions'. (manifest-action, process-actions): Pass #:allow-collisions? to 'build-and-use-profile'. * tests/guix-package.sh: Add collision test. * doc/guix.texi (Invoking guix package): Document '--allow-collisions'.
Diffstat (limited to 'guix/scripts/package.scm')
-rw-r--r--guix/scripts/package.scm17
1 files changed, 15 insertions, 2 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index d8b80efe8e..4f519e6f33 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -194,15 +194,18 @@ denote ranges as interpreted by 'matching-generations'."
(define* (build-and-use-profile store profile manifest
#:key
+ allow-collisions?
bootstrap? use-substitutes?
dry-run?)
"Build a new generation of PROFILE, a file name, using the packages
-specified in MANIFEST, a manifest object."
+specified in MANIFEST, a manifest object. When ALLOW-COLLISIONS? is true,
+do not treat collisions in MANIFEST as an error."
(when (equal? profile %current-profile)
(ensure-default-profile))
(let* ((prof-drv (run-with-store store
(profile-derivation manifest
+ #:allow-collisions? allow-collisions?
#:hooks (if bootstrap?
'()
%default-profile-hooks)
@@ -408,6 +411,8 @@ Install, remove, or upgrade packages in a single transaction.\n"))
-p, --profile=PROFILE use PROFILE instead of the user's default profile"))
(newline)
(display (G_ "
+ --allow-collisions do not treat collisions in the profile as an error"))
+ (display (G_ "
--bootstrap use the bootstrap Guile to build the profile"))
(display (G_ "
--verbose produce verbose output"))
@@ -544,6 +549,10 @@ kind of search path~%")
(lambda (opt name arg result arg-handler)
(values (alist-cons 'verbose? #t result)
#f)))
+ (option '("allow-collisions") #f #f
+ (lambda (opt name arg result arg-handler)
+ (values (alist-cons 'allow-collisions? #t result)
+ #f)))
(option '(#\s "search") #t #f
(lambda (opt name arg result arg-handler)
(values (cons `(query search ,(or arg ""))
@@ -831,13 +840,15 @@ processed, #f otherwise."
(let* ((user-module (make-user-module '((guix profiles) (gnu))))
(manifest (load* file user-module))
(bootstrap? (assoc-ref opts 'bootstrap?))
- (substitutes? (assoc-ref opts 'substitutes?)))
+ (substitutes? (assoc-ref opts 'substitutes?))
+ (allow-collisions? (assoc-ref opts 'allow-collisions?)))
(if dry-run?
(format #t (G_ "would install new manifest from '~a' with ~d entries~%")
file (length (manifest-entries manifest)))
(format #t (G_ "installing new manifest from '~a' with ~d entries~%")
file (length (manifest-entries manifest))))
(build-and-use-profile store profile manifest
+ #:allow-collisions? allow-collisions?
#:bootstrap? bootstrap?
#:use-substitutes? substitutes?
#:dry-run? dry-run?)))
@@ -856,6 +867,7 @@ processed, #f otherwise."
(define dry-run? (assoc-ref opts 'dry-run?))
(define bootstrap? (assoc-ref opts 'bootstrap?))
(define substitutes? (assoc-ref opts 'substitutes?))
+ (define allow-collisions? (assoc-ref opts 'allow-collisions?))
(define profile (or (assoc-ref opts 'profile) %current-profile))
(define transform (options->transformation opts))
@@ -894,6 +906,7 @@ processed, #f otherwise."
(show-manifest-transaction store manifest step3
#:dry-run? dry-run?)
(build-and-use-profile store profile new
+ #:allow-collisions? allow-collisions?
#:bootstrap? bootstrap?
#:use-substitutes? substitutes?
#:dry-run? dry-run?))))