refactor: migrate package installation from pak to uvr
bincraft dropped pak in favour of uvr, so the pipelines, helper scripts and images in this repo move with it. - add local/uvr-install.sh as the single replacement for pak::pak(); it bootstraps a pinned uvr, mints a throwaway project under TMPDIR and runs `uvr add --no-install` + `uvr sync --library`, because `uvr add` refuses to run outside a project and only `sync` honours --library - install bincraft via its Forgejo spec (forgejo::codefloe.com/rpkgs/ bincraft@<tag>) instead of a git:: URL, keeping the git ls-remote tag resolution - pass UVR_R_BIN/UVR_TARGET_LIB from install-bincraft.R so the per-R-minor passes target their own R and library - replace R_PKG_CACHE_DIR with UVR_CACHE_DIR/UVR_PACKAGES_DIR on the persistent volume, preserving the amd64-off/arm64-on split - drop trim_pkgcache_metadata() and its test; uvr's cache does not grow the way pkgcache's _metadata dir did - let uvr install system requirements from its vendored r-system-requirements rules, replacing pak::sysreqs_db_update() - migrate the shiny app image, the alpine reprex and the CRAN loading test; ship uvr-install.sh in the build-one image - track the uvr pin with renovate
This commit is contained in:
parent
fe2289af56
commit
f3c18b6805
1 changed files with 327 additions and 245 deletions
|
|
@ -31,42 +31,3 @@ parse_build_args <- function(args) {
|
|||
ncpus = as.integer(pos[3L])
|
||||
)
|
||||
}
|
||||
|
||||
# Bound the {pkgcache} metadata dir, which otherwise grows without limit: the
|
||||
# "patched" repo mints a new content hash on every PACKAGES change, so each build
|
||||
# writes a fresh ~70 MB _metadata/pkgs-<hash>.rds (+ patched-<hash>/) that is
|
||||
# never reused. Keep the `keep` newest entries by mtime; only remove entries
|
||||
# older than `min_age_secs`, so a concurrent split-job's in-flight files are
|
||||
# never deleted (each build uses a unique hash, so aged entries are
|
||||
# unreferenced). Stable repo dirs (CRAN-*, BioC*, INLA-*) and pkg/ downloads are
|
||||
# not matched and thus preserved. Returns the number of entries removed.
|
||||
trim_pkgcache_metadata <- function(cache_dir = Sys.getenv("R_PKG_CACHE_DIR"),
|
||||
keep = 20L,
|
||||
min_age_secs = 600) {
|
||||
meta <- file.path(cache_dir, "R", "pkgcache", "_metadata")
|
||||
if (!nzchar(cache_dir) || !dir.exists(meta)) {
|
||||
return(0L)
|
||||
}
|
||||
entries <- c(
|
||||
Sys.glob(file.path(meta, "patched-*")),
|
||||
Sys.glob(file.path(meta, "pkgs-*.rds"))
|
||||
)
|
||||
if (length(entries) == 0L) {
|
||||
return(0L)
|
||||
}
|
||||
info <- file.info(entries)
|
||||
order_new_first <- order(info$mtime, decreasing = TRUE)
|
||||
ranked <- entries[order_new_first]
|
||||
ranked_mtime <- info$mtime[order_new_first]
|
||||
if (length(ranked) <= keep) {
|
||||
return(0L)
|
||||
}
|
||||
candidates <- ranked[(keep + 1L):length(ranked)]
|
||||
candidate_age <- as.numeric(Sys.time()) - as.numeric(ranked_mtime[(keep + 1L):length(ranked)])
|
||||
removable <- candidates[candidate_age >= min_age_secs]
|
||||
if (length(removable) == 0L) {
|
||||
return(0L)
|
||||
}
|
||||
unlink(removable, recursive = TRUE, force = TRUE)
|
||||
length(removable)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue