diff --git a/NEWS.md b/NEWS.md index 3a348a4e8..7f0ec1ce1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # pak (development version) -* Use `use_bioconductor` configuration option when creating cache in `R/cache.R` (https://github.com/r-lib/pak/issues/295, @meztez). +* pak now uses the `use_bioconductor` configuration option in `meta_*()` and + `repo_*()` functions (#295, #726, @meztez). # pak 0.8.0 diff --git a/R/repo.R b/R/repo.R index 496dc98e2..752ba5905 100644 --- a/R/repo.R +++ b/R/repo.R @@ -7,13 +7,15 @@ #' summary of the data, and it returns its result invisibly. #' #' @param platforms Platforms to use, default is the current platform, -#' plus source packages. +#' plus source packages, via the [`pkg.platforms`][pak-config] option. #' @param r_version R version(s) to use, the default is the current #' R version, via [getRversion()]. #' @param bioc Whether to add the Bioconductor repositories. If you #' already configured them via `options(repos)`, then you can -#' set this to `FALSE`. -#' @param cran_mirror The CRAN mirror to use. +#' set this to `FALSE`. Defaults to the [`pkg.use_bioconductor`][pak-config] +#' option. +#' @param cran_mirror The CRAN mirror to use. Defaults to the +#' [`pkg.cran_mirror`][pak-config] option. #' @return A data frame that has a row for every repository, on every #' queried platform and R version. It has these columns: #' * `name`: the name of the repository. This comes from the names @@ -55,7 +57,7 @@ #' ``` repo_status <- function(platforms = NULL, r_version = getRversion(), - bioc = TRUE, cran_mirror = NULL) { + bioc = NULL, cran_mirror = NULL) { load_extra("pillar") remote( function(...) asNamespace("pak")$repo_status_internal(...), @@ -64,10 +66,12 @@ repo_status <- function(platforms = NULL, r_version = getRversion(), } repo_status_internal <- function(platforms = NULL, r_version = getRversion(), - bioc = TRUE, cran_mirror = NULL) { + bioc = NULL, cran_mirror = NULL) { - platforms <- platforms %||% pkgcache::default_platforms() - cran_mirror <- cran_mirror %||% pkgcache::default_cran_mirror() + config <- pkgdepends::current_config() + platforms <- platforms %||% config$get("platforms") + cran_mirror <- cran_mirror %||% config$get("cran_mirror") + bioc <- bioc %||% config$get("use_bioconductor") tab <- pkgcache::repo_status( platforms = platforms, @@ -84,7 +88,8 @@ repo_status_internal <- function(platforms = NULL, r_version = getRversion(), #' @rdname repo_status repo_ping <- function(platforms = NULL, r_version = getRversion(), - bioc = TRUE, cran_mirror = NULL) { + bioc = NULL, cran_mirror = NULL) { + ret <- remote( function(...) asNamespace("pak")$repo_ping_internal(...), list(platforms, r_version, bioc, cran_mirror) @@ -95,10 +100,12 @@ repo_ping <- function(platforms = NULL, r_version = getRversion(), } repo_ping_internal <- function(platforms = NULL, r_version = getRversion(), - bioc = TRUE, cran_mirror = NULL) { + bioc = NULL, cran_mirror = NULL) { - platforms <- platforms %||% pkgcache::default_platforms() - cran_mirror <- cran_mirror %||% pkgcache::default_cran_mirror() + config <- pkgdepends::current_config() + platforms <- platforms %||% config$get("platforms") + cran_mirror <- cran_mirror %||% config$get("cran_mirror") + bioc <- bioc %||% config$get("use_bioconductor") tab <- pkgcache::repo_status( platforms = platforms, @@ -135,7 +142,7 @@ repo_ping_internal <- function(platforms = NULL, r_version = getRversion(), #' ``` repo_get <- function(r_version = getRversion(), - bioc = TRUE, cran_mirror = NULL) { + bioc = NULL, cran_mirror = NULL) { load_extra("pillar") remote( function(...) asNamespace("pak")$repo_get_internal(...), @@ -143,9 +150,11 @@ repo_get <- function(r_version = getRversion(), ) } -repo_get_internal <- function(r_version = getRversion(), bioc = TRUE, +repo_get_internal <- function(r_version = getRversion(), bioc = NULL, cran_mirror = NULL) { - cran_mirror = cran_mirror %||% pkgcache::default_cran_mirror() + config <- pkgdepends::current_config() + cran_mirror <- cran_mirror %||% config$get("cran_mirror") + bioc <- bioc %||% config$get("use_bioconductor") pkgcache::repo_get(r_version, bioc, cran_mirror) } diff --git a/man/repo_get.Rd b/man/repo_get.Rd index 1ef531fdc..6372dc1b5 100644 --- a/man/repo_get.Rd +++ b/man/repo_get.Rd @@ -4,7 +4,7 @@ \alias{repo_get} \title{Query the currently configured CRAN-like repositories} \usage{ -repo_get(r_version = getRversion(), bioc = TRUE, cran_mirror = NULL) +repo_get(r_version = getRversion(), bioc = NULL, cran_mirror = NULL) } \arguments{ \item{r_version}{R version to use to determine the correct Bioconductor diff --git a/man/repo_status.Rd b/man/repo_status.Rd index 8c512d3eb..cc458d0f1 100644 --- a/man/repo_status.Rd +++ b/man/repo_status.Rd @@ -8,29 +8,31 @@ repo_status( platforms = NULL, r_version = getRversion(), - bioc = TRUE, + bioc = NULL, cran_mirror = NULL ) repo_ping( platforms = NULL, r_version = getRversion(), - bioc = TRUE, + bioc = NULL, cran_mirror = NULL ) } \arguments{ \item{platforms}{Platforms to use, default is the current platform, -plus source packages.} +plus source packages, via the \code{\link[=pak-config]{pkg.platforms}} option.} \item{r_version}{R version(s) to use, the default is the current R version, via \code{\link[=getRversion]{getRversion()}}.} \item{bioc}{Whether to add the Bioconductor repositories. If you already configured them via \code{options(repos)}, then you can -set this to \code{FALSE}.} +set this to \code{FALSE}. Defaults to the \code{\link[=pak-config]{pkg.use_bioconductor}} +option.} -\item{cran_mirror}{The CRAN mirror to use.} +\item{cran_mirror}{The CRAN mirror to use. Defaults to the +\code{\link[=pak-config]{pkg.cran_mirror}} option.} } \value{ A data frame that has a row for every repository, on every