all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#33286] Add 'list-formats' to 'guix pack'
@ 2018-11-06  9:53 Efraim Flashner
  2018-11-06 10:39 ` Danny Milosavljevic
  2018-11-06 15:31 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Efraim Flashner @ 2018-11-06  9:53 UTC (permalink / raw)
  To: 33286


[-- Attachment #1.1: Type: text/plain, Size: 363 bytes --]

I was looking at the help menu for 'guix pack' and I realized that I
didn't know what formats were available and there wasn't a flag to show
them.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-pack-List-the-available-formats.patch --]
[-- Type: text/plain, Size: 2392 bytes --]

From af9a132a662f1d703df1c32278a45d2adca146ed Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Tue, 6 Nov 2018 11:50:48 +0200
Subject: [PATCH] pack: List the available formats.

* guix/scripts/pack.scm (show-formats): New variable.
(%options, show-help): Add 'list-formats' option.
---
 guix/scripts/pack.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 83bfa4ce0..9056ada6d 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -551,6 +552,18 @@ please email '~a'~%")
     (squashfs . ,squashfs-image)
     (docker  . ,docker-image)))
 
+(define (show-formats)
+  ;; Print the supported pack formats.
+  (display (G_ "The supported formats for 'guix pack' are:"))
+  (newline)
+  (display (G_ "
+  tarball       A self-contained tarball, ready to run on another machine."))
+  (display (G_ "
+  squashfs      A squashfs image, ready for 'cluster engines' and the like."))
+  (display (G_ "
+  docker        A tarball ready for 'docker load'."))
+  (newline))
+
 (define %options
   ;; Specifications of the command-line options.
   (cons* (option '(#\h "help") #f #f
@@ -567,6 +580,10 @@ please email '~a'~%")
          (option '(#\f "format") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'format (string->symbol arg) result)))
+         (option '("list-formats") #f #f
+                 (lambda args
+                   (show-formats)
+                   (exit 0)))
          (option '(#\R "relocatable") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'relocatable? #t result)))
@@ -621,6 +638,8 @@ Create a bundle of PACKAGE.\n"))
   (newline)
   (display (G_ "
   -f, --format=FORMAT    build a pack in the given FORMAT"))
+  (display (G_ "
+      --list-formats     list the formats available"))
   (display (G_ "
   -R, --relocatable      produce relocatable executables"))
   (display (G_ "
-- 
2.19.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#33286] Add 'list-formats' to 'guix pack'
  2018-11-06  9:53 [bug#33286] Add 'list-formats' to 'guix pack' Efraim Flashner
@ 2018-11-06 10:39 ` Danny Milosavljevic
  2018-11-06 10:48   ` Efraim Flashner
  2018-11-06 15:31 ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Danny Milosavljevic @ 2018-11-06 10:39 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 33286

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

Hi Efraim,

On Tue, 6 Nov 2018 11:53:16 +0200
Efraim Flashner <efraim@flashner.co.il> wrote:

> I was looking at the help menu for 'guix pack' and I realized that I
> didn't know what formats were available and there wasn't a flag to show
> them.

Good idea!  In principle LGTM, but why not (also?) always show them on "--help"?
It's kinda weird to have "--help" not show something and then having to invoke a
command again to get it.  It's not like the new output is long in proportion
to the existing output of "--help" or anything.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [bug#33286] Add 'list-formats' to 'guix pack'
  2018-11-06 10:39 ` Danny Milosavljevic
@ 2018-11-06 10:48   ` Efraim Flashner
  0 siblings, 0 replies; 6+ messages in thread
From: Efraim Flashner @ 2018-11-06 10:48 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 33286

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

On Tue, Nov 06, 2018 at 11:39:15AM +0100, Danny Milosavljevic wrote:
> Hi Efraim,
> 
> On Tue, 6 Nov 2018 11:53:16 +0200
> Efraim Flashner <efraim@flashner.co.il> wrote:
> 
> > I was looking at the help menu for 'guix pack' and I realized that I
> > didn't know what formats were available and there wasn't a flag to show
> > them.
> 
> Good idea!  In principle LGTM, but why not (also?) always show them on "--help"?
> It's kinda weird to have "--help" not show something and then having to invoke a
> command again to get it.  It's not like the new output is long in proportion
> to the existing output of "--help" or anything.

we also have 'guix refresh --list-updaters' and 'guix lint
--list-checkers'.

'guix system', for file-system-type, shows '(one of 'ext4', 'iso9660')'
right in the options.

also 'guix hash' allows other formats but doesn't have a list-updaters

having "(one of 'tarball', 'squashfs', 'docker')" would be easier, but
IMO my patch gives more information, specifically about squashfs and
needing to run 'docker load'.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#33286] Add 'list-formats' to 'guix pack'
  2018-11-06  9:53 [bug#33286] Add 'list-formats' to 'guix pack' Efraim Flashner
  2018-11-06 10:39 ` Danny Milosavljevic
@ 2018-11-06 15:31 ` Ludovic Courtès
  2018-11-27 17:26   ` Efraim Flashner
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2018-11-06 15:31 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 33286

Hello,

Efraim Flashner <efraim@flashner.co.il> skribis:

> From af9a132a662f1d703df1c32278a45d2adca146ed Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Tue, 6 Nov 2018 11:50:48 +0200
> Subject: [PATCH] pack: List the available formats.
>
> * guix/scripts/pack.scm (show-formats): New variable.
> (%options, show-help): Add 'list-formats' option.

[...]

> @@ -551,6 +552,18 @@ please email '~a'~%")
>      (squashfs . ,squashfs-image)
>      (docker  . ,docker-image)))
>  
> +(define (show-formats)
> +  ;; Print the supported pack formats.
> +  (display (G_ "The supported formats for 'guix pack' are:"))
> +  (newline)
> +  (display (G_ "
> +  tarball       A self-contained tarball, ready to run on another machine."))
> +  (display (G_ "
> +  squashfs      A squashfs image, ready for 'cluster engines' and the like."))

I’d write “Squashfs image suitable for Singularity” and remove “A” from
each.

Also, since we have the ‘%formats’ alist right above, what about
adjusting it so that it contains each format description, and then
‘show-formats’ would just traverse it?

You could do:

  (define-record-type <image-format>
    (image-format proc description)
    image-format?
    (proc        image-format-procedure)
    (description image-format-description))

  (define %formats
    (let-syntax ((description (syntax-rules () ((_ str) str))))
      `((tarball . ,(image-format self-contained-tarball
                                  (description "foo bar")))
        …)))

The dummy ‘description’ macro is here to allow ‘xgettext’ to catch the
translatable strings without actually translating them right away;
‘show-formats’ will have to call ‘G_’ for that.

WDYT?

Ludo’.

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

* [bug#33286] Add 'list-formats' to 'guix pack'
  2018-11-06 15:31 ` Ludovic Courtès
@ 2018-11-27 17:26   ` Efraim Flashner
  2021-07-13 12:03     ` bug#33286: " Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Efraim Flashner @ 2018-11-27 17:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 33286

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

On Tue, Nov 06, 2018 at 04:31:59PM +0100, Ludovic Courtès wrote:
> Hello,
> 
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > From af9a132a662f1d703df1c32278a45d2adca146ed Mon Sep 17 00:00:00 2001
> > From: Efraim Flashner <efraim@flashner.co.il>
> > Date: Tue, 6 Nov 2018 11:50:48 +0200
> > Subject: [PATCH] pack: List the available formats.
> >
> > * guix/scripts/pack.scm (show-formats): New variable.
> > (%options, show-help): Add 'list-formats' option.
> 
> [...]
> 
> > @@ -551,6 +552,18 @@ please email '~a'~%")
> >      (squashfs . ,squashfs-image)
> >      (docker  . ,docker-image)))
> >  
> > +(define (show-formats)
> > +  ;; Print the supported pack formats.
> > +  (display (G_ "The supported formats for 'guix pack' are:"))
> > +  (newline)
> > +  (display (G_ "
> > +  tarball       A self-contained tarball, ready to run on another machine."))
> > +  (display (G_ "
> > +  squashfs      A squashfs image, ready for 'cluster engines' and the like."))
> 
> I’d write “Squashfs image suitable for Singularity” and remove “A” from
> each.
> 
> Also, since we have the ‘%formats’ alist right above, what about
> adjusting it so that it contains each format description, and then
> ‘show-formats’ would just traverse it?
> 
> You could do:
> 
>   (define-record-type <image-format>
>     (image-format proc description)
>     image-format?
>     (proc        image-format-procedure)
>     (description image-format-description))
> 
>   (define %formats
>     (let-syntax ((description (syntax-rules () ((_ str) str))))
>       `((tarball . ,(image-format self-contained-tarball
>                                   (description "foo bar")))
>         …)))
> 
> The dummy ‘description’ macro is here to allow ‘xgettext’ to catch the
> translatable strings without actually translating them right away;
> ‘show-formats’ will have to call ‘G_’ for that.
> 
> WDYT?
> 
> Ludo’.

I do like the idea, but I haven't been able to get it to work. In the
mean time I've committed this as db08ea40873ae20507bc40d34a56dea1b8ce8f0e
so we at least get the benefits of having it here.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* bug#33286: Add 'list-formats' to 'guix pack'
  2018-11-27 17:26   ` Efraim Flashner
@ 2021-07-13 12:03     ` Maxim Cournoyer
  0 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-07-13 12:03 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Ludovic Courtès, 33286-done

Hello,

Efraim Flashner <efraim@flashner.co.il> writes:

> On Tue, Nov 06, 2018 at 04:31:59PM +0100, Ludovic Courtès wrote:
>> Hello,
>> 
>> Efraim Flashner <efraim@flashner.co.il> skribis:
>> 
>> > From af9a132a662f1d703df1c32278a45d2adca146ed Mon Sep 17 00:00:00 2001
>> > From: Efraim Flashner <efraim@flashner.co.il>
>> > Date: Tue, 6 Nov 2018 11:50:48 +0200
>> > Subject: [PATCH] pack: List the available formats.
>> >
>> > * guix/scripts/pack.scm (show-formats): New variable.
>> > (%options, show-help): Add 'list-formats' option.
>> 
>> [...]
>> 
>> > @@ -551,6 +552,18 @@ please email '~a'~%")
>> >      (squashfs . ,squashfs-image)
>> >      (docker  . ,docker-image)))
>> >  
>> > +(define (show-formats)
>> > +  ;; Print the supported pack formats.
>> > +  (display (G_ "The supported formats for 'guix pack' are:"))
>> > +  (newline)
>> > +  (display (G_ "
>> > +  tarball       A self-contained tarball, ready to run on another machine."))
>> > +  (display (G_ "
>> > +  squashfs      A squashfs image, ready for 'cluster engines' and the like."))
>> 
>> I’d write “Squashfs image suitable for Singularity” and remove “A” from
>> each.
>> 
>> Also, since we have the ‘%formats’ alist right above, what about
>> adjusting it so that it contains each format description, and then
>> ‘show-formats’ would just traverse it?

[...]

> I do like the idea, but I haven't been able to get it to work. In the
> mean time I've committed this as db08ea40873ae20507bc40d34a56dea1b8ce8f0e
> so we at least get the benefits of having it here.

Closing.

Thank you!

Maxim




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

end of thread, other threads:[~2021-07-13 12:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06  9:53 [bug#33286] Add 'list-formats' to 'guix pack' Efraim Flashner
2018-11-06 10:39 ` Danny Milosavljevic
2018-11-06 10:48   ` Efraim Flashner
2018-11-06 15:31 ` Ludovic Courtès
2018-11-27 17:26   ` Efraim Flashner
2021-07-13 12:03     ` bug#33286: " Maxim Cournoyer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.