unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 6/7] import cran: Add "recursive" option.
Date: Mon, 30 May 2016 10:55:23 +0200	[thread overview]
Message-ID: <874m9g9b7o.fsf@gnu.org> (raw)
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")

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> 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))
>  
>  \f
> @@ -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 ‘find-packages-by-name’ 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) 'cran))))
> +             (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’.

  reply	other threads:[~2016-05-30  8:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 15:40 [PATCH] Add recursive CRAN importer Ricardo Wurmus
2016-05-23 15:40 ` [PATCH 1/7] import cran: Remove more invalid characters from package names Ricardo Wurmus
2016-05-30  8:48   ` Ludovic Courtès
2016-06-14 15:02     ` Ricardo Wurmus
2016-05-23 15:40 ` [PATCH 2/7] import cran: Move guix-name to top-level Ricardo Wurmus
2016-05-30  8:49   ` Ludovic Courtès
2016-05-23 15:40 ` [PATCH 3/7] import cran: description->package: Also return package dependencies Ricardo Wurmus
2016-05-30  8:51   ` Ludovic Courtès
2016-06-14 15:49     ` Ricardo Wurmus
2016-08-05 16:03       ` Ricardo Wurmus
2016-08-29 15:20         ` Ludovic Courtès
2016-08-31 10:39           ` Ricardo Wurmus
2016-09-01 11:50             ` Ludovic Courtès
2016-05-23 15:40 ` [PATCH 4/7] import cran: Ignore default R packages Ricardo Wurmus
2016-05-30  8:52   ` Ludovic Courtès
2016-05-23 15:40 ` [PATCH 5/7] import cran: Add recursive importer Ricardo Wurmus
2016-05-23 15:40 ` [PATCH 6/7] import cran: Add "recursive" option Ricardo Wurmus
2016-05-30  8:55   ` Ludovic Courtès [this message]
2016-06-14 15:30     ` Ricardo Wurmus
2016-05-23 15:40 ` [PATCH 7/7] guix import: Print list of expressions Ricardo Wurmus
2016-05-30  8:56   ` 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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=874m9g9b7o.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ricardo.wurmus@mdc-berlin.de \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).