diff mbox series

[bug#54454,v2] ui: Describe package outputs.

Message ID a4c86a2ce063a2b8e9d09625ce4c622c630d1ab8.camel@gmail.com
State Accepted
Headers show
Series [bug#54454,v2] ui: Describe package outputs. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Liliana Marie Prikler June 26, 2022, 12:37 p.m. UTC
* guix/ui.scm (package->recutils): Output outputs with their descriptions,
one per line.
* po/packages/Makevars (XGETTEXT_OPTIONS): Add ‘output-synopsis’ as keyword.
---
 guix/ui.scm          | 27 ++++++++++++++++++++++++++-
 po/packages/Makevars |  3 ++-
 2 files changed, 28 insertions(+), 2 deletions(-)

Comments

Liliana Marie Prikler Aug. 16, 2022, 7:37 p.m. UTC | #1
Am Sonntag, dem 26.06.2022 um 14:37 +0200 schrieb Liliana Marie
Prikler:
> * guix/ui.scm (package->recutils): Output outputs with their
> descriptions,
> one per line.
> * po/packages/Makevars (XGETTEXT_OPTIONS): Add ‘output-synopsis’ as
> keyword.
I pushed this now.

Cheers
Ludovic Courtès Sept. 2, 2022, 5:07 p.m. UTC | #2
Hey,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> Am Sonntag, dem 26.06.2022 um 14:37 +0200 schrieb Liliana Marie
> Prikler:
>> * guix/ui.scm (package->recutils): Output outputs with their
>> descriptions,
>> one per line.
>> * po/packages/Makevars (XGETTEXT_OPTIONS): Add ‘output-synopsis’ as
>> keyword.
> I pushed this now.

Thanks for moving forward on this!

I get:

--8<---------------cut here---------------start------------->8---
$ guix show git |head -10
name: git
version: 2.37.2
outputs:
+ send-email: see Appendix H
+ svn: see Appendix H
+ credential-netrc: see Appendix H
+ credential-libsecret: see Appendix H
+ subtree: see Appendix H
+ gui: see Appendix H
+ out: everything else
--8<---------------cut here---------------end--------------->8---

Where can I see Appendix H though?  (Real question.)

Ludo’.
Liliana Marie Prikler Sept. 2, 2022, 5:14 p.m. UTC | #3
Am Freitag, dem 02.09.2022 um 19:07 +0200 schrieb Ludovic Courtès:
> Hey,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:
> 
> > Am Sonntag, dem 26.06.2022 um 14:37 +0200 schrieb Liliana Marie
> > Prikler:
> > > * guix/ui.scm (package->recutils): Output outputs with their
> > > descriptions,
> > > one per line.
> > > * po/packages/Makevars (XGETTEXT_OPTIONS): Add ‘output-synopsis’
> > > as
> > > keyword.
> > I pushed this now.
> 
> Thanks for moving forward on this!
> 
> I get:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix show git |head -10
> name: git
> version: 2.37.2
> outputs:
> + send-email: see Appendix H
> + svn: see Appendix H
> + credential-netrc: see Appendix H
> + credential-libsecret: see Appendix H
> + subtree: see Appendix H
> + gui: see Appendix H
> + out: everything else
> --8<---------------cut here---------------end--------------->8---
> 
> Where can I see Appendix H though?  (Real question.)
There is no appendix H, it's an obscure reference to the appendix H of
the x86 instruction set (containing undocumented instructions or here
undocumented outputs 🙂️).

In order to have a more meaningful string, you'd need to add an output
synopsis property to the package like so: 
(properties 
  `(...
    (output-synopsis "send-email" "the `git send-email' command")
    (output-synopsis "credential-libsecret" "the libsecret credential
helper")
    ...))

The second string should (if I got everything right) be translatable
without needing to wrap it in a G_.

Cheers
Simon Tournier Sept. 3, 2022, 9:53 a.m. UTC | #4
Hi,

Thanks for this nice improvement.

On Fri, 02 Sep 2022 at 19:14, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

>> --8<---------------cut here---------------start------------->8---
>> $ guix show git |head -10
>> name: git
>> version: 2.37.2
>> outputs:
>> + send-email: see Appendix H
>> + svn: see Appendix H
>> + credential-netrc: see Appendix H
>> + credential-libsecret: see Appendix H
>> + subtree: see Appendix H
>> + gui: see Appendix H
>> + out: everything else
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Where can I see Appendix H though?  (Real question.)
>
> There is no appendix H, it's an obscure reference to the appendix H of
> the x86 instruction set (containing undocumented instructions or here
> undocumented outputs 🙂️).

--8<---------------cut here---------------start------------->8---
+      (assoc-ref `(("bin" . ,(G_ "executable programs and scripts"))
+                   ("debug" . ,(G_ "debug information"))
+                   ("lib" . ,(G_ "shared libraries"))
+                   ("static" . ,(G_ "static libraries"))
+                   ("out" . ,(G_ "everything else")))
+                 output)
+      (G_ "see Appendix H"))))
--8<---------------cut here---------------end--------------->8---

Maybe we could just replace this “see Appendix H” by “undocumented”.

Or if we want to keep the reference, “see the non-existing Appendix H”.


Cheers,
simon
Ludovic Courtès Sept. 5, 2022, 7:25 a.m. UTC | #5
Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> On Fri, 02 Sep 2022 at 19:14, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
>
>>> --8<---------------cut here---------------start------------->8---
>>> $ guix show git |head -10
>>> name: git
>>> version: 2.37.2
>>> outputs:
>>> + send-email: see Appendix H
>>> + svn: see Appendix H
>>> + credential-netrc: see Appendix H
>>> + credential-libsecret: see Appendix H
>>> + subtree: see Appendix H
>>> + gui: see Appendix H
>>> + out: everything else
>>> --8<---------------cut here---------------end--------------->8---
>>> 
>>> Where can I see Appendix H though?  (Real question.)
>>
>> There is no appendix H, it's an obscure reference to the appendix H of
>> the x86 instruction set (containing undocumented instructions or here
>> undocumented outputs 🙂️).

Oooh, I see.  :-)

> +      (assoc-ref `(("bin" . ,(G_ "executable programs and scripts"))
> +                   ("debug" . ,(G_ "debug information"))
> +                   ("lib" . ,(G_ "shared libraries"))
> +                   ("static" . ,(G_ "static libraries"))
> +                   ("out" . ,(G_ "everything else")))
> +                 output)
> +      (G_ "see Appendix H"))))
>
> Maybe we could just replace this “see Appendix H” by “undocumented”.

+1!  For those like me who’d otherwise take it at face value.

Thanks,
Ludo’.
diff mbox series

Patch

diff --git a/guix/ui.scm b/guix/ui.scm
index a7acd41440..dad2b853ac 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -18,6 +18,7 @@ 
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2018 Steve Sprang <scs@stevesprang.com>
 ;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
+;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1511,6 +1512,29 @@  (define (dependencies->recutils packages)
                                    (sort packages package<?))) " ")))
       (split-lines list (string-length "dependencies: "))))
 
+  (define (output->recutils package output)
+    (string-append
+     "+ " output ": "
+     (or
+      (any
+       (match-lambda
+         (('output-synopsis key synopsis)
+          (and (string=? key output) (P_ synopsis)))
+         (_ #f))
+       (package-properties package))
+      (assoc-ref `(("bin" . ,(G_ "executable programs and scripts"))
+                   ("debug" . ,(G_ "debug information"))
+                   ("lib" . ,(G_ "shared libraries"))
+                   ("static" . ,(G_ "static libraries"))
+                   ("out" . ,(G_ "everything else")))
+                 output)
+      (G_ "see Appendix H"))))
+
+  (define (package-outputs/out-last package)
+    ((compose append partition)
+     (negate (cut string=? "out" <>))
+     (package-outputs package)))
+
   (define (package<? p1 p2)
     (string<? (package-full-name p1) (package-full-name p2)))
 
@@ -1522,7 +1546,8 @@  (define highlighting*
   ;; Note: Don't i18n field names so that people can post-process it.
   (format port "name: ~a~%" (highlight (package-name p) port*))
   (format port "version: ~a~%" (highlight (package-version p) port*))
-  (format port "outputs: ~a~%" (string-join (package-outputs p)))
+  (format port "outputs:~%~{~a~%~}"
+          (map (cut output->recutils p <>) (package-outputs/out-last p)))
   (format port "systems: ~a~%"
           (split-lines (string-join (package-transitive-supported-systems p))
                        (string-length "systems: ")))
diff --git a/po/packages/Makevars b/po/packages/Makevars
index 4cdb98d8fe..65912786d8 100644
--- a/po/packages/Makevars
+++ b/po/packages/Makevars
@@ -10,7 +10,8 @@  top_builddir = ../..
 # synopses and descriptions.
 XGETTEXT_OPTIONS =				\
   --language=Scheme --from-code=UTF-8		\
-  --keyword=synopsis --keyword=description
+  --keyword=synopsis --keyword=description      \
+  --keyword=output-synopsis:2
 
 COPYRIGHT_HOLDER = the authors of Guix (msgids)