Some checks failed
ci/crow/cron/process-updates/15 Pipeline failed
ci/crow/cron/process-updates/14 Pipeline failed
ci/crow/cron/process-updates/16 Pipeline failed
ci/crow/cron/process-updates/18 Pipeline failed
ci/crow/cron/process-updates/11 Pipeline failed
ci/crow/cron/process-updates/12 Pipeline failed
ci/crow/cron/process-updates/17 Pipeline failed
ci/crow/cron/process-updates/6 Pipeline failed
ci/crow/cron/process-updates/5 Pipeline failed
## Summary Adds the curated **patch registry** and wiring that drives bincraft's new package-patching mechanism (see bincraft PR `feat/package-patching`). Lets specific packages be patched (env/configure/Makevars overrides or source diffs) before pak installs them — including as transitive dependencies — so compiler-/OS-specific failures like RcppParallel's bundled TBB stop cascading. ## What's included - `local/patches/registry.json` — initial entry: RcppParallel with `RCPP_PARALLEL_USE_TBB=0` for alpine / ubuntu-2604, plus `local/patches/README.md` schema docs. - `local/validate-patches.R` — validates schema, referenced patch files, and ambiguous overlaps; clean failure + exit 1 (no stacktrace). - `.pre-commit-config.yaml` — a `validate-patches` hook (re-runs when the registry or the validator changes). - `local/build-one.R` / `local/build-all.R` — pass `patches = "local/patches"` to `bincraft::build_binary_package()`. - `specs/2026-06-30-package-patching-design.md` and `plans/2026-06-30-package-patching-implementation.md`. ## ⚠️ Merge ordering (blocker) This PR adds a `patches = ...` argument to `build_binary_package()` calls. The `.crow/*.yaml` workflows currently pin bincraft **v4.2.3**, which does not accept that argument — CI will error with `unused argument (patches=...)` until: 1. bincraft **v4.3.0** is released (PR `feat/package-patching`), and 2. the pin is bumped in `.crow/build-all-versions-install-deps.yaml`, `.crow/build-all-versions.yaml`, and `.crow/process-updates.yaml`. The `.crow` pin bump will be added to this PR once bincraft v4.3.0 is tagged. Do not merge before then. Reviewed-on: #103
56 lines
1.7 KiB
R
56 lines
1.7 KiB
R
#!/usr/bin/env Rscript
|
|
# Validate local/patches/registry.json: schema, referenced patch files, and
|
|
# ambiguous overlaps. Exits 1 on any problem. Used by pre-commit and CI.
|
|
|
|
dir <- "local/patches"
|
|
registry_file <- file.path(dir, "registry.json")
|
|
if (!file.exists(registry_file)) {
|
|
cat("No registry.json found; nothing to validate.\n")
|
|
quit(status = 0L)
|
|
}
|
|
|
|
or_q <- function(x) if (is.null(x)) "?" else x
|
|
|
|
reg <- jsonlite::fromJSON(registry_file, simplifyVector = FALSE)
|
|
required <- c("package", "versions", "platforms", "reason")
|
|
errs <- character(0L)
|
|
|
|
for (i in seq_along(reg)) {
|
|
e <- reg[[i]]
|
|
missing <- setdiff(required, names(e))
|
|
if (length(missing) > 0L) {
|
|
errs <- c(errs, sprintf(
|
|
"entry %d (%s): missing %s", i,
|
|
if (is.null(e$package)) "?" else e$package, toString(missing)
|
|
))
|
|
}
|
|
if (!is.null(e$patch)) {
|
|
p <- file.path(dir, e$patch)
|
|
if (!file.exists(p)) {
|
|
errs <- c(errs, sprintf("entry %d (%s): patch file '%s' missing",
|
|
i, e$package, p))
|
|
}
|
|
}
|
|
}
|
|
|
|
# Ambiguous overlap: two entries for the same package with identical platforms
|
|
# and versions.
|
|
keys <- vapply(reg, function(e) {
|
|
sprintf(
|
|
"%s|%s|%s",
|
|
or_q(e$package),
|
|
paste(sort(as.character(unlist(e$platforms))), collapse = ","),
|
|
or_q(e$versions)
|
|
)
|
|
}, character(1L))
|
|
dups <- keys[duplicated(keys)]
|
|
if (length(dups) > 0L) {
|
|
errs <- c(errs, sprintf("ambiguous duplicate entries: %s", toString(unique(dups))))
|
|
}
|
|
|
|
if (length(errs) > 0L) {
|
|
cat("Patch registry validation FAILED:\n")
|
|
cat(paste0(" - ", errs, "\n"))
|
|
quit(status = 1L)
|
|
}
|
|
cat(sprintf("Patch registry OK (%d %s).\n", length(reg), if (length(reg) == 1L) "entry" else "entries"))
|