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.
This commit is contained in:
parent
acb59d99db
commit
435603a1d6
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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 © 2013 Nikita Karetnikov <nikita@karetnikov.org>
|
||||||
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
|
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
|
||||||
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
;;; 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."
|
Remove MANIFEST entries that have the same name and output as ENTRIES."
|
||||||
(define (same-entry? entry name output)
|
(define (same-entry? entry name output)
|
||||||
(match entry
|
(match entry
|
||||||
(($ <manifest-entry> entry-name _ entry-output _ ...)
|
(($ <manifest-entry> entry-name _ entry-output _)
|
||||||
(and (equal? name entry-name)
|
(and (equal? name entry-name)
|
||||||
(equal? output entry-output)))))
|
(equal? output entry-output)))))
|
||||||
|
|
||||||
(make-manifest
|
(make-manifest
|
||||||
(append entries
|
(fold (lambda (entry result) ;XXX: quadratic
|
||||||
(fold (lambda (entry result)
|
(match entry
|
||||||
(match entry
|
(($ <manifest-entry> name _ out _)
|
||||||
(($ <manifest-entry> name _ out _ ...)
|
(cons entry
|
||||||
(filter (negate (cut same-entry? <> name out))
|
(remove (cut same-entry? <> name out)
|
||||||
result))))
|
result)))))
|
||||||
(manifest-entries manifest)
|
(manifest-entries manifest)
|
||||||
entries))))
|
entries)))
|
||||||
|
|
||||||
(define (manifest-lookup manifest pattern)
|
(define (manifest-lookup manifest pattern)
|
||||||
"Return the first item of MANIFEST that matches PATTERN, or #f if there is
|
"Return the first item of MANIFEST that matches PATTERN, or #f if there is
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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 © 2014 Alex Kost <alezost@gmail.com>
|
;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -148,6 +148,11 @@
|
||||||
(_ #f))
|
(_ #f))
|
||||||
(equal? m3 m4))))
|
(equal? m3 m4))))
|
||||||
|
|
||||||
|
(test-equal "manifest-add removes duplicates" ;<https://bugs.gnu.org/30569>
|
||||||
|
(list guile-2.0.9)
|
||||||
|
(manifest-entries (manifest-add (manifest '())
|
||||||
|
(list guile-2.0.9 guile-2.0.9))))
|
||||||
|
|
||||||
(test-assert "manifest-perform-transaction"
|
(test-assert "manifest-perform-transaction"
|
||||||
(let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug)))
|
(let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug)))
|
||||||
(t1 (manifest-transaction
|
(t1 (manifest-transaction
|
||||||
|
|
Loading…
Reference in New Issue