From 417e1c8904bafe72464dd6f6f78b15f17113e0a7 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:22:36 +0200 Subject: [PATCH 01/19] various enhancements --- NAMESPACE | 2 + R/desc_utils.R | 1 + R/get_ref.R | 138 +++++++++++++++++++++------------ R/solve.R | 5 ++ R/utils.R | 2 +- man/cli_pb_init.Rd | 4 +- man/get_ref_min.Rd | 8 +- man/get_release_date.Rd | 7 +- man/get_version.Rd | 31 ++++++++ tests/testthat/setup-options.R | 20 +++++ 10 files changed, 157 insertions(+), 61 deletions(-) create mode 100644 man/get_version.Rd create mode 100644 tests/testthat/setup-options.R diff --git a/NAMESPACE b/NAMESPACE index ea456ab2..ea79ffc3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,7 @@ S3method(get_release_date,remote_ref) S3method(get_release_date,remote_ref_cran) S3method(get_release_date,remote_ref_github) S3method(get_release_date,remote_ref_standard) +S3method(get_version,remote_ref) S3method(solve_ip,deps_installation_proposal) S3method(solve_ip,min_isolated_deps_installation_proposal) export(check_ip) @@ -20,6 +21,7 @@ export(get_ref_min) export(get_ref_min_incl_cran) export(get_ref_release) export(get_release_date) +export(get_version) export(install_ip) export(max_deps_check) export(min_cohort_deps_check) diff --git a/R/desc_utils.R b/R/desc_utils.R index 80983b3c..dcfc43fc 100644 --- a/R/desc_utils.R +++ b/R/desc_utils.R @@ -128,6 +128,7 @@ desc_cond_set_refs <- function(d, refs) { desc_to_ip <- function(d, config) { temp_desc <- tempfile() d$write(temp_desc) + cli::cli_alert_info(paste0("Creating temporary DESCRIPTION file: ", cli::col_blue(temp_desc))) pkgdepends::new_pkg_installation_proposal( refs = paste0("deps::", temp_desc), diff --git a/R/get_ref.R b/R/get_ref.R index 9171cf9a..302e5192 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -79,7 +79,7 @@ get_ref_min <- function(remote_ref, op = "", op_ver = "") { #' @rdname get_ref_min #' @exportS3Method get_ref_min remote_ref #' @examples -#' verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) +#' get_ref_min(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) get_ref_min.remote_ref <- function(remote_ref, op = "", op_ver = "") { remote_ref } @@ -94,9 +94,9 @@ get_ref_min.remote_ref <- function(remote_ref, op = "", op_ver = "") { #' @importFrom pkgdepends parse_pkg_ref #' @importFrom stats setNames #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" -#' verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("cran::dplyr")) +#' get_ref_min(pkgdepends::parse_pkg_ref("cran::dplyr")) get_ref_min.remote_ref_cran <- function(remote_ref, op = "", op_ver = "") { - if (remote_ref$atleast == "" && remote_ref$version != "") { + if (remote_ref$version != "") { return(remote_ref) } @@ -107,7 +107,7 @@ get_ref_min.remote_ref_cran <- function(remote_ref, op = "", op_ver = "") { pv <- filter_valid_version(pv, op, op_ver) min_ver <- Filter(function(x) x == min(pv), pv) - new_ref <- sprintf("%s@%s", remote_ref$ref, names(min_ver)) # @TODO deparse, add ver, parse again + new_ref <- sprintf("%s@%s", remote_ref$package, names(min_ver)) tryCatch( pkgdepends::parse_pkg_ref(new_ref), error = function(err) { @@ -127,7 +127,7 @@ get_ref_min.remote_ref_cran <- function(remote_ref, op = "", op_ver = "") { #' @rdname get_ref_min #' @exportS3Method get_ref_min remote_ref_standard #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" -#' verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("dplyr")) +#' get_ref_min(pkgdepends::parse_pkg_ref("dplyr")) get_ref_min.remote_ref_standard <- function(remote_ref, op = "", op_ver = "") { get_ref_min.remote_ref_cran(remote_ref, op, op_ver) } @@ -140,7 +140,7 @@ get_ref_min.remote_ref_standard <- function(remote_ref, op = "", op_ver = "") { #' @importFrom pkgdepends parse_pkg_ref #' #' @examplesIf gh::gh_token() != "" -#' verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("cran/dplyr")) +#' get_ref_min(pkgdepends::parse_pkg_ref("cran/dplyr")) get_ref_min.remote_ref_github <- function(remote_ref, op = "", op_ver = "") { if (remote_ref$commitish != "") { return(remote_ref) @@ -285,22 +285,50 @@ get_ref_max <- function(remote_ref) { #' @importFrom pkgdepends parse_pkg_ref #' @export get_ref_release <- function(remote_ref) { + # create list of ref candidates to check + # return the one of the highest version + # this is a named list of character with version values and refs names + ref_candidates <- list() if (check_if_on_cran(remote_ref)) { - return(pkgdepends::parse_pkg_ref(remote_ref$package)) + cran_ref <- remote_ref$package + cran_ver <- get_version(pkgdepends::parse_pkg_ref(cran_ref)) + ref_candidates <- append(ref_candidates, setNames(list(cran_ver), cran_ref)) } if (inherits(remote_ref, "remote_ref_github")) { + gh_release_ref <- cond_parse_pkg_ref_release(remote_ref) + gh_release_ver <- get_version(gh_release_ref) + ref_candidates <- c(ref_candidates, setNames(list(gh_release_ver), gh_release_ref$ref)) + if (!is.null(remote_ref$commitish) && remote_ref$commitish != "") { - return(remote_ref) + gh_commitish_ref <- remote_ref + gh_commitish_ver <- get_version(gh_commitish_ref) + ref_candidates <- c(ref_candidates, setNames(list(gh_commitish_ver), gh_commitish_ref$ref)) } if (!is.null(remote_ref$pull) && remote_ref$pull != "") { - return(remote_ref) + gh_pull_ref <- remote_ref + gh_pull_ver <- get_version(gh_pull_ref) + ref_candidates <- c(ref_candidates, setNames(list(gh_pull_ver), gh_pull_ref$ref)) } - if (!is.null(remote_ref$release) && remote_ref$release != "") { - return(cond_parse_pkg_ref_release(remote_ref)) + } else { + input_ref <- remote_ref$ref + input_ver <- get_version(remote_ref) + ref_candidates <- c(ref_candidates, setNames(list(input_ver), input_ref)) + } + + if (length(ref_candidates) == 0 || all(is.na(ref_candidates))) { + return(remote_ref) + } else { + max_ver <- ref_candidates[[1]] + max_ref <- names(ref_candidates[1]) + for (i in 2:length(ref_candidates)) { + i_ver <- ref_candidates[[i]] + i_ref <- names(ref_candidates[i]) + if (!is.na(i_ver) && i_ver > max_ver) { + max_ref <- i_ref + } } - return(cond_parse_pkg_ref_release(remote_ref)) + return(pkgdepends::parse_pkg_ref(max_ref)) } - return(remote_ref) } #' @importFrom pkgdepends parse_pkg_ref @@ -335,66 +363,78 @@ cond_parse_pkg_ref_release <- function(remote_ref) { } } +#' Get package version. +#' +#' @inheritParams get_ref_min +#' @returns Package version created with `package_version`. +#' +#' @export +get_version <- function(remote_ref) { + UseMethod("get_version", remote_ref) +} + +#' @rdname get_version +#' @importFrom pkgdepends::new_pkg_deps +#' @exportS3Method get_version remote_ref +#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" +#' get_version(pkgdepends::parse_pkg_ref("dplyr")) +#' get_version(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) +#' get_version(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) +get_version.remote_ref <- function(remote_ref, op = "", op_ver = "") { + x <- pkgdepends::new_pkg_deps(remote_ref$ref, config = list(dependencies = FALSE)) + x$solve() + if (x$get_solution()$status == "FAILED") { + return(NA) + } else { + as.package_version(x$get_resolution()[1, "version"]) + } +} + + #' Get release date. #' #' @inheritParams get_ref_min -#' @inherit get_ref_min return +#' @returns Date #' #' @export get_release_date <- function(remote_ref) { UseMethod("get_release_date", remote_ref) } -#' Get release date from GitHub references -#' #' @rdname get_release_date #' @exportS3Method get_release_date remote_ref_github #' @importFrom gh gh_gql #' #' @examplesIf gh::gh_token() != "" -#' remote_ref <- pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0") -#' get_release_date(remote_ref) +#' get_release_date(pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0")) get_release_date.remote_ref_github <- function(remote_ref) { + x <- pkgdepends::new_pkg_deps(remote_ref$ref, config = list(dependencies = FALSE)) + x$solve() + if (x$get_solution()$status == "FAILED") { + return(as.Date(NA)) + } + + sha <- x$get_resolution()[1, "extra"][[1]]$remotesha + if (is.null(sha)) { + return(as.Date(NA)) + } + gql_query <- sprintf("{ repository(owner: \"%s\", name: \"%s\") { - refs(refPrefix: \"refs/tags/\", query: \"%s\", first: 100) { - edges { - node { - name - target { - ... on Commit { - committedDate - } - } - } + object(oid: \"%s\") { + ... on Commit { + committedDate } } } - }", remote_ref$username, remote_ref$repo, remote_ref$commitish) + }", remote_ref$username, remote_ref$repo, sha) resp <- try(gh::gh_gql(gql_query), silent = TRUE) - if (inherits(resp, "try-error") || is.null(resp$data$repository$refs$edges)) { - return(as.Date(NA_real_)) - } - - result <- vapply( - resp$data$repository$refs$edges, - function(x) { - if (x$node$name != remote_ref$commitish) { - return(as.Date(NA_real_)) - } - as.Date(x$node$target$committedDate) - }, - double(1) - ) - - result <- Filter(function(el) !is.na(el) && !is.null(el), result) - - if (length(result) == 0) { - return(as.Date(NA_real_)) + if (inherits(resp, "try-error") || is.null(resp$data$repository$object$committedDate)) { + return(as.Date(NA)) } - max(as.Date(result)) + as.Date(resp$data$repository$object$committedDate) } #' Get release date from GitHub references diff --git a/R/solve.R b/R/solve.R index 2fd25c1a..e681b84e 100644 --- a/R/solve.R +++ b/R/solve.R @@ -71,6 +71,11 @@ solve_ip.min_isolated_deps_installation_proposal <- function(ip) { # nolint new_res <- do.call(rbind, deps_res) + if (is.null(new_res)) { + ip$solve() + return(invisible(ip)) + } + # Keep only top versions in calculated resolution (new_res). # Very large resolution tables can become problematic and take a long to # converge to a solution. diff --git a/R/utils.R b/R/utils.R index 94d79282..a563a065 100644 --- a/R/utils.R +++ b/R/utils.R @@ -86,7 +86,7 @@ resolve_ppm_snapshot <- function(pkg_ref_str, operator, pkg_version) { i_res } -#' Create `cli` progress bar for resolving versions. +#' Create `cli` progress bar to print status to the console. #' @importFrom cli col_blue col_yellow cli_progress_bar col_green pb_current pb_elapsed pb_eta pb_extra #' pb_spin pb_total style_bold symbol #' @keywords internal diff --git a/man/cli_pb_init.Rd b/man/cli_pb_init.Rd index 62a5daa9..85fd0d9d 100644 --- a/man/cli_pb_init.Rd +++ b/man/cli_pb_init.Rd @@ -2,11 +2,11 @@ % Please edit documentation in R/utils.R \name{cli_pb_init} \alias{cli_pb_init} -\title{Create \code{cli} progress bar for resolving versions.} +\title{Create \code{cli} progress bar to print status to the console.} \usage{ cli_pb_init(type, total, ...) } \description{ -Create \code{cli} progress bar for resolving versions. +Create \code{cli} progress bar to print status to the console. } \keyword{internal} diff --git a/man/get_ref_min.Rd b/man/get_ref_min.Rd index e81310bb..dd630224 100644 --- a/man/get_ref_min.Rd +++ b/man/get_ref_min.Rd @@ -42,15 +42,15 @@ and then \code{\link[gh:gh]{gh::gh()}} to download \code{DESCRIPTION} file and t } } \examples{ -verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) +get_ref_min(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) \dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("cran::dplyr")) +get_ref_min(pkgdepends::parse_pkg_ref("cran::dplyr")) \dontshow{\}) # examplesIf} \dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("dplyr")) +get_ref_min(pkgdepends::parse_pkg_ref("dplyr")) \dontshow{\}) # examplesIf} \dontshow{if (gh::gh_token() != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -verdepcheck:::get_ref_min(pkgdepends::parse_pkg_ref("cran/dplyr")) +get_ref_min(pkgdepends::parse_pkg_ref("cran/dplyr")) \dontshow{\}) # examplesIf} } \seealso{ diff --git a/man/get_release_date.Rd b/man/get_release_date.Rd index d36fe28f..9aba4136 100644 --- a/man/get_release_date.Rd +++ b/man/get_release_date.Rd @@ -16,19 +16,16 @@ get_release_date(remote_ref) \item{remote_ref}{(\code{remote_ref}) object created with \code{\link[pkgdepends:parse_pkg_refs]{pkgdepends::parse_pkg_ref()}}} } \value{ -(\code{remote_ref}) object with the package reference +Date } \description{ Get release date. -Get release date from GitHub references - Get release date from GitHub references } \examples{ \dontshow{if (gh::gh_token() != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -remote_ref <- pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0") -get_release_date(remote_ref) +get_release_date(pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0")) \dontshow{\}) # examplesIf} \dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} remote_ref <- pkgdepends::parse_pkg_ref("dplyr@1.1.0") diff --git a/man/get_version.Rd b/man/get_version.Rd new file mode 100644 index 00000000..bc26b7c0 --- /dev/null +++ b/man/get_version.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_ref.R +\name{get_version} +\alias{get_version} +\alias{get_version.remote_ref} +\title{Get package version.} +\usage{ +get_version(remote_ref) + +\method{get_version}{remote_ref}(remote_ref, op = "", op_ver = "") +} +\arguments{ +\item{remote_ref}{(\code{remote_ref}) object created with \code{\link[pkgdepends:parse_pkg_refs]{pkgdepends::parse_pkg_ref()}}} + +\item{op}{(\code{character(1)}) optional, version condition comparison operator (e.g. \code{">"}, \code{">="})} + +\item{op_ver}{(\code{character(1)}) optional, version number against which \code{op} argument is applied} +} +\value{ +Package version created with \code{package_version}. +} +\description{ +Get package version. +} +\examples{ +\dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +get_version(pkgdepends::parse_pkg_ref("dplyr")) +get_version(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) +get_version(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) +\dontshow{\}) # examplesIf} +} diff --git a/tests/testthat/setup-options.R b/tests/testthat/setup-options.R new file mode 100644 index 00000000..78be1f9b --- /dev/null +++ b/tests/testthat/setup-options.R @@ -0,0 +1,20 @@ +# `opts_partial_match_old` is left for exclusions due to partial matching in dependent packages (i.e. not fixable here) +# it might happen that it is not used right now, but it is left for possible future use +# use with: `withr::with_options(opts_partial_match_old, { ... })` inside the test +opts_partial_match_old <- list( + warnPartialMatchDollar = getOption("warnPartialMatchDollar"), + warnPartialMatchArgs = getOption("warnPartialMatchArgs"), + warnPartialMatchAttr = getOption("warnPartialMatchAttr") +) +opts_partial_match_new <- list( + warnPartialMatchDollar = TRUE, + warnPartialMatchArgs = TRUE, + warnPartialMatchAttr = TRUE +) + +if (isFALSE(getFromNamespace("on_cran", "testthat")()) && requireNamespace("withr", quietly = TRUE)) { + withr::local_options( + opts_partial_match_new, + .local_envir = testthat::teardown_env() + ) +} From c38a12779e11542c85a644c9407ee3cecb130254 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:40:36 +0200 Subject: [PATCH 02/19] rcmdcheck fixes --- R/get_ref.R | 6 +++--- man/get_version.Rd | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/R/get_ref.R b/R/get_ref.R index 302e5192..ec063d83 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -374,13 +374,13 @@ get_version <- function(remote_ref) { } #' @rdname get_version -#' @importFrom pkgdepends::new_pkg_deps +#' @importFrom pkgdepends new_pkg_deps #' @exportS3Method get_version remote_ref #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" #' get_version(pkgdepends::parse_pkg_ref("dplyr")) #' get_version(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) #' get_version(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) -get_version.remote_ref <- function(remote_ref, op = "", op_ver = "") { +get_version.remote_ref <- function(remote_ref) { x <- pkgdepends::new_pkg_deps(remote_ref$ref, config = list(dependencies = FALSE)) x$solve() if (x$get_solution()$status == "FAILED") { @@ -483,7 +483,7 @@ get_cran_data <- function(package) { if (is.null(pkgenv$cache_db)) { pkgenv$cache_db <- tools::CRAN_package_db() } - db <- subset(pkgenv$cache_db, Package == package) + db <- subset(pkgenv$cache_db, pkgenv$cache_db$Package == package) cran_current <- data.frame( type = "cran", package = package, diff --git a/man/get_version.Rd b/man/get_version.Rd index bc26b7c0..1a668b01 100644 --- a/man/get_version.Rd +++ b/man/get_version.Rd @@ -7,14 +7,10 @@ \usage{ get_version(remote_ref) -\method{get_version}{remote_ref}(remote_ref, op = "", op_ver = "") +\method{get_version}{remote_ref}(remote_ref) } \arguments{ \item{remote_ref}{(\code{remote_ref}) object created with \code{\link[pkgdepends:parse_pkg_refs]{pkgdepends::parse_pkg_ref()}}} - -\item{op}{(\code{character(1)}) optional, version condition comparison operator (e.g. \code{">"}, \code{">="})} - -\item{op_ver}{(\code{character(1)}) optional, version number against which \code{op} argument is applied} } \value{ Package version created with \code{package_version}. From 4f9120c09262ac361a100f4525e88b4c4ebf7e38 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:45:14 +0200 Subject: [PATCH 03/19] docs --- _pkgdown.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_pkgdown.yml b/_pkgdown.yml index 98a8849f..124a04b8 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -35,3 +35,4 @@ reference: contents: - starts_with("get_ref_") - get_release_date + - get_version From af186e1794fbb8f2e7ca38ed86a0ddbec7029499 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 13 May 2024 17:00:28 +0200 Subject: [PATCH 04/19] more robust in case no release is found --- R/get_ref.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/get_ref.R b/R/get_ref.R index ec063d83..3dade134 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -296,8 +296,10 @@ get_ref_release <- function(remote_ref) { } if (inherits(remote_ref, "remote_ref_github")) { gh_release_ref <- cond_parse_pkg_ref_release(remote_ref) - gh_release_ver <- get_version(gh_release_ref) - ref_candidates <- c(ref_candidates, setNames(list(gh_release_ver), gh_release_ref$ref)) + if (!is.null(gh_release_ref)) { + gh_release_ver <- get_version(gh_release_ref) + ref_candidates <- c(ref_candidates, setNames(list(gh_release_ver), gh_release_ref$ref)) + } if (!is.null(remote_ref$commitish) && remote_ref$commitish != "") { gh_commitish_ref <- remote_ref @@ -320,7 +322,7 @@ get_ref_release <- function(remote_ref) { } else { max_ver <- ref_candidates[[1]] max_ref <- names(ref_candidates[1]) - for (i in 2:length(ref_candidates)) { + for (i in seq_along(ref_candidates)) { i_ver <- ref_candidates[[i]] i_ref <- names(ref_candidates[i]) if (!is.na(i_ver) && i_ver > max_ver) { @@ -337,7 +339,7 @@ get_ref_release <- function(remote_ref) { cond_parse_pkg_ref_release <- function(remote_ref) { has_release <- function(remote_ref) { isFALSE(inherits( - try(remotes::github_remote(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo))), + try(remotes::github_remote(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo)), silent = TRUE), "try-error" )) } From 9f0d7ec0a4823723910347c6ac68713dc7dcb4d2 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 13 May 2024 17:01:19 +0200 Subject: [PATCH 05/19] test: force use binaries to avoid building and compilation --- R/utils.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/utils.R b/R/utils.R index a563a065..38f186aa 100644 --- a/R/utils.R +++ b/R/utils.R @@ -10,6 +10,7 @@ pkgenv <- new.env(parent = emptyenv()) default_config <- function() { list( dependencies = c(.desc_field, pkgdepends::as_pkg_dependencies(TRUE)$direct), + cran_mirror = pak::repo_resolve("PPM@latest"), library = tempfile() ) } From b3596eb60c3f361e4d138af318a83981dd4547c0 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 13 May 2024 17:14:43 +0200 Subject: [PATCH 06/19] use pkgcache instead of pak; docs --- R/utils.R | 4 ++-- man/map_key_character.Rd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index 38f186aa..6e2df40b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -10,7 +10,7 @@ pkgenv <- new.env(parent = emptyenv()) default_config <- function() { list( dependencies = c(.desc_field, pkgdepends::as_pkg_dependencies(TRUE)$direct), - cran_mirror = pak::repo_resolve("PPM@latest"), + cran_mirror = pkgcache::repo_resolve("PPM@latest"), library = tempfile() ) } @@ -169,7 +169,7 @@ local_description <- function(pkg_list = c(pkgdepends = "Import"), #' Support function to reduce repetitive code #' #' @param x (`list`) list of lists where each internal list contain the same key -#' @param field (`character(1)`) key of field to retrieve +#' @param key (`character(1)`) key of field to retrieve #' #' @keywords internal #' diff --git a/man/map_key_character.Rd b/man/map_key_character.Rd index 05e6c552..f89fd78e 100644 --- a/man/map_key_character.Rd +++ b/man/map_key_character.Rd @@ -10,7 +10,7 @@ map_key_character(x, key) \arguments{ \item{x}{(\code{list}) list of lists where each internal list contain the same key} -\item{field}{(\code{character(1)}) key of field to retrieve} +\item{key}{(\code{character(1)}) key of field to retrieve} } \description{ Support function to reduce repetitive code From 06238c3f73106c8555e964f34940a4c270131924 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 13 May 2024 17:26:06 +0200 Subject: [PATCH 07/19] add to its own Config/Needs/verdepcheck --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 3c5574e8..e01867f3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,6 +31,7 @@ Suggests: pingr, testthat (>= 3.0.4) Config/Needs/verdepcheck: + r-lib/cli, r-lib/desc, r-lib/gh, r-lib/pkgcache, From 8229d4d428aa913141b19be5f8d2985e88a4e87e Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Tue, 14 May 2024 18:39:28 +0200 Subject: [PATCH 08/19] use binary repo for min_isolated --- R/utils.R | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/R/utils.R b/R/utils.R index 6e2df40b..6ef83f8f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -31,35 +31,22 @@ base_pkgs <- function() { #' get_ppm_snapshot_by_date("2023-08-01") #' get_ppm_snapshot_by_date(Sys.Date() + 10) get_ppm_snapshot_by_date <- function(date) { - fallback_repo <- file.path(pkgcache::ppm_repo_url(), "latest") - if (is.na(date) || is.infinite(date)) { - return(fallback_repo) - } - - snaps <- pkgcache::ppm_snapshots() - res <- as.character(as.Date(utils::head( - snaps[as.Date(snaps$date) > as.Date(date), "date"], - 1 - ))) - if (length(res) == 0) { - warning(sprintf( - paste0( - "Cannot find PPM snapshot for date after %s.", - " Will use latest ppm snapshot instead." - ), - as.character(date) - )) - return(fallback_repo) - } - parse_ppm_url(res) -} - -#' @importFrom pkgcache ppm_repo_url -parse_ppm_url <- function(snapshot) { - file.path(pkgcache::ppm_repo_url(), snapshot) + tryCatch({ + # https://github.com/r-lib/pkgcache/issues/110 + # pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) + snaps <- pkgcache::ppm_snapshots() + date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1]) + if (length(date_snap) == 0) { + stop("No PPM snapshot found for the given date.") + } + file.path(pkgcache::ppm_repo_url(), date_snap) + gsub("latest", date_snap, pkgcache::repo_resolve("PPM@latest")) + }, error = function(err) { + pkgcache::repo_resolve("PPM@latest") + }) } -#' Resolve the dependencies of package based on the release date + 1 +#' Resolve the dependencies of a package based on its release date + 1. #' #' @importFrom pkgdepends new_pkg_deps parse_pkg_ref #' @keywords internal From a10eef96539d30661816016c7139afbb1ce59d2d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 16:41:38 +0000 Subject: [PATCH 09/19] [skip style] [skip vbump] Restyle files --- R/utils.R | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/R/utils.R b/R/utils.R index 6ef83f8f..5a222580 100644 --- a/R/utils.R +++ b/R/utils.R @@ -31,19 +31,22 @@ base_pkgs <- function() { #' get_ppm_snapshot_by_date("2023-08-01") #' get_ppm_snapshot_by_date(Sys.Date() + 10) get_ppm_snapshot_by_date <- function(date) { - tryCatch({ - # https://github.com/r-lib/pkgcache/issues/110 - # pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) - snaps <- pkgcache::ppm_snapshots() - date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1]) - if (length(date_snap) == 0) { - stop("No PPM snapshot found for the given date.") + tryCatch( + { + # https://github.com/r-lib/pkgcache/issues/110 + # pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) + snaps <- pkgcache::ppm_snapshots() + date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1]) + if (length(date_snap) == 0) { + stop("No PPM snapshot found for the given date.") + } + file.path(pkgcache::ppm_repo_url(), date_snap) + gsub("latest", date_snap, pkgcache::repo_resolve("PPM@latest")) + }, + error = function(err) { + pkgcache::repo_resolve("PPM@latest") } - file.path(pkgcache::ppm_repo_url(), date_snap) - gsub("latest", date_snap, pkgcache::repo_resolve("PPM@latest")) - }, error = function(err) { - pkgcache::repo_resolve("PPM@latest") - }) + ) } #' Resolve the dependencies of a package based on its release date + 1. From 0dfd27e94c7f5ae28e4913d600a91651e31e9868 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 16:41:46 +0000 Subject: [PATCH 10/19] [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update --- man/resolve_ppm_snapshot.Rd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/resolve_ppm_snapshot.Rd b/man/resolve_ppm_snapshot.Rd index 11b8613c..977c3ec5 100644 --- a/man/resolve_ppm_snapshot.Rd +++ b/man/resolve_ppm_snapshot.Rd @@ -2,11 +2,11 @@ % Please edit documentation in R/utils.R \name{resolve_ppm_snapshot} \alias{resolve_ppm_snapshot} -\title{Resolve the dependencies of package based on the release date + 1} +\title{Resolve the dependencies of a package based on its release date + 1.} \usage{ resolve_ppm_snapshot(pkg_ref_str, operator, pkg_version) } \description{ -Resolve the dependencies of package based on the release date + 1 +Resolve the dependencies of a package based on its release date + 1. } \keyword{internal} From 44554bd40539a42da340cb21b4df67bb34756bc5 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Tue, 14 May 2024 18:52:18 +0200 Subject: [PATCH 11/19] lint --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 5a222580..68359e39 100644 --- a/R/utils.R +++ b/R/utils.R @@ -34,7 +34,7 @@ get_ppm_snapshot_by_date <- function(date) { tryCatch( { # https://github.com/r-lib/pkgcache/issues/110 - # pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) + # uncomment this: pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) snaps <- pkgcache::ppm_snapshots() date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1]) if (length(date_snap) == 0) { From c15cb55e52e328139fd366cb33c180d9aed662ba Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Thu, 16 May 2024 11:36:44 +0200 Subject: [PATCH 12/19] Update R/get_ref.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> --- R/get_ref.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/get_ref.R b/R/get_ref.R index 3dade134..a058aafa 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -327,6 +327,7 @@ get_ref_release <- function(remote_ref) { i_ref <- names(ref_candidates[i]) if (!is.na(i_ver) && i_ver > max_ver) { max_ref <- i_ref + max_ver <- i_ver } } return(pkgdepends::parse_pkg_ref(max_ref)) From aea4aa8458918d7a1487a51a4af775e3c85564a2 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Thu, 16 May 2024 11:37:11 +0200 Subject: [PATCH 13/19] Update R/get_ref.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> --- R/get_ref.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/get_ref.R b/R/get_ref.R index a058aafa..92e0dff5 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -292,7 +292,7 @@ get_ref_release <- function(remote_ref) { if (check_if_on_cran(remote_ref)) { cran_ref <- remote_ref$package cran_ver <- get_version(pkgdepends::parse_pkg_ref(cran_ref)) - ref_candidates <- append(ref_candidates, setNames(list(cran_ver), cran_ref)) + ref_candidates <- c(ref_candidates, setNames(list(cran_ver), cran_ref)) } if (inherits(remote_ref, "remote_ref_github")) { gh_release_ref <- cond_parse_pkg_ref_release(remote_ref) From 39e04f2a8b92ea486a64c730dbdef33877cd3f2b Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Thu, 16 May 2024 11:40:17 +0200 Subject: [PATCH 14/19] review comments; other minor stuff --- R/get_ref.R | 59 ++++++++----------- R/solve.R | 4 +- R/utils.R | 2 +- man/get_desc_from_gh.Rd | 2 + man/get_ref_release.Rd | 6 ++ man/get_release_date.Rd | 2 +- .../test-deps_installation_proposal.R | 8 +-- 7 files changed, 42 insertions(+), 41 deletions(-) diff --git a/R/get_ref.R b/R/get_ref.R index 92e0dff5..8319aab1 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -14,7 +14,7 @@ get_ref_min_incl_cran <- function(remote_ref, op = "", op_ver = "") { } #' @rdname get_ref_min_incl_cran -#' @exportS3Method get_ref_min_incl_cran remote_ref +#' @export #' @examples #' verdepcheck:::get_ref_min_incl_cran(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" @@ -25,7 +25,7 @@ get_ref_min_incl_cran.remote_ref <- function(remote_ref, op = "", op_ver = "") { #' @rdname get_ref_min_incl_cran #' @importFrom pkgdepends parse_pkg_ref -#' @exportS3Method get_ref_min_incl_cran remote_ref_github +#' @export #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" #' verdepcheck:::get_ref_min_incl_cran(pkgdepends::parse_pkg_ref("cran/dplyr")) get_ref_min_incl_cran.remote_ref_github <- function(remote_ref, op = "", op_ver = "") { @@ -77,7 +77,7 @@ get_ref_min <- function(remote_ref, op = "", op_ver = "") { } #' @rdname get_ref_min -#' @exportS3Method get_ref_min remote_ref +#' @export #' @examples #' get_ref_min(pkgdepends::parse_pkg_ref("bioc::MultiAssayExperiment")) get_ref_min.remote_ref <- function(remote_ref, op = "", op_ver = "") { @@ -88,7 +88,7 @@ get_ref_min.remote_ref <- function(remote_ref, op = "", op_ver = "") { #' to obtain historical data. #' #' @rdname get_ref_min -#' @exportS3Method get_ref_min remote_ref_cran +#' @export #' @importFrom cli cli_alert_danger #' @importFrom pkgcache cran_archive_list meta_cache_list #' @importFrom pkgdepends parse_pkg_ref @@ -101,7 +101,7 @@ get_ref_min.remote_ref_cran <- function(remote_ref, op = "", op_ver = "") { } x_pkg_cache <- pkgcache::meta_cache_list(remote_ref$package) - x_pkg_cache_archive <- pkgcache::cran_archive_list(package = remote_ref$package) + x_pkg_cache_archive <- pkgcache::cran_archive_list(packages = remote_ref$package) pv <- unique(c(x_pkg_cache_archive$version, x_pkg_cache$version)) pv <- stats::setNames(package_version(pv), pv) pv <- filter_valid_version(pv, op, op_ver) @@ -125,7 +125,7 @@ get_ref_min.remote_ref_cran <- function(remote_ref, op = "", op_ver = "") { } #' @rdname get_ref_min -#' @exportS3Method get_ref_min remote_ref_standard +#' @export #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" #' get_ref_min(pkgdepends::parse_pkg_ref("dplyr")) get_ref_min.remote_ref_standard <- function(remote_ref, op = "", op_ver = "") { @@ -136,7 +136,7 @@ get_ref_min.remote_ref_standard <- function(remote_ref, op = "", op_ver = "") { #' and then [`gh::gh()`] to download `DESCRIPTION` file and then read package version. #' #' @rdname get_ref_min -#' @exportS3Method get_ref_min remote_ref_github +#' @export #' @importFrom pkgdepends parse_pkg_ref #' #' @examplesIf gh::gh_token() != "" @@ -254,7 +254,7 @@ get_gh_tags <- function(org, repo, max_date = Sys.Date() + 1, min_date = as.Date #' @importFrom gh gh #' @keywords internal #' -#' @examples +#' @examplesIf gh::gh_token() != "" #' verdepcheck:::get_desc_from_gh("tidyverse", "dplyr") #' verdepcheck:::get_desc_from_gh("tidyverse", "dplyr", "v1.1.0") get_desc_from_gh <- function(org, repo, ref = "") { @@ -284,6 +284,10 @@ get_ref_max <- function(remote_ref) { #' #' @importFrom pkgdepends parse_pkg_ref #' @export +#' +#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" +#' get_ref_release(pkgdepends::parse_pkg_ref("dplyr")) +#' get_ref_release(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) get_ref_release <- function(remote_ref) { # create list of ref candidates to check # return the one of the highest version @@ -301,15 +305,13 @@ get_ref_release <- function(remote_ref) { ref_candidates <- c(ref_candidates, setNames(list(gh_release_ver), gh_release_ref$ref)) } - if (!is.null(remote_ref$commitish) && remote_ref$commitish != "") { - gh_commitish_ref <- remote_ref - gh_commitish_ver <- get_version(gh_commitish_ref) - ref_candidates <- c(ref_candidates, setNames(list(gh_commitish_ver), gh_commitish_ref$ref)) - } - if (!is.null(remote_ref$pull) && remote_ref$pull != "") { - gh_pull_ref <- remote_ref - gh_pull_ver <- get_version(gh_pull_ref) - ref_candidates <- c(ref_candidates, setNames(list(gh_pull_ver), gh_pull_ref$ref)) + if ( + (!is.null(remote_ref$commitish) && remote_ref$commitish != "") || + (!is.null(remote_ref$pull) && remote_ref$pull != "") + ) { + gh_ref <- remote_ref + gh_ver <- get_version(gh_ref) + ref_candidates <- c(ref_candidates, setNames(list(gh_ver), gh_ref$ref)) } } else { input_ref <- remote_ref$ref @@ -338,6 +340,8 @@ get_ref_release <- function(remote_ref) { #' @importFrom remotes github_remote #' @keywords internal cond_parse_pkg_ref_release <- function(remote_ref) { + stopifnot(inherits(remote_ref, "remote_ref_github")) + has_release <- function(remote_ref) { isFALSE(inherits( try(remotes::github_remote(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo)), silent = TRUE), @@ -345,18 +349,7 @@ cond_parse_pkg_ref_release <- function(remote_ref) { )) } parse_pkg_ref_remote <- function(remote_ref) { - # temporary fix for https://github.com/r-lib/pkgdepends/issues/275#issuecomment-1461787363 - # @TODO: replace it with below one-liner if fixed - # parse_pkg_ref(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo)) # nolint - pkgdepends::parse_pkg_ref( - sprintf( - "%s=%s/%s@%s", - remote_ref$package, - remote_ref$username, - remote_ref$repo, - remotes::github_remote(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo))$ref - ) - ) + parse_pkg_ref(sprintf("%s/%s@*release", remote_ref$username, remote_ref$repo)) # nolint } if (has_release(remote_ref)) { @@ -378,7 +371,7 @@ get_version <- function(remote_ref) { #' @rdname get_version #' @importFrom pkgdepends new_pkg_deps -#' @exportS3Method get_version remote_ref +#' @export #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" #' get_version(pkgdepends::parse_pkg_ref("dplyr")) #' get_version(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) @@ -405,10 +398,10 @@ get_release_date <- function(remote_ref) { } #' @rdname get_release_date -#' @exportS3Method get_release_date remote_ref_github +#' @export #' @importFrom gh gh_gql #' -#' @examplesIf gh::gh_token() != "" +#' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" && gh::gh_token() != "" #' get_release_date(pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0")) get_release_date.remote_ref_github <- function(remote_ref) { x <- pkgdepends::new_pkg_deps(remote_ref$ref, config = list(dependencies = FALSE)) @@ -443,7 +436,7 @@ get_release_date.remote_ref_github <- function(remote_ref) { #' Get release date from GitHub references #' #' @rdname get_release_date -#' @exportS3Method get_release_date remote_ref_cran +#' @export #' #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" #' remote_ref <- pkgdepends::parse_pkg_ref("dplyr@1.1.0") diff --git a/R/solve.R b/R/solve.R index e681b84e..9b5d9185 100644 --- a/R/solve.R +++ b/R/solve.R @@ -9,7 +9,7 @@ solve_ip <- function(ip) { UseMethod("solve_ip", ip) } -#' @exportS3Method solve_ip deps_installation_proposal +#' @export solve_ip.deps_installation_proposal <- function(ip) { ip$solve() resolve_ignoring_release_remote(ip) @@ -24,7 +24,7 @@ solve_ip.deps_installation_proposal <- function(ip) { #' #' @importFrom stats na.omit #' -#' @exportS3Method solve_ip min_isolated_deps_installation_proposal +#' @export solve_ip.min_isolated_deps_installation_proposal <- function(ip) { # nolint ip$resolve() res <- ip$get_resolution() diff --git a/R/utils.R b/R/utils.R index 68359e39..5593412b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -15,7 +15,7 @@ default_config <- function() { ) } append_config <- function(x1, x2) { - append(x1, x2)[unique(c(names(x1), names(x2)))] + modifyList(x1, x2) } #' @importFrom utils installed.packages diff --git a/man/get_desc_from_gh.Rd b/man/get_desc_from_gh.Rd index 2bf134a7..2122706a 100644 --- a/man/get_desc_from_gh.Rd +++ b/man/get_desc_from_gh.Rd @@ -10,7 +10,9 @@ get_desc_from_gh(org, repo, ref = "") Get DESCRIPTION from GitHub Repository } \examples{ +\dontshow{if (gh::gh_token() != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} verdepcheck:::get_desc_from_gh("tidyverse", "dplyr") verdepcheck:::get_desc_from_gh("tidyverse", "dplyr", "v1.1.0") +\dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/man/get_ref_release.Rd b/man/get_ref_release.Rd index d7bcd39c..21d92028 100644 --- a/man/get_ref_release.Rd +++ b/man/get_ref_release.Rd @@ -15,3 +15,9 @@ get_ref_release(remote_ref) \description{ Get reference to the release version of the package. } +\examples{ +\dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +get_ref_release(pkgdepends::parse_pkg_ref("dplyr")) +get_ref_release(pkgdepends::parse_pkg_ref("tidyverse/dplyr")) +\dontshow{\}) # examplesIf} +} diff --git a/man/get_release_date.Rd b/man/get_release_date.Rd index 9aba4136..47beab33 100644 --- a/man/get_release_date.Rd +++ b/man/get_release_date.Rd @@ -24,7 +24,7 @@ Get release date. Get release date from GitHub references } \examples{ -\dontshow{if (gh::gh_token() != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "" && gh::gh_token() != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} get_release_date(pkgdepends::parse_pkg_ref("tidyverse/dplyr@v1.1.0")) \dontshow{\}) # examplesIf} \dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} diff --git a/tests/testthat/test-deps_installation_proposal.R b/tests/testthat/test-deps_installation_proposal.R index aa21d985..2bd255bc 100644 --- a/tests/testthat/test-deps_installation_proposal.R +++ b/tests/testthat/test-deps_installation_proposal.R @@ -235,8 +235,8 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles tern an withr::defer(unlink(x$get_config()$library)) x <- test_proposal_common(x, "tern", "source", "0.8.3", NULL) - x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip = FALSE) - test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip = FALSE) + x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip_flag = FALSE) }) # Test for encapsulation isssue where another dependency (primary or in the tree) @@ -259,8 +259,8 @@ test_that("new_min_isolated_deps_installation_proposal correctly resolves a diff withr::defer(unlink(x$get_config()$library)) x <- test_proposal_common(x, "tern", "source", "0.8.3", NULL) - x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip = FALSE) - test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip = FALSE) + x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip_flag = FALSE) }) # ################################################################# From 2bb3914ec401e541712477a2a61c614fa5703161 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Thu, 16 May 2024 12:01:41 +0200 Subject: [PATCH 15/19] rm platform arg --- tests/testthat/helper.R | 8 +--- .../test-deps_installation_proposal.R | 42 +++++++++---------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 30d14488..4defb0fa 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -30,8 +30,6 @@ skip_if_empty_gh_token <- function() { #' @param x (`pkg_installation_proposal` object) Valid proposal created by one #' of the available methods. #' @param pkg_name (`string`) Name of package that is being tested for version. -#' @param platform (optional `string`) Name of the platform, should be 'source' in -#' most cases. #' @param pkg_ver_target (optional `string`) version that is expected to be in the #' proposal. A `NULL` value indicates to use the latest version on CRAN or a #' GitHub repository reference @@ -45,7 +43,6 @@ skip_if_empty_gh_token <- function() { #' @keywords internal test_proposal_common <- function(x, pkg_name = "pkgdepends", - platform = "source", pkg_ver_target = NULL, pkg_gh_str = NULL, solve_ip_flag = TRUE) { @@ -60,7 +57,7 @@ test_proposal_common <- function(x, x_solution_pkg <- subset( x_solution, - package == pkg_name & platform == "source" + package == pkg_name ) expect_true(nrow(x_solution_pkg) >= 1) @@ -95,7 +92,6 @@ test_proposal_common <- function(x, #' @keywords internal test_proposal_common_bioc <- function(x, pkg_name = "pkgdepends", - platform = "source", solve_ip_flag = TRUE) { expect_s3_class(x, "pkg_installation_proposal") @@ -108,7 +104,7 @@ test_proposal_common_bioc <- function(x, x_solution_pkg <- subset( x_solution, - package == pkg_name & platform == "source" + package == pkg_name ) expect_true(nrow(x_solution_pkg) >= 1) diff --git a/tests/testthat/test-deps_installation_proposal.R b/tests/testthat/test-deps_installation_proposal.R index 2bd255bc..d9263da1 100644 --- a/tests/testthat/test-deps_installation_proposal.R +++ b/tests/testthat/test-deps_installation_proposal.R @@ -6,7 +6,7 @@ test_that("new_max_deps_installation_proposal correctly handles standard referen x <- new_max_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, NULL) + test_proposal_common(x, "pkgdepends", NULL, NULL) }) test_that("new_release_deps_installation_proposal correctly handles standard reference", { @@ -17,7 +17,7 @@ test_that("new_release_deps_installation_proposal correctly handles standard ref x <- new_release_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, NULL) + test_proposal_common(x, "pkgdepends", NULL, NULL) }) test_that("new_min_isolated_installation_proposal correctly handles standard reference", { @@ -28,7 +28,7 @@ test_that("new_min_isolated_installation_proposal correctly handles standard ref x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.1.0", NULL) + test_proposal_common(x, "pkgdepends", "0.1.0", NULL) }) test_that("new_min_cohort_deps_installation_proposal correctly handles standard reference", { @@ -39,7 +39,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles standard x <- new_min_cohort_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.1.0", NULL) + test_proposal_common(x, "pkgdepends", "0.1.0", NULL) }) # ################################################################# @@ -69,7 +69,7 @@ test_that("new_max_deps_installation_proposal correctly handles / ref x <- new_max_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, remote_str) + test_proposal_common(x, "pkgdepends", NULL, remote_str) }) test_that("new_max_deps_installation_proposal correctly handles /@*release reference", { @@ -85,7 +85,7 @@ test_that("new_max_deps_installation_proposal correctly handles /@*re x <- new_max_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, remote_str) + test_proposal_common(x, "pkgdepends", NULL, remote_str) }) test_that("new_max_deps_installation_proposal correctly handles /@ ref. (particular remote tag)", { @@ -101,7 +101,7 @@ test_that("new_max_deps_installation_proposal correctly handles /@/ ref. (without Config/Need/verdpcheck)", { @@ -113,7 +113,7 @@ test_that("new_max_deps_installation_proposal correctly handles / ref x <- new_max_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, remote_str) + test_proposal_common(x, "pkgdepends", NULL, remote_str) }) test_that("new_release_deps_installation_proposal correctly handles / reference", { @@ -125,7 +125,7 @@ test_that("new_release_deps_installation_proposal correctly handles / x <- new_release_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", NULL, NULL) + test_proposal_common(x, "pkgdepends", NULL, NULL) }) test_that("new_min_cohort_deps_installation_proposal correctly handles / reference", { @@ -137,7 +137,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles // reference", { @@ -154,7 +154,7 @@ test_that("new_min_deps_installation_proposal correctly handles / ref x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.1.0", NULL) + test_proposal_common(x, "pkgdepends", "0.1.0", NULL) }) # ################################################################ @@ -179,7 +179,7 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles \">=\" x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.2.0", NULL) + test_proposal_common(x, "pkgdepends", "0.2.0", NULL) }) test_that("new_min_isolated_deps_installation_proposal correctly handles \">=\" dependency for standard reference", { @@ -190,7 +190,7 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles \">=\" x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.2.0", NULL) + test_proposal_common(x, "pkgdepends", "0.2.0", NULL) }) test_that("new_min_cohort_deps_installation_proposal correctly handles \">=\" dependency for / reference", { @@ -201,7 +201,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles \">=\" de x <- new_min_cohort_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.2.0", NULL) + test_proposal_common(x, "pkgdepends", "0.2.0", NULL) }) test_that("new_min_cohort_deps_installation_proposal correctly handles \">=\" dependency for standard reference", { @@ -212,7 +212,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles \">=\" de x <- new_min_cohort_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - test_proposal_common(x, "pkgdepends", "source", "0.2.0", NULL) + test_proposal_common(x, "pkgdepends", "0.2.0", NULL) }) test_that("new_min_isolated_deps_installation_proposal correctly handles tern and rtables", { @@ -234,9 +234,9 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles tern an x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - x <- test_proposal_common(x, "tern", "source", "0.8.3", NULL) - x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip_flag = FALSE) - test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "tern", "0.8.3", NULL) + test_proposal_common(x, "rtables", "0.6.1", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "formatters", "0.5.0", NULL, solve_ip_flag = FALSE) }) # Test for encapsulation isssue where another dependency (primary or in the tree) @@ -258,9 +258,9 @@ test_that("new_min_isolated_deps_installation_proposal correctly resolves a diff x <- new_min_isolated_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) - x <- test_proposal_common(x, "tern", "source", "0.8.3", NULL) - x <- test_proposal_common(x, "rtables", "source", "0.6.1", NULL, solve_ip_flag = FALSE) - test_proposal_common(x, "formatters", "source", "0.5.0", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "tern", "0.8.3", NULL) + test_proposal_common(x, "rtables", "0.6.1", NULL, solve_ip_flag = FALSE) + test_proposal_common(x, "formatters", "0.5.0", NULL, solve_ip_flag = FALSE) }) # ################################################################# From 0bbe250fdaafe2150acfe0ae4ff6d0aba5717b7a Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 17 May 2024 11:29:08 +0200 Subject: [PATCH 16/19] fix tests --- R/get_ref.R | 55 ++++++++++--------- R/utils.R | 2 +- .../test-deps_installation_proposal.R | 10 +--- tests/testthat/test-get_ref.R | 4 +- tests/testthat/test-utils.R | 5 +- 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/R/get_ref.R b/R/get_ref.R index 8319aab1..2bc46d40 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -468,32 +468,37 @@ get_release_date.remote_ref <- function(remote_ref) { #' verdepcheck:::get_cran_data("dplyr") #' verdepcheck:::get_cran_data("SummarizedExperiment") get_cran_data <- function(package) { - cran_archive <- pkgcache::cran_archive_list(packages = package)[, c( - "package", "version", "mtime" - )] - cran_current <- pkgcache::meta_cache_list(packages = package)[, c( - "type", "package", "version", "published" - )] - if (all(is.na(cran_current$published))) { - # workaround of https://github.com/r-lib/pkgcache/issues/109 - if (is.null(pkgenv$cache_db)) { - pkgenv$cache_db <- tools::CRAN_package_db() - } - db <- subset(pkgenv$cache_db, pkgenv$cache_db$Package == package) - cran_current <- data.frame( - type = "cran", - package = package, - version = db$Version, - published = as.POSIXct(db$`Date/Publication`) - ) - } + cran_archive <- pkgcache::cran_archive_list(packages = package)[, c("package", "version", "mtime")] + cran_current <- head( + pkgcache::meta_cache_list(packages = package)[, c("type", "package", "version", "published")], + 1 + ) - # Bioc custom logic as packages in Bioconductor do not return a published date - # this will be immediately obsolete if {pkgcache} starts to return a non-NA value - # note: a date is required for the `min_cohort` strategy - bioc_na_mtime_ix <- is.na(cran_current$published) & cran_current$type == "bioc" - if (NROW(cran_current[bioc_na_mtime_ix, ]) > 0) { - cran_current[bioc_na_mtime_ix, "published"] <- Sys.Date() + # handle missing dates + if (nrow(cran_current > 0)) { + if (is.na(cran_current$published)) { + if (cran_current$type == "cran") { + # in general, this should not happen for cran - https://github.com/r-lib/pkgcache/issues/109 + # this is a temporary workaround + if (is.null(pkgenv$cache_db)) { + pkgenv$cache_db <- tools::CRAN_package_db() + } + db <- subset(pkgenv$cache_db, pkgenv$cache_db$Package == package) + cran_current <- data.frame( + type = "cran", + package = package, + version = db$Version[1], + published = as.POSIXct(db$`Date/Publication`[1]) + ) + } else if (cran_current$type == "bioc") { + cran_current <- data.frame( + type = "bioc", + package = package, + version = cran_current$version, + published = Sys.Date() + ) + } + } } # Remove extra columns diff --git a/R/utils.R b/R/utils.R index 5593412b..89f44219 100644 --- a/R/utils.R +++ b/R/utils.R @@ -36,7 +36,7 @@ get_ppm_snapshot_by_date <- function(date) { # https://github.com/r-lib/pkgcache/issues/110 # uncomment this: pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1))) snaps <- pkgcache::ppm_snapshots() - date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1]) + date_snap <- as.character(head(snaps[as.Date(snaps$date) > as.Date(date), "date"], 1)) if (length(date_snap) == 0) { stop("No PPM snapshot found for the given date.") } diff --git a/tests/testthat/test-deps_installation_proposal.R b/tests/testthat/test-deps_installation_proposal.R index d9263da1..8eb903bc 100644 --- a/tests/testthat/test-deps_installation_proposal.R +++ b/tests/testthat/test-deps_installation_proposal.R @@ -289,10 +289,7 @@ test_that("new_min_cohort_deps_installation_proposal correctly handles Bioc pack d_std_path <- local_description(list(SummarizedExperiment = "Import")) - expect_warning( - x <- new_min_cohort_deps_installation_proposal(d_std_path), - "Cannot find PPM snapshot" - ) + x <- new_min_cohort_deps_installation_proposal(d_std_path) withr::defer(unlink(x$get_config()$library)) @@ -309,10 +306,7 @@ test_that("new_min_isolated_deps_installation_proposal correctly handles Bioc pa withr::defer(unlink(x$get_config()$library)) - expect_warning( - test_proposal_common_bioc(x, "SummarizedExperiment"), - "Cannot find PPM snapshot" - ) + test_proposal_common_bioc(x, "SummarizedExperiment") }) test_that("new_release_deps_installation_proposal correctly handles Bioc package", { diff --git a/tests/testthat/test-get_ref.R b/tests/testthat/test-get_ref.R index 6c5ac605..524da724 100644 --- a/tests/testthat/test-get_ref.R +++ b/tests/testthat/test-get_ref.R @@ -24,7 +24,7 @@ test_that("get_release_date.remote_ref_github will only retrieve 1 date for rlan expect_identical(as.Date(result), as.Date("2022-01-20T16:47:02Z")) }) -test_that("get_release_date.remote_ref_github will retrieve missing date (NA) for rlang@0.0.0", { +test_that("get_release_date.remote_ref_github will retrieve missing date (NA) for r-lib/rlang@v0.0.0", { skip_if_offline() skip_if_empty_gh_token() @@ -37,7 +37,7 @@ test_that("get_release_date.remote_ref_github will retrieve missing date (NA) fo expect_s3_class(result, "Date") }) -test_that("get_release_date.remote_ref_cran will retrieve missing date (NA) for rlang@0.0.0", { +test_that("get_release_date.remote_ref_cran will retrieve missing date (NA) for package.does.not.exist@1.1.0", { skip_if_offline() skip_if_empty_gh_token() diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 1e30911d..6bf3a044 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -101,10 +101,7 @@ test_that("get_ppm_snapshot_by_date will accept NA", { test_that("get_ppm_snapshot_by_date will accept dates in the future", { skip_if_offline() auxiliary_fun <- function(days = 0) { - expect_warning( - expect_latest_ppm(get_ppm_snapshot_by_date(Sys.Date())), - "Cannot find PPM snapshot for date" - ) + expect_latest_ppm(get_ppm_snapshot_by_date(Sys.Date())) } auxiliary_fun(0) From 412e3260c1e44f0a592dea1610949b859a3688a5 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 17 May 2024 16:18:31 +0200 Subject: [PATCH 17/19] rename get_cran_data to get_release_data; more accurate release date for bioc packages --- NAMESPACE | 1 + R/get_ref.R | 16 ++++++++++------ man/{get_cran_data.Rd => get_release_data.Rd} | 14 +++++++------- tests/testthat/test-get_ref.R | 4 ++-- 4 files changed, 20 insertions(+), 15 deletions(-) rename man/{get_cran_data.Rd => get_release_data.Rd} (52%) diff --git a/NAMESPACE b/NAMESPACE index ea79ffc3..9e205165 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -49,6 +49,7 @@ importFrom(cli,symbol) importFrom(desc,desc) importFrom(gh,gh) importFrom(gh,gh_gql) +importFrom(jsonlite,fromJSON) importFrom(pkgcache,cran_archive_list) importFrom(pkgcache,meta_cache_list) importFrom(pkgcache,ppm_repo_url) diff --git a/R/get_ref.R b/R/get_ref.R index 2bc46d40..b017ac27 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -443,7 +443,7 @@ get_release_date.remote_ref_github <- function(remote_ref) { #' get_release_date.remote_ref_cran(remote_ref) get_release_date.remote_ref_cran <- function(remote_ref) { result <- subset( - get_cran_data(remote_ref$package), + get_release_data(remote_ref$package), package_version(version, strict = FALSE) == package_version(remote_ref$version, strict = FALSE), select = "mtime" )[[1]][1] @@ -460,14 +460,16 @@ get_release_date.remote_ref <- function(remote_ref) { as.Date(NA_real_) } -#' Get CRAN/Bioconductor metadata information on packages +#' Get data for CRAN/Bioconductor package releases #' #' @importFrom pkgcache cran_archive_list meta_cache_list +#' @importFrom jsonlite fromJSON +#' #' @keywords internal #' @examplesIf Sys.getenv("R_USER_CACHE_DIR", "") != "" -#' verdepcheck:::get_cran_data("dplyr") -#' verdepcheck:::get_cran_data("SummarizedExperiment") -get_cran_data <- function(package) { +#' verdepcheck:::get_release_data("dplyr") +#' verdepcheck:::get_release_data("SummarizedExperiment") +get_release_data <- function(package) { cran_archive <- pkgcache::cran_archive_list(packages = package)[, c("package", "version", "mtime")] cran_current <- head( pkgcache::meta_cache_list(packages = package)[, c("type", "package", "version", "published")], @@ -491,11 +493,13 @@ get_cran_data <- function(package) { published = as.POSIXct(db$`Date/Publication`[1]) ) } else if (cran_current$type == "bioc") { + url <- sprintf("https://packagemanager.posit.co/__api__/repos/4/packages/%s?bioc_version=%s", package, pkgcache::bioc_version()) + release_date <- as.POSIXct(jsonlite::fromJSON(readLines(url, warn = FALSE))$occurred) cran_current <- data.frame( type = "bioc", package = package, version = cran_current$version, - published = Sys.Date() + published = release_date ) } } diff --git a/man/get_cran_data.Rd b/man/get_release_data.Rd similarity index 52% rename from man/get_cran_data.Rd rename to man/get_release_data.Rd index 34e6f37d..3860b7fb 100644 --- a/man/get_cran_data.Rd +++ b/man/get_release_data.Rd @@ -1,18 +1,18 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_ref.R -\name{get_cran_data} -\alias{get_cran_data} -\title{Get CRAN/Bioconductor metadata information on packages} +\name{get_release_data} +\alias{get_release_data} +\title{Get data for CRAN/Bioconductor package releases} \usage{ -get_cran_data(package) +get_release_data(package) } \description{ -Get CRAN/Bioconductor metadata information on packages +Get data for CRAN/Bioconductor package releases } \examples{ \dontshow{if (Sys.getenv("R_USER_CACHE_DIR", "") != "") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -verdepcheck:::get_cran_data("dplyr") -verdepcheck:::get_cran_data("SummarizedExperiment") +verdepcheck:::get_release_data("dplyr") +verdepcheck:::get_release_data("SummarizedExperiment") \dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/tests/testthat/test-get_ref.R b/tests/testthat/test-get_ref.R index 524da724..70cd32ed 100644 --- a/tests/testthat/test-get_ref.R +++ b/tests/testthat/test-get_ref.R @@ -62,10 +62,10 @@ test_that("get_release_date with any class other than remote_ref.{github,cran,st expect_s3_class(result, "Date") }) -test_that("get_cran_data returns date for Bioconductor", { +test_that("get_release_data returns date for Bioconductor", { skip_if_offline() - expect_false(any(is.na(get_cran_data("SummarizedExperiment")$mtime))) + expect_false(any(is.na(get_release_data("SummarizedExperiment")$mtime))) }) test_that("get_ref_release returns a CRAN remote_reference if package exists", { From 35be885ffa024eb29bb4a7e2dac872575b1882d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Mon, 20 May 2024 19:17:45 -0400 Subject: [PATCH 18/19] fix: add jsonlite to description --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index e01867f3..62c3049c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,6 +18,7 @@ Imports: cli (>= 3.6.0), desc (>= 1.2), gh, + jsonlite, pkgcache (>= 2.1.0), pkgdepends (>= 0.5.0), rcmdcheck, @@ -34,6 +35,7 @@ Config/Needs/verdepcheck: r-lib/cli, r-lib/desc, r-lib/gh, + jeroen/jsonlite, r-lib/pkgcache, r-lib/pkgdepends, r-lib/rcmdcheck, From 8a41033aed6cde5aba5d9de6eabe8fd8e51dca25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Mon, 20 May 2024 19:18:00 -0400 Subject: [PATCH 19/19] fix: linter error --- R/get_ref.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/get_ref.R b/R/get_ref.R index b017ac27..33332b87 100644 --- a/R/get_ref.R +++ b/R/get_ref.R @@ -493,7 +493,11 @@ get_release_data <- function(package) { published = as.POSIXct(db$`Date/Publication`[1]) ) } else if (cran_current$type == "bioc") { - url <- sprintf("https://packagemanager.posit.co/__api__/repos/4/packages/%s?bioc_version=%s", package, pkgcache::bioc_version()) + url <- sprintf( + "https://packagemanager.posit.co/__api__/repos/4/packages/%s?bioc_version=%s", + package, + pkgcache::bioc_version() + ) release_date <- as.POSIXct(jsonlite::fromJSON(readLines(url, warn = FALSE))$occurred) cran_current <- data.frame( type = "bioc",