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 4/4] pack: Allow multiple '--manifest' options.
Date: Wed, 20 Nov 2019 14:44:37 +0100	[thread overview]
Message-ID: <20191120134437.30881-4-ludo@gnu.org> (raw)
In-Reply-To: <20191120134437.30881-1-ludo@gnu.org>

* guix/scripts/pack.scm (guix-pack): Collect 'manifest' options, and
concatenate the resulting manifests.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
---
 doc/guix.texi         |  3 ++-
 guix/scripts/pack.scm | 17 ++++++++++++-----
 tests/guix-pack.sh    | 11 +++++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9de1dbd6d5..e702bc3055 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5178,7 +5178,8 @@ build} (@pxref{Additional Build Options, @code{--expression} in
 @item --manifest=@var{file}
 @itemx -m @var{file}
 Use the packages contained in the manifest object returned by the Scheme
-code in @var{file}.
+code in @var{file}.  This option can be repeated several times, in which
+case the manifests are concatenated.
 
 This has a similar purpose as the same-named option in @command{guix
 package} (@pxref{profile-manifest, @option{--manifest}}) and uses the
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 89b3e389fc..c8a52374bd 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -965,7 +965,10 @@ Create a bundle of PACKAGE.\n"))
                                   (list (transform store package) "out")))
                                (reverse
                                 (filter-map maybe-package-argument opts))))
-           (manifest-file (assoc-ref opts 'manifest)))
+           (manifests     (filter-map (match-lambda
+                                        (('manifest . file) file)
+                                        (_ #f))
+                                      opts)))
       (define properties
         (if (assoc-ref opts 'save-provenance?)
             (lambda (package)
@@ -979,11 +982,15 @@ Create a bundle of PACKAGE.\n"))
             (const '())))
 
       (cond
-       ((and manifest-file (not (null? packages)))
+       ((and (not (null? manifests)) (not (null? packages)))
         (leave (G_ "both a manifest and a package list were given~%")))
-       (manifest-file
-        (let ((user-module (make-user-module '((guix profiles) (gnu)))))
-          (load* manifest-file user-module)))
+       ((not (null? manifests))
+        (concatenate-manifests
+         (map (lambda (file)
+                (let ((user-module (make-user-module
+                                    '((guix profiles) (gnu)))))
+                  (load* file user-module)))
+              manifests)))
        (else
         (manifest
          (map (match-lambda
diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh
index cf4e4ca4f9..7a0f3400c3 100644
--- a/tests/guix-pack.sh
+++ b/tests/guix-pack.sh
@@ -109,3 +109,14 @@ drv1="`guix pack -n guile 2>&1 | grep pack.*\.drv`"
 drv2="`guix pack -n --with-source=guile=$test_directory guile 2>&1 | grep pack.*\.drv`"
 test -n "$drv1"
 test "$drv1" != "$drv2"
+
+# Try '--manifest' options.
+cat > "$test_directory/manifest1.scm" <<EOF
+(specifications->manifest '("guile"))
+EOF
+cat > "$test_directory/manifest2.scm" <<EOF
+(specifications->manifest '("emacs"))
+EOF
+drv="`guix pack -nd -m "$test_directory/manifest1.scm" -m "$test_directory/manifest2.scm"`"
+guix gc -R "$drv" | grep `guix build guile -nd`
+guix gc -R "$drv" | grep `guix build emacs -nd`
-- 
2.24.0

  parent 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   ` [bug#38301] [PATCH 2/4] profiles: Add 'concatenate-manifests' Ludovic Courtès
2019-11-20 13:44   ` [bug#38301] [PATCH 3/4] package: Allow multiple '--manifest' options Ludovic Courtès
2019-11-20 13:44   ` Ludovic Courtès [this message]
2019-11-20 16:23     ` [bug#38301] [PATCH 4/4] pack: " 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-4-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).