smarter removal feature

This commit is contained in:
Patrick Schratz 2024-08-28 18:29:52 +02:00
commit 284d298916
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -24,9 +24,9 @@ process_cran_updates <- function(
updated_pkgs <- get_updated_cran_packages(interval)
new_pkgs <- get_new_cran_packages(interval)
cli::cli_alert_success("{.fun process_cran_updates}: Updated packages:")
cli::cli_alert_success("{.fun process_cran_updates}: Updated packages:")
print(updated_pkgs)
cli::cli_alert_success("{.fun process_cran_updates}: New packages:")
cli::cli_alert_success("{.fun process_cran_updates}: New packages:")
print(new_pkgs)
all_pkgs <- dplyr::bind_rows(updated_pkgs, new_pkgs)
@ -35,7 +35,7 @@ process_cran_updates <- function(
if (prune) {
removed_pkgs <- get_removed_cran_packages(interval)
cli::cli_alert_success("{.fun process_cran_updates}: Removed packages:")
cli::cli_alert_success("{.fun process_cran_updates}: Removed packages:")
print(removed_pkgs)
s3fs::s3_file_system(
@ -58,7 +58,11 @@ process_cran_updates <- function(
purrr::walk(removed_pkgs$name, ~ {
cli::cli_alert("{.fun process_cran_updates}: Removing package {.pkg {.x}} from S3.")
files_filtered <- grep(sprintf("%s_", .x), files, value = TRUE)
s3fs::s3_file_delete(files_filtered)
if (length(files_filtered > 0)) {
s3fs::s3_file_delete(files_filtered)
} else {
cli::cli_alert("{.fun process_cran_updates}: No tarballs found for package {.pkg {.x}} - already removed?")
}
cli::cli_alert_success("{.fun process_cran_updates}: Successfully removed {.pkg {basename(files_filtered)}} from S3.")
})