pack: Add '--manifest'.
* guix/scripts/pack.scm (%options, show-help): Add --manifest. (guix-pack)[manifest-from-args]: New procedure. Use it. * doc/guix.texi (Invoking guix pack): Document --manifest. Signed-off-by: Ludovic Courtès <ludo@gnu.org>master
parent
47551a761b
commit
4a979afe1b
|
@ -2841,6 +2841,19 @@ This has the same purpose as the same-named option in @command{guix
|
||||||
build} (@pxref{Additional Build Options, @code{--expression} in
|
build} (@pxref{Additional Build Options, @code{--expression} in
|
||||||
@command{guix build}}).
|
@command{guix build}}).
|
||||||
|
|
||||||
|
@item --manifest=@var{file}
|
||||||
|
@itemx -m @var{file}
|
||||||
|
Use the packages contained in the manifest object returned by the Scheme
|
||||||
|
code in @var{file}.
|
||||||
|
|
||||||
|
This has a similar purpose as the same-named option in @command{guix
|
||||||
|
package} (@pxref{profile-manifest, @option{--manifest}}) and uses the
|
||||||
|
same manifest files. It allows you to define a collection of packages
|
||||||
|
once and use it both for creating profiles and for creating archives
|
||||||
|
for use on machines that do not have Guix installed. Note that you can
|
||||||
|
specify @emph{either} a manifest file @emph{or} a list of packages,
|
||||||
|
but not both.
|
||||||
|
|
||||||
@item --system=@var{system}
|
@item --system=@var{system}
|
||||||
@itemx -s @var{system}
|
@itemx -s @var{system}
|
||||||
Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of
|
Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
|
||||||
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -292,6 +293,9 @@ the image."
|
||||||
(option '(#\e "expression") #t #f
|
(option '(#\e "expression") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'expression arg result)))
|
(alist-cons 'expression arg result)))
|
||||||
|
(option '(#\m "manifest") #t #f
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(alist-cons 'manifest arg result)))
|
||||||
(option '(#\s "system") #t #f
|
(option '(#\s "system") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'system arg
|
(alist-cons 'system arg
|
||||||
|
@ -344,6 +348,9 @@ Create a bundle of PACKAGE.\n"))
|
||||||
-C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
|
-C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
|
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
|
||||||
|
(display (G_ "
|
||||||
|
-m, --manifest=FILE create a new profile generation with the manifest
|
||||||
|
from FILE"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--localstatedir include /var/guix in the resulting pack"))
|
--localstatedir include /var/guix in the resulting pack"))
|
||||||
(newline)
|
(newline)
|
||||||
|
@ -375,10 +382,21 @@ Create a bundle of PACKAGE.\n"))
|
||||||
(read/eval-package-expression exp))
|
(read/eval-package-expression exp))
|
||||||
(x #f)))
|
(x #f)))
|
||||||
|
|
||||||
|
(define (manifest-from-args opts)
|
||||||
|
(let ((packages (filter-map maybe-package-argument opts))
|
||||||
|
(manifest-file (assoc-ref opts 'manifest)))
|
||||||
|
(cond
|
||||||
|
((and manifest-file (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)))
|
||||||
|
(else (packages->manifest packages)))))
|
||||||
|
|
||||||
(with-error-handling
|
(with-error-handling
|
||||||
(parameterize ((%graft? (assoc-ref opts 'graft?)))
|
(parameterize ((%graft? (assoc-ref opts 'graft?)))
|
||||||
(let* ((dry-run? (assoc-ref opts 'dry-run?))
|
(let* ((dry-run? (assoc-ref opts 'dry-run?))
|
||||||
(packages (filter-map maybe-package-argument opts))
|
(manifest (manifest-from-args opts))
|
||||||
(pack-format (assoc-ref opts 'format))
|
(pack-format (assoc-ref opts 'format))
|
||||||
(name (string-append (symbol->string pack-format)
|
(name (string-append (symbol->string pack-format)
|
||||||
"-pack"))
|
"-pack"))
|
||||||
|
@ -397,7 +415,7 @@ Create a bundle of PACKAGE.\n"))
|
||||||
|
|
||||||
(run-with-store store
|
(run-with-store store
|
||||||
(mlet* %store-monad ((profile (profile-derivation
|
(mlet* %store-monad ((profile (profile-derivation
|
||||||
(packages->manifest packages)
|
manifest
|
||||||
#:target target))
|
#:target target))
|
||||||
(drv (build-image name profile
|
(drv (build-image name profile
|
||||||
#:target
|
#:target
|
||||||
|
|
Reference in New Issue