diff --git a/local/build-all.R b/local/build-all.R index 102d18c..d46e27a 100644 --- a/local/build-all.R +++ b/local/build-all.R @@ -25,6 +25,31 @@ sprintf("# of package versions for this job: %s", nrow(chunk)) exclude <- jsonlite::fromJSON("local/excluded-packages.json")[["package"]] chunk <- chunk[!chunk$Package %in% exclude, ] +# Skip package versions already built in a previous run. +# pkgs_to_build.rds is a static snapshot from the install-deps step, so on a +# restart it still lists everything an interrupted run already produced. The +# metadata DB reflects that progress, so we re-derive the remaining set here. +platform <- paste(Sys.getenv("OS"), gsub("[.]", "", Sys.getenv("OS_VERSION")), sep = "-") +arch <- Sys.getenv("ARCH") +con <- DBI::dbConnect( + RPostgres::Postgres(), + dbname = "build_metadata", + host = "r-binaries.devxy.io", + port = 15432, + user = "rpkgs", + password = Sys.getenv("PGPASS"), + sslmode = "require" +) +built <- DBI::dbGetQuery( + con, + "SELECT name, tag FROM single_builds WHERE platform = $1 AND arch = $2 AND error_occurred = FALSE", + params = list(platform, arch) +) +DBI::dbDisconnect(con) +before <- nrow(chunk) +chunk <- chunk[!paste(chunk$Package, chunk$Version) %in% paste(built$name, built$tag), ] +sprintf("Skipped %d already-built package versions; %d remaining for this job", before - nrow(chunk), nrow(chunk)) + # Read pre-computed S3 listing from install-deps step # This avoids loading s3fs/reticulate/Python in the build container, # saving significant memory for pak subprocess forks