refactor(build-one): delegate ABI classification to bincraft #136

Merged
pat-s merged 1 commit from t3code/github-app-rate-limits into main 2026-07-20 17:06:36 +00:00

View file

@ -30,43 +30,21 @@ s3 <- list(
s3_secret_access_key = Sys.getenv("B2_S3_SECRET_KEY")
)
# Clone the CRAN source for a version and ask the ABI classifier whether it
# must be rebuilt per R minor. Fails safe to TRUE so a possibly-fragile binary
# is never served from the cross-minor generic slot by mistake.
# Ask bincraft's ABI classifier whether a version must be rebuilt per R minor.
# The classifier downloads the CRAN source tarball (no GitHub) and caches the
# verdict in the metadata DB keyed on package+version, so repeated runs and
# new-OS rebuilds reuse it. Fails safe to TRUE inside bincraft so a
# possibly-fragile binary is never served from the cross-minor generic slot.
classify <- function(pkg, ver) {
dest <- file.path(tempdir(), sprintf("classify_%s_%s", pkg, ver))
on.exit(unlink(dest, recursive = TRUE, force = TRUE), add = TRUE)
tryCatch(
{
message(sprintf(
"[classify] cloning %s@%s from github.com/cran ...",
pkg,
ver
))
system2(
"git",
c(
"clone",
"--depth",
"1",
"--branch",
ver,
sprintf("https://github.com/cran/%s", pkg),
dest
)
)
message(sprintf("[classify] running ABI classifier on %s ...", pkg))
isTRUE(as.logical(bincraft::needs_per_minor_recompile(dest)))
},
error = function(e) {
message(sprintf(
"classify failed for %s %s: %s; treating as r-minor-sensitive",
pkg,
ver,
conditionMessage(e)
))
TRUE
}
bincraft::classify_r_minor_sensitive(
pkg,
ver,
metadata_db_host = "r-binaries.devxy.io",
metadata_db_name = "build_metadata",
metadata_db_port = 15432,
metadata_db_user = "rpkgs",
metadata_db_password = Sys.getenv("PGPASS"),
metadata_db_sslmode = "require"
)
}