Skip to content

Commit

Permalink
chore: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Jun 4, 2024
1 parent 42e4420 commit 05c9894
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
35 changes: 18 additions & 17 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,26 @@ download_ip <- function(ip) {
code = {
tar_file <- file.path(ip$get_config()$get("cache_dir"), res$target[ix_el])

# Only do this for files that actually exist (Recommended are not )
# Only do this for files that actually exist
if (!file.exists(tar_file)) next
untar(
tarfile = tar_file,
exdir = "./"
utils::untar(tarfile = tar_file, exdir = "./")
tryCatch(
{
asNamespace("pkgdepends")$verify_extracted_package(res$package[ix_el], "./")
},
error = function(error) {
cli::cli_warn("{res$package[ix_el]} binary is not valid, trying to re-download.")
# Attempts to download again using {pkgcache} / {pkgdepends} http methods
async_fun <- asNamespace("pkgcache")$async(function() {
asNamespace("pkgcache")$download_file(
# Builds URL manually from mirror
url = file.path(res$mirror[ix_el], "src/contrib", basename(tar_file)),
destfile = tar_file
)
})
asNamespace("pkgcache")$synchronise(async_fun())
}
)
tryCatch({
pkgdepends:::verify_extracted_package(res$package[ix_el], "./")
}, error = function(error) {
cli::cli_warn("{res$package[ix_el]} binary is not valid, trying to re-download.")
# Attempts to download again using pkgcache/pkgdepends methods
async_fun <- asNamespace("pkgcache")$async(function() {
asNamespace("pkgcache")$download_file(
url = file.path(res$mirror[ix_el], "src/contrib", basename(tar_file)),
destfile = tar_file
)
})
asNamespace("pkgcache")$synchronise(async_fun())
})
}
)
}
Expand Down
4 changes: 2 additions & 2 deletions R/get_ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ get_release_date.remote_ref_cran <- function(remote_ref) {
package_version(remote_ref$version, strict = FALSE)
)
)
as.Date(tail(rel_data[idx, "mtime"], 1))
as.Date(utils::tail(rel_data[idx, "mtime"], 1))
} else {
as.Date(tail(rel_data$mtime, 1))
as.Date(utils::tail(rel_data$mtime, 1))
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default_config <- function() {
)
}
append_config <- function(x1, x2) {
modifyList(x1, x2)
utils::modifyList(x1, x2)
}

#' @importFrom utils installed.packages
Expand Down

0 comments on commit 05c9894

Please sign in to comment.