pack: Allow multiple '--manifest' options.
* 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.master
parent
bf9206d8ed
commit
ca541f9ce6
|
@ -5178,7 +5178,8 @@ build} (@pxref{Additional Build Options, @code{--expression} in
|
||||||
@item --manifest=@var{file}
|
@item --manifest=@var{file}
|
||||||
@itemx -m @var{file}
|
@itemx -m @var{file}
|
||||||
Use the packages contained in the manifest object returned by the Scheme
|
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
|
This has a similar purpose as the same-named option in @command{guix
|
||||||
package} (@pxref{profile-manifest, @option{--manifest}}) and uses the
|
package} (@pxref{profile-manifest, @option{--manifest}}) and uses the
|
||||||
|
|
|
@ -965,7 +965,10 @@ Create a bundle of PACKAGE.\n"))
|
||||||
(list (transform store package) "out")))
|
(list (transform store package) "out")))
|
||||||
(reverse
|
(reverse
|
||||||
(filter-map maybe-package-argument opts))))
|
(filter-map maybe-package-argument opts))))
|
||||||
(manifest-file (assoc-ref opts 'manifest)))
|
(manifests (filter-map (match-lambda
|
||||||
|
(('manifest . file) file)
|
||||||
|
(_ #f))
|
||||||
|
opts)))
|
||||||
(define properties
|
(define properties
|
||||||
(if (assoc-ref opts 'save-provenance?)
|
(if (assoc-ref opts 'save-provenance?)
|
||||||
(lambda (package)
|
(lambda (package)
|
||||||
|
@ -979,11 +982,15 @@ Create a bundle of PACKAGE.\n"))
|
||||||
(const '())))
|
(const '())))
|
||||||
|
|
||||||
(cond
|
(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~%")))
|
(leave (G_ "both a manifest and a package list were given~%")))
|
||||||
(manifest-file
|
((not (null? manifests))
|
||||||
(let ((user-module (make-user-module '((guix profiles) (gnu)))))
|
(concatenate-manifests
|
||||||
(load* manifest-file user-module)))
|
(map (lambda (file)
|
||||||
|
(let ((user-module (make-user-module
|
||||||
|
'((guix profiles) (gnu)))))
|
||||||
|
(load* file user-module)))
|
||||||
|
manifests)))
|
||||||
(else
|
(else
|
||||||
(manifest
|
(manifest
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
|
|
|
@ -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`"
|
drv2="`guix pack -n --with-source=guile=$test_directory guile 2>&1 | grep pack.*\.drv`"
|
||||||
test -n "$drv1"
|
test -n "$drv1"
|
||||||
test "$drv1" != "$drv2"
|
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`
|
||||||
|
|
Reference in New Issue