R version 3.6.3 (2020-02-29) -- "Holding the Windsock" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > .R_LIBS <- function(libp = .libPaths()) { # (>> in utils?) + libp <- libp[! libp %in% .Library] + if(length(libp)) + paste(libp, collapse = .Platform$path.sep) + else "" # character(0) is invalid for Sys.setenv() + } > Sys.setenv(R_LIBS = .R_LIBS() # for build.pkg() & install.packages() + , R_BUILD_ENVIRON = "nothing" # avoid ~/.R/build.environ which might set R_LIBS + , R_ENVIRON = "none" + , R_PROFILE = "none" + ) > > ## PR 1271 detach("package:base") crashes R. > tools::assertError(detach("package:base")) > > > ## invalid 'lib.loc' > stopifnot(length(installed.packages("mgcv")) == 0) > ## gave a low-level error message > > > ## package.skeleton() with metadata-only code > ## work in current (= ./tests/ directory): > tmp <- tempfile() > writeLines(c('setClass("foo", contains="numeric")', + 'setMethod("show", "foo",', + ' function(object) cat("I am a \\"foo\\"\\n"))'), + tmp) > if(file.exists("myTst")) unlink("myTst", recursive=TRUE) > package.skeleton("myTst", code_files = tmp)# with a file name warning Creating directories ... Creating DESCRIPTION ... Creating NAMESPACE ... Creating Read-and-delete-me ... Copying code files ... Making help files ... Done. Further steps are described in './myTst/Read-and-delete-me'. Warning message: In package.skeleton("myTst", code_files = tmp) : Invalid file name(s) for R code in ./myTst/R: 'file83258b67f2c' are now renamed to 'z.R' > file.copy(tmp, (tm2 <- paste(tmp,".R", sep=""))) [1] TRUE > unlink("myTst", recursive=TRUE) > op <- options(warn=2) # *NO* "invalid file name" warning {failed in 2.7.[01]}: > package.skeleton("myTst", code_files = tm2) Creating directories ... Creating DESCRIPTION ... Creating NAMESPACE ... Creating Read-and-delete-me ... Copying code files ... Making help files ... Done. Further steps are described in './myTst/Read-and-delete-me'. > options(op) > ##_2_ only a class, no generics/methods: > writeLines(c('setClass("DocLink",', + 'representation(name="character",', + ' desc="character"))'), tmp) > if(file.exists("myTst2")) unlink("myTst2", recursive=TRUE) > package.skeleton("myTst2", code_files = tmp) Creating directories ... Creating DESCRIPTION ... Creating NAMESPACE ... Creating Read-and-delete-me ... Copying code files ... Making help files ... Done. Further steps are described in './myTst2/Read-and-delete-me'. Warning message: In package.skeleton("myTst2", code_files = tmp) : Invalid file name(s) for R code in ./myTst2/R: 'file83258b67f2c' are now renamed to 'z.R' > ##- end_2_ # failed in R 2.11.0 > stopifnot(1 == grep("setClass", + readLines(list.files("myTst/R", full.names=TRUE))), + c("foo-class.Rd","show-methods.Rd") %in% list.files("myTst/man")) > ## failed for several reasons in R < 2.7.0 > ## > ## Part 2: -- build, install, load and "inspect" the package: > build.pkg <- function(dir) { + stopifnot(dir.exists(dir), file.exists(DESC <- file.path(dir, "DESCRIPTION"))) + pkgName <- sub("^[A-Za-z]+: ", "", grep("^Package: ", readLines(DESC), value=TRUE)) + patt <- paste(pkgName, ".*tar\\.gz$", sep="_") + unlink(dir('.', pattern = patt)) + Rcmd <- paste(shQuote(file.path(R.home("bin"), "R")), "CMD") + r <- system(paste(Rcmd, "build --keep-empty-dirs", shQuote(dir)), + intern = TRUE) + ## return name of tar file built + structure(dir('.', pattern = patt), log3 = r) + } > build.pkg("myTst") [1] "myTst_1.0.tar.gz" attr(,"log3") [1] "* checking for file 'myTst/DESCRIPTION' ... OK" [2] "* preparing 'myTst':" [3] "* checking DESCRIPTION meta-information ... OK" [4] "* installing the package to process help pages" [5] "* saving partial Rd database" [6] "* checking for LF line-endings in source and make files and shell scripts" [7] "* checking for empty or unneeded directories" [8] "* building 'myTst_1.0.tar.gz'" > ## clean up any previous attempt (which might have left a 00LOCK) > unlink("myLib", recursive = TRUE) > dir.create("myLib") > install.packages("myTst", lib = "myLib", repos=NULL, type = "source") # with warnings * installing *source* package 'myTst' ... ** using staged installation ** R ** byte-compile and prepare package for lazy loading ** help Warning: /var/tmp/portage/dev-lang/R-3.6.3-r1/work/R-3.6.3/tests/myTst/man/myTst-package.Rd:27: All text must be in a section Warning: /var/tmp/portage/dev-lang/R-3.6.3-r1/work/R-3.6.3/tests/myTst/man/myTst-package.Rd:28: All text must be in a section *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (myTst) > print(installed.packages(lib.loc= "myLib", priority= "NA"))## (PR#13332) Package LibPath Version Priority Depends Imports LinkingTo Suggests myTst "myTst" "myLib" "1.0" NA "methods" NA NA NA Enhances License License_is_FOSS myTst NA "What license is it under?" NA License_restricts_use OS_type MD5sum NeedsCompilation Built myTst NA NA NA NA "3.6.3" > stopifnot(require("myTst",lib = "myLib")) Loading required package: myTst > sm <- findMethods(show, where= as.environment("package:myTst")) > stopifnot(names(sm@names) == "foo") > unlink("myTst_*") > > ## getPackageName() for "package:foo": > require('methods') > library(tools) > oo <- options(warn=2) > detach("package:tools", unload=TRUE) > options(oo) > ## gave warning (-> Error) about creating package name > > > ## More building & installing packages > ## NB: tests were added here for 2.11.0. > ## NB^2: do not do this in the R sources (but in a build != src directory!) > ## and this testdir is not installed. > if(interactive() && Sys.getenv("USER") == "maechler") + Sys.setenv(SRCDIR = normalizePath("~/R/D/r-devel/R/tests")) > (pkgSrcPath <- file.path(Sys.getenv("SRCDIR"), "Pkgs"))# e.g., -> "../../R/tests/Pkgs" [1] "./Pkgs" > if(!file_test("-d", pkgSrcPath) && !interactive()) { + unlink("myTst", recursive=TRUE) + print(proc.time()) + q("no") + } > ## else w/o clause: > > do.cleanup <- !nzchar(Sys.getenv("R_TESTS_NO_CLEAN")) > isWIN <- .Platform$OS.type == "windows" > has.symlink <- !isWIN > ## Installing "on to" a package existing as symlink in the lib.loc > ## -- used to fail with misleading error message (#PR 16725): > > if(has.symlink && !unlink("myLib_2", recursive=TRUE) && dir.create("myLib_2") && + file.rename("myLib/myTst", "myLib_2/myTst") && + file.symlink("../myLib_2/myTst", "myLib/myTst")) + install.packages("myTst", lib = "myLib", repos=NULL, type = "source") * installing *source* package 'myTst' ... ** using staged installation ** R ** byte-compile and prepare package for lazy loading ** help Warning: /var/tmp/portage/dev-lang/R-3.6.3-r1/work/R-3.6.3/tests/myTst/man/myTst-package.Rd:27: All text must be in a section Warning: /var/tmp/portage/dev-lang/R-3.6.3-r1/work/R-3.6.3/tests/myTst/man/myTst-package.Rd:28: All text must be in a section *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (myTst) > ## In R <= 3.3.2 gave error with *misleading* error message: > ## ERROR: ‘myTst’ is not a legal package name > > if(isWIN) { # (has no symlinks anyway) + file.copy(pkgSrcPath, tempdir(), recursive = TRUE) + } else { # above file.copy() not useful as it replaces symlink by copy + system(paste('cp -R', shQuote(pkgSrcPath), shQuote(tempdir()))) + } > pkgPath <- file.path(tempdir(), "Pkgs") > if(!dir.exists(pkgPath)) { + message("No valid 'pkgPath' (from 'pkgSrcPath') - exit this test") + if(!interactive()) q("no") + } > > ## pkgB tests an empty R directory > dir.create(file.path(pkgPath, "pkgB", "R"), recursive = TRUE, + showWarnings = FALSE) > p.lis <- c(if("Matrix" %in% row.names(installed.packages(.Library))) + c("pkgA", "pkgB", "pkgC"), + "exNSS4", "exSexpr") > InstOpts <- list("exSexpr" = "--html") > pkgApath <- file.path(pkgPath, "pkgA") > if("pkgA" %in% p.lis && !dir.exists(d <- pkgApath)) { + cat("symlink 'pkgA' does not exist as directory ",d,"; copying it\n", sep='') + file.copy(file.path(pkgPath, "xDir", "pkg"), to = d, recursive=TRUE) + ## if even the copy failed (NB: pkgB, pkgC depend on pkgA) + if(!dir.exists(d)) p.lis <- p.lis[!(p.lis %in% c("pkgA", "pkgB", "pkgC"))] + } > dir2pkg <- function(dir) ifelse(dir == "pkgC", "PkgC", dir) > if(is.na(match("myLib", .lP <- .libPaths()))) { + .libPaths(c("myLib", .lP)) # PkgC needs pkgA from there + .lP <- .libPaths() + } > Sys.setenv(R_LIBS = .R_LIBS(.lP)) # for build.pkg() & install.packages() > for(p in p.lis) { + p. <- dir2pkg(p) # 'p' is sub directory name; 'p.' is package name + cat("building package", p., "...\n") + r <- build.pkg(file.path(pkgPath, p)) + if(!length(r)) # so some sort of failure, show log + cat(attr(r, "log3"), sep = "\n") + if(!isTRUE(file.exists(r))) + stop("R CMD build failed (no tarball) for package ", p) + ## otherwise install the tar file: + cat("installing package", p., "using built file", r, "...\n") + ## "FIXME": want to catch warnings in the "console output" of this: + install.packages(r, lib = "myLib", repos=NULL, type = "source", + INSTALL_opts = InstOpts[[p.]]) + stopifnot(require(p., lib = "myLib", character.only=TRUE)) + detach(pos = match(p., sub("^package:","", search()))) + } building package pkgA ... installing package pkgA using built file pkgA_1.2.tar.gz ... * installing *source* package 'pkgA' ... ** using staged installation ** R ** data *** moving datasets to lazyload DB ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (pkgA) Loading required package: pkgA Attaching package: 'pkgA' The following object is masked from 'package:base': search building package pkgB ... installing package pkgB using built file pkgB_1.0.tar.gz ... * installing *source* package 'pkgB' ... ** using staged installation ** help No man pages found in package 'pkgB' *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (pkgB) Loading required package: pkgB building package PkgC ... installing package PkgC using built file PkgC_1.0-0.tar.gz ... * installing *source* package 'PkgC' ... ** using staged installation ** R ** byte-compile and prepare package for lazy loading From .checkSubclasses(): subclass "classApp" of class "classA" is not local and is not updated for new inheritance information currently; [where=, where2=] ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (PkgC) Loading required package: PkgC building package exNSS4 ... installing package exNSS4 using built file exNSS4_1.1.tar.gz ... * installing *source* package 'exNSS4' ... ** using staged installation ** R ** byte-compile and prepare package for lazy loading ** help No man pages found in package 'exNSS4' *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (exNSS4) Loading required package: exNSS4 building package exSexpr ... Converting Rd files to LaTeX Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, : Running 'texi2dvi' on 'Rd2.tex' failed. Messages: You don't have a working TeX binary (tex) installed anywhere in your PATH, and texi2dvi cannot proceed without one. If you want to use this script, you'll need to install TeX (if you don't have it) or change your PATH or TEX environment variable (if you do). See the --help output for more details. For information about obtaining TeX, please see http://tug.org/texlive, or do a web search for TeX and your operating system or distro. Output: Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, : Running 'texi2dvi' on 'Rd2.tex' failed. Messages: You don't have a working TeX binary (tex) installed anywhere in your PATH, and texi2dvi cannot proceed without one. If you want to use this script, you'll need to install TeX (if you don't have it) or change your PATH or TEX environment variable (if you do). See the --help output for more details. For information about obtaining TeX, please see http://tug.org/texlive, or do a web search for TeX and your operating system or distro. Output: Error in running tools::texi2pdf() * checking for file '/var/tmp/portage/dev-lang/R-3.6.3-r1/temp/RtmpbvT8MO/Pkgs/exSexpr/DESCRIPTION' ... OK * preparing 'exSexpr': * checking DESCRIPTION meta-information ... OK * installing the package to process help pages * saving partial Rd database * building the PDF package manual Hmm ... looks like a package Creating pdf output from LaTeX ... Error: R CMD build failed (no tarball) for package exSexpr In addition: Warning message: In system(paste(Rcmd, "build --keep-empty-dirs", shQuote(dir)), : running command ''/var/tmp/portage/dev-lang/R-3.6.3-r1/work/R-3.6.3/bin/R' CMD build --keep-empty-dirs '/var/tmp/portage/dev-lang/R-3.6.3-r1/temp/RtmpbvT8MO/Pkgs/exSexpr'' had status 1 Execution halted