# 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" } parse_build_args <- function(args) { sensitive_only <- "--sensitive-only" %in% args pos <- args[!startsWith(args, "--")] list( sensitive_only = sensitive_only, split_into = as.integer(pos[1L]), split_index = as.integer(pos[2L]), ncpus = as.integer(pos[3L]) ) } # The `single_builds` platform name for a bincraft codename, e.g. alpine324 -> # "alpine-324", rhel9 -> "redhat-9". NA for a codename this repo does not build. codename_platform <- function(codename) { ubuntu <- c(jammy = "2204", noble = "2404", resolute = "2604") if (codename %in% names(ubuntu)) { return(paste0("ubuntu-", ubuntu[[codename]])) } if (grepl("^rhel[0-9]+$", codename)) { return(sub("^rhel", "redhat-", codename)) } if (grepl("^alpine[0-9]+$", codename)) { return(sub("^alpine", "alpine-", codename)) } NA_character_ } # The wall-clock deadline a build loop must stop at, from BUILD_DEADLINE (epoch # seconds). The pipeline sets it once per step, so every pass in the step shares # one budget and the steps after the builds (archiving, the index upload) still # get to run before Crow's timeout kills the step. Unset or unparsable means no # deadline. build_deadline <- function(value = Sys.getenv("BUILD_DEADLINE", unset = "")) { deadline <- suppressWarnings(as.numeric(value)) if (length(deadline) != 1L || is.na(deadline)) Inf else deadline } deadline_reached <- function(deadline, now = as.numeric(Sys.time())) { now >= deadline }