Skip to content

Commit

Permalink
simplify repos handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Aug 20, 2024
1 parent 7c6cd46 commit 59c94bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
2 changes: 0 additions & 2 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,8 @@ renv_init_repos <- function(repos = getOption("repos")) {

if (isdefault) {
repos[["CRAN"]] <- config$ppm.url()
return(repos)
}

# repos appears to have been configured separately; just use it
repos

}
Expand Down
47 changes: 2 additions & 45 deletions R/lockfile.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,52 +25,9 @@ renv_lockfile_init_r_version <- function(project) {

}

renv_lockfile_init_r_repos <- function(project) {

repos <- getOption("repos")

# save names
nms <- names(repos)

# force as character
repos <- as.character(repos)

# clear RStudio attribute
renv_lockfile_init_r_repos <- function(project, repos = getOption("repos")) {
attr(repos, "RStudio") <- NULL

# check for default repositories
#
# note that if the user is using RStudio, we only want to override
# the repositories if they haven't explicitly set their own repo URL
#
# https://github.com/rstudio/renv/issues/1782
rstudio <- structure(
list(CRAN = "https://cran.rstudio.com/"),
RStudio = TRUE
)

isdefault <-
identical(repos, list(CRAN = "@CRAN@")) ||
identical(repos, rstudio)

if (isdefault) {
repos[["CRAN"]] <- config$ppm.url()
}

# remove PPM bits from URL
if (renv_ppm_enabled()) {
pattern <- "/__[^_]+__/[^/]+/"
repos <- sub(pattern, "/", repos)
}

# force as list
repos <- as.list(repos)

# ensure names
names(repos) <- nms

repos

convert(repos, "list")
}

renv_lockfile_init_r <- function(project) {
Expand Down

0 comments on commit 59c94bf

Please sign in to comment.