Last active
December 15, 2021 04:16
-
-
Save HenrikBengtsson/464b181dce49cdb82d5bdec160a498d8 to your computer and use it in GitHub Desktop.
Figuring out how long too wait to avoid the limit of maximum 7 CRAN releases last 180 days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cran_days_since_release <- function(pkg, now = Sys.time()) { | |
db <- rbind(tools:::CRAN_archive_db()[[pkg]], tools:::CRAN_current_db()[pkg,]) | |
now - sort(db$mtime, decreasing = TRUE) | |
} | |
# The CRAN rule is maximum 7 existing releases within the last 180 days | |
# https://github.com/wch/r-source/blob/tags/R-4-1-2/src/library/tools/R/QC.R#L7990-L8007 | |
cran_wait_needed <- function(pkg, max = 7L, limit = 180, now = Sys.time()) { | |
since <- cran_days_since_release(pkg, now = now) | |
too_new <- since[since <= limit] | |
n <- length(too_new) | |
if (n < max) (now-now) else limit - too_new[n] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## On December 14, 2021 | |
now <- Sys.time() | |
now | |
#> [1] "2021-12-14 18:22:59 PST" | |
## vroom needs to wait another 5 days to avoid | |
## the 'R CMD check --as-cran' NOTE on: | |
## Number of updates in past 6 months: 7 | |
cran_wait_needed("vroom") | |
#> Time difference of 4.706 days | |
## parallelly can be submitted now | |
cran_wait_needed("parallelly") | |
#> Time difference of 0 secs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment