unofficial mirror of guix-patches@gnu.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

* [bug#39430] Use CRAN’s canonical URL as home-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
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Baines @ 2020-12-13 13:17 UTC (permalink / raw)
  To: Lars-Dominik Braun; +Cc: 39430

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


Lars-Dominik Braun <ldb@leibniz-psychology.org> writes:

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

Hi,

Sorry for the delay in following up on this.

I gave this patch a try, testing using gProfileR as just a random
package I picked.

So, my take on this is that the canonical URLs still redirect, but using
a 303 redirect, which the linter doesn't complain about. Given I see [1]
on the page, I guess it makes sense to use these URLs.

1: Please use the canonical form https://CRAN.R-project.org/package=gProfileR to link to this page.

I'll leave it a day or two for others to comment, as I'm not
particularly familiar with CRAN, but I'm happy to merge this.

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* bug#39430: Use CRAN’s canonical URL as home-page
  2020-12-13 13:17 ` Christopher Baines
@ 2020-12-15 22:35   ` Christopher Baines
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Baines @ 2020-12-15 22:35 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 39430-done

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


Christopher Baines <mail@cbaines.net> writes:

> Lars-Dominik Braun <ldb@leibniz-psychology.org> writes:
>
>> 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.
>
> Hi,
>
> Sorry for the delay in following up on this.
>
> I gave this patch a try, testing using gProfileR as just a random
> package I picked.
>
> So, my take on this is that the canonical URLs still redirect, but using
> a 303 redirect, which the linter doesn't complain about. Given I see [1]
> on the page, I guess it makes sense to use these URLs.
>
> 1: Please use the canonical form https://CRAN.R-project.org/package=gProfileR to link to this page.
>
> I'll leave it a day or two for others to comment, as I'm not
> particularly familiar with CRAN, but I'm happy to merge this.

I've gone ahead and pushed this as
f14bb29defb36051039e977ba3791b542d90578a. I tweaked one of the variable
names.

Thanks again,

Chris


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[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 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).