diff --git a/DESCRIPTION b/DESCRIPTION
index a0db7d9..b09b473 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,9 +1,9 @@
Package: miniCRAN
Authors@R: c(person("Revolution Analytics", role="aut"), person("Andrie", "de
- Vries", role=c("aut", "cre"), email="andrie@revolutionanalytics.com"),
+ Vries", role=c("aut", "cre"), email="adevries@microsoft.com"),
person("Alex", "Chubaty", role="ctb", email="alex.chubaty@gmail.com"))
License: GPL-2
-Copyright: Revolution Analytics
+Copyright: Microsoft Corporation
Title: Create a Mini Version of CRAN Containing Only Selected Packages
LazyData: true
LazyLoad: true
@@ -11,21 +11,25 @@ Description: Makes it possible to create an internally consistent
repository consisting of selected packages from CRAN-like repositories.
The user specifies a set of desired packages, and miniCRAN recursively
reads the dependency tree for these packages, then downloads only this
- subset. The user can then install packages from this repository directly,
- rather than from CRAN. This is useful in production settings, e.g. server
+ subset. The user can then install packages from this repository directly,
+ rather than from CRAN. This is useful in production settings, e.g. server
behind a firewall, or remote locations with slow broadband access.
-Version: 0.2.4
+Version: 0.2.5
URL: https://github.com/RevolutionAnalytics/miniCRAN
BugReports: https://github.com/RevolutionAnalytics/miniCRAN/issues
-Date: 2015-03-26
+Date: 2016-04-12
Imports:
tools,
XML,
httr,
methods,
- utils
+ utils,
+ graphics,
+ stats
Suggests:
testthat(>= 0.9),
knitr,
+ rmarkdown,
igraph
VignetteBuilder: knitr
+RoxygenNote: 5.0.1
diff --git a/NAMESPACE b/NAMESPACE
index c40a07b..dab2862 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,4 +1,4 @@
-# Generated by roxygen2 (4.1.0): do not edit by hand
+# Generated by roxygen2: do not edit by hand
S3method(plot,pkgDepGraph)
S3method(print,pkgDep)
@@ -17,8 +17,19 @@ export(pkgDep)
export(updatePackages)
export(updateRepoIndex)
import(XML)
+importFrom(graphics,legend)
+importFrom(graphics,par)
+importFrom(graphics,title)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,stop_for_status)
importFrom(methods,is)
+importFrom(stats,reshape)
+importFrom(stats,setNames)
importFrom(tools,write_PACKAGES)
+importFrom(utils,chooseCRANmirror)
+importFrom(utils,compareVersion)
+importFrom(utils,download.file)
+importFrom(utils,flush.console)
+importFrom(utils,installed.packages)
+importFrom(utils,select.list)
diff --git a/R/MRAN.R b/R/MRAN.R
new file mode 100644
index 0000000..ed66246
--- /dev/null
+++ b/R/MRAN.R
@@ -0,0 +1,9 @@
+MRAN <- function(snapshot){
+ url <- "http://mran.microsoft.com"
+ if(missing("snapshot") || is.null(snapshot)){
+ url
+ } else {
+ sprintf("%s/snapshot/%s", url, snapshot)
+ }
+}
+CRAN <- function()getOption("repos")[1]
diff --git a/R/getCranDescription.R b/R/getCranDescription.R
index 109c271..2b66ee0 100644
--- a/R/getCranDescription.R
+++ b/R/getCranDescription.R
@@ -6,12 +6,20 @@
#' @export
#'
#' @example /inst/examples/example_getCranDescription.R
-getCranDescription <- function(pkg, repos=getOption("repos"), type="source", path, pkgs = pkgDep(pkg, repos=repos, type=type)){
+getCranDescription <- function(pkg, repos = getOption("repos"),
+ type = "source",
+ pkgs = pkgDep(pkg, repos=repos, type=type)){
getOne <- function(package){
- url <- sprintf("http://cran.r-project.org/web/packages/%s/index.html", package)
+ repos <- repos[[1]]
+ if(!grepl("/$", repos)) repos <- paste0(repos, "/")
+
+ url <- gsub("https://", "http://",
+ sprintf("%sweb/packages/%s/index.html", repos, package)
+ )
x <- tryCatch({
- readHTMLTable(url, header=FALSE, which=1, stringsAsFactors=FALSE)
+ text <- paste(readLines(url), collapse = "\n")
+ XML::readHTMLTable(text, header=FALSE, which=1, stringsAsFactors=FALSE)
}, error=function(e) e
)
if(inherits(x, "error")) {
diff --git a/R/github-functions.R b/R/github-functions.R
index a9ad837..88a7c0e 100644
--- a/R/github-functions.R
+++ b/R/github-functions.R
@@ -72,7 +72,8 @@ addPackageListing <- function(pdb=pkgAvail(), dcf, warnings=TRUE) {
-# from http://stackoverflow.com/questions/13163248/possible-to-override-the-blocking-of-a-packages-re-installation-after-it-has
+# from http://stackoverflow.com/questions/13163248
+# Possible to override the blocking of a package's (re-)installation after it has been required/loaded?
#' @importFrom httr GET stop_for_status content
readDescriptionGithub <- function(repo, username, branch="master", quiet=TRUE){
diff --git a/R/minicran-package.R b/R/minicran-package.R
index 63a0964..e0b77e6 100644
--- a/R/minicran-package.R
+++ b/R/minicran-package.R
@@ -68,8 +68,11 @@
#' @name miniCRAN-package
#' @aliases miniCRAN minicran
#' @docType package
-#' @author Andrie de Vries \email{andrie@@revolutionanalytics.com} with contributions from Alex Chubaty \email{alex.chubaty@@gmail.com}
+#' @author Andrie de Vries \email{adevries@@microsoft.com} with contributions from Alex Chubaty \email{alex.chubaty@@gmail.com}
#' @keywords package
+#' @importFrom graphics legend par title
+#' @importFrom stats reshape setNames
+#' @importFrom utils chooseCRANmirror compareVersion download.file flush.console installed.packages select.list
NULL
diff --git a/R/pkgDep.R b/R/pkgDep.R
index a036c83..56ed19d 100644
--- a/R/pkgDep.R
+++ b/R/pkgDep.R
@@ -47,7 +47,7 @@ pkgDep <- function(pkg, availPkgs, repos=getOption("repos"), type="source", depe
}
if(missing(availPkgs)){
if(!is.null(names(repos)) & repos["CRAN"] == "@CRAN@"){
- repos <- c(CRAN="http://cran.revolutionanalytics.com")
+ repos <- MRAN()
}
if(is.na(type)) type <- "source"
availPkgs <- pkgAvail(repos=repos, type=type, Rversion = Rversion, ...)
@@ -130,8 +130,8 @@ pkgAvail <- function(repos=getOption("repos"), type="source", Rversion = R.versi
if(!grepl("^http://|file:///", repos[1]) && file.exists(repos[1])) {
repos <- paste0("file:///", normalizePath(repos[1], mustWork = FALSE, winslash = "/"))
} else {
- if(!is.null(names(repos)) && repos["CRAN"] == "@CRAN@"){
- repos <- c(CRAN="http://cran.revolutionanalytics.com")
+ if(!is.null(names(repos)) && isTRUE(unname(repos["CRAN"]) == "@CRAN@")){
+ repos <- MRAN()
}
}
utils::available.packages(contribUrl(repos, type=type, Rversion = Rversion), type=type, filters=list())
diff --git a/R/pkgDepTools.R b/R/pkgDepTools.R
index 6ba04f2..3b0150b 100644
--- a/R/pkgDepTools.R
+++ b/R/pkgDepTools.R
@@ -1,13 +1,22 @@
-# This code is from package pkgDepTools
+# Code copied from the pkgDepTools project
+# Copyright (C) Seth Falcon
# http://www.bioconductor.org/packages/release/bioc/html/pkgDepTools.html
-# Author: Seth Falcom
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 2
+# as published by the Free Software Foundation
+# Code copied from the pkgDepTools project
+# Copyright (C) Seth Falcon
+# http://www.bioconductor.org/packages/release/bioc/html/pkgDepTools.html
+
+
# Copy of tools:::split_op_version.
-#' @rdname pkgDepTools
-#' @keywords internal
+# @rdname pkgDepTools
+# @keywords internal
split_op_version <- function (x) {
pat <- "^([^\\([:space:]]+)[[:space:]]*\\(([^\\)]+)\\).*"
x1 <- sub(pat, "\\1", x)
@@ -25,8 +34,8 @@ split_op_version <- function (x) {
# Copy of tools:::.split_dependencies.
-#' @rdname pkgDepTools
-#' @keywords internal
+# @rdname pkgDepTools
+# @keywords internal
split_dependencies <- function (x) {
if (!length(x))
return(list())
@@ -38,12 +47,12 @@ split_dependencies <- function (x) {
}
-#' Clean package fields.
-#'
-#' Given the value from a field like 'Depends' in a package's DESCRIPTION file, return a character vector of package names with the version restrictions stripped and \R~removed.
-#' @param val Value from a field like 'Depends' in a package's DESCRIPTION file
-#' @rdname pkgDepTools
-#' @keywords internal
+# Clean package fields.
+#
+# Given the value from a field like 'Depends' in a package's DESCRIPTION file, return a character vector of package names with the version restrictions stripped and \R~removed.
+# @param val Value from a field like 'Depends' in a package's DESCRIPTION file
+# @rdname pkgDepTools
+# @keywords internal
cleanPkgField <- function(val) {
if (is.na(val))
return(character(0))
diff --git a/R/plot.pkgDepGraph.R b/R/plot.pkgDepGraph.R
index a96a438..6f9a7b0 100644
--- a/R/plot.pkgDepGraph.R
+++ b/R/plot.pkgDepGraph.R
@@ -37,6 +37,10 @@ plot.pkgDepGraph <- function(
edgeColor <- c(Imports="red", Depends="orange", Suggests="grey80", Enhances="blue", LinkingTo="black")
eColor <- edgeColor[igraph::get.edge.attribute(x, "type")]
+
+ typesInGraph <- unique(igraph::get.edge.attribute(x, "type"))
+ edgeColor <- edgeColor[typesInGraph]
+ # eColor <- eColor[typesInGraph]
par(mai=rep(0.25, 4))
# browser()
diff --git a/R/testSuiteFunctions.R b/R/testSuiteFunctions.R
index fc978e0..58ad97e 100644
--- a/R/testSuiteFunctions.R
+++ b/R/testSuiteFunctions.R
@@ -13,7 +13,7 @@
# Create sample repo from MRAN snapshot
.createSampleRepo <- function(MRAN, path, pkgs, Rversion="3.1"){
- if(missing(MRAN)) MRAN <- c(CRAN="http://mran.revolutionanalytics.com/snapshot/2014-10-15")
+ if(missing(MRAN)) MRAN <- MRAN("2014-10-15")
if(missing(path)) path <- file.path(tempdir(), "miniCRAN", Sys.Date())
if(missing(pkgs)) pkgs <- c("chron", "adaptivetau")
diff --git a/R/testthat_helpers.R b/R/testthat_helpers.R
new file mode 100644
index 0000000..0c31fc8
--- /dev/null
+++ b/R/testthat_helpers.R
@@ -0,0 +1,16 @@
+# helper functions for testing
+
+# Returns TRUE if a URL can be accessed
+is.online <- function(url = MRAN()){
+ z <- tryCatch(suppressWarnings(readLines(url, n = 10, warn = FALSE)),
+ error = function(e)e
+ )
+ if(inherits(z, "error")) return(FALSE)
+ TRUE
+}
+
+# Interrupt the test if url can not be reached
+skip_if_offline <- function(url = MRAN()){
+ if(!is.online(url)) testthat::skip("offline")
+}
+
diff --git a/inst/doc/miniCRAN-dependency-graph.html b/inst/doc/miniCRAN-dependency-graph.html
index 44025c8..e142d3e 100644
--- a/inst/doc/miniCRAN-dependency-graph.html
+++ b/inst/doc/miniCRAN-dependency-graph.html
@@ -1,271 +1,119 @@
-
-
-
-
-A worked example using the package chron
-
+
-
-
+
+
+
-
-
-
-
-
-
+
+
-
+
-
The miniCRAN
package exposes two functions that provide information about dependencies:
-
The function pkgDep()
returns a character vector with the names of dependencies. Internally, pkgDep()
is a wrapper around tools::package_dependencies()
, a base R function that, well, tells you about package dependencies. My pkgDep()
function is in one way a convenience, but more importantly it sets different defaults (more about this later).
The function makeDepGraph()
creates a graph representation of the dependencies.
-
The package chron
neatly illustrates the different roles of Imports, Suggests and Enhances:
-
chron
Imports the base packages graphics and stats. This means that chron
internally makes use of graphics and stats and will always load these packages.
-chron
Suggests the packages scales and ggplot2. This means that chron
uses some functions from these packages in examples or in its vignettes. However, these functions are not necessary to use chron
+chron
Suggests the packages scales and ggplot2. This means that chron
uses some functions from these packages in examples or in its vignettes. However, these functions are not necessary to use chron
chron
Enhances the package zoo
, meaning that it adds something to zoo
packages. These enhancements are made available to you if you have zoo
installed.
-
+
A worked example using the package chron
-
The function pkgDep()
exposes not only these dependencies, but also also all recursive dependencies. In other words, it answers the question which packages need to be installed to satsify all dependencies of dependencies.
-
This means that the algorithm is as follows:
-
First retrieve a list of Suggests and Enhances, using a non-recursive dependency search
Next, perform a recursive search for all Imports, Depends and LinkingTo
-
The resulting list of packages should then contain the complete list necessary to satisfy all dependencies. In code:
-
-
library("miniCRAN")
-
-
-
tags <- "chron"
-pkgDep(tags, availPkgs = cranJuly2014)
-
-
+
library("miniCRAN")
+
tags <- "chron"
+pkgDep(tags, availPkgs = cranJuly2014)
## [1] "chron" "RColorBrewer" "dichromat" "munsell"
## [5] "plyr" "labeling" "colorspace" "Rcpp"
## [9] "digest" "gtable" "reshape2" "scales"
-## [13] "proto" "MASS" "stringr" "ggplot2"
-
-
-
To create an igraph plot of the dependencies, use the function makeDepGraph()
and plot the results:
-
-
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
-
-
-
## Loading required namespace: igraph
-
-
-
set.seed(1)
-plot(dg, legendPosition = c(-1, 1), vertex.size=20)
-
-
-
-
+## [13] "proto" "MASS" "stringr" "ggplot2"
+
To create an igraph plot of the dependencies, use the function makeDepGraph()
and plot the results:
+
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
+
## Loading required namespace: igraph
+
set.seed(1)
+plot(dg, legendPosition = c(-1, 1), vertex.size=20)
+
Note how the dependencies expand to zoo
(enhanced), scales
and ggplot
(suggested) and then recursively from there to get all the Imports
and LinkingTo
dependencies.
-
+
+
An example with multiple input packages
-
As a final example, create a dependency graph of seven very popular R packages:
-
-
tags <- c("ggplot2", "data.table", "plyr", "knitr", "shiny", "xts", "lattice")
-pkgDep(tags, suggests = TRUE, enhances=FALSE, availPkgs = cranJuly2014)
-
-
+
tags <- c("ggplot2", "data.table", "plyr", "knitr", "shiny", "xts", "lattice")
+pkgDep(tags, suggests = TRUE, enhances=FALSE, availPkgs = cranJuly2014)
## [1] "ggplot2" "data.table" "plyr" "knitr"
## [5] "shiny" "xts" "lattice" "digest"
## [9] "gtable" "reshape2" "scales" "proto"
@@ -285,16 +133,34 @@ An example with multiple input packages
## [65] "foreach" "doMC" "itertools" "testit"
## [69] "rgl" "XML" "RCurl" "Cairo"
## [73] "timeSeries" "tseries" "its" "fts"
-## [77] "tis" "KernSmooth"
-
-
-
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
+## [77] "tis" "KernSmooth"
+
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
set.seed(1)
-plot(dg, legendPosition = c(-1, -1), vertex.size=10, cex=0.7)
-
+plot(dg, legendPosition = c(-1, -1), vertex.size=10, cex=0.7)
+
+
-
-
+
+
+
+
+
+
+
+
diff --git a/inst/doc/miniCRAN-dependency-graph.rmd b/inst/doc/miniCRAN-dependency-graph.rmd
index 2d42cd6..6d59e85 100644
--- a/inst/doc/miniCRAN-dependency-graph.rmd
+++ b/inst/doc/miniCRAN-dependency-graph.rmd
@@ -1,13 +1,13 @@
---
title: "Using miniCRAN to identify package dependencies"
author: "Andrie de Vries"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using miniCRAN to identify package dependencies}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
diff --git a/inst/doc/miniCRAN-introduction.R b/inst/doc/miniCRAN-introduction.R
index 8245f07..29d6d87 100644
--- a/inst/doc/miniCRAN-introduction.R
+++ b/inst/doc/miniCRAN-introduction.R
@@ -2,7 +2,7 @@
library("miniCRAN")
# use Revolution Analytics CRAN mirror
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN="http://cran.microsoft.com")
# Specify list of packages to download
pkgs <- c("foreach")
diff --git a/inst/doc/miniCRAN-introduction.html b/inst/doc/miniCRAN-introduction.html
index 706cd8d..d8147e1 100644
--- a/inst/doc/miniCRAN-introduction.html
+++ b/inst/doc/miniCRAN-introduction.html
@@ -1,291 +1,140 @@
-
-
-
-Creating a miniCRAN repository
+
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-Creating a miniCRAN repository
+
+
+
+
+
+
Start by creating the recursive dependency tree for your target packages.
-
For example, imagine a scenario where you want to create a repository that consists of the package foreach
and its dependencies.
-
Start by creating the dependency list:
-
-
library("miniCRAN")
+library("miniCRAN")
# use Revolution Analytics CRAN mirror
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN="http://cran.microsoft.com")
# Specify list of packages to download
pkgs <- c("foreach")
pkgList <- pkgDep(pkgs, repos=revolution, type="source", suggests = FALSE, availPkgs = cranJuly2014)
-pkgList
-
-
-## [1] "foreach" "codetools" "iterators"
-
-
-Next, create a repository with the function makeRepo()
. In this example, get the required files for source
packages as well as windows binaries:
-
-# Create temporary folder for miniCRAN
+pkgList
+## [1] "foreach" "codetools" "iterators"
+Next, create a repository with the function makeRepo()
. In this example, get the required files for source
packages as well as windows binaries:
+# Create temporary folder for miniCRAN
dir.create(pth <- file.path(tempdir(), "miniCRAN"))
# Make repo for source and win.binary
makeRepo(pkgList, path=pth, repos=revolution, type="source")
-makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")
-
-
+makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")
Investigate the repository file structure:
-
-
# List all files in miniCRAN
-list.files(pth, recursive=TRUE, full.names=FALSE)
-
-
+
# List all files in miniCRAN
+list.files(pth, recursive=TRUE, full.names=FALSE)
Use pkgAvail
to list available packages in your repository:
-
-
# Check for available packages
-pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)]
-
-
+
# Check for available packages
+pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)]
+
Install packages from your local repository
-
To install packages from a local repository, you need to use the URI convention file:///
to point to your file lcoation.
-
-
install.packages(pkgs,
+install.packages(pkgs,
repos = paste0("file:///", pth),
- type = "source")
-
-
+ type = "source")
+
+
Adding packages to an existing miniCRAN repository
-
+
Adding new packages from CRAN
-
After creating a local miniCRAN repository, additional packages and their dependencies can easily be added. This mechanism can also be used to re-add an existing package to the miniCRAN repo.
-
-
# Add new packages (from CRAN) to the miniCRAN repo
-addPackage("Matrix", path=pth, repos=revolution, type="source")
-
-
+
# Add new packages (from CRAN) to the miniCRAN repo
+addPackage("Matrix", path=pth, repos=revolution, type="source")
The value that is returned via addPackage
is the number of packages written to the index file, i.e. , the total number of packages in the repo of that type.
-
+
+
Adding an older version of a package from CRAN
-
To add a specific version of a package from CRAN (or another CRAN-like repository), we can easily download the source packages from the CRAN archives. Dependencies for old package versions cannot be determined automatically and must be specified by the user.
-
Note: in order to to add binaries of older packages, you will need to download the source and build the binaries on the intended platform yourself. You will need the appropriate R development tools installed in order to build package binaries from source.
-
-
# create a data frame with the package and version info
+# create a data frame with the package and version info
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
# download old source package version and create repo index
-addOldPackage(pkgList, path=pth, vers=oldVers$version, repos=revolution, type="source")
-
-
-You will get a warning whenever there are multiple versions of a package saved in the repository. Currently, you need to manually remove duplicate versions before rebuilding the repository's package index.
-
+addOldPackage(pkgList, path=pth, vers=oldVers$version, repos=revolution, type="source")
+
You will get a warning whenever there are multiple versions of a package saved in the repository. Currently, you need to manually remove duplicate versions before rebuilding the repository’s package index.
Note: This last step is important, otherwise you may end up with a repo in an inconsistent state.
-
-
# List package versions in the miniCRAN repo (produces warning about duplicates)
+# List package versions in the miniCRAN repo (produces warning about duplicates)
pkgVersionsSrc <- checkVersions(pkgList, path=pth, type="source")
pkgVersionsBin <- checkVersions(pkgList, path=pth, type="win.binary")
@@ -296,35 +145,49 @@ Adding an older version of a package from CRAN
file.remove(pkgVersionsSrc[c(2,4,6)])
# rebuild the package index after removing duplicate package versions
-updateRepoIndex(pth, type=c("source", "win.binary"))
-
-
+updateRepoIndex(pth, type=c("source", "win.binary"))
To see the updated list of packages available in the miniCRAN repo:
-
-
pkgAvail(pth, type="source")[, c(1:3, 5)] # contains the old versions
-pkgAvail(pth, type="win.binary")[, c(1:3, 5)] # contains the current versions
-
-
+
pkgAvail(pth, type="source")[, c(1:3, 5)] # contains the old versions
+pkgAvail(pth, type="win.binary")[, c(1:3, 5)] # contains the current versions
+
+
Adding packages from other sources
-
This feature will be implemented in a future release.
-
+
+
+
Updating the packages in a miniCRAN repository
-
Checking for updated versions of the packages currently stored in the miniCRAN repository:
-
-
# Check if updated packages are available
+# Check if updated packages are available
oldPackages(path=pth, repos=revolution, type="source")[, 1:3] # should need update
-oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be current
-
-
+oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be current
Update the versions of the packages currently stored in the miniCRAN repository. By default, a prompt is given to confirm the update for each package. This prompt can be suppressed using ask=FALSE
, which will update all packages. Be careful using this option if you want to keep certain packages at an older version.
-
-
# Update available packages
+# Update available packages
updatePackages(path=pth, repos=revolution, type="source", ask=FALSE) # should need update
-updatePackages(path=pth, repos=revolution, type="win.binary", ask=FALSE) # should be current
-
+updatePackages(path=pth, repos=revolution, type="win.binary", ask=FALSE) # should be current
+
-
+
+
+
+
+
+
+
+
diff --git a/inst/doc/miniCRAN-introduction.rmd b/inst/doc/miniCRAN-introduction.rmd
index e41f8b7..2ee58b0 100644
--- a/inst/doc/miniCRAN-introduction.rmd
+++ b/inst/doc/miniCRAN-introduction.rmd
@@ -1,21 +1,19 @@
---
-title: "Using miniCRAN to create a local CRAN repository"
+title: "Using miniCRAN to create a local CRAN repository"
author: "Andrie de Vries and Alex Chubaty"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using miniCRAN to create and maintain a local CRAN repository}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
%\usepackage[utf8]{inputenc}
---
-# Creating a miniCRAN repository
-
Start by creating the recursive dependency tree for your target packages.
For example, imagine a scenario where you want to create a repository that consists of the package `foreach` and its dependencies.
@@ -26,7 +24,7 @@ Start by creating the dependency list:
library("miniCRAN")
# use Revolution Analytics CRAN mirror
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN="http://cran.microsoft.com")
# Specify list of packages to download
pkgs <- c("foreach")
diff --git a/inst/doc/miniCRAN-non-CRAN-repos.html b/inst/doc/miniCRAN-non-CRAN-repos.html
index 32b1089..b08b0d1 100644
--- a/inst/doc/miniCRAN-non-CRAN-repos.html
+++ b/inst/doc/miniCRAN-non-CRAN-repos.html
@@ -1,268 +1,150 @@
-
-
-
-
-Using repositories other than CRAN with miniCRAN
-
+
-
-
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
Using repositories other than CRAN with miniCRAN
+
Although the package name miniCRAN
seems to indicate you can only use CRAN as a repository, you can in fact use any CRAN-like repository.
-
This vignette contains some examples of how to refer to different package repositories, including CRAN, alternative mirrors of CRAN, R-Forge as well as BioConductor.
-
To make simplify the code to show the salient features, we use a little helper function, index()
that is a simple wrapper around available.packages()
:
-
-
# Wrapper around available.packages ---------------------------------------
-
+# Wrapper around available.packages ---------------------------------------
+
index <- function(url, type="source", filters=NULL, head=5, cols=c("Package", "Version")){
contribUrl <- contrib.url(url, type=type)
p <- available.packages(contribUrl, type=type, filters=filters)
p[1:head, cols]
-}
-
-
+}
+
Using CRAN
-
The URL for the master mirror in Austria:
-
-
CRAN <- "http://cran.r-project.org"
-index(CRAN)
-
-
+
CRAN <- "http://cran.r-project.org"
+index(CRAN)
+
+
Using a different mirror
-
You can also point to any other mirror, for example the stable version hosted by Revolution Analytics:
-
-
revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable"
+revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable"
index(revoStable)
-
+
revoMirror <- "http://cran.revolutionanalytics.com"
-index(revoMirror)
-
-
+index(revoMirror)
+
+
Using R-forge
-
R-forge has CRAN-like structure:
-
-
rforge <- "http://r-forge.r-project.org"
-index(rforge)
-
-
+
rforge <- "http://r-forge.r-project.org"
+index(rforge)
+
+
Using BioConductor
-
Although BioConductor has a different preferred install mechanism, the underlying repository structure is also CRAN-like:
-
-
bioc <- local({
+bioc <- local({
env <- new.env()
on.exit(rm(env))
evalq(source("http://bioconductor.org/biocLite.R", local=TRUE), env)
biocinstallRepos()
})
-
+
bioc
bioc[grep("BioC", names(bioc))]
+
+
+index(bioc["BioCsoft"])
+
-index(bioc["BioCsoft"])
-
+
-
+
+
+
+
+
+
diff --git a/inst/doc/miniCRAN-non-CRAN-repos.rmd b/inst/doc/miniCRAN-non-CRAN-repos.rmd
index 7837e6f..0b356d7 100644
--- a/inst/doc/miniCRAN-non-CRAN-repos.rmd
+++ b/inst/doc/miniCRAN-non-CRAN-repos.rmd
@@ -1,21 +1,19 @@
---
title: "Using repositories other than CRAN with miniCRAN"
author: "Andrie de Vries"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using repositories other than CRAN with miniCRAN}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
%\usepackage[utf8]{inputenc}
---
-# Using repositories other than CRAN with miniCRAN
-
Although the package name `miniCRAN` seems to indicate you can only use CRAN as a repository, you can in fact use any CRAN-like repository.
This vignette contains some examples of how to refer to different package repositories, including CRAN, alternative mirrors of CRAN, R-Forge as well as BioConductor.
diff --git a/inst/examples/example_addPackageListingGithub.R b/inst/examples/example_addPackageListingGithub.R
index f201d9c..0b244b6 100644
--- a/inst/examples/example_addPackageListingGithub.R
+++ b/inst/examples/example_addPackageListingGithub.R
@@ -2,7 +2,7 @@
pdb <- cranJuly2014
\dontrun{
- pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com"))
+ pdb <- pkgAvail(repos = c(CRAN="http://mran.microsoft.com"))
# Overwrite pdb with development version of miniCRAN at github
diff --git a/inst/examples/example_checkVersions.R b/inst/examples/example_checkVersions.R
index a02fdfe..839eae0 100644
--- a/inst/examples/example_checkVersions.R
+++ b/inst/examples/example_checkVersions.R
@@ -1,7 +1,7 @@
### `checkVersions` and `add.packages.miniCRAN` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
diff --git a/inst/examples/example_getCranDescription.R b/inst/examples/example_getCranDescription.R
index 5ef5d59..a4cd812 100644
--- a/inst/examples/example_getCranDescription.R
+++ b/inst/examples/example_getCranDescription.R
@@ -1,5 +1,5 @@
\dontrun{
getCranDescription(c("igraph", "ggplot2", "XML"),
- repos=c(CRAN="http://cran.revolutionanalytics.com")
+ repos = c(CRAN = "http://mran.microsoft.com")
)
}
diff --git a/inst/examples/example_makeDepGraph.R b/inst/examples/example_makeDepGraph.R
index 7b82b4a..0512944 100644
--- a/inst/examples/example_makeDepGraph.R
+++ b/inst/examples/example_makeDepGraph.R
@@ -5,7 +5,7 @@ availPkgs <- cranJuly2014
\dontrun{
availPkgs <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN="http://mran.microsoft.com"),
type="source"
)
}
@@ -26,7 +26,7 @@ if(require(igraph)) plot(p)
p <- makeDepGraph(
c("ggplot2", "forecast"),
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
if(require(igraph)) plot(p)
diff --git a/inst/examples/example_makeRepo.R b/inst/examples/example_makeRepo.R
index aebda66..0862315 100644
--- a/inst/examples/example_makeRepo.R
+++ b/inst/examples/example_makeRepo.R
@@ -1,13 +1,13 @@
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
\dontrun{
pdb <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
}
diff --git a/inst/examples/example_pkgDep.R b/inst/examples/example_pkgDep.R
index 099f2ed..12bf962 100644
--- a/inst/examples/example_pkgDep.R
+++ b/inst/examples/example_pkgDep.R
@@ -1,13 +1,13 @@
\dontrun{
-pkgDep(pkg=c("ggplot2", "plyr", "reshape2"),
- repos=c(CRAN="http://cran.revolutionanalytics.com")
+pkgDep(pkg = c("ggplot2", "plyr", "reshape2"),
+ repos = c(CRAN = "http://mran.microsoft.com")
)
}
pdb <- cranJuly2014
\dontrun{
-pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com"))
+pdb <- pkgAvail(repos = c(CRAN = "http://mran.microsoft.com"))
}
pkgDep(pkg=c("ggplot2", "plyr", "reshape2"), pdb)
diff --git a/inst/examples/example_plot.pkgDepGraph.R b/inst/examples/example_plot.pkgDepGraph.R
index 2ca89bb..879fb72 100644
--- a/inst/examples/example_plot.pkgDepGraph.R
+++ b/inst/examples/example_plot.pkgDepGraph.R
@@ -5,7 +5,7 @@ pdb <- cranJuly2014
\dontrun{
pdb <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
}
diff --git a/inst/examples/example_rsynctools.R b/inst/examples/example_rsynctools.R
index 7a2c40e..d347487 100644
--- a/inst/examples/example_rsynctools.R
+++ b/inst/examples/example_rsynctools.R
@@ -1,4 +1,4 @@
\dontrun{
pkgs <- c("ggplot2", "plyr", "reshape2")
- makeRsyncInclude(pkgs, type="source", repos=c(CRAN="http://cran.revolutionanalytics.com"))
+ makeRsyncInclude(pkgs, type = "source", repos = c(CRAN = "http://mran.microsoft.com"))
}
diff --git a/inst/examples/example_updatePackages.R b/inst/examples/example_updatePackages.R
index f76bf20..0acd34c 100644
--- a/inst/examples/example_updatePackages.R
+++ b/inst/examples/example_updatePackages.R
@@ -1,7 +1,7 @@
### `oldPackages` and `updatePackages` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
@@ -25,7 +25,7 @@ pkgList
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
- addOldPackage(pkgList, path=pth, vers=oldVers$version, type="source")
+ addOldPackage(pkgList, path=pth, repos=revolution, vers=oldVers$version, type="source")
# NOTE: older binary versions would need to be build from source
# Check if updated packages are available
@@ -33,7 +33,7 @@ pkgList
oldPackages(path=pth, repos=revolution, type="win.binary") # should be current
# Update available packages
- updatePackages(path=pth, repos=revolution, type="source") # should need update
+ updatePackages(path=pth, repos=revolution, type="source", ask=FALSE) # should need update
updatePackages(path=pth, repos=revolution, type="win.binary") # should be current
# Delete temporary folder
diff --git a/man/addOldPackage.Rd b/man/addOldPackage.Rd
index ac8986f..374daeb 100644
--- a/man/addOldPackage.Rd
+++ b/man/addOldPackage.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addPackages.R
\name{addOldPackage}
\alias{addOldPackage}
@@ -40,7 +40,7 @@ Dependencies for old package versions cannot be determined automatically and mus
### `checkVersions` and `add.packages.miniCRAN` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
@@ -91,10 +91,8 @@ pkgList
}
}
\seealso{
-Other update repo functions: \code{\link{addPackage}};
- \code{\link{checkVersions}}; \code{\link{makeRepo}},
- \code{\link{updateRepoIndex}}; \code{\link{oldPackages}},
- \code{\link{updatePackages}},
+Other update repo functions: \code{\link{addPackage}},
+ \code{\link{checkVersions}}, \code{\link{makeRepo}},
\code{\link{updatePackages}}
}
diff --git a/man/addPackage.Rd b/man/addPackage.Rd
index aa73d0c..6f9ddef 100644
--- a/man/addPackage.Rd
+++ b/man/addPackage.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addPackages.R
\name{addPackage}
\alias{addPackage}
@@ -35,7 +35,7 @@ Add packages to a miniCRAN repository.
### `checkVersions` and `add.packages.miniCRAN` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
@@ -86,10 +86,8 @@ pkgList
}
}
\seealso{
-Other update repo functions: \code{\link{addOldPackage}};
- \code{\link{checkVersions}}; \code{\link{makeRepo}},
- \code{\link{updateRepoIndex}}; \code{\link{oldPackages}},
- \code{\link{updatePackages}},
+Other update repo functions: \code{\link{addOldPackage}},
+ \code{\link{checkVersions}}, \code{\link{makeRepo}},
\code{\link{updatePackages}}
}
diff --git a/man/addPackageListingGithub.Rd b/man/addPackageListingGithub.Rd
index 5379ab3..4a0c086 100644
--- a/man/addPackageListingGithub.Rd
+++ b/man/addPackageListingGithub.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/github-functions.R
\name{addPackageListingGithub}
\alias{addPackageListingGithub}
@@ -24,7 +24,7 @@ Downloads the DESCRIPTION file from a package on github, parses the fields and a
pdb <- cranJuly2014
\dontrun{
- pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com"))
+ pdb <- pkgAvail(repos = c(CRAN="http://mran.microsoft.com"))
# Overwrite pdb with development version of miniCRAN at github
diff --git a/man/basePkgs.Rd b/man/basePkgs.Rd
index 3d6ccc3..99c140c 100644
--- a/man/basePkgs.Rd
+++ b/man/basePkgs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pkgDep.R
\name{basePkgs}
\alias{basePkgs}
@@ -12,7 +12,7 @@ Retrieves names of installed packages by calling \code{\link[utils]{installed.pa
\seealso{
\code{\link{pkgDep}}
-Other dependency functions: \code{\link{makeDepGraph}};
- \code{\link{pkgDep}}; \code{\link{plot.pkgDepGraph}}
+Other dependency functions: \code{\link{makeDepGraph}},
+ \code{\link{pkgDep}}, \code{\link{plot.pkgDepGraph}}
}
diff --git a/man/checkVersions.Rd b/man/checkVersions.Rd
index e871598..e6e248e 100644
--- a/man/checkVersions.Rd
+++ b/man/checkVersions.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addPackages.R
\name{checkVersions}
\alias{checkVersions}
@@ -26,7 +26,7 @@ Checks for previous versions, and returns the file paths for packages with multi
### `checkVersions` and `add.packages.miniCRAN` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
@@ -77,10 +77,8 @@ pkgList
}
}
\seealso{
-Other update repo functions: \code{\link{addOldPackage}};
- \code{\link{addPackage}}; \code{\link{makeRepo}},
- \code{\link{updateRepoIndex}}; \code{\link{oldPackages}},
- \code{\link{updatePackages}},
+Other update repo functions: \code{\link{addOldPackage}},
+ \code{\link{addPackage}}, \code{\link{makeRepo}},
\code{\link{updatePackages}}
}
diff --git a/man/cranJuly2014.Rd b/man/cranJuly2014.Rd
index 4e3380f..d244e69 100644
--- a/man/cranJuly2014.Rd
+++ b/man/cranJuly2014.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/minicran-package.R
\docType{data}
\name{cranJuly2014}
diff --git a/man/getCranDescription.Rd b/man/getCranDescription.Rd
index b287f36..d9426ef 100644
--- a/man/getCranDescription.Rd
+++ b/man/getCranDescription.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/getCranDescription.R
\name{getCranDescription}
\alias{getCranDescription}
\title{Scrape DESCRIPTION from CRAN for each pkg.}
\usage{
-getCranDescription(pkg, repos = getOption("repos"), type = "source", path,
+getCranDescription(pkg, repos = getOption("repos"), type = "source",
pkgs = pkgDep(pkg, repos = repos, type = type))
}
\arguments{
@@ -14,8 +14,6 @@ getCranDescription(pkg, repos = getOption("repos"), type = "source", path,
\item{type}{Possible values are (currently) "source", "mac.binary" and "win.binary": the binary types can be listed and downloaded but not installed on other platforms. Passed to \code{\link{download.packages}}.}
-\item{path}{Destination download path. This path is the root folder of your new repository.}
-
\item{pkgs}{Character vector of packages to download}
}
\description{
@@ -24,7 +22,7 @@ Scrape DESCRIPTION from CRAN for each pkg.
\examples{
\dontrun{
getCranDescription(c("igraph", "ggplot2", "XML"),
- repos=c(CRAN="http://cran.revolutionanalytics.com")
+ repos = c(CRAN = "http://mran.microsoft.com")
)
}
}
diff --git a/man/makeDepGraph.Rd b/man/makeDepGraph.Rd
index cc94714..eed8f1b 100644
--- a/man/makeDepGraph.Rd
+++ b/man/makeDepGraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/makeDepGraph.R
\name{makeDepGraph}
\alias{makeDepGraph}
@@ -35,7 +35,7 @@ availPkgs <- cranJuly2014
\dontrun{
availPkgs <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN="http://mran.microsoft.com"),
type="source"
)
}
@@ -56,7 +56,7 @@ if(require(igraph)) plot(p)
p <- makeDepGraph(
c("ggplot2", "forecast"),
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
if(require(igraph)) plot(p)
@@ -65,7 +65,7 @@ if(require(igraph)) plot(p)
\seealso{
\code{\link{pkgDep}} to extract package dependencies
-Other dependency functions: \code{\link{basePkgs}};
- \code{\link{pkgDep}}; \code{\link{plot.pkgDepGraph}}
+Other dependency functions: \code{\link{basePkgs}},
+ \code{\link{pkgDep}}, \code{\link{plot.pkgDepGraph}}
}
diff --git a/man/makeLibrary.Rd b/man/makeLibrary.Rd
index 37182ae..14f124c 100644
--- a/man/makeLibrary.Rd
+++ b/man/makeLibrary.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/makeRepo.R
\name{makeLibrary}
\alias{makeLibrary}
diff --git a/man/makeRepo.Rd b/man/makeRepo.Rd
index b17e70d..f755739 100644
--- a/man/makeRepo.Rd
+++ b/man/makeRepo.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/makeRepo.R
\name{makeRepo}
\alias{makeRepo}
@@ -69,14 +69,14 @@ The folder structure of a repository
\examples{
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
\dontrun{
pdb <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
}
@@ -107,9 +107,8 @@ unlink(pth, recursive = TRUE)
}
}
\seealso{
-Other update repo functions: \code{\link{addOldPackage}};
- \code{\link{addPackage}}; \code{\link{checkVersions}};
- \code{\link{oldPackages}}, \code{\link{updatePackages}},
+Other update repo functions: \code{\link{addOldPackage}},
+ \code{\link{addPackage}}, \code{\link{checkVersions}},
\code{\link{updatePackages}}
}
diff --git a/man/miniCRAN-package.Rd b/man/miniCRAN-package.Rd
index b7e44c7..8af83ed 100644
--- a/man/miniCRAN-package.Rd
+++ b/man/miniCRAN-package.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/minicran-package.R
\docType{package}
\name{miniCRAN-package}
@@ -7,9 +7,9 @@
\alias{minicran}
\title{Create a Private Version of CRAN Containing Only Selected Packages}
\description{
-At the end of 2014, CRAN consisted of more than 6,000 packages. Many organisations need to maintain a private mirror of CRAN, but with only a subset of packages that are relevant to them.
+At the end of 2014, CRAN consisted of more than 6,000 packages. Many organisations need to maintain a private mirror of CRAN, but with only a subset of packages that are relevant to them.
-\code{miniCRAN} makes it possible to create an internally consistent repository consisting of selected packages from CRAN-like repositories. The user specifies a set of desired packages, and miniCRAN recursively reads the dependency tree for these packages, then downloads only this subset.
+\code{miniCRAN} makes it possible to create an internally consistent repository consisting of selected packages from CRAN-like repositories. The user specifies a set of desired packages, and miniCRAN recursively reads the dependency tree for these packages, then downloads only this subset.
There are many reasons for not creating a complete mirror CRAN using \code{rsync}:
@@ -63,7 +63,7 @@ To get a recursive list of dependencies as well as a plot, use \code{\link{pkgDe
}
}
\author{
-Andrie de Vries \email{andrie@revolutionanalytics.com} with contributions from Alex Chubaty \email{alex.chubaty@gmail.com}
+Andrie de Vries \email{adevries@microsoft.com} with contributions from Alex Chubaty \email{alex.chubaty@gmail.com}
}
\keyword{package}
diff --git a/man/pkgAvail.Rd b/man/pkgAvail.Rd
index d263287..7240c2c 100644
--- a/man/pkgAvail.Rd
+++ b/man/pkgAvail.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pkgDep.R
\name{pkgAvail}
\alias{pkgAvail}
diff --git a/man/pkgDep.Rd b/man/pkgDep.Rd
index 53676c8..c759da3 100644
--- a/man/pkgDep.Rd
+++ b/man/pkgDep.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pkgDep.R
\name{pkgDep}
\alias{pkgDep}
@@ -35,22 +35,22 @@ Performs recursive retrieve for \code{Depends}, \code{Imports} and \code{LinkLib
\examples{
\dontrun{
-pkgDep(pkg=c("ggplot2", "plyr", "reshape2"),
- repos=c(CRAN="http://cran.revolutionanalytics.com")
+pkgDep(pkg = c("ggplot2", "plyr", "reshape2"),
+ repos = c(CRAN = "http://mran.microsoft.com")
)
}
pdb <- cranJuly2014
\dontrun{
-pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com"))
+pdb <- pkgAvail(repos = c(CRAN = "http://mran.microsoft.com"))
}
pkgDep(pkg=c("ggplot2", "plyr", "reshape2"), pdb)
}
\seealso{
-Other dependency functions: \code{\link{basePkgs}};
- \code{\link{makeDepGraph}};
+Other dependency functions: \code{\link{basePkgs}},
+ \code{\link{makeDepGraph}},
\code{\link{plot.pkgDepGraph}}
}
diff --git a/man/pkgDepTools.Rd b/man/pkgDepTools.Rd
deleted file mode 100644
index 0067924..0000000
--- a/man/pkgDepTools.Rd
+++ /dev/null
@@ -1,22 +0,0 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
-% Please edit documentation in R/pkgDepTools.R
-\name{split_op_version}
-\alias{cleanPkgField}
-\alias{split_dependencies}
-\alias{split_op_version}
-\title{Clean package fields.}
-\usage{
-split_op_version(x)
-
-split_dependencies(x)
-
-cleanPkgField(val)
-}
-\arguments{
-\item{val}{Value from a field like 'Depends' in a package's DESCRIPTION file}
-}
-\description{
-Given the value from a field like 'Depends' in a package's DESCRIPTION file, return a character vector of package names with the version restrictions stripped and \R~removed.
-}
-\keyword{internal}
-
diff --git a/man/plot.pkgDepGraph.Rd b/man/plot.pkgDepGraph.Rd
index 90aa0d9..fbfd040 100644
--- a/man/plot.pkgDepGraph.Rd
+++ b/man/plot.pkgDepGraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.pkgDepGraph.R
\name{plot.pkgDepGraph}
\alias{plot.pkgDepGraph}
@@ -36,7 +36,7 @@ pdb <- cranJuly2014
\dontrun{
pdb <- pkgAvail(
- repos = c(CRAN="http://cran.revolutionanalytics.com"),
+ repos = c(CRAN = "http://mran.microsoft.com"),
type="source"
)
}
@@ -61,7 +61,7 @@ plot(dg, legendPosition=c(1, 1), vertex.size=20, cex=0.5)
}
\seealso{
-Other dependency functions: \code{\link{basePkgs}};
- \code{\link{makeDepGraph}}; \code{\link{pkgDep}}
+Other dependency functions: \code{\link{basePkgs}},
+ \code{\link{makeDepGraph}}, \code{\link{pkgDep}}
}
diff --git a/man/repoBinPath.Rd b/man/repoBinPath.Rd
index 93c3a58..22d7c9f 100644
--- a/man/repoBinPath.Rd
+++ b/man/repoBinPath.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{repoBinPath}
\alias{repoBinPath}
diff --git a/man/repoPrefix.Rd b/man/repoPrefix.Rd
index ceeea0e..6b2a8be 100644
--- a/man/repoPrefix.Rd
+++ b/man/repoPrefix.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{repoPrefix}
\alias{repoPrefix}
diff --git a/man/twodigitRversion.Rd b/man/twodigitRversion.Rd
index 60f47bc..530d25a 100644
--- a/man/twodigitRversion.Rd
+++ b/man/twodigitRversion.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{twodigitRversion}
\alias{twodigitRversion}
diff --git a/man/updatePackages.Rd b/man/updatePackages.Rd
index fabd005..fb9bdb5 100644
--- a/man/updatePackages.Rd
+++ b/man/updatePackages.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/updatePackages.R
\name{updatePackages}
\alias{oldPackages}
@@ -51,7 +51,7 @@ These functions are based on \code{\link{update.packages}}. However, rather tha
### `oldPackages` and `updatePackages` require an existing miniCRAN repo
# Specify list of packages to download
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN = "http://mran.microsoft.com")
pkgs <- c("foreach")
pdb <- cranJuly2014
@@ -75,7 +75,7 @@ pkgList
oldVers <- data.frame(package=c("foreach", "codetools", "iterators"),
version=c("1.4.0", "0.2-7", "1.0.5"),
stringsAsFactors=FALSE)
- addOldPackage(pkgList, path=pth, vers=oldVers$version, type="source")
+ addOldPackage(pkgList, path=pth, repos=revolution, vers=oldVers$version, type="source")
# NOTE: older binary versions would need to be build from source
# Check if updated packages are available
@@ -83,7 +83,7 @@ pkgList
oldPackages(path=pth, repos=revolution, type="win.binary") # should be current
# Update available packages
- updatePackages(path=pth, repos=revolution, type="source") # should need update
+ updatePackages(path=pth, repos=revolution, type="source", ask=FALSE) # should need update
updatePackages(path=pth, repos=revolution, type="win.binary") # should be current
# Delete temporary folder
@@ -93,8 +93,8 @@ pkgList
\seealso{
\code{\link{updatePackages}}, \code{\link{pkgAvail}}.
-Other update repo functions: \code{\link{addOldPackage}};
- \code{\link{addPackage}}; \code{\link{checkVersions}};
- \code{\link{makeRepo}}, \code{\link{updateRepoIndex}}
+Other update repo functions: \code{\link{addOldPackage}},
+ \code{\link{addPackage}}, \code{\link{checkVersions}},
+ \code{\link{makeRepo}}
}
diff --git a/tests/testthat/test-1-pkgAvail.R b/tests/testthat/test-1-pkgAvail.R
new file mode 100644
index 0000000..fdac386
--- /dev/null
+++ b/tests/testthat/test-1-pkgAvail.R
@@ -0,0 +1,23 @@
+context("pkgAvail")
+
+test_that("pkgAvail throws warnings and errors for incorrect CRAN repos", {
+ expect_warning(pkgAvail(repos=""))
+
+
+ is.available.packages <- function(x){
+ all(is.matrix(x), dim(x)[2] == 17, names(x)[1:3] == c("Package", "Version","Priority", "Depends"))
+ }
+
+ skip_if_offline(MRAN())
+
+ expect_true(is.available.packages(
+ pkgAvail(repos = unname(MRAN()))
+ ))
+ expect_true(is.available.packages(
+ pkgAvail(repos = MRAN())
+ ))
+ expect_true(is.available.packages(
+ pkgAvail(repos=c(CRAN="@CRAN@"))
+ ))
+
+})
\ No newline at end of file
diff --git a/tests/testthat/test-1-pkgDep.R b/tests/testthat/test-1-pkgDep.R
index 8c5493f..58c8ea9 100644
--- a/tests/testthat/test-1-pkgDep.R
+++ b/tests/testthat/test-1-pkgDep.R
@@ -1,4 +1,4 @@
-context("Test pkgDep")
+context("pkgDep")
@@ -7,7 +7,7 @@ context("Test pkgDep")
test_that("pkgDep throws warnings and errors", {
expect_error(
- pkgDep(, availPkgs = cranJuly2014),
+ pkgDep(availPkgs = cranJuly2014),
"pkg should be a character vector with package names"
)
@@ -86,24 +86,3 @@ test_that("pkgDep treats includeBasePkgs correctly", {
-# CRAN mirror -------------------------------------------------------------
-
-test_that("pkgDep throws warnings and errors for incorrect CRAN repos", {
- expect_warning(pkgAvail(repos=""))
-
- is.available.packages <- function(x){
- all(is.matrix(x), dim(x)[2] == 17, names(x)[1:3] == c("Package", "Version","Priority", "Depends"))
- }
-
- expect_true(is.available.packages(
- pkgAvail(repos="http://cran.revolutionanalytics.com")
- ))
- expect_true(is.available.packages(
- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com"))
- ))
- expect_true(is.available.packages(
- pkgAvail(repos=c(CRAN="@CRAN@"))
- ))
-
-
-})
\ No newline at end of file
diff --git a/tests/testthat/test-2-makeDepGraph.R b/tests/testthat/test-2-makeDepGraph.R
index 7a1a2c7..23409a7 100644
--- a/tests/testthat/test-2-makeDepGraph.R
+++ b/tests/testthat/test-2-makeDepGraph.R
@@ -1,5 +1,5 @@
checkPkgDepFunctions <- function(pkg, availPkgs = cranJuly2014,
- repos = "http://cran.revolutionanalytics.com",
+ repos = MRAN(),
type="source",
suggests=TRUE,
enhances=FALSE,
@@ -47,6 +47,7 @@ mock_require <- function(pkg, ...){
test_that("throws error if igraph not available", {
+ skip_if_offline()
with_mock(
`base::requireNamespace` = function(pkg, ...){
packages.to.exclude <- c("igraph")
@@ -75,8 +76,8 @@ test_that("throws error if igraph not available", {
})
test_that("makeDepGraph and pgkDep gives similar results for MASS", {
-
-
+ skip_if_offline()
+
tag <- "MASS"
expect_true(
diff --git a/tests/testthat/test-3-makeRepo.R b/tests/testthat/test-3-makeRepo.R
index 0beea10..71cf833 100644
--- a/tests/testthat/test-3-makeRepo.R
+++ b/tests/testthat/test-3-makeRepo.R
@@ -3,7 +3,7 @@ if(interactive()) {library(testthat); Sys.setenv(NOT_CRAN="true")}
context("makeRepo")
-revolution <- c(CRAN="http://mran.revolutionanalytics.com/snapshot/2014-10-15")
+revolution <- MRAN("2014-10-15")
pkgs <- c("Bmix")
repo_root <- file.path(tempdir(), "miniCRAN", Sys.Date())
if(file.exists(repo_root)) unlink(repo_root, recursive = TRUE)
@@ -19,6 +19,7 @@ for(pkg_type in names(types)){
test_that(sprintf("makeRepo downloads %s files and builds PACKAGES file", pkg_type), {
skip_on_cran()
+ skip_if_offline()
pdb <- pkgAvail(repos = revolution, type=pkg_type)
pkgList <- pkgDep(pkgs, availPkgs = pdb, repos=revolution, type=pkg_type, suggests=FALSE)
diff --git a/tests/testthat/test-4-updateRepo.R b/tests/testthat/test-4-updateRepo.R
index 9f51d3e..f7a4e5f 100644
--- a/tests/testthat/test-4-updateRepo.R
+++ b/tests/testthat/test-4-updateRepo.R
@@ -9,18 +9,21 @@ repo_root <- file.path(tempdir(), "miniCRAN", Sys.Date())
if(file.exists(repo_root)) unlink(repo_root, recursive=TRUE)
dir.create(repo_root, recursive=TRUE, showWarnings=FALSE)
-revolution <- c(CRAN="http://mran.revolutionanalytics.com/snapshot/2014-10-15")
+revolution <- MRAN("2014-10-15")
pkgs <- c("chron", "adaptivetau")
types <- c("source", "win.binary", "mac.binary")
names(types) <- types
-pdb <- lapply(types, pkgAvail, repos=revolution, Rversion = "3.1")
-pkgList <- lapply(types, function(type){
- pkgDep(pkg=pkgs, type=types[type], availPkgs=pdb[[type]], repos=revolution, suggests=FALSE, Rversion = "3.1")
-})
test_that("sample repo is setup correctly", {
+ skip_if_offline(revolution)
+
+ pdb <<- lapply(types, pkgAvail, repos=revolution, Rversion = "3.1")
+ pkgList <<- lapply(types, function(type){
+ pkgDep(pkg=pkgs, type=types[type], availPkgs=pdb[[type]], repos=revolution, suggests=FALSE, Rversion = "3.1")
+ })
+
miniCRAN:::.createSampleRepo(path = repo_root, MRAN = revolution, Rversion = "3.1")
expect_equal(unname(pkgAvail(repo_root)[, "Package"]), sort(pkgs))
})
@@ -39,6 +42,7 @@ for(pkg_type in names(types)){
test_that(sprintf("addPackage downloads %s files and rebuilds PACKAGES file", pkg_type), {
skip_on_cran()
+ skip_if_offline(revolution)
pkgListAdd <- pkgDep(pkgsAdd, availPkgs=pdb[[pkg_type]],
repos = revolution,
@@ -70,7 +74,7 @@ for(pkg_type in names(types)){
# Check for updates -------------------------------------------------------
-MRAN <- c(CRAN="http://mran.revolutionanalytics.com/snapshot/2014-12-01")
+MRAN_mirror <- MRAN("2014-12-01")
for(pkg_type in names(types)){
@@ -80,27 +84,17 @@ for(pkg_type in names(types)){
test_that(sprintf("updatePackages downloads %s files and builds PACKAGES file", pkg_type), {
skip_on_cran()
+ skip_if_offline(MRAN_mirror)
prefix <- miniCRAN:::repoPrefix(pkg_type, Rversion = "3.1")
- # cat("\n")
- # print(pkgAvail(repo_root, type=pkg_type)[, c("Package", "Version")])
- # cat("\n")
-
- old <- oldPackages(path=repo_root, repos=MRAN, type=pkg_type, Rversion = "3.1")
- # cat("\n")
- # print(pkg_type)
- # cat("\n")
- # cat("Old packages\n")
- # print(old)
- # cat("\n")
-
+ old <- oldPackages(path=repo_root, repos=MRAN_mirror, type=pkg_type, Rversion = "3.1")
+
expect_equal(nrow(old), 2)
expect_equal(ncol(old), 4)
expect_equal(rownames(old), c("adaptivetau", "aprof"))
- # expect_equal(rownames(old), c("adaptivetau"))
- updatePackages(path=repo_root, repos=MRAN, type=pkg_type, ask=FALSE, quiet=TRUE, Rversion = "3.1")
+ updatePackages(path=repo_root, repos=MRAN_mirror, type=pkg_type, ask=FALSE, quiet=TRUE, Rversion = "3.1")
updateVers <- miniCRAN:::getPkgVersFromFile(list.files(file.path(repo_root, prefix)))
@@ -112,7 +106,7 @@ for(pkg_type in names(types)){
file.exists(file.path(repo_root, prefix, "PACKAGES.gz"))
)
- old <- oldPackages(path=repo_root, repos=MRAN, type=pkg_type, Rversion = "3.1")
+ old <- oldPackages(path=repo_root, repos=MRAN_mirror, type=pkg_type, Rversion = "3.1")
# browser()
expect_equal(nrow(old), 0)
expect_equal(ncol(old), 4)
@@ -130,17 +124,18 @@ for(pkg_type in names(types)){
test_that(sprintf("checkVersions() finds out-of-date %s packages", pkg_type), {
skip_on_cran()
+ skip_if_offline(MRAN_mirror)
oldVersions <- list(package=c("aprof"),
version=c("0.2.1"))
if(pkg_type != "source"){
expect_error(
addOldPackage(oldVersions[["package"]], path=repo_root, vers=oldVersions[["version"]],
- repos=MRAN, type=pkg_type)
+ repos=MRAN_mirror, type=pkg_type)
)
} else {
addOldPackage(oldVersions[["package"]], path=repo_root, vers=oldVersions[["version"]],
- repos=MRAN, type=pkg_type)
+ repos=MRAN_mirror, type=pkg_type)
files <- suppressWarnings(
checkVersions(path=repo_root, type=pkg_type)
)
diff --git a/vignettes/miniCRAN-dependency-graph.rmd b/vignettes/miniCRAN-dependency-graph.rmd
index 2d42cd6..6d59e85 100644
--- a/vignettes/miniCRAN-dependency-graph.rmd
+++ b/vignettes/miniCRAN-dependency-graph.rmd
@@ -1,13 +1,13 @@
---
title: "Using miniCRAN to identify package dependencies"
author: "Andrie de Vries"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using miniCRAN to identify package dependencies}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
diff --git a/vignettes/miniCRAN-introduction.rmd b/vignettes/miniCRAN-introduction.rmd
index e41f8b7..2ee58b0 100644
--- a/vignettes/miniCRAN-introduction.rmd
+++ b/vignettes/miniCRAN-introduction.rmd
@@ -1,21 +1,19 @@
---
-title: "Using miniCRAN to create a local CRAN repository"
+title: "Using miniCRAN to create a local CRAN repository"
author: "Andrie de Vries and Alex Chubaty"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using miniCRAN to create and maintain a local CRAN repository}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
%\usepackage[utf8]{inputenc}
---
-# Creating a miniCRAN repository
-
Start by creating the recursive dependency tree for your target packages.
For example, imagine a scenario where you want to create a repository that consists of the package `foreach` and its dependencies.
@@ -26,7 +24,7 @@ Start by creating the dependency list:
library("miniCRAN")
# use Revolution Analytics CRAN mirror
-revolution <- c(CRAN="http://cran.revolutionanalytics.com")
+revolution <- c(CRAN="http://cran.microsoft.com")
# Specify list of packages to download
pkgs <- c("foreach")
diff --git a/vignettes/miniCRAN-non-CRAN-repos.rmd b/vignettes/miniCRAN-non-CRAN-repos.rmd
index 7837e6f..0b356d7 100644
--- a/vignettes/miniCRAN-non-CRAN-repos.rmd
+++ b/vignettes/miniCRAN-non-CRAN-repos.rmd
@@ -1,21 +1,19 @@
---
title: "Using repositories other than CRAN with miniCRAN"
author: "Andrie de Vries"
-date: "March 26, 2015"
+date: "`r as.character(format(Sys.Date(), format='%B %d, %Y'))`"
output:
html_document:
self_contained: yes
toc: yes
vignette: >
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Using repositories other than CRAN with miniCRAN}
%\VignettePackage{miniCRAN}
%\VignetteKeyword{miniCRAN}
%\usepackage[utf8]{inputenc}
---
-# Using repositories other than CRAN with miniCRAN
-
Although the package name `miniCRAN` seems to indicate you can only use CRAN as a repository, you can in fact use any CRAN-like repository.
This vignette contains some examples of how to refer to different package repositories, including CRAN, alternative mirrors of CRAN, R-Forge as well as BioConductor.