Patchwork [2/7] import cran: Move guix-name to top-level.

login
register
mail settings
Submitter Ricardo Wurmus
Date May 23, 2016, 3:40 p.m.
Message ID <1464018008-1767-3-git-send-email-ricardo.wurmus@mdc-berlin.de>
Download mbox | patch
Permalink /patch/12469/
State New
Headers show

Comments

Ricardo Wurmus - May 23, 2016, 3:40 p.m.
* guix/import/cran.scm (guix-name): Move to top-level.
---
 guix/import/cran.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Ludovic Courtès - May 30, 2016, 8:49 a.m.
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> * guix/import/cran.scm (guix-name): Move to top-level.

[...]

> +(define (guix-name name)
> +  "Return a Guix package name for a given R package name."
> +  (string-append "r-" (string-downcase
> +                       (regexp-substitute/global #f "(_|\\.)" name
> +                                                 'pre "-" 'post))))

Same comment as before, but otherwise OK!

Ludo’.

Patch

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 8b368af..0be5346 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -147,14 +147,16 @@  empty list when the FIELD cannot be found."
                         (string-any char-set:whitespace item)))
                   (map string-trim-both items))))))
 
+
+(define (guix-name name)
+  "Return a Guix package name for a given R package name."
+  (string-append "r-" (string-downcase
+                       (regexp-substitute/global #f "(_|\\.)" name
+                                                 'pre "-" 'post))))
+
 (define (description->package repository meta)
   "Return the `package' s-expression for an R package published on REPOSITORY
 from the alist META, which was derived from the R package's DESCRIPTION file."
-  (define (guix-name name)
-    (string-append "r-" (string-downcase
-                         (regexp-substitute/global #f "(_|\\.)" name
-                                                   'pre "-" 'post))))
-
   (let* ((base-url   (case repository
                        ((cran)         %cran-url)
                        ((bioconductor) %bioconductor-url)))