From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: New =?utf-8?Q?=E2=80=9Cguix_refresh=E2=80=9D?= command Date: Sat, 01 Jun 2013 17:55:11 +0200 Message-ID: <87a9n9vna8.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> 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]:50391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UioE6-0005l7-5b for bug-guix@gnu.org; Sat, 01 Jun 2013 12:00:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UioE4-0004RH-80 for bug-guix@gnu.org; Sat, 01 Jun 2013 12:00:18 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:53439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UioE3-0004R1-Tk for bug-guix@gnu.org; Sat, 01 Jun 2013 12:00:16 -0400 In-Reply-To: <877gih2t2a.fsf@karetnikov.org> (Nikita Karetnikov's message of "Thu, 30 May 2013 04:46:21 +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: >> That could be done by changing =E2=80=98gnupg-verify*=E2=80=99. An opti= onal argument >> could be added to select between interactive behavior (=E2=80=9Cdo you w= ant to >> download this key and add it to your keyring?=E2=80=9D), 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=E2=80=99s for command-line argument processin= g.) > (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 f= or > 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 missi= ng. > Return #t if the signature was good, #f otherwise." Likewise. > + (define (receive?) > + (string=3D? "y" ; XXX: i18n Guile=E2=80=99s (ice-9 i18n) exports =E2=80=98locale-yes-regexp=E2=80=99 an= d =E2=80=98locale-no-regexp=E2=80=99 (info "(guile) Accessing Locale Information"). > + (and > + missing > + ;; XXX: 'else' doesn't work. > + (cond ((string=3D? download-sigs "always") > + (download-and-try-again)) > + ((string=3D? download-sigs "never") > + #f) =E2=80=98download-sigs=E2=80=99 (rather, =E2=80=98key-download=E2=80=99) sh= ould 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=3DARG > + download and add signatures to your keyring")) ... here, IMO. The string should rather be: --key-download=3DPOLICY handle missing OpenPGP keys according to POLICY (one of ...) > +(define* (update-package store package #:optional download-sigs) Rename accordingly. Thanks, Ludo=E2=80=99.