all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#39430] Use CRAN’s canonical URL as home-page
@ 2020-02-05  7:49 Lars-Dominik Braun
  2020-12-13 13:17 ` Christopher Baines
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Dominik Braun @ 2020-02-05  7:49 UTC (permalink / raw)
  To: 39430

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

Hi,

I noticed for packages not specifying any URL the CRAN importer emits home-page
URLs like https://cran.r-project.org/web/packages/<package> (without trailing
slash). These are permanent redirects, thus the linter complains about them.
One option would be adding a trailing slash or use the canonical URL, as
provided by CRAN (on the bottom of the description page). The attached patch
does the latter.

Lars


[-- Attachment #2: 0001-import-cran-Use-CRAN-s-canonical-URL-as-home-page.patch --]
[-- Type: text/x-diff, Size: 2287 bytes --]

From 01a43735fe5b2ee5c34431d9e5109e3718e7612b Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Date: Wed, 5 Feb 2020 08:26:08 +0100
Subject: [PATCH] =?UTF-8?q?import:=20cran:=20Use=20CRAN=E2=80=99s=20canoni?=
 =?UTF-8?q?cal=20URL=20as=20home-page?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* guix/import/cran.scm (%cran-canonical-url): New variable.
(description->package): Construct home-page using canonical URL.
---
 guix/import/cran.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index bcb37ed250..9f1214324c 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -134,6 +134,7 @@ package definition."
      `((,type (,'quasiquote ,(format-inputs package-inputs)))))))
 
 (define %cran-url "https://cran.r-project.org/web/packages/")
+(define %cran-canonical-url "https://cran.r-project.org/package=")
 (define %bioconductor-url "https://bioconductor.org/packages/")
 
 ;; The latest Bioconductor release is 3.10.  Bioconductor packages should be
@@ -402,6 +403,10 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
                        ((cran)         %cran-url)
                        ((bioconductor) %bioconductor-url)
                        ((git)          #f)))
+         (canonical-url   (case repository
+                            ((cran)         %cran-canonical-url)
+                            ((bioconductor) %bioconductor-url)
+                            ((git)          #f)))
          (uri-helper (case repository
                        ((cran)         cran-uri)
                        ((bioconductor) bioconductor-uri)
@@ -415,7 +420,7 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
                        ((git) (assoc-ref meta 'git))
                        (else (match (listify meta "URL")
                                ((url rest ...) url)
-                               (_ (string-append base-url name))))))
+                               (_ (string-append canonical-url name))))))
          (source-url (case repository
                        ((git) (assoc-ref meta 'git))
                        (else
-- 
2.20.1


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

end of thread, other threads:[~2020-12-15 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  7:49 [bug#39430] Use CRAN’s canonical URL as home-page Lars-Dominik Braun
2020-12-13 13:17 ` Christopher Baines
2020-12-15 22:35   ` bug#39430: " Christopher Baines

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.