guix package: Do not misdiagnose upgrades when there are propagated inputs.

Fixes <https://bugs.gnu.org/35872>.
Reported by Andy Tai <atai@atai.org>.

* guix/profiles.scm (list=?, manifest-entry=?): New procedures.
* guix/scripts/package.scm (transaction-upgrade-entry): In the '=' case,
use 'manifest-entry=?' to determine whether it's an upgrade.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades,
propagated inputs"): New test.
This commit is contained in:
Ludovic Courtès 2020-03-30 23:34:48 +02:00
parent b9c79cae53
commit a357849f5b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 54 additions and 8 deletions

View file

@ -89,6 +89,8 @@
manifest-entry-properties
lower-manifest-entry
manifest-entry=?
manifest-pattern
manifest-pattern?
manifest-pattern-name
@ -217,6 +219,33 @@
(output manifest-pattern-output ; string | #f
(default "out")))
(define (list=? = lst1 lst2)
"Return true if LST1 and LST2 have the same length and their elements are
pairwise equal per =."
(match lst1
(()
(null? lst2))
((head1 . tail1)
(match lst2
((head2 . tail2)
(and (= head1 head2) (list=? = tail1 tail2)))
(()
#f)))))
(define (manifest-entry=? entry1 entry2)
"Return true if ENTRY1 is equivalent to ENTRY2, ignoring their 'properties'
field."
(match entry1
(($ <manifest-entry> name1 version1 output1 item1 dependencies1 paths1)
(match entry2
(($ <manifest-entry> name2 version2 output2 item2 dependencies2 paths2)
(and (string=? name1 name2)
(string=? version1 version2)
(string=? output1 output2)
(equal? item1 item2) ;XXX: could be <package> vs. store item
(equal? paths1 paths2)
(list=? manifest-entry=? dependencies1 dependencies2)))))))
(define (manifest-transitive-entries manifest)
"Return the entries of MANIFEST along with their propagated inputs,
recursively."