Skip to content

Commit

Permalink
Observe use_bioconductor in repo_*() functions as well
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Dec 17, 2024
1 parent 0b4b522 commit e10e20f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
37 changes: 23 additions & 14 deletions R/repo.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(...),
Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -135,17 +142,19 @@ 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(...),
list(r_version, bioc, cran_mirror)
)
}

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)
}

Expand Down
2 changes: 1 addition & 1 deletion man/repo_get.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/repo_status.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e10e20f

Please sign in to comment.