[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/06: profiles: Delete duplicate manifest entries in packages->manifest
From: |
guix-commits |
Subject: |
03/06: profiles: Delete duplicate manifest entries in packages->manifest. |
Date: |
Mon, 7 Dec 2020 06:49:53 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 07340cbebc1ef97c0196c631144775f5ce61d4f6
Author: Leo Prikler <leo.prikler@student.tugraz.at>
AuthorDate: Sat Dec 5 17:20:10 2020 +0100
profiles: Delete duplicate manifest entries in packages->manifest.
* gnu/profiles.scm (packages->manifest): Delete duplicate entries.
* tests/profiles.scm ("packages->manifest, no duplicates"): New test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
guix/profiles.scm | 34 ++++++++++++++++++----------------
tests/profiles.scm | 10 ++++++++++
2 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 034591e..59a313e 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -399,22 +399,24 @@ denoting a specific output of a package."
'inferior-package->manifest-entry))
(manifest
- (map (match-lambda
- (((? package? package) output)
- (package->manifest-entry package output))
- ((? package? package)
- (package->manifest-entry package))
- ((thing output)
- (if inferiors-loaded?
- ((inferior->entry) thing output)
- (throw 'wrong-type-arg 'packages->manifest
- "Wrong package object: ~S" (list thing) (list thing))))
- (thing
- (if inferiors-loaded?
- ((inferior->entry) thing)
- (throw 'wrong-type-arg 'packages->manifest
- "Wrong package object: ~S" (list thing) (list thing)))))
- packages)))
+ (delete-duplicates
+ (map (match-lambda
+ (((? package? package) output)
+ (package->manifest-entry package output))
+ ((? package? package)
+ (package->manifest-entry package))
+ ((thing output)
+ (if inferiors-loaded?
+ ((inferior->entry) thing output)
+ (throw 'wrong-type-arg 'packages->manifest
+ "Wrong package object: ~S" (list thing) (list thing))))
+ (thing
+ (if inferiors-loaded?
+ ((inferior->entry) thing)
+ (throw 'wrong-type-arg 'packages->manifest
+ "Wrong package object: ~S" (list thing) (list thing)))))
+ packages)
+ manifest-entry=?)))
(define (manifest->gexp manifest)
"Return a representation of MANIFEST as a gexp."
diff --git a/tests/profiles.scm b/tests/profiles.scm
index f0a1a1d..2dec42b 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -384,6 +384,16 @@
(manifest-entry-search-paths
(package->manifest-entry mpl)))))
+(test-assert "packages->manifest, no duplicates"
+ (let ((expected
+ (manifest
+ (list
+ (package->manifest-entry packages:guile-2.2))))
+ (manifest (packages->manifest
+ (list packages:guile-2.2 packages:guile-2.2))))
+ (every manifest-entry=? (manifest-entries expected)
+ (manifest-entries manifest))))
+
(test-equal "packages->manifest, propagated inputs"
(map (match-lambda
((label package)
- branch master updated (27cf238 -> d8ae785), guix-commits, 2020/12/07
- 02/06: profiles: Remove duplicates in manifest transactions., guix-commits, 2020/12/07
- 04/06: services: hurd-vm: Avoid circular dependency with (gnu system images hurd)., guix-commits, 2020/12/07
- 05/06: services: openssh: Warn about 'password-authentication?' default., guix-commits, 2020/12/07
- 01/06: doc: Fix incorrect GUIX_PROFILE value for 'guix pull'., guix-commits, 2020/12/07
- 03/06: profiles: Delete duplicate manifest entries in packages->manifest.,
guix-commits <=
- 06/06: tests: lint: Add origin patch file name test cases., guix-commits, 2020/12/07