source("common.R") Sys.unsetenv("R_HOME") options(warn = 1) rlib <- "/home/ripley/R/Lib32" Rver <- "R" Rgcc <- "Rgcc" list_tars <- function(dir='.') { files <- list.files(dir, pattern="\\.tar\\.gz", full.names=TRUE) nm <- sub("_.*", "", basename(files)) data.frame(name = nm, path=files, mtime = file.info(files)$mtime, row.names = nm, stringsAsFactors = FALSE) } tars <- foo <- foo1 <- list_tars('../contrib') foo <- list_tars('../contrib/3.4.0/Recommended') foo0 <- list_tars('../contrib/3.4.0/Other') foo <- rbind(foo, foo0, foo1) tars <- foo[!duplicated(foo$name), ] logs <- list.files('.', pattern = "\\.log$") logs <- logs[logs != "script.log"] fi <- file.info(logs) nm <- sub("\\.log$", "", logs) logs <- data.frame(name = nm, mtime = fi$mtime, stringsAsFactors = FALSE) old <- nm[! nm %in% tars$name] for(f in old) { cat('removing ', f, '\n', sep='') unlink(c(f, Sys.glob(paste(f, ".*", sep=""))), recursive = TRUE) unlink(file.path(rlib, f), recursive = TRUE) } inst <- basename(dirname(Sys.glob(file.path(rlib, "*", "DESCRIPTION")))) foo <- merge(logs, tars, by='name', all.y = TRUE) row.names(foo) <- foo$name keep <- with(foo, mtime.x < mtime.y) old <- foo[keep %in% TRUE, ] new <- foo[is.na(foo$mtime.x), ] nm <- c(row.names(old), row.names(new)) nm <- nm[! nm %in% stoplist] available <- available.packages(contriburl="file:///home/ripley/R/packages/contrib", filters = list()) nm <- nm[nm %in% rownames(available)] nmr <- nm[nm %in% recommended] nm <- nm[!nm %in% recommended] if(length(nm)) { DL <- utils:::.make_dependency_list(nm, available) nm <- utils:::.find_install_order(nm, DL) } Sys.setenv(R_LIBS = rlib, DISPLAY=':5', CPPFLAGS='-I/usr/local/include', "_R_CHECK_INSTALL_DEPENDS_" = "TRUE", "_R_CHECK_NO_RECOMMENDED_" = "TRUE", "_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_" = "TRUE", RMPI_TYPE="OPENMPI", RMPI_INCLUDE="/opt/SUNWhpc/HPC8.2.1c/sun/include", RMPI_LIB_PATH="/opt/SUNWhpc/HPC8.2.1c/sun/lib") for(f in nm) { unlink(f, recursive = TRUE) unlink(file.path("~/R/Lib32", f), recursive = TRUE) unlink(file.path("~/R/Lib32", paste0("00LOCK-", f)), recursive = TRUE) try(system2("gtar", c("xf", tars[f, "path"]))) # in case it changes in // cat(sprintf('installing %s', f)) opt <- ""; env <- "" if(f == "Rserve") opt <- '--configure-args=--without-server' if(f == "pcaL1") opt <- '--configure-args=--enable-lapack=no' if(f == "stringi") opt <- '--configure-args=--disable-cxx11' desc <- read.dcf(file.path(f, "DESCRIPTION"), "SystemRequirements")[1L, ] if(grepl("GNU make", desc, ignore.case = TRUE)) env <- "MAKE=gmake" if(f %in% fakes) opt <- "--fake" opt <- c("--pkglock", opt) desc <- read.dcf(file.path(f, "DESCRIPTION"), "LinkingTo")[1L, ] cmd <- ifelse(grepl("Rcpp", desc) || f %in% gcc, Rgcc, Rver) args <- c(cmd, "CMD", "INSTALL", opt, tars[f, "path"]) logfile <- paste(f, ".log", sep = "") res <- system2("time", args, logfile, logfile, env = env) if(res) cat(" failed\n") else cat("\n") } Sys.setenv(LC_CTYPE="en_GB.UTF-8") ## used for recommended packages do_one_r <- function(f, tars) { unlink(f, recursive = TRUE) logfile <- paste(f, ".log", sep = "") system2("touch", logfile) system2("gtar", c("xf", tars[f, "path"])) args <- c(Rver, "CMD", "check", tars[f, "path"]) outfile <- paste(f, ".out", sep = "") system2("time", args, outfile, outfile, wait = FALSE) } for(f in nmr) do_one_r(f, tars)