diff --git a/NEWS.md b/NEWS.md index 4c7a68a9..ceba56b3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,13 @@ + # Require 2.0.0.9034 (development version) +* `getCRANrepos()` now also de-duplicates `getOption("repos")` (dropping + duplicate repo URLs, keeping the first occurrence to preserve names) in + addition to stripping the resolved `@CRAN@` placeholder, updating the global + `repos` option in place so downstream resolvers don't query the same repo + twice. Centralizes repo cleanup that previously lived in + `SpaDES.project::setupProject()`. + * Resilience to the transient `cannot open URL 'http://bioconductor.org/config.yaml'` failure. pak/pkgcache fetch the Bioconductor config at startup, and the entire pak call dies when @@ -95,8 +103,6 @@ `?RequireOptions`. (Flows through `SpaDES.project::setupProject()` via `options = list(Require.noRemotes = TRUE)`.) -# Require 2.0.0.9027 (development version) - * A pinned GitHub commit (`Install("owner/repo@")`) is now treated as an exact-version pin under pak: it installs that exact commit even when a *different* version is already installed (previously a bare `@sha` was a no-op @@ -108,8 +114,6 @@ qualify (`isExplicitShaPin()`); branch refs, `(HEAD)` refs, and refs already carrying a version spec are unaffected. -# Require 2.0.0.9026 (development version) - * Performance: the offline (pak download-cache) install path no longer degrades to slow one-at-a-time installs when the resolved set contains a package as both a CRAN ref and a GitHub ref (e.g. `SpaDES.tools (>= 2.0.0)` plus diff --git a/R/CRAN.R b/R/CRAN.R index 8d2a8ef2..cd7d76c9 100644 --- a/R/CRAN.R +++ b/R/CRAN.R @@ -52,13 +52,15 @@ getCRANrepos <- function(repos = NULL, ind) { repos <- getCRANrepos(repos, 1) } } + # Clean up the global repos option: drop the "@CRAN@" placeholder (now + # resolved above) and any duplicate repo URLs so downstream resolvers don't + # query the same repo twice. Keep the first occurrence to preserve names. reposNow <- getOption("repos") - hasAts <- reposNow %in% "@CRAN@" - if (isTRUE(any(hasAts))) { - options(repos = reposNow[!hasAts]) + keep <- !(reposNow %in% "@CRAN@") & !duplicated(unname(reposNow)) + if (!all(keep)) { + options(repos = reposNow[keep]) } - return(repos) }