Skip to content

Commit

Permalink
outdated_pkgs() may work better with PPM
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Jul 8, 2024
1 parent e460180 commit d9925b0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions R/outdated-pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ outdated_pkgs <- function(type = c("binary", "source")) {
default_repo <- getOption("repos")[[1]]
default_repo <- sub("/$", "", default_repo)
default_repo <- sub("https://", "", default_repo, fixed = TRUE)
if (!grepl("packagemanager", default_repo)) {
# ppm is not well detected
access_repo <- tryCatch(curl::nslookup(default_repo),
error = function(e) {
FALSE
}
)
} else {
access_repo <- TRUE
}

access_repo <- tryCatch(curl::nslookup(default_repo),
error = function(e) {
FALSE
}
)
} else {
access_repo <- TRUE
}
Expand All @@ -46,7 +51,12 @@ outdated_pkgs <- function(type = c("binary", "source")) {
outdated_pkg_mat <- utils::old.packages(type = type, lib.loc = .libPaths()[1])

if (rlang::has_length(outdated_pkg_mat) && !is.null(getOption("reuseme.ignore_update"))) {
indices_to_discard <- which(rownames(outdated_pkg_mat) %in% getOption("reuseme.ignore_update"))
if (type == "source") {
# only disallow update when building from source.
indices_to_discard <- which(rownames(outdated_pkg_mat) %in% getOption("reuseme.ignore_update"))
} else {
indices_to_discard <- integer(0L)
}
if (rlang::has_length(indices_to_discard)) { # because matrix[-character(0), ] destroys |> the matrix?
outdated_pkg_mat <- outdated_pkg_mat[-indices_to_discard, , drop = FALSE]
}
Expand Down

0 comments on commit d9925b0

Please sign in to comment.