Last active
October 21, 2019 13:18
-
-
Save mtmorgan/ba6ee9832ace532ab3d04e5b1ec6d518 to your computer and use it in GitHub Desktop.
BiocManager test scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url <- Sys.getenv("BIOCVERSION_REPOS") | |
dir.create(tmp <- tempfile()) | |
pkg <- file.path(tmp, "BiocVersion") | |
system2("git", c("-C", tmp, "clone", url)) | |
system2("git", c("-C", pkg, "checkout", "RELEASE_3_9")) | |
install.packages(pkg, repos=NULL) | |
remotes:: install_git(url, ref = "RELEASE_3_9") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export BIOCVERSION_REPOS=~/b/git/BiocVersion | |
export BIOCMANAGER_REPOS=~/b/git/BiocManager | |
export BIOCMANAGER_SANDBOX=/Users/ma38727/tmp/BiocManagerSandbox | |
# | |
# R-4.0 | |
# | |
echo "R-4.0" | |
export R_LIBS_USER=$BIOCMANAGER_SANDBOX/R-4.0-Bioc-3.10 | |
mkdir -p $R_LIBS_USER | |
rm -rf BiocManager_*tar.gz | |
~/bin/R-devel/bin/R \ | |
--vanilla --silent -e "source('install-dependencies.R', echo = TRUE)" | |
~/bin/R-devel/bin/R CMD build $BIOCMANAGER_REPOS | |
~/bin/R-devel/bin/R CMD check BiocManager_*tar.gz | |
echo "R-4.0 No BiocVersion" | |
~/bin/R-devel/bin/R \ | |
--vanilla --silent -e "source('remove-BiocVersion.R', echo=TRUE)" | |
~/bin/R-devel/bin/R CMD build $BIOCMANAGER_REPOS | |
_R_CHECK_FORCE_SUGGESTS_=0 \ | |
~/bin/R-devel/bin/R CMD check BiocManager_*tar.gz | |
echo "R-4.0 wrong BiocVersion" | |
~/bin/R-3-6-branch/bin/R \ | |
--vanilla --silent -e "source('bad-BiocVersion.R', echo=TRUE)" | |
~/bin/R-devel/bin/R CMD build $BIOCMANAGER_REPOS | |
~/bin/R-devel/bin/R CMD check BiocManager_*tar.gz | |
echo "cleaning up R-4.0" | |
~/bin/R-devel/bin/R \ | |
--vanilla --silent -e "source('install-dependencies.R', echo = TRUE)" | |
# | |
# R-3.6 | |
# | |
echo "R-3.6" | |
export R_LIBS_USER=$BIOCMANAGER_SANDBOX/R-3.6-Bioc-3.9 | |
mkdir -p $R_LIBS_USER | |
rm -rf BiocManager_*tar.gz | |
~/bin/R-3-6-branch/bin/R \ | |
--vanilla --silent -e "source('install-dependencies.R')" | |
~/bin/R-3-6-branch/bin/R CMD build $BIOCMANAGER_REPOS | |
~/bin/R-3-6-branch/bin/R CMD check BiocManager_*tar.gz | |
# | |
# R-3.5 | |
# | |
echo "R-3.5" | |
export R_LIBS_USER=$BIOCMANAGER_SANDBOX/R-3.5-Bioc-3.8 | |
mkdir -p $R_LIBS_USER | |
rm -rf BiocManager_*tar.gz | |
~/bin/R-3-5-branch/bin/R \ | |
--vanilla --silent -e "source('install-dependencies.R')" | |
~/bin/R-3-5-branch/bin/R CMD build $BIOCMANAGER_REPOS | |
~/bin/R-3-5-branch/bin/R CMD check BiocManager_*tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgpath <- Sys.getenv("BIOCMANAGER_REPOS") | |
stopifnot(dir.exists(pkgpath)) | |
has_internet <- | |
function() | |
{ | |
tryCatch({ | |
suppressWarnings(readChar("https://httpbin.org", 1L)) | |
TRUE | |
}, error = function(e) { | |
FALSE | |
}) | |
} | |
if (!has_internet()) | |
quit() | |
## make sure there are no left-over packages | |
pkgs0 <- c("BiocManager", "BiocVersion") | |
inst <- installed.packages() | |
idx <- which(rownames(inst) %in% pkgs0) | |
for (i in idx) | |
remove.packages(inst[i, "Package"], inst[i, "LibPath"]) | |
## install from R base configuration | |
setRepositories(ind = 1:4) | |
chooseCRANmirror(ind=1) | |
chooseBioCmirror(ind=1) | |
fields <- c("Depends", "Imports", "Suggests", "Enhances", "LinkingTo") | |
dcf <- read.dcf(file.path(pkgpath, "DESCRIPTION"), fields) | |
pkgs <- Filter(Negate(is.na), unlist(strsplit(dcf, "[[:punct:]|[:space:]]+"))) | |
pkgs <- setdiff(pkgs, rownames(installed.packages())) | |
message( | |
"installing packages:\n ", | |
paste(pkgs, collapse="\n ") | |
) | |
install.packages(pkgs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inst <- installed.packages() | |
idx <- which(inst[,"Package"] %in% "BiocVersion") | |
for (i in idx) | |
remove.packages(inst[i, "Package"], inst[i, "LibPath"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment