fix matching of packages for which the latest verison is not available

This commit is contained in:
Patrick Schratz 2024-09-03 19:55:35 +02:00
commit 8ae2c12262
Signed by: pat-s
GPG key ID: 3C6318841EF78925
3 changed files with 4 additions and 1 deletions

View file

@ -17,6 +17,7 @@ Imports:
magrittr,
pkgbuild,
progressr,
stringr,
purrr,
RPostgres,
s3fs (>= 0.1.7),

View file

@ -58,6 +58,7 @@ importFrom(s3fs,s3_dir_ls)
importFrom(s3fs,s3_file_exists)
importFrom(s3fs,s3_file_system)
importFrom(s3fs,s3_file_upload)
importFrom(stringr,str_split)
importFrom(xml2,read_xml)
importFrom(xml2,xml_find_all)
importFrom(xml2,xml_find_first)

View file

@ -1,4 +1,5 @@
#' Archive packages in CRAN-like repositories
#' @importFrom stringr str_split
#' @export
#' @examples
#' archive_package("AATtools", codename = "rhel9")
@ -48,7 +49,7 @@ archive_package <- function(
} else {
versions <- rev(pak::pkg_history(.x)$Version)
for (i in versions) {
if (any(grepl(i, all_versions, fixed = TRUE))) {
if (any(grepl(paste0("^", i, "$"), stringr::str_split(stringr::str_split(all_versions, "_", simplify = T)[, 2], ".tar.gz", simplify = TRUE)[, 1]))) {
index <- which(grepl(sprintf("_%s.tar.gz", i), all_versions))
old_versions <- all_versions[-index]
break