Skip to content

Commit

Permalink
Update default repos to include all the things possible
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 12, 2024
1 parent a356b21 commit 7ea68dc
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions Rprofile
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# Enable CRAN and BIOC
options(repos = c(CRAN = "https://cloud.r-project.org"))
utils::setRepositories(ind = 1:4)

local({
# Enable RSPM
rver <- getRversion()
r_branch <- substr(getRversion(), 1, 3)
distro <- system2('lsb_release', '-sc', stdout = TRUE)
options(HTTPUserAgent = sprintf("R/%s R (%s)", rver, paste(rver, R.version$platform, R.version$arch, R.version$os)))
options(repos = c(P3M = sprintf("https://p3m.dev/all/__linux__/%s/latest", distro), getOption("repos")))
binary_universe <- function(universe){
sprintf("%s/bin/linux/%s/%s", universe, distro, r_branch)
}
bioc_urls <- function(){
ver <- utils:::.BioC_version_associated_with_R_version();
c(
BioCsoft = sprintf("https://bioconductor.org/packages/%s/bioc", ver),
BioCann = sprintf("https://bioconductor.org/packages/%s/data/annotation", ver),
BioCexp = sprintf("https://bioconductor.org/packages/%s/data/experiment", ver)
)
}
options(repos = c(
P3M = sprintf("https://p3m.dev/all/__linux__/%s/latest", distro),
BIOC = binary_universe("https://bioc.r-universe.dev"),
CRAN = "https://cloud.r-project.org",
CRANHAVEN = binary_universe("https://cranhaven.r-universe.dev"),
bioc_urls()
))
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))

# Enable universe repo(s)
my_universe <- Sys.getenv("MY_UNIVERSE")
if(nchar(my_universe)){
my_repos <- trimws(strsplit(my_universe, ';')[[1]])
binaries <- sprintf('%s/bin/linux/%s/%s', my_repos[1], distro, substr(rver, 1, 3))
options(repos = c(binaries = binaries, universe = my_repos, getOption("repos")))
options(repos = c(binaries = binary_universe(my_universe), universe = my_universe, getOption("repos")))
}
})

#print(options('repos'))

0 comments on commit 7ea68dc

Please sign in to comment.