summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-01 11:37:36 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-01 14:00:21 +0100
commit435603a1d6106b535cf143d17cb030b2d0795b54 (patch)
tree01ff81d92ae52d7d9046e286b94d91902f5236b8 /guix/profiles.scm
parentacb59d99dbb8779ecf41cdbba45d2ce8ba88f5ed (diff)
downloadgnu-guix-435603a1d6106b535cf143d17cb030b2d0795b54.tar
gnu-guix-435603a1d6106b535cf143d17cb030b2d0795b54.tar.gz
profiles: 'manifest-add' truly deletes duplicate entries.
Fixes <https://bugs.gnu.org/30569>. Reported by Andreas Enge <andreas@enge.fr>. * guix/profiles.scm (manifest-add): Don't append ENTRIES as is. Instead, cons each element of ENTRIES as we fold over it. Remove unneeded ellispes in 'match' patterns.
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm20
1 files changed, 10 insertions, 10 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 8e3e49e444..95dc9746bd 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
@@ -494,19 +494,19 @@ must be a manifest-pattern."
Remove MANIFEST entries that have the same name and output as ENTRIES."
(define (same-entry? entry name output)
(match entry
- (($ <manifest-entry> entry-name _ entry-output _ ...)
+ (($ <manifest-entry> entry-name _ entry-output _)
(and (equal? name entry-name)
(equal? output entry-output)))))
(make-manifest
- (append entries
- (fold (lambda (entry result)
- (match entry
- (($ <manifest-entry> name _ out _ ...)
- (filter (negate (cut same-entry? <> name out))
- result))))
- (manifest-entries manifest)
- entries))))
+ (fold (lambda (entry result) ;XXX: quadratic
+ (match entry
+ (($ <manifest-entry> name _ out _)
+ (cons entry
+ (remove (cut same-entry? <> name out)
+ result)))))
+ (manifest-entries manifest)
+ entries)))
(define (manifest-lookup manifest pattern)
"Return the first item of MANIFEST that matches PATTERN, or #f if there is