From jori@mey@ @ending from gm@il@com  Sat Nov  3 11:53:49 2018
From: jori@mey@ @ending from gm@il@com (Joris Meys)
Date: Sat, 3 Nov 2018 11:53:49 +0100
Subject: [Rd] Suggestion: Make CRAN source URLs immutable
In-Reply-To: <CALEXWq2wTkm7Y_Xnadz0J1TSmt5AAkBeQcFe5jvNVfa-LJ2qTQ@mail.gmail.com>
References: <CAH--+mZTEXEhkhb=_3v2RfkiV=JVr0C9gvib2q4zHvJFxO-WdA@mail.gmail.com>
 <23504.11286.787374.78528@hornik.net>
 <CALEXWq2wTkm7Y_Xnadz0J1TSmt5AAkBeQcFe5jvNVfa-LJ2qTQ@mail.gmail.com>
Message-ID: <CAO1zAVYBrbxxbjeRqp39yQs_hQyNi7yQYW6A0+-tf6f5uWudog@mail.gmail.com>

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)

Cheers
Joris


On Fri, Nov 2, 2018 at 5:42 PM I?aki Ucar <iucar at fedoraproject.org> wrote:

> On Wed, 24 Oct 2018 at 11:40, Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote:
> >
> > >>>>> Kurt Wheeler writes:
> >
> > Try e.g.
> >
> > https://cran.r-project.org/package=httr&version=1.3.1
> > https://cran.r-project.org/package=httr&version=1.3.0
>
> This is a nice feature that I didn't know. I recently proposed
> enforcing this scheme in Fedora's packaging guidelines, because in
> this way, a SPEC would build correctly even if the package was updated
> and the old version was archived (is this guaranteed to continue to
> work in future? I assumed so...).
>
> There is an odd thing about this format though, and that is the
> absence of a file extension. This is a redirection, yes, but the
> spectool can't trust the filename that is sent by the remote server,
> and uses only the filename extracted from the URL.
>
> Without extension, RPM doesn't know how to unpack the sources. So we
> have to do the following similarly odd trick (note the "#"):
>
> Source0:
> https://cran.r-project.org/package=%{packname}&version=%{version}#/%{packname}_%{version}.tar.gz
>
> Did you consider this problem? Is there any alternate immutable URL
> *with* extension? If not, is there any potential issue with the trick
> above?
>
> Regards,
> --
> I?aki Ucar
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
<https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>

-----------
Biowiskundedagen 2017-2018
http://www.biowiskundedagen.ugent.be/

-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



[Rd] Suggestion: Make CRAN source URLs immutable
Joris Meys