Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: fetch from CRAN archive
@ 2022-08-02 20:55 CameronNemo
  2022-08-02 21:43 ` Chocimier
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: CameronNemo @ 2022-08-02 20:55 UTC (permalink / raw)
  To: ml

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

There is a new pull request by CameronNemo against master on the void-packages repository

https://github.com/CameronNemo/void-packages R-cran-archive
https://github.com/void-linux/void-packages/pull/38438

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]
```

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/38438.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-R-cran-archive-38438.patch --]
[-- Type: text/x-diff, Size: 2040 bytes --]

From e1fedcee88529c69f6e19dcad256e6a37c6db60e Mon Sep 17 00:00:00 2001
From: Cameron Nemo <cnemo@tutanota.com>
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

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

end of thread, other threads:[~2022-09-20 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 20:55 [PR PATCH] xbps-src: fetch from CRAN archive CameronNemo
2022-08-02 21:43 ` Chocimier
2022-08-02 22:00 ` [PR PATCH] [Updated] " CameronNemo
2022-08-02 22:05 ` CameronNemo
2022-08-05 20:23 ` CameronNemo
2022-08-05 20:23 ` [PR PATCH] [Updated] " CameronNemo
2022-09-20 12:20 ` [PR PATCH] [Closed]: " CameronNemo

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 NNTP newsgroup(s).