unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: 23874@debbugs.gnu.org
Subject: bug#23874: [PATCH v3 2/2] profiles: Delete duplicate manifest entries in packages->manifest.
Date: Sat,  5 Dec 2020 17:20:10 +0100	[thread overview]
Message-ID: <20201205162010.26652-2-leo.prikler@student.tugraz.at> (raw)
In-Reply-To: <20201205162010.26652-1-leo.prikler@student.tugraz.at>

* gnu/profiles.scm (packages->manifest): Delete duplicate entries.
* tests/profiles.scm ("packages->manifest, no duplicates"): New test.
---
 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 034591eb79..59a313ea08 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 f0a1a1d11c..2dec42bec1 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)
-- 
2.29.2





      reply	other threads:[~2020-12-05 16:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 13:59 bug#23874: duplicates in manifests are “installed” more than once Ricardo Wurmus
2016-06-30 21:14 ` Ludovic Courtès
2020-09-14 18:15   ` zimoun
2020-12-02 13:22 ` bug#23874: [PATCH 1/2] profiles: Remove duplicates in manifest transactions Leo Prikler
2020-12-02 13:22   ` bug#23874: [PATCH 2/2] profiles: Delete duplicate manifest entries in packages->manifest Leo Prikler
2020-12-02 20:26   ` bug#23874: [PATCH 1/2] profiles: Remove duplicates in manifest transactions Mark H Weaver
2020-12-02 22:25     ` Leo Prikler
2020-12-02 23:24       ` zimoun
2020-12-05 15:38       ` Ludovic Courtès
2020-12-05 16:29         ` Leo Prikler
2020-12-07  9:16           ` Ludovic Courtès
2020-12-07 15:28             ` zimoun
2020-12-02 23:39 ` bug#23874: [PATCH v2 " Leo Prikler
2020-12-02 23:39   ` bug#23874: [PATCH v2 2/2] profiles: Delete duplicate manifest entries in packages->manifest Leo Prikler
2020-12-05 16:20 ` bug#23874: [PATCH v3 1/2] profiles: Remove duplicates in manifest transactions Leo Prikler
2020-12-05 16:20   ` Leo Prikler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201205162010.26652-2-leo.prikler@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=23874@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).