unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 38301@debbugs.gnu.org
Cc: "Konrad Hinsen" <konrad.hinsen@fastmail.net>,
	"Pierre Neidhardt" <mail@ambrevar.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#38301] [PATCH 2/4] profiles: Add 'concatenate-manifests'.
Date: Wed, 20 Nov 2019 14:44:35 +0100	[thread overview]
Message-ID: <20191120134437.30881-2-ludo@gnu.org> (raw)
In-Reply-To: <20191120134437.30881-1-ludo@gnu.org>

* guix/profiles.scm (concatenate-manifests): New procedure.
* tests/profiles.scm ("concatenate-manifests"): New test.
---
 guix/profiles.scm  | 5 +++++
 tests/profiles.scm | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index cd3b21e390..f5e5cc33d6 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -92,6 +92,7 @@
             manifest-pattern-version
             manifest-pattern-output
 
+            concatenate-manifests
             manifest-remove
             manifest-add
             manifest-lookup
@@ -515,6 +516,10 @@ procedure is here for backward-compatibility and will eventually vanish."
   "Return the packages listed in MANIFEST."
   (sexp->manifest (read port)))
 
+(define (concatenate-manifests lst)
+  "Concatenate the manifests listed in LST and return the resulting manifest."
+  (manifest (append-map manifest-entries lst)))
+
 (define (entry-predicate pattern)
   "Return a procedure that returns #t when passed a manifest entry that
 matches NAME/OUTPUT/VERSION.  OUTPUT and VERSION may be #f, in which case they
diff --git a/tests/profiles.scm b/tests/profiles.scm
index a4e28672b5..21c912a532 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -113,6 +113,11 @@
       (manifest-matching-entries m (list p))
       #f)))
 
+(test-equal "concatenate-manifests"
+  (manifest (list guile-2.0.9 glibc))
+  (concatenate-manifests (list (manifest (list guile-2.0.9))
+                               (manifest (list glibc)))))
+
 (test-assert "manifest-remove"
   (let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug)))
          (m1 (manifest-remove m0
-- 
2.24.0

  reply	other threads:[~2019-11-20 13:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 13:42 [bug#38301] [PATCH 0/4] Allow for multiple '--manifest' options Ludovic Courtès
2019-11-20 13:44 ` [bug#38301] [PATCH 1/4] environment: Document that '--manifest' can be repeated Ludovic Courtès
2019-11-20 13:44   ` Ludovic Courtès [this message]
2019-11-20 13:44   ` [bug#38301] [PATCH 3/4] package: Allow multiple '--manifest' options Ludovic Courtès
2019-11-20 13:44   ` [bug#38301] [PATCH 4/4] pack: " Ludovic Courtès
2019-11-20 16:23     ` brettg
2019-11-22 14:15       ` bug#38301: " Ludovic Courtès
2019-11-20 16:33 ` [bug#38301] [PATCH 0/4] Allow for " Konrad Hinsen
2019-11-22 14:37   ` zimoun

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=20191120134437.30881-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=38301@debbugs.gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    --cc=mail@ambrevar.xyz \
    /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).