unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
To: 39430@debbugs.gnu.org
Subject: [bug#39430] Use CRAN’s canonical URL as home-page
Date: Wed, 5 Feb 2020 08:49:33 +0100	[thread overview]
Message-ID: <20200205074933.GH2917@zpidnp36> (raw)

[-- 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


             reply	other threads:[~2020-02-05  7:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  7:49 Lars-Dominik Braun [this message]
2020-12-13 13:17 ` [bug#39430] Use CRAN’s canonical URL as home-page Christopher Baines
2020-12-15 22:35   ` bug#39430: " Christopher Baines

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=20200205074933.GH2917@zpidnp36 \
    --to=ldb@leibniz-psychology.org \
    --cc=39430@debbugs.gnu.org \
    /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).