BiocInstaller/DESCRIPTION0000644000175400017540000000076213175731106016051 0ustar00biocbuildbiocbuildPackage: BiocInstaller Title: Install/Update Bioconductor, CRAN, and github Packages Description: This package is used to install and update Bioconductor, CRAN, and (some) github packages. Version: 1.28.0 Author: Dan Tenenbaum and Biocore Team Maintainer: Bioconductor Package Maintainer biocViews: Infrastructure Depends: R (>= 3.4.0) Suggests: devtools, RUnit, BiocGenerics License: Artistic-2.0 NeedsCompilation: no Packaged: 2017-10-30 23:14:14 UTC; biocbuild BiocInstaller/NAMESPACE0000644000175400017540000000026613175714053015563 0ustar00biocbuildbiocbuildimport("utils") export(biocLite, biocVersion, biocUpdatePackages, biocinstallRepos, isDevel, useDevel, biocValid, monograph_group, RBioinf_group, biocases_group, all_group) BiocInstaller/NEWS0000644000175400017540000000304413175714053015040 0ustar00biocbuildbiocbuildCHANGES IN VERSION 1.28.0 ------------------------- NEW FEATURES o biocLite() supports full URLs, e.g., to archived Bioconductor packages. o Support MRAN (Microsoft R) archives. CHANGES IN VERSION 1.24.0 ------------------------- NEW FEATURES o biocLite() uses lib.loc= to find devtools, reports more informatively why devtools fails to load o biocLite() only offers to update non-masked packages o biocLite() reports when packages in unwriteable directories are out-of-date, but does not try (and fail) to update them. o isDevel() returns TRUE if the version of BiocInstaller corresponds to the development version of Bioconductor. CHANGES IN VERSION 1.20.0 ------------------------- BUG FIXES o biocLite() uses lib.loc when calling update.packages CHANGES IN VERSION 1.18.0 ------------------------- NEW FEATURES o biocLite() supports github repositories (implicitly, 'packages' following the 'maintainer/package' convention) CHANGES IN VERSION 1.14.0 ------------------------- NEW FEATURES o biocUpdatePackages updates installed packages and their dependencies. CHANGES IN VERSION 1.10.0 ------------------------- NEW FEATURES o biocValid() checks that installed packages are consistent with those available via biocLite(). o biocVersion() returns the version of Bioconductor expected with this version of the BiocInstaller package. USER-VISIBLE CHANGES o biocLite() invoked with no arguments updates currently installed packages to their most-recent version. BiocInstaller/R/0000755000175400017540000000000013175714053014541 5ustar00biocbuildbiocbuildBiocInstaller/R/biocLite.R0000644000175400017540000001312513175714053016420 0ustar00biocbuildbiocbuild.mbniFilter <- function(pkgs, ..., type=getOption("pkgType")) { repos <- getOption("repos") ## MBNI packages not always available doing <- character() if ((type %in% c("mac.binary", "mac.binary.leopard")) && ("MBNI" %in% names(repos))) { url <- contrib.url(repos[["MBNI"]]) doing <- intersect(pkgs, row.names(available.packages(url))) if (length(doing)) { pkgNames <- paste(sQuote(doing), collapse=", ") .message("MBNI Brain Array packages %s are not available as Mac binaries, use biocLite with type='source'", pkgNames) } } setdiff(pkgs, doing) } .rRepos <- function(pkgs, invert = FALSE) grep("^(https?://.*|[^/]+)$", pkgs, invert = invert, value=TRUE) .githubRepos <- function(pkgs) { pkgs <- .rRepos(pkgs, invert = TRUE) grep("^[^/]+/.+", pkgs, value=TRUE) } .reposInstall <- function(pkgs, lib, ...) { doing <- .rRepos(pkgs) if (length(doing)) { pkgNames <- paste(sQuote(doing), collapse=", ") .message("Installing package(s) %s", pkgNames) install.packages(pkgs=doing, lib=lib, ...) } setdiff(pkgs, doing) } .githubInstall <- function(pkgs, ..., lib.loc=NULL) { doing <- .githubRepos(pkgs) if (length(doing)) { pkgNames <- paste(sQuote(doing), collapse=", ") .message("Installing github package(s) %s", pkgNames) tryCatch({ loadNamespace("devtools", lib.loc) }, error=function(e) { if (!"devtools" %in% rownames(installed.packages(lib.loc))) { if (is.null(lib.loc)) lib.loc <- .libPaths() stop(conditionMessage(e), "\n package 'devtools' not installed in library path(s)", "\n ", paste(lib.loc, collapse="\n "), "\n install with 'biocLite(\"devtools\")', and re-run your biocLite() command", call.=FALSE) } else .stop("'loadNamespace(\"devtools\")' failed:\n %s", conditionMessage(e)) }) devtools::install_github(doing, ...) } setdiff(pkgs, doing) } .biocLiteInstall <- function(pkgs, repos, ask, suppressUpdates, siteRepos=character(), lib.loc=NULL, lib=.libPaths()[1], instlib=NULL, ...) { if (!missing(repos)) .stop("'repos' argument to 'biocLite' not allowed") if (!(is.character(suppressUpdates) || is.logical(suppressUpdates)) || (is.logical(suppressUpdates) && 1L != length(suppressUpdates))) .stop("'suppressUpdates' must be character() or logical(1)") biocMirror <- getOption("BioC_mirror", sprintf("%s//bioconductor.org", .protocol())) .message("BioC_mirror: %s", biocMirror) .message("Using Bioconductor %s (BiocInstaller %s), %s.", biocVersion(), packageVersion("BiocInstaller"), sub(" version", "", R.version.string)) if (!suppressPackageStartupMessages(require("utils", quietly=TRUE))) .stop("failed to load package 'utils'") orepos <- options(repos=biocinstallRepos(siteRepos)) on.exit(options(orepos)) if (length(pkgs)) { todo <- .mbniFilter(pkgs, ...) todo <- .reposInstall(todo, lib=lib, ...) todo <- .githubInstall(todo, ...) } ## early exit if suppressUpdates if (is.logical(suppressUpdates) && suppressUpdates) return(invisible(pkgs)) oldPkgs <- old.packages(lib.loc, checkBuilt=TRUE) if (is.null(oldPkgs)) return(invisible(pkgs)) oldPkgs <- .package_filter_suppress_updates(oldPkgs, suppressUpdates) oldPkgs <- .package_filter_masked(oldPkgs) oldPkgs <- .package_filter_unwriteable(oldPkgs, instlib) if (nrow(oldPkgs)) { pkgList <- paste(oldPkgs[,"Package"], collapse="', '") if (ask) { .message("Old packages: '%s'", pkgList) answer <- .getAnswer("Update all/some/none? [a/s/n]: ", allowed = c("a", "A", "s", "S", "n", "N")) switch(answer, a = update.packages(lib.loc, oldPkgs=oldPkgs, ask=FALSE, instlib=instlib), s = update.packages(lib.loc, oldPkgs=oldPkgs, ask=TRUE, instlib=instlib), n = invisible(pkgs)) } else { .message("Updating packages '%s'", pkgList) update.packages(lib.loc, oldPkgs=oldPkgs, ask=ask, instlib=instlib) } } invisible(pkgs) } .getAnswer <- function(msg, allowed) { if (interactive()) { repeat { cat(msg) answer <- readLines(n = 1) if (answer %in% allowed) break } tolower(answer) } else { "n" } } biocLite <- function(pkgs=c("Biobase","IRanges","AnnotationDbi"), suppressUpdates=FALSE, suppressAutoUpdate=FALSE, siteRepos=character(), ask=TRUE, ...) { if (missing(pkgs)) # biocLite() update w/out installing defaults pkgs <- pkgs[!pkgs %in% rownames(installed.packages())] if (!suppressAutoUpdate && !.isCurrentBiocInstaller()) { on.exit(.updateBiocInstaller(pkgs, ask=ask, suppressUpdates=suppressUpdates, siteRepos=siteRepos, ...)) } else if ("BiocUpgrade" %in% pkgs) { .biocUpgrade() } else { .biocLiteInstall(pkgs, ask=ask, siteRepos=siteRepos, suppressUpdates=suppressUpdates, ...) } } BiocInstaller/R/biocUpdatePackages.R0000644000175400017540000000077213175714053020410 0ustar00biocbuildbiocbuildbiocUpdatePackages <- function(pkgs, dependencies = NA, repos = biocinstallRepos(), ...) { if (identical(dependencies, NA)) dependencies <- c("Depends", "Imports", "LinkingTo") avail <- available.packages(contriburl=contrib.url(repos)) deps <- avail[pkgs, dependencies, drop=FALSE] deps <- unlist(apply(deps, 1, utils:::.clean_up_dependencies)) deps <- unique(c(pkgs, deps)) deps <- deps[deps %in% rownames(avail)] update.packages(oldPkgs=deps, repos=repos, ...) } BiocInstaller/R/biocValid.R0000644000175400017540000000524613175714053016567 0ustar00biocbuildbiocbuild.tooNewPkgs <- function(instPkgs, availPkgs) { idx <- rownames(availPkgs) %in% rownames(instPkgs) vers <- availPkgs[idx, "Version"] idx <- package_version(vers) < package_version(instPkgs[names(vers), "Version"]) tooNew <- names(vers)[idx] instPkgs[tooNew, c("Version", "LibPath"), drop=FALSE] } biocValid <- function(pkgs = installed.packages(lib.loc, priority=priority), lib.loc=NULL, priority="NA", type=getOption("pkgType"), filters=NULL, silent=FALSE, ..., fix=FALSE) { if (!is.matrix(pkgs)) { if (is.character(pkgs)) pkgs <- installed.packages(pkgs, lib.loc=lib.loc) else .stop("'pkgs' must be a character vector of package names, or a matrix like that returned by 'installed.packages()'") } repos <- biocinstallRepos() contribUrl <- contrib.url(repos, type=type) availPkgs <- available.packages(contribUrl, type=type, filters=filters) oldPkgs <- old.packages(lib.loc, repos=biocinstallRepos(), instPkgs=pkgs, available=availPkgs, checkBuilt=TRUE, type=type) tooNewPkgs <- .tooNewPkgs(pkgs, availPkgs) valid <- (NROW(oldPkgs) == 0) && (NROW(tooNewPkgs) == 0) if (valid) return(valid) if (!silent) { result <- structure(list(oldPkgs=oldPkgs, tooNewPkgs = tooNewPkgs), class="biocValid") print(result) } if (fix) { pkgs <- c(rownames(oldPkgs), rownames(tooNewPkgs)) biocLite(pkgs, lib.loc=lib.loc, ...) .warning("updated or downgraded package(s) %s", paste(.sQuote(pkgs), collapse=" ")) } else { msg <- character() if (NROW(oldPkgs)) msg <- c(msg, sprintf("%d package(s) out of date", NROW(oldPkgs))) if (NROW(tooNewPkgs)) msg <- c(msg, sprintf("%d package(s) too new", NROW(tooNewPkgs))) .stop(paste(msg, collapse="; ")) } invisible(valid) } print.biocValid <- function(x, ...) { cat("\n* sessionInfo()\n\n") print(sessionInfo()) cat("\n") if (NROW(x$oldPkgs)) { cat("* Out-of-date packages\n") print(x$oldPkgs) cat("\nupdate with biocLite()\n\n") } if (NROW(x$tooNewPkgs)) { cat("* Packages too new for Bioconductor version ", .sQuote(as.character(biocVersion())), "\n\n", sep="") print(x$tooNewPkgs) pkgs <- paste(.dQuote(rownames(x$tooNewPkgs)), collapse=", ") msg <- .msg(ifelse(NROW(x$tooNewPkgs) == 1L, "biocLite(%s)", "biocLite(c(%s))"), pkgs) cat("\ndowngrade with ", msg, "\n\n", sep="") } } BiocInstaller/R/biocVersion.R0000644000175400017540000000004713175714053017147 0ustar00biocbuildbiocbuildbiocVersion <- function() BIOC_VERSION BiocInstaller/R/biocinstallRepos.R0000644000175400017540000000660513175714053020207 0ustar00biocbuildbiocbuild## TODO: should probably print out a message about how to use mirrors, ## the way sourcing biocLite.R does now. biocinstallRepos <- function(siteRepos=character(), version=biocVersion()) { biocVersion <- as.package_version(version) old.opts <- options("repos") on.exit(options(old.opts)) ## Starting at some point in R-2.14, Omegahat is included in ## the list of available repositories, on windows only, it seems. ## on mac and linux: ## 1: + CRAN ## 2: + CRAN (extras) ## 3: + BioC software ## 4: + BioC annotation ## 5: + BioC experiment ## 6: + BioC extra ## 7: R-Forge ## 8: rforge.net ## on windows: ## 1: + CRAN ## 2: + CRAN (extras) ## 3: Omegahat ## 4: BioC software ## 5: BioC annotation ## 6: BioC experiment ## 7: BioC extra ## 8: R-Forge ## 9: rforge.net ## So it's probably better not to rely on the numbers. setRepositories(ind=1:20) # in case more repos are added repos <- getOption("repos") biocMirror <- getOption("BioC_mirror", sprintf("%s//bioconductor.org", .protocol())) biocPaths <- c(BioCsoft="bioc", BioCann="data/annotation", BioCexp="data/experiment") biocRepos <- paste(biocMirror, "packages", biocVersion, biocPaths, sep="/") repos[names(biocPaths)] <- biocRepos keepRepos <- if (.Platform$OS.type %in% "windows") { c(names(biocPaths), "CRAN", "CRANextra") } else { c(names(biocPaths), "CRAN") } repos <- repos[keepRepos] ## This needs to be commented out a few months (3? 4?) after the ## next development cycle has started, when we are confident that ## no developper is still using an early R devel with a ## tools:::.BioC_version_associated_with_R_version still pointing ## to the release repository. if (isDevel()) { ## comment repos here as they become available. inactive <- c( ## "BioCsoft" ## , "BioCann" ## , "BioCexp" ) ## No need to touch below. tmpRepos <- paste(biocMirror, "packages", DOWNGRADE_VERSION, biocPaths[inactive], sep="/") repos[inactive] <- tmpRepos } repos <- subset(repos, !is.na(repos)) CRAN_repo <- repos[["CRAN"]] ## Microsoft R Open is shipped with getOption("repos")[["CRAN"]] ## pointing to a *snapshot* of CRAN (e.g. ## https://mran.microsoft.com/snapshot/2017-05-01), and not ## to a CRAN mirror that is current. For the current release and devel ## BioC versions, biocinstallRepos() needs to point to a CRAN mirror ## that is current so biocLite() and biocValid() behave the same for ## all BioC users, whether they use mainstream R or Microsoft R Open. ## However, since old versions of BioC are frozen, it would probably ## make sense to point to a *snapshot* of CRAN instead of a CRAN mirror ## that is current. snapshot_pattern <- "/snapshot/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" if (CRAN_repo == "@CRAN@" || grepl(snapshot_pattern, CRAN_repo)) repos[["CRAN"]] <- sprintf("%s//cran.rstudio.com", .protocol()) if (includeMBNI && (getOption("pkgType") %in% c("source", "win.binary"))) repos[["MBNI"]] <- mbniUrl c(siteRepos=siteRepos, repos) } BiocInstaller/R/package_groups.R0000644000175400017540000000443713175714053017666 0ustar00biocbuildbiocbuildmonograph_group <- function() { warning("'arrayMagic' package is no longer available") c("affycomp", "affydata", "affypdnn", "affyPLM", "ALL", "ALLMLL", "AmpAffyExample", "annaffy", "AnnBuilder", "annotate", "arrayQuality", "beta7", "Biobase", "bioDist", "Biostrings", "cMAP", "CoCiteStats", "convert", "e1071", "edd", "estrogen", "exactRankTests", "facsDorit", "factDesign", "gbm", "gcrma", "geneplotter", "golubEsets", "GOstats", "gpls", "graph", "hexbin", "hgu133a", "hgu133atagcdf", "hgu133acdf", "hgu133bcdf", "hgu2beta7", "hgu95av2", "hgu95av2cdf", "hgu95av2probe", "hopach", "hsahomology", "hu6800cdf", "hu6800probe", "humanLLMappings", "ipred", "KEGG", "KEGGSOAP", "kidpack", "limma", "locfit", "LogitBoost", "matchprobes", "mclust", "mlbench", "MLInterfaces", "multtest", "pamr", "prada", "PROcess", "ProData", "randomForest", "rat2302", "RbcBook1", "RBGL", "RColorBrewer", "RCurl", "Rgraphviz", "rrcov", "simpleaffy", "sma", "SpikeInSubset", "SSOAP", "statmod", "vsn", "XML", "xtable", "YEAST", "yeastExpData") } lite_group <- function() { c("affy", "affydata", "affyPLM", "annaffy", "annotate", "Biobase", "biomaRt", "Biostrings", "DynDoc", "gcrma", "genefilter", "geneplotter", "hgu95av2.db", "limma", "marray", "multtest", "vsn", "xtable", "affyQCReport") } graph_group <- function() { c("graph", "Rgraphviz", "RBGL") } all_group <- function() { rownames(available.packages(repos=biocinstallRepos()['BioCsoft'])) } RBioinf_group <- function() { c(lite_group(), graph_group(), "RBioinf", "BiocCaseStudies", "XML", "RCurl", "biomaRt", "GEOquery", "KEGG", "KEGGSOAP", "hgu95av2", "hgu95av2probe", "hgu95av2cdf", "human.db0", "BSgenome.Hsapiens.UCSC.hg18") } biocases_group <- function() { c(lite_group(), graph_group(), "ALL", "apComplex", "bioDist", "BiocCaseStudies", "biocGraph", "biomaRt", "CCl4", "CLL", "Category", "class", "convert", "GO.db", "GOstats", "GSEABase", "hgu133a.db", "hgu95av2cdf", "hgu95av2probe", "hopach", "KEGG.db", "kohonen", "lattice", "latticeExtra", "MASS", "matchprobes", "MLInterfaces", "org.Hs.eg.db", "ppiStats", "randomForest", "RColorBrewer", "Rintact", "sma", "weaver", "yeastExpData") } BiocInstaller/R/package_update.R0000644000175400017540000000333113175714053017621 0ustar00biocbuildbiocbuild.package_filter_suppress_updates <- function(pkgs, suppressUpdates) { if (!is.logical(suppressUpdates)) { ## alternate form of argument: vector of regex regex <- paste(suppressUpdates, collapse="|") hits <- !grepl(regex, pkgs[,"Package"]) pkgs[hits, , drop=FALSE] } else { pkgs } } .package_filter_masked <- function(pkgs) { path0 <- normalizePath(pkgs[, "LibPath"], winslash="/") path1 <- normalizePath(.libPaths(), winslash="/") idx <- order(match(path0, path1)) dup <- duplicated(pkgs[idx,"Package"])[order(idx)] pkgs[!dup,, drop=FALSE] } .package_filter_unwriteable <- function(pkgs, instlib=NULL) { if (!nrow(pkgs)) return(pkgs) libs <- if (is.null(instlib)) pkgs[,"LibPath"] else instlib ulibs <- unique(libs) status <- dir.exists(ulibs) if (.Platform$OS.type == "windows") { status[status] <- vapply(ulibs[status], function(lib) { ## from tools::install.R: file.access() unreliable on ## Windows fn <- file.path(lib, paste0("_test_dir", Sys.getpid())) unlink(fn, recursive = TRUE) # precaution res <- try(dir.create(fn, showWarnings = FALSE)) if (inherits(res, "try-error") || !res) { FALSE } else { unlink(fn, recursive = TRUE) TRUE } }, logical(1)) } else status[status] <- file.access(ulibs[status], 2L) == 0 status <- status[match(libs, ulibs)] if (!all(status)) .message( "installation path not writeable, unable to update packages: %s", paste(pkgs[!status, "Package"], collapse=", ")) pkgs[status,, drop=FALSE] } BiocInstaller/R/updateBiocInstaller.R0000644000175400017540000000757013175714053020632 0ustar00biocbuildbiocbuild.getContribUrl <- function(biocVersion) { .contribUrl <- function(repos) { contribUrl <- contrib.url(repos) pkgs <- available.packages(contribUrl) if (nrow(pkgs) == 0L) .stop("no packages in repository (no internet connection?)", call.=FALSE) else if (!"BiocInstaller" %in% rownames(pkgs)) .stop("'BiocInstaller' package not in repository", call.=FALSE) contribUrl } repos <- biocinstallRepos(version=biocVersion)["BioCsoft"] suppressWarnings(tryCatch({ .contribUrl(repos) }, error=function(err) { version <- getRversion() currentVersion <- sprintf("%d.%d", version$major, version$minor) lowerVersion <- .lowerRVersionString(version) oldRepos <- sub(currentVersion, lowerVersion, repos) if (oldRepos == repos) .stop("'%s' while trying %s", conditionMessage(err), repos, call.=FALSE) .message("'%s' while trying %s, trying %s", conditionMessage(err), repos, oldRepos) .contribUrl(oldRepos) })) } .isCurrentBiocInstaller <- function() { installedSentinel <- availableSentinel <- package_version("0.0.0") installedVersion <- tryCatch(packageVersion("BiocInstaller"), error = function(err) installedSentinel) contribUrl <- .getContribUrl(biocVersion()) ap <- available.packages(contribUrl) availableVersion <- if ("BiocInstaller" %in% rownames(ap)) package_version(ap["BiocInstaller", "Version"]) else availableSentinel if ((installedVersion == availableVersion) && (installedVersion == installedSentinel)) .stop("'BiocInstaller' package not installed, and not available") availableVersion <= installedVersion } .updateBiocInstaller <- function(pkgs, ask, suppressUpdates, lib.loc=NULL, ...) { .dbg("before, version is %s", packageVersion("BiocInstaller")) bootstrap <- function() { if (isNamespaceLoaded("BiocInstaller")) tryCatch({ unloadNamespace("BiocInstaller") }, error=function(err) { stop("failed to update BiocInstaller:", "\n ", conditionMessage(err), call.=FALSE) }) ## repos will be in bootstrap's environment suppressWarnings(tryCatch({ update.packages(lib.loc, repos=repos, ask=FALSE, checkBuilt=TRUE, oldPkgs="BiocInstaller") }, error=function(err) { assign("failed", TRUE, "biocBootstrapEnv") NULL })) library(BiocInstaller) BiocInstaller:::.updateBiocInstallerFinish() } biocBootstrapEnv <- new.env() biocBootstrapEnv[["pkgs"]] <- pkgs[pkgs != "BiocInstaller"] biocBootstrapEnv[["ask"]] <- ask biocBootstrapEnv[["suppressUpdates"]] <- suppressUpdates biocBootstrapEnv[["repos"]] <- biocinstallRepos(version=biocVersion()) biocBootstrapEnv[["dotArgs"]] <- list(...) .stepAside(biocBootstrapEnv, bootstrap) } .updateBiocInstallerFinish <- function() { args <- c(list(pkgs=get("pkgs", "biocBootstrapEnv"), ask=get("ask", "biocBootstrapEnv"), suppressUpdates=get("suppressUpdates", "biocBootstrapEnv")), get("dotArgs", "biocBootstrapEnv")) failed <- exists("failed", "biocBootstrapEnv") detach("biocBootstrapEnv") .dbg("after, version is %s", packageVersion("BiocInstaller")) vers <- packageVersion("BiocInstaller") if (!failed) .message("'BiocInstaller' updated to version %s", vers) else .warning("'BiocInstaller' update failed, using version %s", vers, call.=FALSE) if ("BiocUpgrade" %in% args$pkgs) { .biocUpgrade() } else { do.call(.biocLiteInstall, args) } } BiocInstaller/R/useDevel.R0000644000175400017540000000550113175714053016441 0ustar00biocbuildbiocbuild.biocUpgrade <- function() { if (!IS_UPGRADEABLE) { .stop("Bioconductor version %s cannot be upgraded with R version %s", biocVersion(), getRversion()) } if (IS_UPGRADEABLE && UPGRADE_IS_DEVEL) .stop("Bioconductor version %s can be upgraded, but only to 'devel'; see ?useDevel. Use biocLite() without any arguments to update installed packages", biocVersion()) txt <- sprintf("Upgrade all packages to Bioconductor version %s? [y/n]: ", UPGRADE_VERSION) answer <- .getAnswer(txt, allowed = c("y", "Y", "n", "N")) if ("y" == answer) .update(UPGRADE_VERSION, TRUE) } isDevel <- function() !IS_USER useDevel <- function(devel=TRUE) { if (devel) { if (isDevel()) .stop("'devel' version already in use") if (IS_END_OF_LIFE) .stop("'devel' version not available") if (!IS_UPGRADEABLE) .stop("'devel' version requires a more recent R") biocVers <- UPGRADE_VERSION } else { if (!isDevel()) .stop("'devel' version not in use") if (!IS_DOWNGRADEABLE) .stop("'devel' version cannot be down-graded with this version of R") biocVers <- DOWNGRADE_VERSION } .update(biocVers, FALSE) } .update <- function(biocVersion, biocLiteAfterUpdate = FALSE) { .dbg("before, version is %s", packageVersion("BiocInstaller")) bootstrap <- function() { if (nchar(Sys.getenv("BIOCINSTALLER_TEST_REPOS"))) repos = Sys.getenv("BIOCINSTALLER_TEST_REPOS") if ("package:BiocInstaller" %in% search()) detach("package:BiocInstaller", unload=TRUE, force=TRUE) ## repos will be in bootstrap's environment suppressWarnings(tryCatch({ install.packages("BiocInstaller", repos=repos) }, error=function(err) { assign("failed", TRUE, "biocBootstrapEnv") NULL })) library(BiocInstaller) BiocInstaller:::.updateFinish() } biocBootstrapEnv <- new.env() biocBootstrapEnv[["repos"]] <- biocinstallRepos(version=biocVersion) biocBootstrapEnv[["biocLiteAfterUpdate"]] <- biocLiteAfterUpdate .stepAside(biocBootstrapEnv, bootstrap) } .updateFinish <- function() { failed <- exists("failed", "biocBootstrapEnv") biocLiteAfterUpdate <- get("biocLiteAfterUpdate", "biocBootstrapEnv") detach("biocBootstrapEnv") .dbg("after, version is %s", packageVersion("BiocInstaller")) vers <- packageVersion("BiocInstaller") if (!failed) { .message("'BiocInstaller' changed to version %s", vers) if (biocLiteAfterUpdate) biocLite(character(), ask=FALSE) } else .warning("update failed, using BiocInstaller version %s", vers, call.=FALSE) } BiocInstaller/R/utilities.R0000644000175400017540000000277313175714053016710 0ustar00biocbuildbiocbuild.dQuote <- function(x) sprintf('"%s"', as.character(x)) .sQuote <- function(x) sprintf("'%s'", as.character(x)) .msg <- function(fmt, ..., width=getOption("width")) ## Use this helper to format all error / warning / message text { txt <- strwrap(sprintf(fmt, ...), width=width, exdent=2) paste(txt, collapse="\n") } # use as BiocInstaller:::.opts$get() BiocInstaller:::.opts$set(TRUE) .opts = local({ debug <- FALSE list(get=function() debug, set=function(x) { old <- debug debug <<- x old }) }) .dbg <- function(...) { if (.opts$get()) { .msg(...) } } .message <- function(..., appendLF=TRUE) { message(.msg(...), appendLF=appendLF) } .stop <- function(..., call.=FALSE) { stop(.msg(...), call.=call.) } .warning <- function(..., call.=FALSE, immediate.=FALSE) { warning(.msg(...), call.=call., immediate.=immediate.) } .lowerRVersionString <- function(version=getRversion()) { if (0L == version$minor) { major <- version$major - 1L minor <- version$minor } else { major <- version$major minor <- version$minor - 1L } paste(major, minor, sep=".") } # bootstrap() should take care of unloading BiocInstaller # and reloading it. .stepAside <- function(biocBootstrapEnv, bootstrap) { environment(bootstrap) <- biocBootstrapEnv biocBootstrapEnv[["bootstrap"]] <- bootstrap attach(biocBootstrapEnv) on.exit(eval(bootstrap(), biocBootstrapEnv)) } BiocInstaller/R/zzz.R0000644000175400017540000001341613175714053015526 0ustar00biocbuildbiocbuildR_VERSION_MAX <- IS_USER <- IS_END_OF_LIFE <- IS_UPGRADEABLE <- UPGRADE_IS_DEVEL <- IS_DOWNGRADEABLE <- UPGRADE_VERSION <- DOWNGRADE_VERSION <- NEXT_R_DEVEL_VERSION <- NULL ## The following values are updated with each Bioc release; see .onLoad BIOC_VERSION <- package_version("3.6") # Bioc version for this package # R_VERSION_MAX <- package_version("3.3.0") # Maximum version of R for # # this version of BiocInstaller # IS_USER <- FALSE # TRUE if this version of # # Bioconductor is the # # current release version # IS_END_OF_LIFE <- FALSE # TRUE if this version of # # Bioconductor is no longer # # the release version # # IS_UPGRADEABLE <- FALSE # TRUE if a more recent # # version (release or # # devel) of Bioconductor is # # available for this # # version of R # UPGRADE_IS_DEVEL <- TRUE # TRUE if UPGRADE_VERSION # # is for devel use only # IS_DOWNGRADEABLE <- FALSE # TRUE if an older version # # (release or devel) of # # Bioconductor is available # # for this version of R # UPGRADE_VERSION <- package_version("3.2") # Bioconductor version for # # upgrade, if # # IS_UPGRADEABLE == TRUE # DOWNGRADE_VERSION <- package_version("3.2") # Bioconductor version for # # downgrade, if # # IS_DOWNGRADEABLE == TRUE # # NEXT_R_DEVEL_VERSION <- "3.4.0" # next (not-yet-supported) version of R ## Change when the status of MBNI changes. ## Make sure this change is propagated to users, even ## if builds have stopped for a particular version of BioC. ## See biocLite.R:biocinstallRepos to include / exclude package types includeMBNI <- FALSE mbniUrl <- "http://brainarray.mbni.med.umich.edu/bioc" .protocol <- local({ PROTOCOL <- NULL function() { useHTTPS <- getOption("useHTTPS") if (!is.null(useHTTPS)) { PROTOCOL <<- if (useHTTPS) "https:" else "http:" } else if (is.null(PROTOCOL)) { useHTTPS <- TRUE withCallingHandlers({ tryCatch({ fcon <- file("https://bioconductor.org/index.html") on.exit(close(fcon), add=TRUE) readLines(fcon, 1L) }, error=function(e) { useHTTPS <<- FALSE }) }, warning=function(e) { useHTTPS <<- FALSE invokeRestart("muffleWarning") }) PROTOCOL <<- if (useHTTPS) "https:" else "http:" } PROTOCOL } }) globalVariables("repos") # used in 'bootstrap' functions .onLoad <- function(libname, pkgname) { fl <- system.file(package="BiocInstaller", "scripts", "BiocInstaller.dcf") dcf <- read.dcf(fl) opt <- getOption( "BIOCINSTALLER_ONLINE_DCF", Sys.getenv("BIOCINSTALLER_ONLINE_DCF", TRUE) ) if (opt) { tryCatch({ con <- url(paste0( .protocol(), "//bioconductor.org/BiocInstaller.dcf" )) on.exit(close(con)) dcf <- read.dcf(con) }, error=function(e) {}) } biocInstallerVars <- dcf[dcf[, "BIOC_VERSION"] == BIOC_VERSION,] R_VERSION_MAX <<- package_version(biocInstallerVars[['R_VERSION_MAX']]) IS_USER <<- as.logical(biocInstallerVars[['IS_USER']]) IS_END_OF_LIFE <<- as.logical(biocInstallerVars[['IS_END_OF_LIFE']]) IS_UPGRADEABLE <<- as.logical(biocInstallerVars[['IS_UPGRADEABLE']]) UPGRADE_IS_DEVEL <<- as.logical(biocInstallerVars[['UPGRADE_IS_DEVEL']]) IS_DOWNGRADEABLE <<- as.logical(biocInstallerVars[['IS_DOWNGRADEABLE']]) UPGRADE_VERSION <<- package_version(biocInstallerVars[['UPGRADE_VERSION']]) DOWNGRADE_VERSION <<- package_version(biocInstallerVars[['DOWNGRADE_VERSION']]) NEXT_R_DEVEL_VERSION <<- package_version(biocInstallerVars[['NEXT_R_DEVEL_VERSION']]) } .onAttach <- function(libname, pkgname) { .message("Bioconductor version %s (BiocInstaller %s), ?biocLite for help", biocVersion(), packageVersion("BiocInstaller")) Rversion <- getRversion() if (IS_END_OF_LIFE) { if (IS_UPGRADEABLE) .message("A newer version of Bioconductor is available for this version of R, ?BiocUpgrade for help") else if (Rversion > R_VERSION_MAX) .warning("Bioconductor version %s is too old for R version %s; see https://bioconductor.org/install/#troubleshoot-biocinstaller", BIOC_VERSION, Rversion) else .message("A new version of Bioconductor is available after installing the most recent version of R; see http://bioconductor.org/install") } else if (Rversion > R_VERSION_MAX) { if (Rversion >= NEXT_R_DEVEL_VERSION) .message("Bioconductor does not yet support R version %s", Rversion) else .warning("Bioconductor version %s is too old for R version %s; see https://bioconductor.org/install/#troubleshoot-biocinstaller", BIOC_VERSION, Rversion) } } BiocInstaller/inst/0000755000175400017540000000000013175714053015315 5ustar00biocbuildbiocbuildBiocInstaller/inst/scripts/0000755000175400017540000000000013175714053017004 5ustar00biocbuildbiocbuildBiocInstaller/inst/scripts/BiocInstaller.dcf0000644000175400017540000000244513175714053022221 0ustar00biocbuildbiocbuildComment: update NEXT_R_DEVEL_VERSION in all entries Comment: Accurate as of release day BIOC_VERSION: 3.6 R_VERSION_MAX: 3.4.4 IS_USER: FALSE IS_END_OF_LIFE: FALSE IS_UPGRADEABLE: FALSE UPGRADE_IS_DEVEL: FALSE IS_DOWNGRADEABLE: TRUE UPGRADE_VERSION: 3.7 DOWNGRADE_VERSION: 3.5 NEXT_R_DEVEL_VERSION: 3.5.0 Comment: Accurate as of release day BIOC_VERSION: 3.5 R_VERSION_MAX: 3.4.2 IS_USER: TRUE IS_END_OF_LIFE: FALSE IS_UPGRADEABLE: TRUE UPGRADE_IS_DEVEL: TRUE IS_DOWNGRADEABLE: FALSE UPGRADE_VERSION: 3.6 DOWNGRADE_VERSION: 3.4 NEXT_R_DEVEL_VERSION: 3.5.0 Comment: Accurate as of release day BIOC_VERSION: 3.4 R_VERSION_MAX: 3.3.3 IS_USER: FALSE IS_END_OF_LIFE: TRUE IS_UPGRADEABLE: FALSE UPGRADE_IS_DEVEL: FALSE IS_DOWNGRADEABLE: FALSE UPGRADE_VERSION: 3.5 DOWNGRADE_VERSION: 3.3 NEXT_R_DEVEL_VERSION: 3.5.0 Comment: Accurate as of release day BIOC_VERSION: 3.3 R_VERSION_MAX: 3.3.1 IS_USER: FALSE IS_END_OF_LIFE: TRUE IS_UPGRADEABLE: TRUE UPGRADE_IS_DEVEL: FALSE IS_DOWNGRADEABLE: FALSE UPGRADE_VERSION: 3.4 DOWNGRADE_VERSION: 3.2 NEXT_R_DEVEL_VERSION: 3.5.0 Comment: Accurate as of release day BIOC_VERSION: 3.2 R_VERSION_MAX: 3.2.5 IS_USER: FALSE IS_END_OF_LIFE: TRUE IS_UPGRADEABLE: FALSE UPGRADE_IS_DEVEL: FALSE IS_DOWNGRADEABLE: TRUE UPGRADE_VERSION: 3.3 DOWNGRADE_VERSION: 3.1 NEXT_R_DEVEL_VERSION: 3.5.0 BiocInstaller/inst/scripts/biocLite.R0000644000175400017540000001742413175714053020671 0ustar00biocbuildbiocbuild## Mirrors: uncomment the following and change to your favorite CRAN mirror ## if you don't want to use the default (cran.rstudio.com). ## options("repos" = c(CRAN="https://cran.rstudio.com")) ## Mirrors: uncomment the following and change to your favorite Bioconductor ## mirror, if you don't want to use the default (bioconductor.org) ## options("BioC_mirror" = "https://bioconductor.org") local({ vers <- getRversion() biocVers <- tryCatch({ BiocInstaller::biocVersion() # recent BiocInstaller }, error=function(...) { # no / older BiocInstaller BioC_version_associated_with_R_version <- get(".BioC_version_associated_with_R_version", envir=asNamespace("tools"), inherits=FALSE) if (is.function(BioC_version_associated_with_R_version)) BioC_version_associated_with_R_version() else # numeric_version BioC_version_associated_with_R_version }) if (vers < "3.0") { ## legacy; no need to change "3.0" ever ## coordinate this message with .onAttach txt <- strwrap("A new version of Bioconductor is available after installing the most recent version of R; see http://bioconductor.org/install", exdent=2) message(paste(txt, collapse="\n")) } else if ("package:BiocInstaller" %in% search()) { ## messages even if already attached tryCatch(BiocInstaller:::.onAttach(), error=function(...) NULL) } if (vers > "2.13" && biocVers > "2.8") { if (exists("biocLite", .GlobalEnv, inherits=FALSE)) { txt <- strwrap("There is an outdated biocLite() function in the global environment; run 'rm(biocLite)' and try again.") stop("\n", paste(txt, collapse="\n")) } if (!suppressWarnings(require("BiocInstaller", quietly=TRUE))) { a <- NULL p <- file.path(Sys.getenv("HOME"), ".R", "repositories") if (file.exists(p)) { a <- tools:::.read_repositories(p) if (!"BioCsoft" %in% rownames(a)) a <- NULL } if (is.null(a)) { p <- file.path(R.home("etc"), "repositories") a <- tools:::.read_repositories(p) } if (!"package:utils" %in% search()) { path <- "//bioconductor.org/biocLite.R" txt <- sprintf("use 'source(\"https:%s\")' or 'source(\"http:%s\")' to update 'BiocInstaller' after library(\"utils\")", path, path) message(paste(strwrap(txt), collapse="\n ")) } else { ## add a conditional for Bioc releases occuring WITHIN ## a single R minor version. This is so that a user with a ## version of R (whose etc/repositories file references the ## no-longer-latest URL) and without BiocInstaller ## will be pointed to the most recent repository suitable ## for their version of R if (vers >= "3.2.2" && vers < "3.3.0") { ## transitioning to https support; check availability con <- file(fl <- tempfile(), "w") sink(con, type="message") tryCatch({ xx <- close(file("https://bioconductor.org")) }, error=function(e) { message(conditionMessage(e)) }) sink(type="message") close(con) if (!length(readLines(fl))) a["BioCsoft", "URL"] <- sub("^http:", "https:", a["BioCsoft", "URL"]) } if (vers >= "3.4") { a["BioCsoft", "URL"] <- sub(as.character(biocVers), "3.5", a["BioCsoft", "URL"]) } else if (vers >= "3.3.0") { a["BioCsoft", "URL"] <- sub(as.character(biocVers), "3.4", a["BioCsoft", "URL"]) } else if (vers >= "3.2") { a["BioCsoft", "URL"] <- sub(as.character(biocVers), "3.2", a["BioCsoft", "URL"]) } else if (vers == "3.1.1") { ## R-3.1.1's etc/repositories file at the time of the release ## of Bioc 3.0 pointed to the 2.14 repository, but we want ## new installations to access the 3.0 repository a["BioCsoft", "URL"] <- sub(as.character(biocVers), "3.0", a["BioCsoft", "URL"]) } else if (vers == "3.1.0") { ## R-devel points to 2.14 repository a["BioCsoft", "URL"] <- sub(as.character(biocVers), "2.14", a["BioCsoft", "URL"]) } else if (vers >= "2.15" && vers < "2.16") { a["BioCsoft", "URL"] <- sub(as.character(biocVers), "2.11", a["BioCsoft", "URL"]) biocVers <- numeric_version("2.11") } install.packages("BiocInstaller", repos=a["BioCsoft", "URL"]) if (!suppressWarnings(require("BiocInstaller", quietly=TRUE))) { path0 <- "//bioconductor.org/packages" path <- sprintf("%s/%s/bioc", path0, as.character(biocVers)) txt0 <- "'biocLite.R' failed to install 'BiocInstaller', use 'install.packages(\"BiocInstaller\", repos=\"https:%s\")' or 'install.packages(\"BiocInstaller\", repos=\"http:%s\")'" txt <- sprintf(txt0, path, path) message(paste(strwrap(txt), collapse="\n ")) } } } else { ## BiocInstaller version 1.16.0-1.18.1 do not ## automatically update when type=="source"; notify users ## when they have updated R over their old libraries installerVersion <- utils::packageVersion("BiocInstaller") test0 <- (vers > "3.1.2") && !identical(getOption("pkgType"), "source") && (installerVersion >= "1.16.0") && (installerVersion <= "1.16.4") if (test0) { if (installerVersion < "1.16.4") { txt <- "Update BiocInstaller with oldPkgType=options(pkgType=\"source\"); biocLite(\"BiocInstaller\"); options(oldPkgType)" message(paste(strwrap(txt, exdent=2), collapse="\n")) } if (vers >= "3.2") { path <- "//bioconductor.org/biocLite.R" txt <- sprintf("BiocInstaller version %s is too old for R version %s; remove.packages(\"BiocInstaller\"), re-start R, then source(\"https:%s\") or source(\"http:%s\")", biocVers, vers, path, path) warning(paste(strwrap(txt, exdent=2), collapse="\n")) } } } } else { tryCatch({ source("https://bioconductor.org/getBioC.R") }, error=function(e) { warning("https: failed (", conditionMessage(e), "), trying http", immediate.=TRUE) source("http://bioconductor.org/getBioC.R") }) biocLite <<- function(pkgs, groupName="lite", ...) { if (missing(pkgs)) biocinstall(groupName=groupName, ...) else biocinstall(pkgs=pkgs, groupName=groupName, ...) } } }) BiocInstaller/inst/scripts/workflows.R0000644000175400017540000000053613175714053021170 0ustar00biocbuildbiocbuildsource("http://bioconductor.org/biocLite.R") workflowInstall <- function(pkg, ...) { repos <- c(biocinstallRepos(), sprintf("%s//bioconductor.org/packages/%s/workflows", BiocInstaller:::.protocol(), BiocInstaller::biocVersion())) install.packages(pkg, repos=repos, ...) } BiocInstaller/inst/unitTests/0000755000175400017540000000000013175714053017317 5ustar00biocbuildbiocbuildBiocInstaller/inst/unitTests/test_BiocUpgrade.R0000644000175400017540000000141313175714053022664 0ustar00biocbuildbiocbuildtest_useDevel <- function() { if (!BiocInstaller:::IS_DOWNGRADEABLE) checkException(useDevel(FALSE), silent=TRUE) if (!BiocInstaller:::IS_UPGRADEABLE) { checkException(useDevel(), silent=TRUE) opts <- options(warn=2); on.exit(options(opts)) checkException(biocLite("BiocUpgrade")) } } test_getContribUrl_exist <- function() { fun <- BiocInstaller:::.getContribUrl vers <- BiocInstaller:::BIOC_VERSION checkTrue(grepl(vers, fun(vers))) if (BiocInstaller:::IS_UPGRADEABLE) { vers <- BiocInstaller:::UPGRADE_VERSION checkTrue(grepl(vers, fun(vers))) } if (BiocInstaller:::IS_DOWNGRADEABLE) { vers <- BiocInstaller:::DOWNGRADE_VERSION checkTrue(grepl(vers, fun(vers))) } } BiocInstaller/inst/unitTests/test_biocLite.R0000644000175400017540000000055013175714053022233 0ustar00biocbuildbiocbuildtest_reposType <- function() { .rRepos <- BiocInstaller:::.rRepos .githubRepos <- BiocInstaller:::.githubRepos r <- "foo" http <- c("http://foo.bar/baz", "https://foo.bar/baz") github <- c("foo/bar", "foo/bar@baz") all <- c(r, http, github) checkIdentical(c(r, http), .rRepos(all)) checkIdentical(github, .githubRepos(all)) } BiocInstaller/inst/unitTests/test_biocinstallRepos.R0000644000175400017540000000110413175714053024011 0ustar00biocbuildbiocbuildrepos <- biocinstallRepos() test_biocinstallRepos_named_repositories <- function() { allOS <- c("BioCsoft", "CRAN", "BioCann", "BioCexp") windowsOnly <- "CRANextra" checkTrue(all(allOS %in% names(repos))) if (.Platform$OS.type == "windows") { checkTrue(windowsOnly %in% names(repos)) } else { checkTrue(!windowsOnly %in% names(repos)) } } test_biocinstallRepos_noNA_repositories <- function() { checkTrue(!any(is.na(repos))) } test_biocinstallRepos_order <- function() { checkIdentical("BioCsoft", names(repos)[[1]]) } BiocInstaller/inst/unitTests/test_package_update.R0000644000175400017540000001030313175714053023433 0ustar00biocbuildbiocbuildtest_package_filter_suppress_updates <- function() { .filter <- BiocInstaller:::.package_filter_suppress_updates pkgs0 <- matrix( character(), 0, 2, dimnames=list(NULL, c("Package", "LibPath"))) checkIdentical(pkgs0, .filter(pkgs0, FALSE)) checkIdentical(pkgs0, .filter(pkgs0, character())) p0 <- tempdir() pkgs <- matrix( c("Foo", "Bar", "Baz", p0, p0, p0), 3, 2, dimnames=list(c("Foo", "Bar", "Baz"), c("Package", "LibPath"))) checkIdentical(pkgs, .filter(pkgs, FALSE)) checkIdentical(pkgs[3,,drop=FALSE], .filter(pkgs, c("Foo", "Bar"))) checkIdentical(pkgs0, .filter(pkgs, c("Foo", "Bar", "Baz"))) checkIdentical(pkgs0, .filter(pkgs, "")) } test_package_filter_masked <- function() { .filter <- BiocInstaller:::.package_filter_masked pkgs0 <- matrix( character(), 0, 2, dimnames=list(NULL, c("Package", "LibPath"))) checkIdentical(pkgs0, .filter(pkgs0)) paths <- c(tempfile(), tempfile()) for (path in paths) dir.create(path) oLibPaths <- .libPaths() on.exit(.libPaths(oLibPaths)) .libPaths(paths) pkgs <- matrix( c("Foo", "Bar", "Baz", "Bim", paths, paths), 4, 2, dimnames=list(c("Foo", "Bar", "Baz", "Bim"), c("Package", "LibPath"))) checkIdentical(pkgs, .filter(pkgs)) checkIdentical(pkgs[c(1, 3, 2),], .filter(pkgs[c(1, 3, 2),])) pkgs <- matrix( c("Foo", "Bar", "Foo", paths, paths[2]), 3, 2, dimnames=list(c("Foo", "Bar", "Foo"), c("Package", "LibPath"))) checkIdentical(pkgs[1:2,], .filter(pkgs)) pkgs <- pkgs[3:1,] checkIdentical(pkgs[2:3,], .filter(pkgs)) } test_package_filter_unwriteable <- function() { .filter <- BiocInstaller:::.package_filter_unwriteable ## setup dir.create(p0 <- tempfile()) on.exit(unlink(p0, recursive=TRUE)) pkgs0 <- matrix( character(), 0, 2, dimnames=list(NULL, c("Package", "LibPath"))) pkgs <- pkgs0 checkIdentical(pkgs, .filter(pkgs, NULL)) checkIdentical(pkgs, .filter(pkgs, character())) checkIdentical(pkgs, .filter(pkgs, tempdir())) pkgs <- matrix(c("Foo", p0), 1, byrow=TRUE, dimnames=list("Foo", c("Package", "LibPath"))) checkIdentical(pkgs, .filter(pkgs, NULL)) checkIdentical(pkgs, .filter(pkgs, p0)) p1 <- tempfile() pkgs <- matrix(c("Foo", p1), 1, byrow=TRUE, dimnames=list("Foo", c("Package", "LibPath"))) checkIdentical(pkgs[FALSE,, drop=FALSE], .filter(pkgs, NULL)) checkIdentical(pkgs[FALSE,, drop=FALSE], .filter(pkgs, p1)) checkIdentical(pkgs, .filter(pkgs, p0)) pkgs <- matrix( c("Foo", p0, "Bar", p1, "Baz", p0), 3, 2, byrow=TRUE, dimnames=list(c("Foo", "Bar", "Baz"), c("Package", "LibPath"))) checkIdentical(pkgs[c(1, 3),], .filter(pkgs, NULL)) checkIdentical(pkgs, .filter(pkgs, p0)) checkIdentical(pkgs0, .filter(pkgs, p1)) msg <- tryCatch(.filter(pkgs, NULL), message=conditionMessage) checkIdentical( "installation path not writeable, unable to update packages: Bar\n", msg) if (.Platform$OS.type == "windows") ## how to create a read-only directory? return(TRUE) dir.create(p2 <- tempfile(), mode="0400") # read but not write pkgs <- matrix(c("Foo", p2), 1, byrow=TRUE, dimnames=list("Foo", c("Package", "LibPath"))) checkIdentical(pkgs0, .filter(pkgs, NULL)) pkgs <- matrix( c("Foo", p0, "Bar", p2, "Baz", p0), 3, 2, byrow=TRUE, dimnames=list(c("Foo", "Bar", "Baz"), c("Package", "LibPath"))) checkIdentical(pkgs[c(1, 3),], .filter(pkgs, NULL)) checkIdentical(pkgs0, .filter(pkgs, p2)) Sys.chmod(p2, mode="0700") unlink(p2, recursive=TRUE) } test_writeable_biocLite <- function() { DEACTIVATED("too idiosyncratic for standardized testing") lib <- system.file(package="BiocInstaller", "unitTests", "cases", "lib", "Biobase") dir.create(locked <- tempfile()) file.copy(lib, locked, recursive=TRUE) oLibPaths <- .libPaths() on.exit(.libPaths(oLibPaths)) .libPaths(c(locked, .libPaths())) Sys.chmod(locked, mode="0500") biocLite() # Sys.chmod(locked, mode="0700") } BiocInstaller/man/0000755000175400017540000000000013175714053015113 5ustar00biocbuildbiocbuildBiocInstaller/man/BiocUpgrade.Rd0000644000175400017540000000203013175714053017561 0ustar00biocbuildbiocbuild\name{BiocUpgrade} \alias{BiocUpgrade} \title{ Upgrade Bioconductor to the latest version available for this version of R } \description{ Downloads the latest version of the BiocInstaller package, and upgrades all currently installed packages to the latest repositories \strong{for this version of R}. To upgrade, use: \preformatted{ ## 'http' if 'https' unavailable source("https://bioconductor.org/biocLite.R") biocLite("BiocUpgrade") } } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. } \examples{ \dontrun{ source("https://bioconductor.org/biocLite.R") biocLite("BiocUpgrade") } } \keyword{environment} BiocInstaller/man/biocLite.Rd0000644000175400017540000001224613175714053017141 0ustar00biocbuildbiocbuild\name{biocLite} \alias{biocLite} \title{ Install or update Bioconductor and CRAN packages } \description{ \code{biocLite} installs or updates Bioconductor and CRAN packages in a Bioconductor release. Upgrading to a new Bioconductor release requires additional steps; see \url{https://bioconductor.org/install}. } \usage{ biocLite(pkgs=c("Biobase", "IRanges", "AnnotationDbi"), suppressUpdates=FALSE, suppressAutoUpdate=FALSE, siteRepos=character(), ask=TRUE, ...) } \arguments{ \item{pkgs}{\code{character()} of package names to install or update. A missing value and \code{suppressUpdates=FALSE} updates installed packages, perhaps also installing \code{Biobase}, \code{IRanges}, and \code{AnnotationDbi} if they are not already installed. Package names containing a \sQuote{/} are treated as github repositories and installed using the \code{install_github()} function of the \code{devtools} package.} \item{suppressUpdates}{\code{logical(1)} or \code{character()}. When \code{FALSE}, biocLite asks the user whether old packages should be update. When \code{TRUE}, the user is not prompted to update old packages. When \code{character()} a vector specifying which packages to NOT update.} \item{suppressAutoUpdate}{\code{logical(1)} indicating whether the \code{BiocInstaller} package updates itself.} \item{siteRepos}{\code{character()} representing an additional repository in which to look for packages to install. This repository will be prepended to the default repositories (which you can see with \code{\link{biocinstallRepos}}).} \item{ask}{\code{logical(1)} indicating whether to prompt user before installed packages are updated, or the character string 'graphics', which brings up a widget for choosing which packages to update. If TRUE, user can choose whether to update all outdated packages without further prompting, to pick and choose packages to update, or to cancel updating (in a non-interactive session, no packages will be updated). Otherwise, the value is passed to \code{\link{update.packages}}.} \item{...}{Additional arguments. When installing CRAN or Bioconductor packages, typical arguments include: \code{lib.loc}, passed to \code{\link{old.packages}} and used to determine the library location of installed packages to be updated; and \code{lib}, passed to \code{\link{install.packages}} to determine the library location where \code{pkgs} are to be installed. When installing github packages, \code{...} is passed to the \pkg{devtools} package functions \code{\link[devtools]{install_github}} and \code{\link[devtools]{install}}. A typical use is to build vignettes, via \code{dependencies=TRUE, build_vignettes=TRUE}. } } \details{ Installation of Bioconductor and CRAN packages use R's standard functions for library management -- \code{install.packages()}, \code{available.packages()}, \code{update.packages()}. Installation of github packages uses the \code{install_github()} function from the \code{devtools} package. For this reason it usually makes sense, when complicated installation options are needed, to invoke \code{biocLite()} separately for Bioconductor / CRAN packages and for github packages. } \value{ \code{biocLite()} returns the \code{pkgs} argument, invisibly. } \seealso{ \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. \code{\link{update.packages}} updates all installed packages. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. \code{\link{monograph_group}}, \code{\link{RBioinf_group}} and \code{\link{biocases_group}} return package names associated with Bioconductor publications. \code{\link{all_group}} returns the names of all Bioconductor software packages. } \examples{ \dontrun{ ## Change default Bioconductor and CRAN mirrors chooseBioCmirror() chooseCRANmirror() ## If you don't have the BiocInstaller package installed, you can ## quickly install and load it as follows: source("https://bioconductor.org/biocLite.R") # 'http' if 'https' unavailable ## The most recent version of the BiocInstaller package is now loaded. ## No need to load it with library(). # installs default packages (if not already installed) and updates # previously installed packages biocLite() ## Now install a CRAN package: biocLite("survival") ## install a Bioconductor package, but don't update all installed ## packages as well: biocLite("GenomicRanges", suppressUpdates=TRUE) ## Install default packages, but do not update any package whose name ## starts with "org." or "BSgenome." biocLite(suppressUpdates=c("^org\\.", "^BSgenome\\.")) ## install a package from source: biocLite("IRanges", type="source") ## install all Bioconductor software packages biocLite(all_group()) } ## Show the Bioconductor and CRAN repositories that will be used to ## install/update packages. biocinstallRepos() } \keyword{environment} BiocInstaller/man/biocUpdatePackages.Rd0000644000175400017540000000271213175714053021122 0ustar00biocbuildbiocbuild\name{biocUpdatePackages} \alias{biocUpdatePackages} \title{ Update previously installed Bioconductor or CRAN packages and their dependencies. } \description{ Update previously installed Bioconductor and CRAN packages and their dependencies. Use \code{\link{biocLite}} to install new packages or to update all out-of-date packages. Upgrading to a new Bioconductor release requires additional steps; see \url{https://bioconductor.org/install}. } \usage{ biocUpdatePackages(pkgs, dependencies = NA, repos=biocinstallRepos(), ...) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{pkgs}{\code{character()} of package names to install or update.} \item{dependencies}{\code{character()} describing out-of-date dependencies that are also updated. Defaults to \code{c("Depends", "Imports", "LinkingTo")} but can be a subset of \code{c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")}.} \item{repos}{\code{character()} of named repositories in which to look for package updates, in the style of \code{biocinstallRepos()}.} \item{\dots}{Additional arguments, passed to \code{\link{update.packages}}. For example, \code{ask=FALSE} to avoid prompts to update individual packages.} } \value{\sQuote{NULL}, invisibly.} \author{Martin Morgan \url{mtmorgan@fhcrc.org}} \seealso{\code{\link{biocLite}}} \examples{ \dontrun{ biocUpdatePackages("GenomicRanges", ask=FALSE) } } \keyword{environment} BiocInstaller/man/biocValid.Rd0000644000175400017540000000520413175714053017277 0ustar00biocbuildbiocbuild\name{biocValid} \alias{biocValid} \title{Validate installed package versions against biocLite versions.} \description{ Check that installed packages are consistent (neither out-of-date nor too new) with the version of R and Bioconductor in use, using \code{biocLite} for validation. } \usage{ biocValid(pkgs = installed.packages(lib.loc, priority = priority), lib.loc = NULL, priority = "NA", type = getOption("pkgType"), filters = NULL, silent = FALSE, ..., fix=FALSE) } \arguments{ \item{pkgs}{A character list of package names for checking, or a matrix as returned by \code{\link{installed.packages}}.} \item{lib.loc}{The library location(s) of packages to be validated; see \code{\link{installed.packages}}.} \item{priority}{check validity of all, \dQuote{base}, or \dQuote{recommended} packages; see \code{\link{installed.packages}}.} \item{type}{The type of available package (e.g., binary, source) to check validity against; see \code{\link{available.packages}}.} \item{filters}{Filter available packages to check validity against; see \code{\link{available.packages}}.} \item{silent}{Report how packages are invalid (\code{silent=FALSE}, default) and abort execution, or return a logical(1) (\code{silent=TRUE}) indicating the overall validity of installed packages.} \item{\dots}{Additional arguments, passed to \code{\link{biocLite}} when \code{fix=TRUE}.} \item{fix}{When \code{TRUE}, invoke \code{biocLite} to reinstall (update or downgrade, as appropriate) invalid packages.} } \details{ This function compares the version of installed packages to the version of packages associated with the version of R and Bioconductor appropriate for the BiocInstaller package currently in use. Packages are reported as \sQuote{out-of-date} if a more recent version is available at the repositories specified by \code{biocinstallRepos()}. Usually, \code{biocLite()} is sufficient to update packages to their most recent version. Packages are reported as \sQuote{too new} if the installed version is more recent than the most recent available in the \code{biocinstallRepos()} repositories. It is possible to down-grade by re-installing a too new package \dQuote{PkgA} with \code{biocLite("PkgA")}. It is important for the user to understand how their installation became too new, and to avoid this in the future. } \value{ \code{logical(1)} indicating overall validity of installed packages. } \author{Martin Morgan \url{mtmorgan@fhcrc.org}} \seealso{\code{\link{biocLite}} to update installed packages.} \examples{try(biocValid())} \keyword{ environment } BiocInstaller/man/biocVersion.Rd0000644000175400017540000000074313175714053017670 0ustar00biocbuildbiocbuild\name{biocVersion} \alias{biocVersion} \title{Bioconductor version} \description{ This function reports the Bioconductor version in use, as determined by the BiocInstaller package. } \usage{ biocVersion() } \value{ \code{package_version} representing the Bioconductor version in use. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{BiocUpgrade}} Upgrading to new versions. } \examples{ biocVersion() } \keyword{environment} BiocInstaller/man/biocinstallRepos.Rd0000644000175400017540000000250513175714053020720 0ustar00biocbuildbiocbuild\name{biocinstallRepos} \alias{biocinstallRepos} \title{ Display current Bioconductor and CRAN repositories. } \description{ Displays the URLs of the repositories used by \code{\link{biocLite}} to install Bioconductor and CRAN packages. } \usage{ biocinstallRepos(siteRepos=character(), version=biocVersion()) } \arguments{ \item{siteRepos}{(Optional) \code{character(1)} representing an additional repository (e.g., a URL to an organization's internally maintained repository) in which to look for packages to install. This repository will be prepended to the default repositories returned by the function.} \item{version}{(Optional) \code{character(1)} or \code{package_version} indicating the Bioconductor version (e.g., \dQuote{3.1}) for which repositories are required.} } \value{ Named \code{character()} of repositories. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ biocinstallRepos() ## Choose mirrors \dontrun{ chooseCRANmirror() chooseBioCmirror() } } \keyword{environment} BiocInstaller/man/packageGroups.Rd0000644000175400017540000000257413175714053020205 0ustar00biocbuildbiocbuild\name{Package Groups} \alias{biocases_group} \alias{RBioinf_group} \alias{monograph_group} \alias{all_group} \title{ Convenience functions to return package names associated with Bioconductor publications. } \description{ Returns character vectors of packages associated with Bioconductor publications, which can then be passed to \code{\link{biocLite}()} } \usage{ monograph_group() RBioinf_group() biocases_group() all_group() } \value{ \code{character()} of package names. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ ## Get the names of packages used in the book ## "Bioconductor Case Studies": biocases_group() ## Get the names of packages used in the book ## "R Programming for Bioinformatics": RBioinf_group() ## Get the names of packages used in the monograph ## "Bioinformatics and Computational Biology Solutions ## Using R and Bioconductor": monograph_group() ## Get the names of all Bioconductor software packages all_group() } \keyword{environment} BiocInstaller/man/useDevel.Rd0000644000175400017540000001400413175714053017155 0ustar00biocbuildbiocbuild\name{useDevel} \alias{useDevel} \alias{isDevel} \title{ Get the 'devel' version of the BiocInstaller package. } \description{ Downloads the 'devel' version of the BiocInstaller package so that all subsequent invocations of \code{\link{biocLite}} and \code{\link{biocinstallRepos}} use the devel repositories. Displays the URLs of the repositories used by \code{\link{biocLite}} to install Bioconductor and CRAN packages. Should only be used with a release (or patched) version of R, freshly installed. } \usage{ isDevel() useDevel(devel=TRUE) } \arguments{ \item{devel}{Whether to look in the devel (TRUE) or release (FALSE) repositories in subsequent invocations of \code{\link{biocLite}} and \code{\link{biocinstallRepos}}.} } \details{ Bioconductor has a 'release' branch and a 'devel' branch. The branch in use depends on the version of R and the version of the BiocInstaller. \code{useDevel()} installs the correct version of the BiocInstaller package for use of the devel version of Bioconductor, provided it is supported by the version of R in use. \code{isDevel()} returns TRUE when the version of BiocInstaller in use corresponds to the 'devel' version of Bioconductor. In more detail, the version number of the BiocInstaller package determines whether to download packages from the release or devel repositories of Bioconductor. In keeping with Bioconductor versioning conventions, if the middle number (y in x.y.z) is even, the package is part of a release version; if odd, it's part of a devel version. By default, when BiocInstaller is first installed and when the version of R supports the current release version of Bioconductor, BiocInstaller will use the release repository. To change the version of BiocInstaller to support the 'devel' branch of Bioconductor, run \code{useDevel()}. With argument \code{TRUE} (the default), it will download the devel version of BiocInstaller and subsequently all packages downloaded with \code{\link{biocLite}} will be from the devel repository. You should run \code{\link{useDevel}} only once. During release cycles where both the release and devel version of Bioconductor use the same version of R, it is possible to use release and devel versions of Bioconductor with the same installation of R. To do this, use the \code{R_LIBS_USER} environment variable. First, create two separate directories for your BioC release and devel packages. Suggested directory names are as follows: Linux: ~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-release ~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-devel Mac OS: ~/Library/R/3.2-bioc-release/library ~/Library/R/3.2-bioc-devel/library Windows: C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.2-bioc-release C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.2-bioc-devel (change YOUR_USER_NAME to your user name) Invoke "R for bioc-devel" or "R for bioc-release" from the command line as follows: Linux: R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-release R R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-devel R Mac OS X: R_LIBS_USER=~~/Library/R/3.2-bioc-release/library R R_LIBS_USER=~~/Library/R/3.2-bioc-devel/library R Windows: cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.2-bioc-release && R" cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.2-bioc-devel && R" (Note: this assumes that R.exe is in your PATH.) If you launch R in this way and then invoke \code{\link{.libPaths}}, you'll see that the first item is your special release or devel directory. Packages will be installed to that directory and that is the first place that \code{\link{library}} will look for them. \code{\link{biocLite}}, \code{\link{install.packages}}, \code{\link{update.packages}} and friends all respect this setting. On Linux and Mac OS X, you can create a bash alias to save typing. Add the following to your ~/bash_profile: Linux alias Rdevel='R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-devel R' alias Rrelease='R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.2-bioc-release R' Mac OS X alias Rdevel='R_LIBS_USER=~/Library/R/3.2-bioc-devel/library R' alias Rrelease='R_LIBS_USER=~/Library/R/3.2-bioc-release/library R' You can then invoke these from the command line as Rdevel ...and... Rrelease On Windows, you can create two shortcuts, one for devel and one for release. Go to My Computer and navigate to a directory that is in your PATH. Then right-click and choose New->Shortcut. in the "type the location of the item" box, put: cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.2-bioc-release && R" ...for release and cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-devel && R" ...for devel. (again, it's assumed R.exe is in your PATH) Click "Next". In the "Type a name for this shortcut" box, type Rdevel or Rrelease You can invoke these from the command line as Rdevel.lnk ...and... Rrelease.lnk (You must type in the .lnk extension.) Because \code{R_LIBS_USER} is an environment variable, its value should be inherited by any subprocesses started by R, so they should do the right thing as well. } \value{ \code{useDevel()}: Invisible NULL. \code{isDevel()}: logical(1) TRUE or FALSE. } \seealso{ \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ isDevel() \dontrun{useDevel()} } \keyword{environment} BiocInstaller/tests/0000755000175400017540000000000013175714053015502 5ustar00biocbuildbiocbuildBiocInstaller/tests/BiocInstaller_unit_tests.R0000644000175400017540000000005313175714053022636 0ustar00biocbuildbiocbuildBiocGenerics:::testPackage("BiocInstaller")