Hi Mark, Am Mittwoch, den 02.12.2020, 15:26 -0500 schrieb Mark H Weaver: > Hi, > > Leo Prikler <leo.prik...@student.tugraz.at> writes: > > > * guix/profiles.scm (manifest-transaction-effects): Delete > > duplicates in > > install and remove. Let multiple upgrades and downgrades shadow > > previous > > transactions of the same kind. > > --- > > guix/profiles.scm | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/guix/profiles.scm b/guix/profiles.scm > > index 1b15257210..99b7dbf299 100644 > > --- a/guix/profiles.scm > > +++ b/guix/profiles.scm > [...] > > @@ -740,10 +743,10 @@ replace it." > > (loop rest > > (if previous install (cons entry install)) > > (if (and previous newer?) > > - (alist-cons previous entry upgrade) > > + (assoc-set! upgrade previous entry) > > upgrade) > > (if (and previous (not newer?)) > > - (alist-cons previous entry downgrade) > > + (assoc-set! downgrade previous entry) > > downgrade))))))) > > We should avoid mutating existing list structure, as done above with > 'assoc-set!'. In this case the bug is not with mutating existing structures (as those are allocated only for this loop), but in not checking, whether the entries are the same. Either way, I've now implemented a version, that should fix both wrong-doings (see attachment).
Regards, Leo
From 67ae06895b0d6f2f31410cc32d733bfa098102d6 Mon Sep 17 00:00:00 2001 From: Leo Prikler <leo.prik...@student.tugraz.at> Date: Wed, 2 Dec 2020 14:06:52 +0100 Subject: [PATCH 1/2] profiles: Remove duplicates in manifest transactions. * guix/profiles.scm (manifest-transaction-effects): Delete duplicates in install and remove. Let multiple upgrades and downgrades shadow previous transactions of the same kind. --- guix/profiles.scm | 18 ++++++++++++++++-- 1 file 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. -- 2.29.2