style: air-format and prettier the new r-minor build files
This commit is contained in:
parent
4d10f400a6
commit
67960b7b3b
1 changed files with 106 additions and 54 deletions
|
|
@ -17,7 +17,11 @@ suppressPackageStartupMessages(library(data.table))
|
|||
|
||||
arch = Sys.getenv("ARCH")
|
||||
# target: alpine-322, ubuntu-2404, redhat-9, etc.
|
||||
platform = paste(Sys.getenv("OS"), gsub("[.]", "", Sys.getenv("OS_VERSION")), sep = "-")
|
||||
platform = paste(
|
||||
Sys.getenv("OS"),
|
||||
gsub("[.]", "", Sys.getenv("OS_VERSION")),
|
||||
sep = "-"
|
||||
)
|
||||
# Use bincraft's codename detection for S3 paths (e.g. "rhel10" not "redhat10")
|
||||
codename = bincraft::set_codename(NULL)
|
||||
|
||||
|
|
@ -34,7 +38,9 @@ con <- DBI::dbConnect(
|
|||
cran_archive = tools::CRAN_archive_db()
|
||||
cran_release = tools::CRAN_package_db()
|
||||
# Subset cran_archive to only those packages
|
||||
cran_archive_in_release <- cran_archive[names(cran_archive) %in% cran_release$Package]
|
||||
cran_archive_in_release <- cran_archive[
|
||||
names(cran_archive) %in% cran_release$Package
|
||||
]
|
||||
|
||||
archive_versions <- rbindlist(
|
||||
lapply(names(cran_archive), function(pkg) {
|
||||
|
|
@ -126,11 +132,15 @@ query_error <- function(pkg, ver) {
|
|||
# Fetch all relevant columns from the database
|
||||
errored_pkgs <- DBI::dbGetQuery(
|
||||
con,
|
||||
sprintf("SELECT name, tag FROM single_builds WHERE error_occurred = TRUE and platform='%s' and arch='%s'", platform, arch)
|
||||
sprintf(
|
||||
"SELECT name, tag FROM single_builds WHERE error_occurred = TRUE and platform='%s' and arch='%s'",
|
||||
platform,
|
||||
arch
|
||||
)
|
||||
)
|
||||
errored_pkgs <- as.data.table(errored_pkgs)
|
||||
setkey(pkgs_to_build, Package, Version)
|
||||
setnames(errored_pkgs, c("Package","Version"))
|
||||
setnames(errored_pkgs, c("Package", "Version"))
|
||||
setkey(errored_pkgs, Package, Version)
|
||||
|
||||
### Final subsetting
|
||||
|
|
@ -152,12 +162,14 @@ release_meta <- data.table(
|
|||
)
|
||||
|
||||
meta <- release_meta[Package %in% unique(pkgs$Package)]
|
||||
meta[, triage := mapply(
|
||||
classify_from_metadata,
|
||||
NeedsCompilation,
|
||||
LinkingTo,
|
||||
MoreArgs = list(risky_deps = risky_deps)
|
||||
)]
|
||||
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]
|
||||
|
|
@ -165,19 +177,35 @@ 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))
|
||||
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))
|
||||
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))
|
||||
sprintf(
|
||||
"R-minor-sensitive packages: %s of %s",
|
||||
length(sensitive_pkgs),
|
||||
uniqueN(pkgs$Package)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue