From eb49b26599ed62e115713d96ff68918647be4b35 Mon Sep 17 00:00:00 2001 From: pat-s Date: Mon, 20 Jul 2026 16:47:24 +0000 Subject: [PATCH] refactor(build-one): delegate ABI classification to bincraft Replace the per-version git clone of github.com/cran plus bincraft::needs_per_minor_recompile() with a single call to the newly exported bincraft::classify_r_minor_sensitive(). That classifier now fetches the CRAN source tarball (no GitHub) and caches its verdict in the metadata database, so repeated runs and new-OS rebuilds reuse it instead of recomputing. --- local/build-one.R | 50 +++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/local/build-one.R b/local/build-one.R index 07c0b6a..830231e 100644 --- a/local/build-one.R +++ b/local/build-one.R @@ -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" ) } -- 2.54.0