unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack
@ 2018-02-09 19:33 Konrad Hinsen
  2018-02-15 14:19 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Hinsen @ 2018-02-09 19:33 UTC (permalink / raw)
  To: 30409

* 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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack
  2018-02-09 19:33 [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack Konrad Hinsen
@ 2018-02-15 14:19 ` Ludovic Courtès
  2018-02-15 19:19   ` Konrad Hinsen
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-02-15 14:19 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: 30409

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Hi Konrad,

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> * 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.

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.

Thanks,
Ludo’.


[-- Attachment #2: Type: text/x-patch, Size: 1672 bytes --]

diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index f772083c6..a1b839e9a 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -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"))
   (display (G_ "
       --localstatedir    include /var/guix in the resulting pack"))
   (newline)
@@ -383,12 +387,12 @@ Create a bundle of PACKAGE.\n"))
           (manifest-file (assoc-ref opts 'manifest)))
       (cond
        ((and manifest-file (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
-        (let ((user-module  (make-user-module '((guix profiles) (gnu)))))
+        (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?))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack
  2018-02-15 14:19 ` Ludovic Courtès
@ 2018-02-15 19:19   ` Konrad Hinsen
  2018-02-15 21:24     ` bug#30409: " Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Hinsen @ 2018-02-15 19:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30409

ludo@gnu.org (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".

Otherwise this looks fine!

Konrad.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30409: [PATCH 1/2] guix: Add option --manifest to guix pack
  2018-02-15 19:19   ` Konrad Hinsen
@ 2018-02-15 21:24     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-02-15 21:24 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: 30409-done

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> ludo@gnu.org (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’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-15 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 19:33 [bug#30409] [PATCH 1/2] guix: Add option --manifest to guix pack Konrad Hinsen
2018-02-15 14:19 ` Ludovic Courtès
2018-02-15 19:19   ` Konrad Hinsen
2018-02-15 21:24     ` bug#30409: " Ludovic Courtès

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).