--- Begin Message ---
Subject: |
[PATCH 1/2] guix: Add option --manifest to guix pack |
Date: |
Fri, 9 Feb 2018 20:33:12 +0100 |
* guix/scripts/pack.scm: Extend the way the manifest for the archive
contents is created. If the --manifest option is given, read the
manifest from the provided file. Otherwise, create the manifest from
a package list as before. Check if both a manifest file and a package list
were given, which is an error.
---
guix/scripts/pack.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index a22258d5a..f772083c6 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -292,6 +292,9 @@ the image."
(option '(#\e "expression") #t #f
(lambda (opt name 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
(lambda (opt name arg result)
(alist-cons 'system arg
@@ -375,10 +378,21 @@ Create a bundle of PACKAGE.\n"))
(read/eval-package-expression exp))
(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
(parameterize ((%graft? (assoc-ref opts 'graft?)))
(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))
(name (string-append (symbol->string pack-format)
"-pack"))
@@ -397,7 +411,7 @@ Create a bundle of PACKAGE.\n"))
(run-with-store store
(mlet* %store-monad ((profile (profile-derivation
- (packages->manifest packages)
+ manifest
#:target target))
(drv (build-image name profile
#:target
--
2.14.3 (Apple Git-98)
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack |
Date: |
Thu, 15 Feb 2018 22:24:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Konrad Hinsen <address@hidden> skribis:
> address@hidden (Ludovic Courtès) writes:
>
>> Awesome! I took the liberty to make the changes below (let me know if
>> anything’s amiss!), and adjusted the commit log to match our
>> conventions.
>
> Well, there is this:
>
>> @@ -347,6 +348,9 @@ Create a bundle of PACKAGE.\n"))
>> -C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
>> (display (G_ "
>> -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"))
>
> The "new profile generation" should probably be "bundle".
Oops, fixed now. Thanks!
Ludo’.
--- End Message ---