Github messages for voidlinux
 help / color / mirror / Atom feed
From: CameronNemo <CameronNemo@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] xbps-src: fetch from CRAN archive
Date: Tue, 02 Aug 2022 22:55:15 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-38438@inbox.vuxu.org> (raw)

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

             reply	other threads:[~2022-08-02 20:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 20:55 CameronNemo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-38438@inbox.vuxu.org \
    --to=cameronnemo@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).