#### This file can be used "manually" (by Martin Maechler) #### BUT is also run daily via a cron job: #### e.g. on deb1 & deb7 ( <--> /u/local/div/crontabs/deb1 ): ## ## 31 1 * * * /usr/local/app/R/R_local/src/Auto-Update_R > /tmp/CRAN-auto-update_R 2>&1 ## 02 2 * * * ..../mail.if.notempty maechler "Auto-Update_R CRAN - `hostname... ## ## COMPLEMENT this by ## ( cd /usr/local/app/R/R_local/src ; ./do-all-differing-version ) ## --------------------------------------========================-- source("/u/sfs/R/sfs-env.R", local = TRUE) ##-> biofromR(), biocLibrary, R.maj.ver() ftpCRAN <- "/u/ftp/CRAN" my.R.local <- RrootDir ## was "/usr/local/app/R/R_local" my.BioC <- "/usr/local/app/R/Bioconductor" stopl <- readLines(file.path(my.R.local, "src", "stop_list")) stopl <- stopl[ - (1:2) ] ## the ``header lines'' stopl <- stopl[ - grep("^#", stopl)] (stopl <- sub("\t.*", '', stopl))##-> now a nice vector of package names! (ftpURL <- paste("file:/", ftpCRAN, "src/contrib", sep="/")) (Rver.maj <- R.maj.ver()) ## was sub("\\.[0-9]$", "", ## was sub(" .*", '', sub("^R version ",'', R.version.string)))) (myLib <- file.path(my.R.local, if(basename(dirname(R.home())) == "r-devel") ## normal "library-R-devel" else "library")) ## "versioned library": ## "library-R-devel" else paste("library", Rver.maj, sep="-"))) myLib0 <- myLib ## This is needed when run without the usual SfS-profile options(repos = c(CRAN = "http://cran.ch.r-project.org", BioC="http://www.bioconductor.org", Omegahat="http://www.omegahat.org/R")) install.pkgs.SfS <- function(pkgs, lib= myLib0, repos = NULL, contriburl = ftpURL, destdir = file.path(my.R.local, "src"), ...) { install.packages(pkgs, lib=lib, repos=repos, contriburl=contriburl, destdir=destdir, ...) } if(FALSE) ## "every couple of years" (more often for "R-devel" !) -- install *everything* from CRAN install.pkgs.SfS(new.packages(), dependencies = FALSE) use.xLib <- TRUE use.xLib <- FALSE if(use.xLib) { ## ********* TEMPORARY: (myLib <- c(myLib0, file.path(my.R.local, "library-2.10"))) ## ********* END {TEMPORARY} } ### Workaround horrible autofs - timeout (Nov/Dec.2007) try(length(list.files(ftpCRAN))) if(FALSE) allop <- old.packages(contriburl = ftpURL) op <- old.packages(lib= myLib, contriburl = ftpURL) ## ----------- only those relevant for now ## still a set, including ## ## Installed ReposVer Built ## Containers "1.1" "1.2" "2.6.2" ## cwhmisc "2.0" "2.0.1" "2.8.0" ## GeoXp "1.0" "1.3" "2.6.0" ## Those from the stoplist : op[(rownames(op) %in% stopl), c(3,5,4)] ## Remove those from the stoplist -- and show the others op <- op[!(rownames(op) %in% stopl), , drop=FALSE] op [,c(3,5,4), drop=FALSE] ## Now only update the old packages *NOT* in the stoplist: try( ## error when trying to install 'uroot' -- missing tcl/tk "BWidget" update.packages(lib= myLib0, repos = NULL, contriburl = ftpURL, destdir = file.path(my.R.local, "src"), oldPkgs = op, ask = FALSE, checkBuilt = TRUE) ) ## often fails because 'rJava' fails badly and others depend on it .... warnings()# in case there were many ## Here, re-install all packages who were installed in a too old version of R ip <- installed.packages(lib = myLib0) table(ip[,"Built"]) ## 2010-07-16 : ## 2.10.0 2.10.1 2.11.0 2.11.1 2.4.0 2.5.0 2.6.0 2.6.1 2.7.0 2.7.1 2.7.2 ## 846 5 1089 445 7 2 8 8 12 2 7 ## 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 ## 7 11 16 13 9 builtP <- package_version(ip[,"Built"]) non.old <- "2.11.0" table(builtP < non.old) ## 2010-07-16 -- < "2.10.0" : ## FALSE TRUE ## 2385 102 str(old2 <- ip[builtP < non.old & !(ip[,"Package"] %in% stopl),]) ## still 100 install.pkgs.SfS(old2[,"Package"]) try( ## Also: -- update the bioconductor packages (from .. bioconductor.org !): update.packages(lib.loc = biocLibrary, destdir = file.path(my.BioC, "src"), ask = FALSE) ## <- just do it! ) ## go on -- comment the following: ## q('no') ##===== if(FALSE) { ## This is particularly useful after REMOVING the normal library, and using the R-devel only : if(FALSE) .libPaths(.libPaths()[-(8:9)]) ## This one needs Rgraphviz install.pkgs.SfS("pcalg", dependencies = TRUE) install.pkgs.SfS("Rmpfr", dependencies = TRUE) ## one using Matrix install.pkgs.SfS("RLRsim", dependencies = TRUE) ## one needed by others (in new-enough version!): install.pkgs.SfS("gWidgets", dependencies = TRUE) ## Fedora 11 -- [for now, only on 'deb5':] ## yum install gdal-devel proj-devel proj-epsg proj-nad ## ---------------------------------------------------- ## Now should work -- on 32-bit only -- needs [lib]gdal + "PROJ.4" ## (on 64-bit libgdal was not quite correctly built .. could use Ubuntu) install.pkgs.SfS("rgdal", dependencies = TRUE) library(rgdal) ## "the" rgdal dependencies for(pkg in c("spgrass6", "trip", "GeoXp")) install.pkgs.SfS(pkg, dependencies = TRUE) ## Fedora: yum -y install fftw2-devel ("2' is important) install.pkgs.SfS("rimage", dependencies = TRUE) install.pkgs.SfS("arules", dependencies = TRUE) install.pkgs.SfS("flexmix", dependencies = TRUE) ## install ... ("mboost" ) geht *NICHT*, wenn ich 'coin' nicht schon habe... install.pkgs.SfS("coin", dependencies = TRUE) ## For long dependencies: mboost -> party -> sandwich -> ..... install.pkgs.SfS("mboost", dependencies = TRUE) ## This also tries to install RODBC (which fails ..) install.pkgs.SfS("Rcmdr", dependencies = TRUE) install.pkgs.SfS("rggobi", dependencies = TRUE) ## Omegahat -- at SfS {when interactive} it's in our getOption("repos") : install.pkgs.SfS("RCurl", repos = getOption("repos"), dependencies = TRUE) ## TODO: update.pkgs.SfS() here for omegahat ! install.pkgs.SfS("multicore", repos = getOption("repos"), dependencies = TRUE) } ## -- other stuff ---- if(!exists("op", .GlobalEnv)) (op <- old.pkgs.SfS(contriburl = ftpURL))[,c(3,5,4)] ## still a set, including ## ## Installed ReposVer Built ## Containers "1.1" "1.2" "2.6.2" ## cwhmisc "2.0" "2.0.1" "2.8.0" ## GeoXp "1.0" "1.3" "2.6.0" ## Those from the stoplist : op[(rownames(op) %in% stopl), c(3,5,4)] ## Remove those from the stoplist op <- op[!(rownames(op) %in% stopl), ] op [,c(3,5,4)] if(length(op)) { nms <- rownames(op) ## Install things in *my* order [is this needed ? ## because we have particular destdir,...?] for(myName in c("Matrix")) if(myName %in% nms) { try( install.pkgs.SfS(op[myName,,drop=FALSE]) ) ## now remove it from op op <- op[myName != nms, , drop=FALSE] } ##vvvvvvvvvvvvvv install.pkgs.SfS(op) } (np <- new.pkgs.SfS(lib = myLib, contriburl = ftpURL)) ## Warning message: ## bundle 'Ecdat' has extra contents ‘NA’ in: new.pkgs.SfS(contriburl = ftpURL) ##--- Now those that are *NOT* in the stop-list: (i.stop <- which(!is.na(match(np, stopl)))) np[i.stop] np <- np[ - i.stop] length(np) cat("New packages, *not* in the stop-list :\n------------------\n") np if(length(np)) try(## so it does not stop after first error install.pkgs.SfS(np, dependencies = TRUE) ) warnings()