add debug arg
This commit is contained in:
parent
f5ce357837
commit
2ad67854d4
2 changed files with 21 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
|||
t1 <- Sys.time()
|
||||
cli::cli_h2("Building ({.pkg {package_name[1]}})")
|
||||
|
||||
cli::cli_alert("[{format(Sys.time(), format='%H:%M:%S')}] Building binaries for {.pkg {package_name[1]}} with tags {.field {tag}}.")
|
||||
cli::cli_alert("[{format(Sys.time(), format='%H:%M:%S')}] Building binaries for {.pkg {package_name[1]}} with tags {.field {tag}}.")
|
||||
|
||||
future::plan(future_strategy,
|
||||
workers = future_workers,
|
||||
|
|
@ -127,25 +127,24 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
|||
total_build_time <- round(Sys.time() - t1, 2)
|
||||
cli::cli_alert("Execution time ({.pkg {package_name[1]}}) ({length(tag)} tags): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.")
|
||||
|
||||
cli::cli_h2("Uploading ({.pkg {package_name[1]}})")
|
||||
# out <- progressr::with_progress({
|
||||
# p <- progressr::progressor(along = tag)
|
||||
# future.apply::future_mapply(function(x, y) {
|
||||
mapply(function(x, y) {
|
||||
tryCatch(
|
||||
{
|
||||
p()
|
||||
dump <- upload_single_binary_to_s3(package_name = x, tag = y, force = force, build_for_minor = build_for_minor, debug = debug)
|
||||
},
|
||||
error = function(e) {
|
||||
message(sprintf("Error in uploading package %s with tag %s: %s", x, y, e))
|
||||
}
|
||||
)
|
||||
# p <- progressr::progressor(along = tag)
|
||||
# future.apply::future_mapply(function(x, y) {
|
||||
mapply(function(x, y) {
|
||||
tryCatch(
|
||||
{
|
||||
# p()
|
||||
dump <- upload_single_binary_to_s3(package_name = x, tag = y, force = force, build_for_minor = build_for_minor, debug = debug)
|
||||
},
|
||||
error = function(e) {
|
||||
message(sprintf("Error in uploading package %s with tag %s: %s", x, y, e))
|
||||
}
|
||||
)
|
||||
# }, package_name, tag, future.seed = TRUE)
|
||||
})
|
||||
|
||||
if (archive) {
|
||||
archive_package(package_name[1])
|
||||
archive_package(package_name[1], debug = debug)
|
||||
}
|
||||
return(invisible(TRUE))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue