From 7ea68dc24d0e62e4a7856e29f23091580a2acce7 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Thu, 12 Sep 2024 21:57:31 +0200 Subject: [PATCH] Update default repos to include all the things possible --- Rprofile | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Rprofile b/Rprofile index bb03048..2a64ed5 100644 --- a/Rprofile +++ b/Rprofile @@ -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'))