all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: bug-guix@gnu.org
Subject: Re: New “guix refresh” command
Date: Sat, 01 Jun 2013 17:55:11 +0200	[thread overview]
Message-ID: <87a9n9vna8.fsf@gnu.org> (raw)
In-Reply-To: <877gih2t2a.fsf@karetnikov.org> (Nikita Karetnikov's message of "Thu, 30 May 2013 04:46:21 +0400")

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> That could be done by changing ‘gnupg-verify*’.  An optional argument
>> could be added to select between interactive behavior (“do you want to
>> download this key and add it to your keyring?”), always-download, and
>> never-download.
>
> I'm attaching my attempt.

Thanks for looking into it!

> There are two similar but unrelated problems:
>
> 1. The following function doesn't print the message.
>
> (begin (format #t (_ "~a~a~!")
> 			   "Would you like to download this key "
> 			   "and add it to your keyring? (y/N) ")
> 	   (read-line))

First the whole string should be enclosed in (_ ...), otherwise xgettext
will just extract "~a~a" for translation.

Second, use ~% (instead of ~!); that will add a newline, and presumably
cause the string to be output.

Lastly, the indentation of (read-line) is incorrect.

> To-do list:
>
> 1. Any argument except 'always', 'never', and 'interactive' should raise
>    an error.
>
> 2. Fetch signatures first and don't download tarballs which can't be
>    authenticated (when signatures are missing and 'never' is used).
>
> 3. How should I change 'receive?' to support i18n?
>
> Anything else?

Comments below:

> +  #:use-module (ice-9 optargs)

This module is not needed (it’s for command-line argument processing.)

>  (define* (download-tarball store project directory version
> -                           #:optional (archive-type "gz"))
> +                           #:optional (archive-type "gz") download-sigs)

Perhaps change it to

  #:key (key-download 'interactive)

and document KEY-DOWNLOAD in the docstring.

> +(define* (package-update store package #:optional download-sigs)
>    "Return the new version and the file name of the new version tarball for
>  PACKAGE, or #f and #f when PACKAGE is up-to-date."

Likewise.

> +(define* (gnupg-verify* sig file #:optional download-sigs
> +                                            (server (%openpgp-key-server)))
>    "Like `gnupg-verify', but try downloading the public key if it's missing.
>  Return #t if the signature was good, #f otherwise."

Likewise.

> +          (define (receive?)
> +            (string=? "y"               ; XXX: i18n

Guile’s (ice-9 i18n) exports ‘locale-yes-regexp’ and ‘locale-no-regexp’
(info "(guile) Accessing Locale Information").

> +          (and
> +           missing
> +           ;; XXX: 'else' doesn't work.
> +           (cond ((string=? download-sigs "always")
> +                  (download-and-try-again))
> +                 ((string=? download-sigs "never")
> +                  #f)

‘download-sigs’ (rather, ‘key-download’) should be a symbol, not a
string (this is a common convention).  So this will read:

  (case key-download
    ((never) #f)
    ((always)
     (download-and-try-again))
    (else
     ;; ...
     ))

> +        (option '(#\d "download-sigs") #t #f

"key-download".

> +                (lambda (opt name arg result)
> +                  (alist-cons 'download-sigs arg result)))

Ditto.

>  When PACKAGE... is given, update only the specified packages.  Otherwise
>  update all the packages of the distribution, or the subset thereof
> -specified with `--select'.\n"))
> +specified with `--select'.
> +
> +'download-sigs' accepts one of the following arguments: 'interactive',
> +'always', and 'never'.  When 'download-sigs' is not specified, assume
> +'interactive'.\n"))

This should go...

> +  (display (_ "
> +  -d, --download-sigs=ARG
> +                         download and add signatures to your keyring"))

... here, IMO.

The string should rather be:

  --key-download=POLICY
         handle missing OpenPGP keys according to POLICY (one of ...)

> +(define* (update-package store package #:optional download-sigs)

Rename accordingly.

Thanks,
Ludo’.

  reply	other threads:[~2013-06-01 16:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 22:24 New “guix refresh” command Ludovic Courtès
2013-04-25 21:27 ` Ludovic Courtès
2013-04-26 16:16 ` Andreas Enge
2013-04-27  9:43   ` Ludovic Courtès
2013-04-27 10:11     ` Andreas Enge
2013-04-27 21:04       ` Ludovic Courtès
2013-04-27 21:14         ` Andreas Enge
2013-04-27 22:35           ` Ludovic Courtès
2013-04-29 21:27             ` Ludovic Courtès
2013-04-30 15:54               ` Andreas Enge
2013-05-07 19:03 ` Nikita Karetnikov
2013-05-07 22:21   ` Ludovic Courtès
2013-05-10  0:29     ` Nikita Karetnikov
2013-05-10 13:11       ` Ludovic Courtès
2013-05-10 22:54         ` Nikita Karetnikov
2013-05-11 10:10           ` Ludovic Courtès
2013-05-11 14:05             ` Nikita Karetnikov
2013-05-24 10:19               ` Nikita Karetnikov
2013-05-24 12:54                 ` Ludovic Courtès
2013-05-30  0:46                   ` Nikita Karetnikov
2013-06-01 15:55                     ` Ludovic Courtès [this message]
2013-06-02 22:29                       ` Ludovic Courtès
2013-06-07  5:26                       ` [PATCH] guix refresh: Add '--key-download' Nikita Karetnikov
2013-06-07 16:19                         ` Ludovic Courtès
2013-06-08 11:19                           ` Nikita Karetnikov
2013-06-08 14:48                             ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9n9vna8.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.