build-cran-binaries/local/r-minor-helpers.R

22 lines
811 B
R

# Metadata-only ABI triage so the full build avoids downloading every source.
# Mirrors bincraft::abi_classify rules 1-2; "ambiguous" packages still need a
# source grep via bincraft::needs_per_minor_recompile().
classify_from_metadata <- function(needs_compilation, linking_to, risky_deps) {
nc <- if (length(needs_compilation) == 0L || is.na(needs_compilation)) {
""
} else {
tolower(trimws(needs_compilation))
}
if (!identical(nc, "yes")) {
return("not-sensitive")
}
lt <- if (length(linking_to) == 0L || is.na(linking_to)) "" else linking_to
linked <- trimws(unlist(strsplit(lt, "[,\n]")))
linked <- sub("\\s*\\(.*\\)$", "", linked) # strip "(>= x)" constraints
linked <- linked[nzchar(linked)]
if (any(linked %in% risky_deps)) {
return("sensitive")
}
"ambiguous"
}