fix(build): hold back packages the cran mirror has not picked up yet #188
1 changed files with 29 additions and 2 deletions
|
|
@ -68,9 +68,36 @@ archive_versions <- archive_versions[
|
||||||
]
|
]
|
||||||
|
|
||||||
# Now get release versions (assuming cran_release has Package and Version columns)
|
# Now get release versions (assuming cran_release has Package and Version columns)
|
||||||
|
#
|
||||||
|
# Packages published in the last few days are held back. `check_for_binary()`
|
||||||
|
# reads the published version from the `cran` GitHub mirror
|
||||||
|
# (`GET /repos/cran/<pkg>/commits`), and that mirror lags CRAN: a package that
|
||||||
|
# has just appeared has no repository there yet. The call then 404s, which is
|
||||||
|
# permanent, but it is wrapped in `purrr::insistently` and retried ten times
|
||||||
|
# with a backoff capped at 60s - so one unmirrored package burns about five
|
||||||
|
# minutes and then aborts the whole shard.
|
||||||
|
#
|
||||||
|
# Holding them back costs nothing: the daily update pipeline builds new and
|
||||||
|
# updated packages anyway, and they arrive here on the next run once the mirror
|
||||||
|
# has caught up.
|
||||||
|
mirror_lag_days <- as.numeric(
|
||||||
|
Sys.getenv("CRAN_MIRROR_LAG_DAYS", unset = "3")
|
||||||
|
)
|
||||||
|
published <- as.POSIXct(cran_release$Published, tz = "UTC")
|
||||||
|
too_recent <- !is.na(published) &
|
||||||
|
published > (Sys.time() - mirror_lag_days * 86400)
|
||||||
|
if (any(too_recent)) {
|
||||||
|
message(sprintf(
|
||||||
|
"Holding back %d package(s) published in the last %g day(s); the cran GitHub mirror will not have them yet: %s",
|
||||||
|
sum(too_recent),
|
||||||
|
mirror_lag_days,
|
||||||
|
paste(utils::head(cran_release$Package[too_recent], 10L), collapse = ", ")
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
release_versions <- data.table(
|
release_versions <- data.table(
|
||||||
Package = cran_release$Package,
|
Package = cran_release$Package[!too_recent],
|
||||||
Version = as.character(cran_release$Version)
|
Version = as.character(cran_release$Version[!too_recent])
|
||||||
)
|
)
|
||||||
|
|
||||||
pkgs_to_build <- unique(rbind(archive_versions, release_versions, fill = TRUE))
|
pkgs_to_build <- unique(rbind(archive_versions, release_versions, fill = TRUE))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue