summaryrefslogtreecommitdiff
path: root/guix/scripts/package.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-08 13:00:50 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-08 13:00:50 +0200
commit27783023993f9272ce422868d14529159c4a5218 (patch)
tree9013b08aa39e497b1fd8e01a05254278d83f0ff7 /guix/scripts/package.scm
parentbe1e842ad78ac6c52fc7790f4a3ffd716673c111 (diff)
parentba6f2bda18ed19fa486a9c3e2c3baea6c66c6867 (diff)
downloadguix-patches-27783023993f9272ce422868d14529159c4a5218.tar
guix-patches-27783023993f9272ce422868d14529159c4a5218.tar.gz
Merge branch 'master' into core-updates
Conflicts: etc/news.scm gnu/local.mk gnu/packages/check.scm gnu/packages/cross-base.scm gnu/packages/gimp.scm gnu/packages/java.scm gnu/packages/mail.scm gnu/packages/sdl.scm gnu/packages/texinfo.scm gnu/packages/tls.scm gnu/packages/version-control.scm
Diffstat (limited to 'guix/scripts/package.scm')
-rw-r--r--guix/scripts/package.scm76
1 files changed, 42 insertions, 34 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 304084796a..b2b734aadd 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -197,6 +197,10 @@ non-zero relevance score."
(define (transaction-upgrade-entry store entry transaction)
"Return a variant of TRANSACTION that accounts for the upgrade of ENTRY, a
<manifest-entry>."
+ (define (lower-manifest-entry* entry)
+ (run-with-store store
+ (lower-manifest-entry entry (%current-system))))
+
(define (supersede old new)
(info (G_ "package '~a' has been superseded by '~a'~%")
(manifest-entry-name old) (package-name new))
@@ -209,40 +213,44 @@ non-zero relevance score."
(output (manifest-entry-output old)))
transaction)))
- (match (if (manifest-transaction-removal-candidate? entry transaction)
- 'dismiss
- entry)
- ('dismiss
- transaction)
- (($ <manifest-entry> name version output (? string? path))
- (match (find-best-packages-by-name name #f)
- ((pkg . rest)
- (let ((candidate-version (package-version pkg)))
- (match (package-superseded pkg)
- ((? package? new)
- (supersede entry new))
- (#f
- (case (version-compare candidate-version version)
- ((>)
- (manifest-transaction-install-entry
- (package->manifest-entry* pkg output)
- transaction))
- ((<)
- transaction)
- ((=)
- (let ((candidate-path (derivation->output-path
- (package-derivation store pkg))))
- ;; XXX: When there are propagated inputs, assume we need to
- ;; upgrade the whole entry.
- (if (and (string=? path candidate-path)
- (null? (package-propagated-inputs pkg)))
- transaction
- (manifest-transaction-install-entry
- (package->manifest-entry* pkg output)
- transaction)))))))))
- (()
- (warning (G_ "package '~a' no longer exists~%") name)
- transaction)))))
+ (define (upgrade entry)
+ (match entry
+ (($ <manifest-entry> name version output (? string? path))
+ (match (find-best-packages-by-name name #f)
+ ((pkg . rest)
+ (let ((candidate-version (package-version pkg)))
+ (match (package-superseded pkg)
+ ((? package? new)
+ (supersede entry new))
+ (#f
+ (case (version-compare candidate-version version)
+ ((>)
+ (manifest-transaction-install-entry
+ (package->manifest-entry* pkg output)
+ transaction))
+ ((<)
+ transaction)
+ ((=)
+ (let* ((new (package->manifest-entry* pkg output)))
+ ;; Here we want to determine whether the NEW actually
+ ;; differs from ENTRY, but we need to intercept
+ ;; 'build-things' calls because they would prevent us from
+ ;; displaying the list of packages to install/upgrade
+ ;; upfront. Thus, if lowering NEW triggers a build (due
+ ;; to grafts), assume NEW differs from ENTRY.
+ (if (with-build-handler (const #f)
+ (manifest-entry=? (lower-manifest-entry* new)
+ entry))
+ transaction
+ (manifest-transaction-install-entry
+ new transaction)))))))))
+ (()
+ (warning (G_ "package '~a' no longer exists~%") name)
+ transaction)))))
+
+ (if (manifest-transaction-removal-candidate? entry transaction)
+ transaction
+ (upgrade entry)))
;;;