[Lme4-commits] r1810 - pkgtests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 17 23:09:55 CEST 2013


Author: bbolker
Date: 2013-04-17 23:09:55 +0200 (Wed, 17 Apr 2013)
New Revision: 1810

Added:
   pkgtests/README
Modified:
   pkgtests/lme4depfuns.R
   pkgtests/lme4deptests.R
   pkgtests/runtests
Log:
update pkgtests machinery



Added: pkgtests/README
===================================================================
--- pkgtests/README	                        (rev 0)
+++ pkgtests/README	2013-04-17 21:09:55 UTC (rev 1810)
@@ -0,0 +1,12 @@
+directory with tools for checking downstream packages (of lme4,
+but could in principle be something else??)
+
+* set up all needed packages in a local ./library directory
+
+* in order to check packages, we need a _tarball_ of the focal package
+_and_ we need all of its dependencies and suggests to be installed locally;
+we're going to do this by setting up a local ./library that can hold
+all that junk so we don't end up installing 75% of CRAN in our own
+local libraries ...
+
+* need new code to handle 'package required and available but unsuitable version'
\ No newline at end of file

Modified: pkgtests/lme4depfuns.R
===================================================================
--- pkgtests/lme4depfuns.R	2013-04-17 15:34:31 UTC (rev 1809)
+++ pkgtests/lme4depfuns.R	2013-04-17 21:09:55 UTC (rev 1810)
@@ -11,7 +11,7 @@
                      checkdir=".",skip=FALSE) {
     ## FIXME: check for/document local version of tarball more recent than R-forge/CRAN versions
     ## FIXME: consistent implementation of checkdir
-    rforge <- "http://r-forge.r-project.org"    
+    rforge <- "http://r-forge.r-project.org"  
     if (!exists("availCRAN")) {
         if (verbose) cat("getting list of available packages from CRAN\n")
         availCRAN <<- available.packages()
@@ -21,22 +21,26 @@
         availRforge <<- available.packages(contriburl=contrib.url(rforge))
     }
     .libPaths(libdir)
+    ## we definitely want this to check for packages in the local library directory;
+    ## not sure if we want to check in the rest of the standard library paths
     instPkgs <- installed.packages()
     if (verbose) cat("checking package",pn,"\n")
-    loc <- "none"
+    loc <- "none"  ## where is the package coming from?
     if (pn %in% rownames(availRforge)) {
+        ## if available at R-forge ... take the R-forge version
         loc <- "Rforge"
         pkginfo <- availRforge[pn,]
     } else if (pn %in% rownames(availCRAN)) {
         loc <- "CRAN"
         pkginfo <- availCRAN[pn,]
     }
+    ## FIXME: look for local tarballs???
     locpkg <- list.files(tarballdir,paste0("^",pn))
     if (length(locpkg)>0) {
         locver <- gsub(paste0(pn,"_([-0-9.]+).tar.gz"),"\\1",locpkg)
     } else locver <- NULL
     if (loc=="none" && is.null(locver)) stop("package seems to be unavailable")
-    ver <- pkginfo["Version"]
+    ver <- pkginfo["Version"]  ## FIXME: check that tarball matches latest available???
     if (!is.null(locver)) {
         if (length(locver)>1) {
             locver <- pkgmax(locver)
@@ -74,7 +78,7 @@
             instPkgs <- installed.packages(noCache=TRUE)  ## update installed package info
         }
     }
-    ## how to force altered .libPaths in R CMD check?  this doesn't seem to work ...
+    ## must have set check.Renviron here in order for R CMD check to respect libdir
     if (verbose) cat("running R CMD check ...\n")
     unlink(file.path(checkdir,paste0(pn,".Rcheck")))  ## erase existing check directory
     ## FIXME: run R CMD check in checkdir ...

Modified: pkgtests/lme4deptests.R
===================================================================
--- pkgtests/lme4deptests.R	2013-04-17 15:34:31 UTC (rev 1809)
+++ pkgtests/lme4deptests.R	2013-04-17 21:09:55 UTC (rev 1810)
@@ -2,43 +2,43 @@
 ##
 ## include all downstream packages from CRAN, r-forge:
 ## packages to check, loaded from package-dependency scan
-X <- read.csv("lme4_depends.csv",as.is=TRUE,fileEncoding="UTF8")
-source("lme4depfuns.R")
-skippkgs <- "polytomous"
 
-## * must export R_LIBS_SITE=./library before running R CMD BATCH?  (why?)
-## * make sure that .R/check.Renviron is set, e.g.
-##   mv /home/bolker/.R/check.Renviron.old  ~/.R/check.Renviron
-##     ~/.R/check.Renviron:
-##        R_LIBS_SITE=/home/bolker/R/pkgs/lme4/testpkgs/library
+source("http://developer.r-project.org/CRAN/Scripts/depends.R")
+rr <- reverse_dependencies_with_maintainers("lme4")
+source("lme4depfuns.R")  ## component/utility functions
+## packages to skip (because dependencies don't install etc.
+## skippkgs <- "polytomous"
+skippkgs <- character(0)
 
+## * must export R_LIBS_SITE=./library before running R CMD BATCH
+##   and  make sure that .R/check.Renviron is set
+##   (this is done in the 'runtests' script)
+
 ##  (repeated from lme4depfuns.R):
-##    FIXME: check for/document local version of tarball more recent than R-forge/CRAN versions
-##    FIXME: consistent implementation of checkdir
+##   FIXME: check for/document local version of tarball more recent than R-forge/CRAN versions
+##  currently just tries to find most recent version and check it, but could check all versions?
+##  FIXME: consistent implementation of checkdir
 
 ## FIXME: set up an appropriate makefile structure for this ? (a little tricky if it also depends on
 ##   checking CRAN/R-forge versions?
+##  might to be able to use update.packages() ...
+  
+## FIXME (?)/warning: need to make sure that latest/appropriate version of lme4 is installed locally ...
 
-## FIXME (?)/warning: need to make sure that latest version of lme4 is installed in libdir ...
-
 ## FIXME: why are R2admb, RLRsim, sdtalt, Zelig not getting checked?
 
-testdir <- "~/R/pkgs/lme4/pkgtests"
+testdir <- getwd()
+
+## directory for tarballs to check
 tarballdir <- file.path(testdir,"tarballs")
+## directory for ?? (at least current lme4 version ...)
 libdir <-     file.path(testdir,"library")
 
 suppressWarnings(rm(list=c("availCRAN","availRforge"))) ## clean up
-options(repos="http://probability.ca/cran")
 
-require(tools)
-## assume wd is test dir, already
-if (FALSE) {
-    setwd(testdir)
-}
+## require(tools)
 
-## auto-generated list -- cleaned up by hand (removed 'lme4', fixed R2STATS maintainer syntax,
-##   fixed comma in LMERconveniencefunctions author)
-
+## make directories ...
 dir.create(tarballdir,showWarnings=FALSE)
 dir.create(libdir,showWarnings=FALSE)
 ## want to install additional dependencies etc. out of the way
@@ -46,7 +46,7 @@
 ## it would be nice to use tools:::testInstalledPackages(), but I may simply
 ##  have to do R CMD check
 
-pkgnames <- X$X
+pkgnames <- rr[,"Package"]
 names(pkgnames) <- pkgnames ## so results are named
 pkgnames <- pkgnames[!pkgnames %in% skippkgs]
 require(parallel)

Modified: pkgtests/runtests
===================================================================
--- pkgtests/runtests	2013-04-17 15:34:31 UTC (rev 1809)
+++ pkgtests/runtests	2013-04-17 21:09:55 UTC (rev 1810)
@@ -1,8 +1,12 @@
 #! /bin/bash
-## install latest version of lme4
+## install latest version of lme4 *into* the test package directory (-l flag)
 R CMD INSTALL -l ./library ../pkg/lme4
-## set up proper testing environment
-cp ~/.R/check.Renviron.bak ~/.R/check.Renviron
+## set up proper testing environment;
+## putting the appropriate library path into ~/.R/check.Renviron
+## (should I try to preserve an existing check.Renviron file???)
+echo "R_LIBS_SITE=`pwd`/library" > ~/.R/check.Renviron
+echo "R_USER_SITE=`pwd`/library" >> ~/.R/check.Renviron
+## make sure this applies for the following R CMD BATCH ...
 export R_LIBS_SITE=./library
 ## run tests
 R CMD BATCH --vanilla lme4deptests.R



More information about the Lme4-commits mailing list