From iuc@r @ending from fedor@project@org  Sat Nov  3 12:37:37 2018
From: iuc@r @ending from fedor@project@org (=?UTF-8?Q?I=C3=B1aki_Ucar?=)
Date: Sat, 3 Nov 2018 12:37:37 +0100
Subject: [Rd] Suggestion: Make CRAN source URLs immutable
In-Reply-To: <CAO1zAVYBrbxxbjeRqp39yQs_hQyNi7yQYW6A0+-tf6f5uWudog@mail.gmail.com>
References: <CAH--+mZTEXEhkhb=_3v2RfkiV=JVr0C9gvib2q4zHvJFxO-WdA@mail.gmail.com>
 <23504.11286.787374.78528@hornik.net>
 <CALEXWq2wTkm7Y_Xnadz0J1TSmt5AAkBeQcFe5jvNVfa-LJ2qTQ@mail.gmail.com>
 <CAO1zAVYBrbxxbjeRqp39yQs_hQyNi7yQYW6A0+-tf6f5uWudog@mail.gmail.com>
Message-ID: <CALEXWq1teuoN3ddoJ1O7NGWJsF7vp1S+7_C_auhE4Lhdg3Zo_w@mail.gmail.com>

On Sat, 3 Nov 2018 at 11:54, Joris Meys <jorismeys at gmail.com> wrote:
>
> FWIW, you can get the URL and extract the link with extension from there. Archived packages are always tarballs, so that makes the following possible:
>
> url <- "https://cran.r-project.org/package=httr&version=1.3.0"
>
> library(RCurl)
>
> pkgurl <- gsub(".*(https://cran.+\\.tar.gz).*",
>                "\\1",
>                getURL(url))
>
> install.packages(pkgurl, type = "source", repos = NULL)

The proper way to do this would be to fetch just the headers and
extract the location field:

$ URL="https://cran.r-project.org/package=httr&version=1.3.0"
$ curl -sI $URL | awk '/^Location:/{print $2}'
https://cran.r-project.org/src/contrib/Archive/httr/httr_1.3.0.tar.gz

But that's not the point. I'm talking about RPM packaging, and the
point is, as I said, that the tool that expands and downloads sources
from specfiles simply doesn't do that, because it can't trust an
extension sent from a remote server. We need to provide it explicitly
in the URL.

--
I?aki ?car



[Rd] Suggestion: Make CRAN source URLs immutable
=?UTF-8?Q?I=C3=B1aki_Ucar?=