feat(full): classify r-minor sensitivity in install-deps precompute
This commit is contained in:
parent
dbf26d7786
commit
34173a6722
1 changed files with 43 additions and 2 deletions
|
|
@ -140,3 +140,44 @@ pkgs <- pkgs_no_error[!s3_dt]
|
|||
# Deduplicate
|
||||
pkgs <- unique(pkgs)
|
||||
setorder(pkgs, Package, Version)
|
||||
|
||||
### R-minor sensitivity (classify once per package, applied to all versions)
|
||||
source(file.path("local", "r-minor-helpers.R"))
|
||||
risky_deps <- bincraft::abi_risky_linking_deps()
|
||||
|
||||
release_meta <- data.table(
|
||||
Package = cran_release$Package,
|
||||
NeedsCompilation = cran_release$NeedsCompilation,
|
||||
LinkingTo = cran_release$LinkingTo
|
||||
)
|
||||
|
||||
meta <- release_meta[Package %in% unique(pkgs$Package)]
|
||||
meta[, triage := mapply(
|
||||
classify_from_metadata,
|
||||
NeedsCompilation,
|
||||
LinkingTo,
|
||||
MoreArgs = list(risky_deps = risky_deps)
|
||||
)]
|
||||
|
||||
# Only the "ambiguous" compiled packages need a source grep.
|
||||
ambiguous <- meta[triage == "ambiguous", Package]
|
||||
sensitive_ambiguous <- character()
|
||||
if (length(ambiguous) > 0L) {
|
||||
tmp_src <- file.path(tempdir(), "abi_src")
|
||||
dir.create(tmp_src, showWarnings = FALSE, recursive = TRUE)
|
||||
sens <- vapply(ambiguous, function(pkg) {
|
||||
out <- tryCatch({
|
||||
dl <- utils::download.packages(
|
||||
pkg, destdir = tmp_src,
|
||||
repos = "https://cloud.r-project.org", quiet = TRUE
|
||||
)
|
||||
isTRUE(as.logical(bincraft::needs_per_minor_recompile(dl[1L, 2L])))
|
||||
}, error = function(e) TRUE) # fail safe: treat as sensitive
|
||||
out
|
||||
}, logical(1L))
|
||||
sensitive_ambiguous <- ambiguous[sens]
|
||||
}
|
||||
|
||||
sensitive_pkgs <- unique(c(meta[triage == "sensitive", Package], sensitive_ambiguous))
|
||||
pkgs[, r_minor_sensitive := Package %in% sensitive_pkgs]
|
||||
sprintf("R-minor-sensitive packages: %s of %s", length(sensitive_pkgs), uniqueN(pkgs$Package))
|
||||
|
|
|
|||
Loading…
Reference in a new issue