all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] New procedure for CRAN URIs.
@ 2015-09-17 15:13 Ricardo Wurmus
  2015-09-18  9:40 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2015-09-17 15:13 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Hi Guix,

after it was reported that the plain CRAN URI only points to the latest
version of a package and previous versions are archived at a different
URI, I took Dave’s advice and wrote a ‘cran-uri’ procedure that produces
a list of URI strings for a given R package name and a version.

Only one of the two URIs will be correct as the archives don’t contain
the latest version.  The first patch adds the procedure, the second
makes the importer generate a package expression containing the
procedure call, and the last updates all existing R packages to use this
procedure.

I’d like to amend and push Vicente’s useful patches for r-dplyr once
this patch set has been accepted.

Thanks for your patience!

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-Add-cran-uri-procedure.patch --]
[-- Type: text/x-patch, Size: 1383 bytes --]

From 702458583776bd28c865ffdf06977262b3901ee5 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 17 Sep 2015 17:00:18 +0200
Subject: [PATCH 1/3] build: Add cran-uri procedure.

* guix/build-system/r.scm (cran-uri): New procedure.
---
 guix/build-system/r.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/r.scm b/guix/build-system/r.scm
index 4daec5e..da06cb1 100644
--- a/guix/build-system/r.scm
+++ b/guix/build-system/r.scm
@@ -28,7 +28,8 @@
   #:use-module (srfi srfi-26)
   #:export (%r-build-system-modules
             r-build
-            r-build-system))
+            r-build-system
+            cran-uri))
 
 ;; Commentary:
 ;;
@@ -36,6 +37,15 @@
 ;;
 ;; Code:
 
+(define (cran-uri name version)
+  "Return a list of URI strings for the R package archive on CRAN for the
+release corresponding to NAME and VERSION.  As only the most recent version is
+available via the first URI, the second URI points to the archived version."
+  (list (string-append "mirror://cran/src/contrib/"
+                       name "_" version ".tar.gz")
+        (string-append "mirror://cran/src/contrib/Archive/"
+                       name "/" name "_" version ".tar.gz")))
+
 (define %r-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build r-build-system)
-- 
2.1.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-import-cran-sxml-sexp-Use-cran-uri-in-package-expres.patch --]
[-- Type: text/x-patch, Size: 997 bytes --]

From 05dc8656928709bfc2ea021a4d0d03b02bb79840 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 17 Sep 2015 17:02:42 +0200
Subject: [PATCH 2/3] import: cran-sxml->sexp: Use cran-uri in package
 expression.

* guix/import/cran.scm (cran-sxml->sexp): Use the cran-uri procedure in
  the generated package expression.
---
 guix/import/cran.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 8ed5e54..585cb9f 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -165,7 +165,7 @@ representation of the package page."
         (version ,version)
         (source (origin
                   (method url-fetch)
-                  (uri (string-append ,@(factorize-uri source-url version)))
+                  (uri (cran-uri ,name version))
                   (sha256
                    (base32
                     ,(bytevector->nix-base32-string (file-sha256 tarball))))))
-- 
2.1.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-Use-cran-uri-in-source-expressions.patch --]
[-- Type: text/x-patch, Size: 8500 bytes --]

From 27abdabf051fc19781c05f7fa2bdb6bc3cf7728f Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Thu, 17 Sep 2015 17:04:35 +0200
Subject: [PATCH 3/3] gnu: Use cran-uri in source expressions.

* gnu/packages/statistics.scm (r-colorspace, r-dichromat, r-digest,
  r-gtable, r-labeling, r-magrittr, r-munsell, r-rcpp, r-plyr, r-proto,
  r-rcolorbrewer, r-stringi, r-stringr, r-reshape2, r-scales, r-ggplot2,
  r-assertthat, r-lazyeval, r-dbi): Use cran-uri in source expressions.
---
 gnu/packages/statistics.scm | 58 +++++++++++++++------------------------------
 1 file changed, 19 insertions(+), 39 deletions(-)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 6ccb97f..54c9abc 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -141,8 +141,7 @@ available, greatly increasing its breadth and scope.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/colorspace_"
-                           version ".tar.gz"))
+       (uri (cran-uri "colorspace" version))
        (sha256
         (base32 "0y8n4ljwhbdvkysdwgqzcnpv107pb3px1jip3k6svv86p72nacds"))))
     (build-system r-build-system)
@@ -162,8 +161,7 @@ colors are provided.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/dichromat_"
-                           version ".tar.gz"))
+       (uri (cran-uri "dichromat" version))
        (sha256
         (base32 "1l8db1nk29ccqg3mkbafvfiw0775iq4gapysf88xq2zp6spiw59i"))))
     (build-system r-build-system)
@@ -181,8 +179,7 @@ effects of different types of color-blindness.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/digest_"
-                           version ".tar.gz"))
+       (uri (cran-uri "digest" version))
        (sha256
         (base32 "0m9grqv67hhf51lz10whymhw0g0d98466ka694kya5x95hn44qih"))))
     (build-system r-build-system)
@@ -207,8 +204,7 @@ OpenSSL should be used.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/gtable_"
-                           version ".tar.gz"))
+       (uri (cran-uri "gtable" version))
        (sha256
         (base32 "0k9hfj6r5y238gqh92s3cbdn34biczx3zfh79ix5xq0c5vkai2xh"))))
     (build-system r-build-system)
@@ -226,8 +222,7 @@ OpenSSL should be used.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/labeling_"
-                           version ".tar.gz"))
+       (uri (cran-uri "labeling" version))
        (sha256
         (base32 "13sk7zrrrzry6ky1bp8mmnzcl9jhvkig8j4id9nny7z993mnk00d"))))
     (build-system r-build-system)
@@ -244,8 +239,7 @@ algorithms.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/magrittr_"
-                           version ".tar.gz"))
+       (uri (cran-uri "magrittr" version))
        (sha256
         (base32 "1s1ar6rag8m277qcqmdp02gn4awn9bdj9ax0r8s32i59mm1mki05"))))
     (build-system r-build-system)
@@ -266,8 +260,7 @@ see package vignette.  To quote Rene Magritte, \"Ceci n'est pas un pipe.\"")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/munsell_"
-                           version ".tar.gz"))
+       (uri (cran-uri "munsell" version))
        (sha256
         (base32 "1bi5yi0i80778bbzx2rm4f0glpc34kvh24pwwfhm4v32izsqgrw4"))))
     (build-system r-build-system)
@@ -287,8 +280,7 @@ Munsell colour system.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/Rcpp_"
-                           version ".tar.gz"))
+       (uri (cran-uri "Rcpp" version))
        (sha256
         (base32 "182109z0yc1snqgd833ssl2cix6cbq83bcxmy5344b15ym820y38"))))
     (build-system r-build-system)
@@ -312,8 +304,7 @@ and Francois (2011, JSS), and the book by Eddelbuettel (2013, Springer); see
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/plyr_"
-                           version ".tar.gz"))
+       (uri (cran-uri "plyr" version))
        (sha256
         (base32 "06v4zxawpjz37rp2q2ii5q43g664z9s29j4ydn0cz3crn7lzl6pk"))))
     (build-system r-build-system)
@@ -335,7 +326,7 @@ panels or collapse high-dimensional arrays to simpler summary statistics.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/proto_" version ".tar.gz"))
+       (uri (cran-uri "proto" version))
        (sha256
         (base32 "03mvzi529y6kjcp9bkpk7zlgpcakb3iz73hca6rpjy14pyzl3nfh"))))
     (build-system r-build-system)
@@ -353,8 +344,7 @@ prototype-based, rather than class-based object oriented ideas.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/RColorBrewer_"
-                           version ".tar.gz"))
+       (uri (cran-uri "RColorBrewer" version))
        (sha256
         (base32 "1pfcl8z1pnsssfaaz9dvdckyfnnc6rcq56dhislbf571hhg7isgk"))))
     (build-system r-build-system)
@@ -373,10 +363,7 @@ designed by Cynthia Brewer as described at http://colorbrewer2.org")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "mirror://cran/src/contrib/stringi_"
-             version
-             ".tar.gz"))
+       (uri (cran-uri "stringi" version))
        (sha256
         (base32
          "183wrrjhpgl1wbnn9lhghyvhz7l2mc64mpcmzplckal7y9j7pmhw"))))
@@ -402,8 +389,7 @@ transliteration, concatenation, date-time formatting and parsing, etc.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/stringr_"
-                           version ".tar.gz"))
+       (uri (cran-uri "stringr" version))
        (sha256
         (base32 "0jnz6r9yqyf7dschr2fnn1slg4wn6b4ik5q00j4zrh43bfw7s9pq"))))
     (build-system r-build-system)
@@ -427,8 +413,7 @@ the input of another.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/reshape2_"
-                           version ".tar.gz"))
+       (uri (cran-uri "reshape2" version))
        (sha256
         (base32 "0hl082dyk3pk07nqprpn5dvnrkqhnf6zjnjig1ijddxhlmsrzm7v"))))
     (build-system r-build-system)
@@ -450,8 +435,7 @@ using just two functions: melt and dcast (or acast).")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/scales_"
-                           version ".tar.gz"))
+       (uri (cran-uri "scales" version))
        (sha256
         (base32 "12xrmn1vh64dl46bq7n7pa427aicb2ifjrby9in3m32nyvir0kac"))))
     (build-system r-build-system)
@@ -477,8 +461,7 @@ legends.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://cran/src/contrib/ggplot2_"
-                           version ".tar.gz"))
+       (uri (cran-uri "ggplot2" version))
        (sha256
         (base32 "0794kjqi3lrxb33lr1mykd58959hlgkhdn259vj8fxrh65mqw920"))))
     (build-system r-build-system)
@@ -506,8 +489,7 @@ aesthetic attributes.")
     (version "0.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://cran/src/contrib/assertthat_"
-                                  version ".tar.gz"))
+              (uri (cran-uri "assertthat" version))
               (sha256
                (base32
                 "0dwsqajyglfscqilj843qfqn1ndbqpswa7b4l1d633qjk9d68qqk"))))
@@ -527,8 +509,7 @@ wrong.")
     (version "0.1.10")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://cran/src/contrib/lazyeval_"
-                                  version ".tar.gz"))
+              (uri (cran-uri "lazyeval" version))
               (sha256
                (base32
                 "02qfpn2fmy78vx4jxr7g7rhqzcm1kcivfwai7lbh0vvpawia0qwh"))))
@@ -546,8 +527,7 @@ evaluation (NSE) in R.")
     (version "0.3.1")
     (source (origin
               (method url-fetch)
-              (uri (string-append "mirror://cran/src/contrib/DBI_"
-                                  version ".tar.gz"))
+              (uri (cran-uri "DBI" version))
               (sha256
                (base32
                 "0xj5baxwnhl23rd5nskhjvranrwrc68f3xlyrklglipi41bm69hw"))))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] New procedure for CRAN URIs.
  2015-09-17 15:13 [PATCH] New procedure for CRAN URIs Ricardo Wurmus
@ 2015-09-18  9:40 ` Ludovic Courtès
  2015-09-18  9:50   ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2015-09-18  9:40 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> From 702458583776bd28c865ffdf06977262b3901ee5 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 17 Sep 2015 17:00:18 +0200
> Subject: [PATCH 1/3] build: Add cran-uri procedure.
>
> * guix/build-system/r.scm (cran-uri): New procedure.

Sounds like a good idea.

You might as well come up with ‘cran-origin’:

  (define (cran-origin package version)
    (origin
      (method url-fetch)
      …))

WDYT?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] New procedure for CRAN URIs.
  2015-09-18  9:40 ` Ludovic Courtès
@ 2015-09-18  9:50   ` Ricardo Wurmus
  2015-09-18 19:26     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2015-09-18  9:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès <ludo@gnu.org> writes:

>> * guix/build-system/r.scm (cran-uri): New procedure.
>
> Sounds like a good idea.
>
> You might as well come up with ‘cran-origin’:
>
>   (define (cran-origin package version)
>     (origin
>       (method url-fetch)
>       …))
>
> WDYT?

I wouldn’t know how to deal with the hash then.  Isn’t it better to have
a static hash in the package definition rather than compute it when
‘(cran-origin ...)’ is evaled?  Or should it be called like this instead:

    (cran-origin "name" version
                 "verylonghash1234")

~~ Ricardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] New procedure for CRAN URIs.
  2015-09-18  9:50   ` Ricardo Wurmus
@ 2015-09-18 19:26     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-09-18 19:26 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> * guix/build-system/r.scm (cran-uri): New procedure.
>>
>> Sounds like a good idea.
>>
>> You might as well come up with ‘cran-origin’:
>>
>>   (define (cran-origin package version)
>>     (origin
>>       (method url-fetch)
>>       …))
>>
>> WDYT?
>
> I wouldn’t know how to deal with the hash then.

Arf, yes, forget my comment; the solution you propose looks best.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-18 19:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 15:13 [PATCH] New procedure for CRAN URIs Ricardo Wurmus
2015-09-18  9:40 ` Ludovic Courtès
2015-09-18  9:50   ` Ricardo Wurmus
2015-09-18 19:26     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.