From e1fedcee88529c69f6e19dcad256e6a37c6db60e Mon Sep 17 00:00:00 2001 From: Cameron Nemo Date: Tue, 2 Aug 2022 13:51:05 -0700 Subject: [PATCH] xbps-src: fetch from CRAN archive CRAN has a lovely practice of moving the latest releases into an archive after a new release is made. So when pillar 1.8.0 is released, for example, version 1.7.0 gets moved into the archive. Add some logic to fetch from the CRAN archive when this happens. See below for an example: => R-cran-pillar-1.7.0_1: fetching distfile 'pillar_1.7.0.tar.gz'... https://cran.r-project.org/src/contrib/pillar_1.7.0.tar.gz: Not Found => R-cran-pillar-1.7.0_1: fetching distfile 'pillar_1.7.0.tar.gz' (from CRAN archive)... pillar_1.7.0.tar.gz: [517KB 0%] 19KB/s ETA: 00m00s pillar_1.7.0.tar.gz: [517KB 25%] 201KB/s ETA: 00m02s pillar_1.7.0.tar.gz: 517KB [avg rate: 788KB/s] --- common/hooks/do-fetch/00-distfiles.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/hooks/do-fetch/00-distfiles.sh b/common/hooks/do-fetch/00-distfiles.sh index e2bf54378fe0..114d22399645 100644 --- a/common/hooks/do-fetch/00-distfiles.sh +++ b/common/hooks/do-fetch/00-distfiles.sh @@ -199,6 +199,8 @@ try_mirrors() { hook() { local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version" local dfcount=0 dfgood=0 errors=0 max_retries + local rcran="https://cran.r-project.org/src/contrib/${pkgname#R-cran-}_${version//r/-}.tar.gz" + local rcranarchive="https://cran.r-project.org/src/contrib/Archive/${pkgname#R-cran-}/${pkgname#R-cran-}_${version//r/-}.tar.gz" if [ ! -d "$srcdir" ]; then mkdir -p -m775 "$srcdir" @@ -281,6 +283,11 @@ hook() { flock "${distfile}.part" $fetch_cmd "$f" fi done + # If R-cran distfile does not exist, try CRAN archive + if [ ! -f "$distfile" -a "$f" = "$rcran" ]; then + msg_normal "$pkgver: fetching distfile '$curfile' (from CRAN archive)...\n" + flock "${distfile}.part" $fetch_cmd "$rcranarchive" + fi if [ ! -f "$distfile" ]; then msg_error "$pkgver: failed to fetch $curfile.\n" fi