fix: account for non-pkg items in counting unique files

This commit is contained in:
Patrick Schratz 2024-11-03 23:00:29 +01:00
commit db3b0531af
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -93,9 +93,9 @@ upload_package_index <- function(
cli::cli_alert("{.fun upload_package_index}: Started listing remote packages") cli::cli_alert("{.fun upload_package_index}: Started listing remote packages")
pkgs <- s3fs::s3_dir_ls(remote_bin_dir) pkgs <- s3fs::s3_dir_ls(remote_bin_dir)
cli::cli_alert_success("{.fun upload_package_index}: Finished listing remote packages") cli::cli_alert_success("{.fun upload_package_index}: Finished listing remote packages")
# We remove 4 from the count as we don't want to count the PACKAGES* files # We remove 4 from the count as we don't want to count the PACKAGES* files + Archive/ dir
pkg_count <- length(pkgs) - 4 pkg_count <- length(pkgs) - 5
unique_pkgs <- length(unique(sapply(strsplit(basename(pkgs), "_"), function(x) x[1]))) unique_pkgs <- length(unique(sapply(strsplit(basename(pkgs), "_"), function(x) x[1]))) - 5
t1 <- Sys.time() t1 <- Sys.time()
cranlike::update_PACKAGES(sprintf("s3://%s", remote_bin_dir)) cranlike::update_PACKAGES(sprintf("s3://%s", remote_bin_dir))