summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorLeo Prikler <leo.prikler@student.tugraz.at>2020-12-05 17:20:09 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-07 12:48:25 +0100
commitf5d952c5f50cd9c6005cdf47dda5bccb6e428119 (patch)
treeaec4d315993e20d59ff3424aa1a0b8717733a4aa /guix/profiles.scm
parentb3f21eb6bc895a4eafe903dfbb480de481bbb4c7 (diff)
downloadguix-f5d952c5f50cd9c6005cdf47dda5bccb6e428119.tar.gz
guix-f5d952c5f50cd9c6005cdf47dda5bccb6e428119.tar.xz
profiles: Remove duplicates in manifest transactions.
Fixes <https://bugs.gnu.org/23874>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * guix/profiles.scm (manifest-transaction-effects): Delete duplicates in install and remove. Let multiple upgrades and downgrades shadow previous transactions of the same kind. * tests/profiles.scm ("manifest-transaction-effects no double install or upgrades") ("manifest-transaction-effects no double downgrade") ("manifest-transaction-effects no double removal"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm18
1 files changed, 16 insertions, 2 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 1b15257210..034591eb79 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -716,6 +716,12 @@ replace it."
(manifest-pattern
(name (manifest-entry-name entry))
(output (manifest-entry-output entry))))
+ (define manifest-entry-pair=?
+ (match-lambda*
+ (((m1a . m2a) (m1b . m2b))
+ (and (manifest-entry=? m1a m1b)
+ (manifest-entry=? m2a m2b)))
+ (_ #f)))
(let loop ((input (manifest-transaction-install transaction))
(install '())
@@ -724,8 +730,16 @@ replace it."
(match input
(()
(let ((remove (manifest-transaction-remove transaction)))
- (values (manifest-matching-entries manifest remove)
- (reverse install) (reverse upgrade) (reverse downgrade))))
+ (values (delete-duplicates
+ (manifest-matching-entries manifest remove)
+ manifest-entry=?)
+ (delete-duplicates (reverse install) manifest-entry=?)
+ (delete-duplicates
+ (reverse upgrade)
+ manifest-entry-pair=?)
+ (delete-duplicates
+ (reverse downgrade)
+ manifest-entry-pair=?))))
((entry rest ...)
;; Check whether installing ENTRY corresponds to the installation of a
;; new package or to an upgrade.