Skip to content

Commit 484ded7

Browse files
committed
Switch to mac.cran.dev/
Works on GHA and it is much faster.
1 parent eb2b345 commit 484ded7

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

R/packages-gz.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ read_packages_file <- function(
257257
#' @importFrom utils read.csv
258258

259259
read_metadata_file <- function(path) {
260-
if (is.na(path)) return(NULL)
260+
if (is.na(path)) {
261+
return(NULL)
262+
}
261263
on.exit(tryCatch(close(con), error = function(x) NULL), add = TRUE)
262264
tryCatch(
263265
suppressWarnings({
@@ -339,7 +341,9 @@ packages_make_target <- function(
339341
file,
340342
path
341343
) {
342-
if (!length(platform)) return(character())
344+
if (!length(platform)) {
345+
return(character())
346+
}
343347
platform <- rep_len(platform, length(package))
344348

345349
assert_that(
@@ -410,7 +414,9 @@ packages_make_sources <- function(
410414
is.null(downloadurl) || is.character(downloadurl)
411415
)
412416

413-
if (!length(package)) return(list())
417+
if (!length(package)) {
418+
return(list())
419+
}
414420
platform <- rep_len(platform, length(package))
415421

416422
result <- replicate(length(package), NULL)
@@ -428,7 +434,7 @@ packages_make_sources <- function(
428434
version,
429435
".tar.gz"
430436
)
431-
macurl <- paste0("https://mac.r-project.org/", target)
437+
macurl <- paste0("https://mac.cran.dev/", target)
432438

433439
os <- parse_platform(platform)$os
434440
macbin <- type == "cran" & !is.na(os) & grepl("^darwin", os)

tests/testthat/test-packages-gz.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ test_that("packages_make_sources", {
7777
downloadurl = NULL
7878
),
7979
list(
80-
c("URL/s/c/p1_1.0.tgz", "https://mac.r-project.org/s/c/p1_1.0.tgz"),
81-
c("URL/s/c/p2_2.0.tgz", "https://mac.r-project.org/s/c/p2_2.0.tgz")
80+
c("URL/s/c/p1_1.0.tgz", "https://mac.cran.dev/s/c/p1_1.0.tgz"),
81+
c("URL/s/c/p2_2.0.tgz", "https://mac.cran.dev/s/c/p2_2.0.tgz")
8282
)
8383
)
8484

@@ -114,7 +114,7 @@ test_that("packages_make_sources", {
114114
),
115115
list(
116116
c("foo"),
117-
c("URL/s/c/p2_2.0.tgz", "https://mac.r-project.org/s/c/p2_2.0.tgz")
117+
c("URL/s/c/p2_2.0.tgz", "https://mac.cran.dev/s/c/p2_2.0.tgz")
118118
)
119119
)
120120
})

0 commit comments

Comments
 (0)