add debug arg

This commit is contained in:
Patrick Schratz 2024-09-23 22:08:27 +02:00
commit 2ad67854d4
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -15,7 +15,8 @@ archive_package <- function(
region = "eu-central-003",
bucket = "devxy-arm64-r-binaries",
pause = NULL,
arch = NULL) {
arch = NULL,
debug = FALSE) {
s3fs::s3_file_system(
aws_access_key_id = Sys.getenv("AWS_ACCESS_KEY_ID"),
aws_secret_access_key = Sys.getenv("AWS_SECRET_ACCESS_KEY"),
@ -23,6 +24,10 @@ archive_package <- function(
region_name = region,
)
if (debug) {
message(sprintf("DEBUG archive_package: package_name: %s", package_name))
}
codename <- set_codename(codename)
if (is.null(arch)) {
@ -50,14 +55,13 @@ archive_package <- function(
files <- s3fs::s3_dir_ls(remote_bin_dir)
foo <- lapply(package_name, function(.x) {
cli::cli_h2("Archiving {.pkg {.x}}")
cli::cli_h2("Archiving ({.pkg {.x}})")
if (!s3fs::s3_dir_exists(sprintf("%s/Archive/%s", remote_bin_dir, .x))) {
s3fs::s3_dir_create(sprintf("%s/Archive/%s", remote_bin_dir, .x))
}
all_versions <- grep(sprintf("/%s_", .x), files, value = TRUE)
# only archive if more than one package exists in the root
if (length(all_versions) > 1) {
# get most recent version from CRAN
last_version <- available.packages("https://cloud.r-project.org/src/contrib")[.x, "Version"]
# check if last version is available in repo