[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/06: guix package: 'transaction-upgrade-entry' swallows build requests
From: |
guix-commits |
Subject: |
02/06: guix package: 'transaction-upgrade-entry' swallows build requests. |
Date: |
Mon, 30 Mar 2020 18:07:39 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit a187cc562890895ad41dfad00eb1d5c4a4b00936
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Mar 30 22:11:54 2020 +0200
guix package: 'transaction-upgrade-entry' swallows build requests.
Fixes a regression introduced in
131f50cdc9dbb7183023f4dae759876a9e700bef whereby the install/upgrade
message would not be displayed:
$ guix upgrade -n
2.1 MB would be downloaded:
/gnu/store/…-something-1.2
/gnu/store/…-its-dependency-2.3
This is because we'd directly abort from 'transaction-upgrade-entry' to
the build handler of 'build-notifier'.
* guix/scripts/package.scm (transaction-upgrade-entry): Call 'string=?'
expression in 'with-build-handler'.
* tests/packages.scm ("transaction-upgrade-entry, grafts"): New test.
---
guix/scripts/package.scm | 14 +++++++++++---
tests/packages.scm | 24 ++++++++++++++++++++++++
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index be2e679..cafa62c 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -234,11 +234,19 @@ non-zero relevance score."
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.
+
;; XXX: When there are propagated inputs, assume we need to
;; upgrade the whole entry.
- (if (and (string=? (manifest-entry-item
- (lower-manifest-entry* new))
- (manifest-entry-item entry))
+ (if (and (with-build-handler (const #f)
+ (string=? (manifest-entry-item
+ (lower-manifest-entry* new))
+ (manifest-entry-item entry)))
(null? (package-propagated-inputs pkg)))
transaction
(manifest-transaction-install-entry
diff --git a/tests/packages.scm b/tests/packages.scm
index 1ff35ec..c2ec1f2 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -148,6 +148,30 @@
(string=? (manifest-pattern-version pattern) "1")
(string=? (manifest-pattern-output pattern) "out")))))))
+(test-assert "transaction-upgrade-entry, grafts"
+ ;; Ensure that, when grafts are enabled, 'transaction-upgrade-entry' doesn't
+ ;; try to build stuff.
+ (with-build-handler (const 'failed!)
+ (parameterize ((%graft? #t))
+ (let* ((old (dummy-package "foo" (version "1")))
+ (bar (dummy-package "bar" (version "0")
+ (replacement old)))
+ (new (dummy-package "foo" (version "1")
+ (inputs `(("bar" ,bar)))))
+ (tx (mock ((gnu packages) find-best-packages-by-name
+ (const (list new)))
+ (transaction-upgrade-entry
+ %store
+ (manifest-entry
+ (inherit (package->manifest-entry old))
+ (item (string-append (%store-prefix) "/"
+ (make-string 32 #\e)
"-foo-1")))
+ (manifest-transaction)))))
+ (and (match (manifest-transaction-install tx)
+ ((($ <manifest-entry> "foo" "1" "out" item))
+ (eq? item new)))
+ (null? (manifest-transaction-remove tx)))))))
+
(test-assert "package-field-location"
(let ()
(define (goto port line column)
- branch master updated (df7bb43 -> b771e01), guix-commits, 2020/03/30
- 01/06: guix package: 'transaction-upgrade-entry' uses 'lower-manifest-entry'., guix-commits, 2020/03/30
- 02/06: guix package: 'transaction-upgrade-entry' swallows build requests.,
guix-commits <=
- 03/06: profiles: 'lower-manifest-entry' recurses on dependencies., guix-commits, 2020/03/30
- 04/06: guix package: Add 'transaction-upgrade-entry' test., guix-commits, 2020/03/30
- 06/06: pack: Adjust test to '--dry-run' changes., guix-commits, 2020/03/30
- 05/06: guix package: Do not misdiagnose upgrades when there are propagated inputs., guix-commits, 2020/03/30