readd pause arg
This commit is contained in:
parent
bb940dafbf
commit
3525ebfbd0
1 changed files with 8 additions and 5 deletions
|
|
@ -4,14 +4,15 @@
|
|||
#' archive_package("AATtools", codename = "rhel9")
|
||||
#'
|
||||
archive_package <- function(
|
||||
package_name,
|
||||
package_name,
|
||||
build_for_minor = FALSE,
|
||||
codename = NULL,
|
||||
r_minor_version = NULL,
|
||||
local_build_root = ".",
|
||||
endpoint = "https://s3.eu-central-003.backblazeb2.com",
|
||||
region = "eu-central-003",
|
||||
bucket = "devxy-arm64-r-binaries") {
|
||||
bucket = "devxy-arm64-r-binaries",
|
||||
pause = NULL) {
|
||||
s3fs::s3_file_system(
|
||||
aws_access_key_id = Sys.getenv("AWS_ACCESS_KEY_ID"),
|
||||
aws_secret_access_key = Sys.getenv("AWS_SECRET_ACCESS_KEY"),
|
||||
|
|
@ -31,7 +32,6 @@ archive_package <- function(
|
|||
files <- s3fs::s3_dir_ls(remote_bin_dir)
|
||||
|
||||
foo <- lapply(package_name, function(.x) {
|
||||
|
||||
cli::cli_h3("Processing {.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))
|
||||
|
|
@ -46,11 +46,11 @@ archive_package <- function(
|
|||
index <- which(grepl(sprintf("_%s.tar.gz", last_version), all_versions, fixed = TRUE))
|
||||
old_versions <- all_versions[-index]
|
||||
} else {
|
||||
versions = rev(pak::pkg_history(.x)$Version)
|
||||
versions <- rev(pak::pkg_history(.x)$Version)
|
||||
for (i in versions) {
|
||||
if (any(grepl(i, all_versions, fixed = TRUE))) {
|
||||
index <- which(grepl(sprintf("_%s.tar.gz", i), all_versions))
|
||||
old_versions <- all_versions[-index]
|
||||
old_versions <- all_versions[-index]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
@ -58,6 +58,9 @@ archive_package <- function(
|
|||
cli::cli_alert("{.fun archive_package}: Archiving {.field {basename(old_versions)}}, keeping {.field {basename(all_versions[index])}}.")
|
||||
s3fs::s3_file_move(old_versions, sprintf("%s/Archive/%s/%s", remote_bin_dir, .x, basename(old_versions)), overwrite = TRUE)
|
||||
cli::cli_alert_success("{.fun archive_package}: Successfully archived package {.pkg {.x}}.")
|
||||
if (!is.null(pause)) {
|
||||
Sys.sleep(pause)
|
||||
}
|
||||
}
|
||||
cli::cli_alert("{.fun archive_package}: Skipping {.pkg {.x}} as only one package versions exists.")
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue