[Rd] how to check all CRAN dependencies for my package, before submitting

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Jan 18 10:33:40 CET 2012

On 18.01.2012 09:28, Edzer Pebesma wrote:
> Suppose I'm author of a package on which quite a few other packages
> depend. When I submit to CRAN, I run R CMD check on it, Kurt does that
> too, and if things work out fine, it is accepted. When one or more of
> the packages that depend on it break because of my changes, however,
> hell breaks loose.
> I would like to extend my testing (currently: R CMD check pkg) to
> running R CMD check on all dependent packages, in their most recent
> (CRAN) version. I got stuck trying this.
> Does anyone know how to get (i) a list of all packages that depend,
> directly or indirectly, on my package, and (ii) a list of file names of
> their package sources in their latest version (i.e., including their
> latest version number)?

Quick an dirty example:

packages_to_check <- function(dep, which = c("Depends", "Imports", 
"LinkingTo", "Suggests"), recursive = FALSE){
"packages.rds", mode="wb")
     x <- readRDS("packages.rds")
     x <- x[!duplicated(x[,1]),]
     packages <- x[,1]
     rdeps <- tools:::.package_dependencies(packages = dep, x,
                         which = which,
                         recursive = recursive, reverse = TRUE)
     paste(apply(x[x[,1] %in% rdeps[[1]], 1:2], 1, paste, collapse="_"), 
".tar.gz", sep="")

result <-  packages_to_check("sp")

or if you want the whole chain including recursive dependencies:

result <-  packages_to_check("sp", recursive=TRUE)


More information about the R-devel mailing list