@@ -63,6 +63,10 @@ local({
6363 if (is.environment(x ) || length(x )) x else y
6464 }
6565
66+ `%??%` <- function (x , y ) {
67+ if (is.null(x )) y else x
68+ }
69+
6670 bootstrap <- function (version , library ) {
6771
6872 # attempt to download renv
@@ -83,11 +87,22 @@ local({
8387
8488 renv_bootstrap_repos <- function () {
8589
90+ # get CRAN repository
91+ cran <- getOption(" renv.repos.cran" , " https://cloud.r-project.org" )
92+
8693 # check for repos override
8794 repos <- Sys.getenv(" RENV_CONFIG_REPOS_OVERRIDE" , unset = NA )
88- if (! is.na(repos ))
95+ if (! is.na(repos )) {
96+
97+ # check for RSPM; if set, use a fallback repository for renv
98+ rspm <- Sys.getenv(" RSPM" , unset = NA )
99+ if (identical(rspm , repos ))
100+ repos <- c(RSPM = rspm , CRAN = cran )
101+
89102 return (repos )
90103
104+ }
105+
91106 # check for lockfile repositories
92107 repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity )
93108 if (! inherits(repos , " error" ) && length(repos ))
@@ -104,10 +119,7 @@ local({
104119 repos <- getOption(" repos" )
105120
106121 # ensure @CRAN@ entries are resolved
107- repos [repos == " @CRAN@" ] <- getOption(
108- " renv.repos.cran" ,
109- " https://cloud.r-project.org"
110- )
122+ repos [repos == " @CRAN@" ] <- cran
111123
112124 # add in renv.bootstrap.repos if set
113125 default <- c(FALLBACK = " https://cloud.r-project.org" )
0 commit comments