diff --git a/.Rbuildignore b/.Rbuildignore index 2971eee..7865738 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,5 +7,5 @@ .prettierrc.json .woodpecker devxy-arm64-r-binaries/ -PACKAGES* +PACKAGES.* s3:* \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index 89ffb9a..eb2f316 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,6 +21,7 @@ importFrom(DBI,dbWriteTable) importFrom(RPostgres,Postgres) importFrom(cli,cli_alert) importFrom(cranlike,add_PACKAGES) +importFrom(cranlike,update_PACKAGES) importFrom(dplyr,filter) importFrom(dplyr,group_by) importFrom(dplyr,n) diff --git a/R/packages_index.R b/R/package_index.R similarity index 77% rename from R/packages_index.R rename to R/package_index.R index 57792a7..4d93465 100644 --- a/R/packages_index.R +++ b/R/package_index.R @@ -39,15 +39,11 @@ add_to_package_index <- function( # list all tarballs for the given package cranlike::add_PACKAGES(file_names, local_bin_dir) - # dummy <- s3fs::s3_file_upload(pkgs_upload_local, pkgs_upload_remote, overwrite = TRUE) - # s3fs::s3_file_upload( - # sprintf("%s/%s", local_bin_dir, c("PACKAGES", "PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")), - # sprintf("%s", remote_bin_dir, c("PACKAGES", "PACKAGES.db", "PACKAGES.rds", "PACKAGES.gz")), - # overwrite = TRUE - # ) return(invisible(TRUE)) } +#' @importFrom s3fs s3_file_upload s3_dir_ls +#' @importFrom cranlike update_PACKAGES #' @export upload_package_index <- function( package_name = NULL, @@ -80,9 +76,9 @@ upload_package_index <- function( region_name = region, ) - pkgs = s3fs::s3_dir_ls(remote_bin_dir) - pkg_count = length(pkgs) - 4 - unique_pkgs = length(unique(sapply(strsplit(basename(pkgs), "_"), function(x) x[1]))) + pkgs <- s3fs::s3_dir_ls(remote_bin_dir) + pkg_count <- length(pkgs) - 4 + unique_pkgs <- length(unique(sapply(strsplit(basename(pkgs), "_"), function(x) x[1]))) t1 <- Sys.time() cranlike::update_PACKAGES(sprintf("s3://%s", remote_bin_dir)) total_build_time <- round(Sys.time() - t1, 2) @@ -94,16 +90,5 @@ upload_package_index <- function( \(x, y) s3fs::s3_file_upload(x, y, overwrite = TRUE) ) - # pkgs_upload_local <- sprintf("%sPACKAGES", local_bin_dir) - # pkgs_upload_remote <- sprintf("%sPACKAGES", remote_bin_dir) - - # if (debug) { - # cli::cli_alert_warning("DEBUG: PACKAGES UPLOAD local dir: {pkgs_upload_local}") - # cli::cli_alert_warning("DEBUG: PACKAGES UPLOAD remote dir: {pkgs_upload_remote}") - # } - - # s3 <- paws.storage::s3(endpoint = endpoint, region = region) - # s3$put_object(Body = pkgs_upload_local, Bucket = bucket, Key = "arm64/rhel9/latest/src/contrib/PACKAGES") - return(invisible(TRUE)) }