From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] guix refresh: Add '--key-download'. Date: Fri, 07 Jun 2013 18:19:39 +0200 Message-ID: <87ppvxgavg.fsf@gnu.org> References: <87ehdzlg89.fsf@gnu.org> <87d2t2ehnp.fsf@karetnikov.org> <87d2t24ejj.fsf@gnu.org> <87bo8jfziy.fsf@karetnikov.org> <87obcjt1x5.fsf@gnu.org> <87fvxu30pi.fsf@karetnikov.org> <877gj5su70.fsf@gnu.org> <87obchmx23.fsf@karetnikov.org> <87fvxc4r3k.fsf@karetnikov.org> <87y5b4y1vp.fsf@gnu.org> <877gih2t2a.fsf@karetnikov.org> <87a9n9vna8.fsf@gnu.org> <87ip1qsd8g.fsf_-_@karetnikov.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkzT8-0006w6-1P for bug-guix@gnu.org; Fri, 07 Jun 2013 12:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkzT6-0003Yl-SB for bug-guix@gnu.org; Fri, 07 Jun 2013 12:24:49 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:50391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkzT6-0003Yb-Bm for bug-guix@gnu.org; Fri, 07 Jun 2013 12:24:48 -0400 In-Reply-To: <87ip1qsd8g.fsf_-_@karetnikov.org> (Nikita Karetnikov's message of "Fri, 07 Jun 2013 09:26:23 +0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Nikita Karetnikov Cc: bug-guix@gnu.org Nikita Karetnikov skribis: >> First the whole string should be enclosed in (_ ...), otherwise xgettext >> will just extract "~a~a" for translation. > > Should I do the same here? > > + (match arg > + ((or "interactive" "always" "never") > + (alist-cons 'key-download (string->symbol arg) > + result)) No, command-line arguments are not i18n=E2=80=99d, so let=E2=80=99s stick t= o this. >> Perhaps change it to > >> #:key (key-download 'interactive) > > I've tried that, but things like (package-update #:key-download > key-download) don't look right. Here is a simplified example: > > ;; guix/scripts/refresh.scm > (define* (update-package #:key (key-download 'interactive)) > (package-update #:key-download key-download)) That=E2=80=99s fine, IMO. In general, I would avoid having more than one optional arguments, unless its meaning and position are obvious. In this case, it=E2=80=99s not obvious IMO, so the best would probably to m= ake both =E2=80=98archive-type=E2=80=99 and =E2=80=98key-download=E2=80=99 keyw= ord arguments. > scheme@(guile-user)> (update-package) > interactive > scheme@(guile-user)> (update-package #:key-download 'never) > never It just occurred to me that it might be more intuitive to use one of 'interactive #f ; never download _ ; (any other value) always download > I'm attaching a patch. Examples (some commands were omitted): The examples look great! > # ./pre-inst-env guix refresh -u > > [...] > > ftp://ftp.gnu.org/.../guile-2.0.9.tar.gz.sig 100.0% of 0.2 KiB > gpg: Signature made Wed 10 Apr 2013 06:14:45 AM UTC using DSA key ID EA52= ECF4 > gpg: Can't check signature: No public key > Would you like to download this key and add it to your keyring? > n > guix refresh: warning: signature verification failed for `guile-2.0.9.tar= .gz' > guix refresh: warning: (could be because the public key is not in your ke= yring) > > Should I prepend "guix refresh: " to the question? No. > (define* (download-tarball store project directory version > - #:optional (archive-type "gz")) > + #:optional (archive-type "gz") > + (key-download 'interactive)) Rather make this #:key (key-download 'interactive). > +(define* (package-update store package #:optional (key-download 'interac= tive)) Ditto. > + (and > + missing > + (case key-download > + ((never) #f) > + ((always) > + (download-and-try-again)) > + (else > + (and (receive?) > + (download-and-try-again))))))))) I would write =E2=80=98missing=E2=80=99 on the same line as =E2=80=98and=E2= =80=99. Modulo these details, it seems ready to get it. Thanks! Ludo=E2=80=99.