From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 6/7] import cran: Add "recursive" option. Date: Mon, 30 May 2016 10:55:23 +0200 Message-ID: <874m9g9b7o.fsf@gnu.org> References: <1464018008-1767-1-git-send-email-ricardo.wurmus@mdc-berlin.de> <1464018008-1767-7-git-send-email-ricardo.wurmus@mdc-berlin.de> 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]:41165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7Iyz-0002Zp-4k for guix-devel@gnu.org; Mon, 30 May 2016 04:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7Iyt-00044p-5E for guix-devel@gnu.org; Mon, 30 May 2016 04:55:32 -0400 In-Reply-To: <1464018008-1767-7-git-send-email-ricardo.wurmus@mdc-berlin.de> (Ricardo Wurmus's message of "Mon, 23 May 2016 17:40:07 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org Ricardo Wurmus skribis: > * guix/scripts/import/cran.scm: (%options): Add "recursive" option. > (guix-import-cran): Handle "recursive" option. > --- > guix/scripts/import/cran.scm | 26 ++++++++++++++++++++------ > 1 file changed, 20 insertions(+), 6 deletions(-) > > diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm > index ace1123..4cae9da 100644 > --- a/guix/scripts/import/cran.scm > +++ b/guix/scripts/import/cran.scm > @@ -63,6 +63,9 @@ Import and convert the CRAN package for PACKAGE-NAME.\n= ")) > (lambda (opt name arg result) > (alist-cons 'repo (string->symbol arg) > (alist-delete 'repo result)))) > + (option '(#\r "recursive") #f #f > + (lambda (opt name arg result) > + (alist-cons 'recursive #t result))) > %standard-import-options)) >=20=20 > > @@ -88,12 +91,23 @@ Import and convert the CRAN package for PACKAGE-NAME.= \n")) > (reverse opts)))) > (match args > ((package-name) > - (let ((sexp (cran->guix-package package-name > - (or (assoc-ref opts 'repo) 'cran)= ))) > - (unless sexp > - (leave (_ "failed to download description for package '~a'~%") > - package-name)) > - sexp)) > + (if (assoc-ref opts 'recursive) > + ;; Recursive import > + (map (match-lambda > + ((and (label . (('package ('name name) . rest))) > + (label . (pkg))) > + `(define-public ,(string->symbol name) > + ,pkg)) Perhaps it could check with =E2=80=98find-packages-by-name=E2=80=99 whether= NAME already exists? > + (_ #f)) > + (recursive-import package-name > + (or (assoc-ref opts 'repo) 'cran))) > + ;; Single import > + (let ((sexp (cran->guix-package package-name > + (or (assoc-ref opts 'repo) 'c= ran)))) > + (unless sexp > + (leave (_ "failed to download description for package '~a= '~%") > + package-name)) > + sexp))) Do you think this could be moved to (guix scripts import)? We would have to change other importers to return an empty list/stream of dependencies for now. Thanks, Ludo=E2=80=99.