From 165be7bdde237cf52e919424e758dbbf3104f309 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Wed, 21 Sep 2022 19:39:27 +0200 Subject: [PATCH 1/4] feat: Add check as CRAN does with env. variables tags: feat, doc, tests Why? - CRAN uses some specific environment variables when running checks What? - Create a specific function to test as CRAN as we retrieved the source files thanks to a discussion with the RConsortium Issue #21 --- DESCRIPTION | 26 +- NAMESPACE | 1 + R/check_as_cran.R | 93 +++ R/cran_check_unique.R | 288 +++++++ README.Rmd | 12 + README.md | 102 ++- dev/{ => dev_history}/dev_history.Rmd | 0 dev/{ => dev_history}/dev_history_2.Rmd | 0 dev/flat_check_as_cran.Rmd | 149 ++++ inst/cran/CRAN_incoming/CRAN_incoming.Rproj | 16 + inst/cran/CRAN_incoming/README.md | 10 + inst/cran/CRAN_incoming/check.Renviron | 95 +++ inst/cran/CRAN_incoming/check_CRAN_incoming.R | 282 +++++++ inst/cran/bin/check_CRAN_Incoming.sh | 166 ++++ inst/cran/lib/check_R_cp_logs.sh | 123 +++ inst/cran/lib/check_R_stoplists.sh | 758 ++++++++++++++++++ inst/cran/lib/check_R_summary.sh | 22 + inst/cran/lib/cran_daily_check_results.sh | 245 ++++++ inst/cran/lib/rsync_daily_check_flavor.sh | 20 + man/check_as_cran.Rd | 46 ++ man/find_missing_tags.Rd | 2 +- tests/testthat/test-check_as_cran.R | 22 + tests/testthat/test-checkhelper.R | 5 +- tests/testthat/test-find_missing_values.R | 2 +- tests/testthat/test-use_data_doc.R | 2 +- .../rconsortium-exploration-check-as-cran.Rmd | 39 + 26 files changed, 2467 insertions(+), 59 deletions(-) create mode 100644 R/check_as_cran.R create mode 100644 R/cran_check_unique.R rename dev/{ => dev_history}/dev_history.Rmd (100%) rename dev/{ => dev_history}/dev_history_2.Rmd (100%) create mode 100644 dev/flat_check_as_cran.Rmd create mode 100644 inst/cran/CRAN_incoming/CRAN_incoming.Rproj create mode 100644 inst/cran/CRAN_incoming/README.md create mode 100644 inst/cran/CRAN_incoming/check.Renviron create mode 100644 inst/cran/CRAN_incoming/check_CRAN_incoming.R create mode 100644 inst/cran/bin/check_CRAN_Incoming.sh create mode 100644 inst/cran/lib/check_R_cp_logs.sh create mode 100644 inst/cran/lib/check_R_stoplists.sh create mode 100644 inst/cran/lib/check_R_summary.sh create mode 100644 inst/cran/lib/cran_daily_check_results.sh create mode 100644 inst/cran/lib/rsync_daily_check_flavor.sh create mode 100644 man/check_as_cran.Rd create mode 100644 tests/testthat/test-check_as_cran.R create mode 100644 vignettes/rconsortium-exploration-check-as-cran.Rmd diff --git a/DESCRIPTION b/DESCRIPTION index 1f5f9f6..ce4573e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,43 +1,41 @@ Package: checkhelper Title: Deal with check outputs Version: 0.0.0.9000 -Authors@R: - c(person(given = "Sebastien", - family = "Rochette", - role = c("aut", "cre"), - email = "sebastien@thinkr.fr"), - person(given = "Vincent", - family = "Guyader", - role = "aut", - email = "vincent@thinkr.fr")) +Authors@R: c( + person("Sebastien", "Rochette", , "sebastien@thinkr.fr", role = c("aut", "cre")), + person("Vincent", "Guyader", , "vincent@thinkr.fr", role = "aut") + ) Description: A package to help you deal with devtools::check outputs. License: GPL-3 URL: https://thinkr-open.github.io/checkhelper/, https://github.com/ThinkR-open/checkhelper BugReports: https://github.com/ThinkR-open/checkhelper/issues Imports: + cli, desc, dplyr, glue, magrittr, + pkgbuild, purrr, rcmdcheck, roxygen2, stringr, + tools, utils, - whisker + whisker, + withr Suggests: - cli, attachment, + callr, fs, knitr, rmarkdown, testthat, - usethis, - withr + usethis VignetteBuilder: knitr Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.1 diff --git a/NAMESPACE b/NAMESPACE index 1b0d434..a0d78e6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export("%>%") +export(check_as_cran) export(find_missing_tags) export(get_data_info) export(get_no_visible) diff --git a/R/check_as_cran.R b/R/check_as_cran.R new file mode 100644 index 0000000..577e2a1 --- /dev/null +++ b/R/check_as_cran.R @@ -0,0 +1,93 @@ +# WARNING - Generated by {fusen} from /dev/flat_check_as_cran.Rmd: do not edit by hand + +#' Check your package with CRAN default values for environment variables +#' +#' @param pkg pkg directory to check +#' @param check_dir Where to store check outputs +#' @param scratch Where to store temporary files (cleaned after) +#' @param Ncpus Number of Cpus +#' @param as_command Whether to run the check as Linux command line, instead of directly in R +#' @param clean_before Whether to delete the previous check_dir +#' @param open Whether to open the check dir at the end of the process +#' +#' @return An object containing errors, warnings, and notes. +#' @export +#' +#' @examples +#' \dontrun{ +#' check_dir <- tempfile("example") +#' # Check the current directory +#' check_as_cran(check_dir = check_dir) +#' # Open directory with all outputs +#' utils::browseURL(check_dir) +#' } +check_as_cran <- function(pkg = ".", check_dir, scratch, Ncpus = 1, as_command = FALSE, + clean_before = TRUE, + open = FALSE) { + pkg <- normalizePath(pkg) + + if (missing(check_dir)) {check_dir <- file.path(dirname(normalizePath(pkg)), "checkdir")} + if (isTRUE(clean_before) | !dir.exists(check_dir)) { + # if ( file.exists(check_dir)) {a <- try(file.remove(check_dir), silent = TRUE)} + if (dir.exists(check_dir)) { + unlink(check_dir, recursive = TRUE) + } + dir.create(check_dir) + } + + if (missing(scratch)) {scratch <- file.path(dirname(normalizePath(pkg)), "scratch")} + if (dir.exists(scratch)) { + unlink(scratch, recursive = TRUE) + } else { + dir.create(scratch) + } + + results <- the_check( + pkg = pkg, + check_dir = check_dir, + scratch = scratch, + Ncpus = Ncpus, + clean_before = clean_before + ) + + writeLines("\nDepends:") + tools::summarize_check_packages_in_dir_depends(check_dir) + writeLines("\nTimings:") + tools::summarize_check_packages_in_dir_timings(check_dir) + writeLines("\nResults:") + tools::summarize_check_packages_in_dir_results(check_dir) + writeLines("\nDetails:") + tools::check_packages_in_dir_details(check_dir) + message("\nSee all check outputs in: ", check_dir) + + if (isTRUE(open)) { + utils::browseURL(check_dir) + } + return(results) +} + + +#' @noRd +the_check <- function(pkg = ".", check_dir, scratch, Ncpus = 1, as_command = FALSE, clean_before = TRUE) { + + pkgbuild::build(path = pkg, dest_path = check_dir) + + envfile <- system.file("cran/CRAN_incoming/check.Renviron", package = "checkhelper") + # read.table does not read comment, which is good + envfile_table <- utils::read.table(envfile, sep = "=") + env_values <- as.list(t(envfile_table)[2,]) + names(env_values) <- as.list(t(envfile_table)[1,]) + + lib_dir <- system.file("cran/lib", package = "checkhelper") + + withr::with_envvar(new = env_values, { + if (!as_command) { + Sys.setenv("TMPDIR" = scratch) + check_unique(check_dir, lib_dir, scratch, Ncpus) + } else { + message("This may only run on Linux OS with sh") + # Run as command line for Linux only + lib_bin <- system.file("cran/bin", package = "checkhelper") + } + }) +} diff --git a/R/cran_check_unique.R b/R/cran_check_unique.R new file mode 100644 index 0000000..b3bc7c2 --- /dev/null +++ b/R/cran_check_unique.R @@ -0,0 +1,288 @@ +#' The code as issued from CRAN (almost) directly +#' +#' @param check_dir file.path(normalizePath("~"), "tmp", "CRAN") where to put tar.gz +#' @param lib_dir lib_dir <- "../lib/" +#' @param scratch scratch directory (temporary) +#' @param Ncpus Number of CPUS to use +#' +#' @details Source: https://svn.r-project.org/R-dev-web/trunk/CRAN/QA/Kurt/lib/R/Scripts/check_CRAN_incoming.R +#' @noRd +check_unique <- function(check_dir, lib_dir, scratch, Ncpus) { + user <- Sys.info()["user"] + if(user == "unknown") user <- Sys.getenv("LOGNAME") + # Sys.setenv("R_USER_DATA_DIR" = + # sprintf("/tmp/check-CRAN-incoming-%s/data", user), + # "R_USER_CACHE_DIR" = + # sprintf("/tmp/check-CRAN-incoming-%s/cache", user), + # "R_USER_CONFIG_DIR" = + # sprintf("/tmp/check-CRAN-incoming-%s/config", user)) + + Sys.setenv("_R_CHECK_INSTALL_DEPENDS_" = "true") + + Sys.setenv("R_GC_MEM_GROW" = "2", + "R_C_BOUNDS_CHECK" = "yes") + + ## + ## Need OMP thread limit as 3 instead of 4 when using OpenBLAS. + Sys.setenv("OMP_NUM_THREADS" = 3, # 4? + "OMP_THREAD_LIMIT" = 3, # 4? + "RCPP_PARALLEL_NUM_THREADS" = 4, + "POCL_KERNEL_CACHE" = 0, + "OMPI_MCA_btl_base_warn_component_unused" = 0 + ) + ## Or maybe instead just + Sys.setenv("OPENBLAS_NUM_THREADS" = 1) + ## ??? + ## + + Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false", + "_R_CHECK_PACKAGE_DEPENDS_IGNORE_MISSING_ENHANCES_" = "true") + + # if(dir.exists(path <- file.path(normalizePath("~"), "tmp", "scratch"))) + # Sys.setenv("TMPDIR" = scratch) + + check_args <- character() # No longer "--as-cran" ... + update_check_dir <- TRUE + use_check_stoplists <- FALSE + # Ncpus <- 6 + + hostname <- system2("hostname", "-f", stdout = TRUE) + if(hostname == "xmanduin.wu.ac.at") { + Sys.setenv("_R_CHECK_EXAMPLE_TIMING_THRESHOLD_" = "10") + Ncpus <- 10 + } + if(hostname %in% c("anduin2.wu.ac.at", "anduin3.wu.ac.at")) { + Ncpus <- 28 + } + + Sys.setenv("_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_" = + Sys.getenv("_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_", + "true")) + + ## + ## Change eventually ... + Sys.setenv("_R_CHECK_NATIVE_ROUTINE_REGISTRATION_" = + Sys.getenv("_R_CHECK_NATIVE_ROUTINE_REGISTRATION_", + "false")) + ## + + ## + ## Remove eventually ... + Sys.setenv("_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_" = + Sys.getenv("_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_", + "true")) + ## + + ## + ## Remove eventually .. + Sys.setenv("_R_STOP_ON_XTFRM_DATA_FRAME_" = + Sys.getenv("_R_STOP_ON_XTFRM_DATA_FRAME_", + "true")) + ## + + reverse <- NULL + + ## + ## Perhaps add a -p argument to be passed to getIncoming? + ## Currently, -p KH/*.tar.gz is hard-wired. + ## + + usage <- function() { + cat("Usage: check_CRAN_incoming [options]", + "", + "Run KH CRAN incoming checks.", + "", + "Options:", + " -h, --help print short help message and exit", + " -n do not update check dir", + " -s use stop lists", + " -c run CRAN incoming feasibility checks", + " -r also check strong reverse depends", + " -r=WHICH also check WHICH reverse depends", + " -N=N use N CPUs", + " -f=FLAVOR use flavor FLAVOR ('g' or 'c' for the GCC or Clang", + " defaults, 'g/v' or 'c/v' for the version 'v' ones)", + " -d=DIR use DIR as check dir (default: ~/tmp/CRAN)", + " -l run local incoming checks only", + " -a=ARGS pass ARGS to R CMD check", + "", + "The CRAN incoming feasibility checks are always used for CRAN", + "incoming checks (i.e., unless '-n' is given), and never when", + "checking the reverse dependencies.", + sep = "\n") + } + + check_args_db_from_stoplist_sh <- + function(stoplist_path = "../lib/check_R_stoplists.sh") + { + x <- system(paste(".", stoplist_path, "; set"), intern = TRUE) + x <- grep("^check_args_db_", x, value = TRUE) + db <- sub(".*='(.*)'$", "\\1", x) + names(db) <- + chartr("_", ".", sub("^check_args_db_([^=]*)=.*", "\\1", x)) + db + } + + args <- commandArgs(trailingOnly = TRUE) + if(any(ind <- (args %in% c("-h", "--help")))) { + usage() + q("no", runLast = FALSE) + } + if(any(ind <- (args == "-n"))) { + update_check_dir <- FALSE + args <- args[!ind] + } + if(any(ind <- (args == "-s"))) { + use_check_stoplists <- TRUE + args <- args[!ind] + } + run_CRAN_incoming_feasibility_checks <- update_check_dir + if(any(ind <- (args == "-c"))) { + run_CRAN_incoming_feasibility_checks <- TRUE + args <- args[!ind] + } + if(any(ind <- (args == "-r"))) { + reverse <- list() + args <- args[!ind] + } + if(any(ind <- (args == "-l"))) { + Sys.setenv("_R_CHECK_CRAN_INCOMING_SKIP_URL_CHECKS_IF_REMOTE_" = "true", + "_R_CHECK_CRAN_INCOMING_SKIP_DOI_CHECKS_" = "true") + args <- args[!ind] + } + if(any(ind <- startsWith(args, "-r="))) { + which <- substring(args[ind][1L], 4L) + reverse <- if(which == "most") { + list(which = list(c("Depends", "Imports", "LinkingTo"), + "Suggests"), + reverse = c(TRUE, FALSE)) + } else { + list(which = which) + } + args <- args[!ind] + } + if(any(ind <- startsWith(args, "-N="))) { + Ncpus <- list(which = substring(args[ind][1L], 4L)) + args <- args[!ind] + } + if(any(ind <- startsWith(args, "-d="))) { + check_dir <- substring(args[ind][1L], 4L) + args <- args[!ind] + } + if(any(ind <- startsWith(args, "-a="))) { + check_args <- substring(args[ind][1L], 4L) + args <- args[!ind] + } + if(length(args)) { + stop(paste("unknown option(s):", + paste(sQuote(args), collapse = ", "))) + } + + # if(update_check_dir) { + # unlink(check_dir, recursive = TRUE) + # if(system2("getIncoming", + # c("-p KH/*.tar.gz", "-d", check_dir), + # stderr = FALSE)) { + # message("no packages to check") + # q("no", status = 1, runLast = FALSE) + # } + # message("") + # } + + + + check_args_db <- if(use_check_stoplists) { + check_args_db_from_stoplist_sh(stoplist_path = file.path(lib_dir, "check_R_stoplists.sh")) + } else { + list() + } + check_env_common <- + c(paste0("LANG=", Sys.getenv("_R_CHECK_LANG_", "en_US.UTF-8")), + ## (allow checking with LANG different from en_US.UTF-8) + "LC_COLLATE=C", + "LANGUAGE=en@quot", + sprintf("_R_CHECK_CRAN_STATUS_SUMMARY_=%s", + Sys.getenv("_R_CHECK_CRAN_STATUS_SUMMARY_", "true")), + "_R_TOOLS_C_P_I_D_ADD_RECOMMENDED_MAYBE_=true", + ## These could be conditionalized according to hostname. + ## "R_SESSION_TIME_LIMIT_CPU=900", + ## "R_SESSION_TIME_LIMIT_ELAPSED=1800", + ## + ## Currently, tools::check_packages_in_dir() only uses + ## _R_INSTALL_PACKAGES_ELAPSED_TIMEOUT_ when installing + ## dependencies. + "_R_INSTALL_PACKAGES_ELAPSED_TIMEOUT_=90m", + ## + "_R_CHECK_ELAPSED_TIMEOUT_=30m", + "_R_CHECK_INSTALL_ELAPSED_TIMEOUT_=90m", + character() + ) + check_env <- + list(c(check_env_common, + "_R_CHECK_WARN_BAD_USAGE_LINES_=TRUE", + sprintf("_R_CHECK_CRAN_INCOMING_SKIP_VERSIONS_=%s", + !run_CRAN_incoming_feasibility_checks), + sprintf("_R_CHECK_CRAN_INCOMING_SKIP_DATES_=%s", + !run_CRAN_incoming_feasibility_checks), + "_R_CHECK_CODOC_VARIABLES_IN_USAGES_=true", + "_R_CHECK_CONNECTIONS_LEFT_OPEN_=true", + "_R_CHECK_CRAN_INCOMING_=true", + "_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_=true", + "_R_CHECK_CRAN_INCOMING_REMOTE_=true", + "_R_CHECK_CRAN_INCOMING_USE_ASPELL_=true", + "_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_=true", + "_R_CHECK_DATALIST_=true", + if(run_CRAN_incoming_feasibility_checks) + c("_R_CHECK_LENGTH_1_CONDITION_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose", + ## "_R_CHECK_LENGTH_1_LOGIC2_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose", + character()), + ## "_R_CHECK_ORPHANED_=true", + "_R_CHECK_PACKAGE_DEPENDS_IGNORE_MISSING_ENHANCES_=true", + "_R_CHECK_PACKAGES_USED_CRAN_INCOMING_NOTES_=true", + "_R_CHECK_RD_CONTENTS_KEYWORDS_=true", + "_R_CHECK_R_DEPENDS_=warn", + "_R_CHECK_THINGS_IN_TEMP_DIR_=true", + "_R_CHECK_BASHISMS_=true", + ## "_R_CHECK_XREFS_MIND_SUSPECT_ANCHORS_=true", + "_R_CHECK_URLS_SHOW_301_STATUS_=true", + "_R_CHECK_CODE_CLASS_IS_STRING_=true", + "_R_CHECK_NEWS_IN_PLAIN_TEXT_=true", + character()), + c(check_env_common, + ## + ## Remove eventually ... + "_R_CHECK_CRAN_INCOMING_=false", + ## + "_R_CHECK_CONNECTIONS_LEFT_OPEN_=false", + "_R_CHECK_THINGS_IN_TEMP_DIR_=false", + ## "_R_CHECK_XREFS_MIND_SUSPECT_ANCHORS_=false", + ## + character()) + ) + + if(!is.null(reverse)) + reverse$repos <- getOption("repos")["CRAN"] + + message("-- check_packages_in_dir --") + + pfiles <- + tools::check_packages_in_dir(check_dir, + check_args = check_args, + check_args_db = check_args_db, + reverse = reverse, + xvfb = TRUE, + check_env = check_env, + Ncpus = Ncpus) + + if(length(pfiles)) { + writeLines("\nDepends:") + tools::summarize_check_packages_in_dir_depends(check_dir) + writeLines("\nTimings:") + tools::summarize_check_packages_in_dir_timings(check_dir) + writeLines("\nResults:") + tools::summarize_check_packages_in_dir_results(check_dir) + writeLines("\nDetails:") + tools::check_packages_in_dir_details(check_dir) + } + +} diff --git a/README.Rmd b/README.Rmd index ca87276..8e079fa 100644 --- a/README.Rmd +++ b/README.Rmd @@ -114,6 +114,18 @@ print_globals(globals) - Store the output of `print_globals()` in package using `usethis::use_r("globals")`. Note that you can also transform all these variables with `.data[[variable]]` +### Experimental: Check as CRAN with CRAN global variables + +Use the exploration of CRAN scripts by the RConsortium to check a package as CRAN does it with their env. variables. See https://github.com/RConsortium/r-repositories-wg/issues/17 for more details. + +```{r eval=FALSE} +check_dir <- tempfile("example") +# Check the current directory +check_as_cran(check_dir = check_dir) +# Open directory with all outputs +utils::browseURL(check_dir) +``` + Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. diff --git a/README.md b/README.md index bc78626..da5d9b6 100644 --- a/README.md +++ b/README.md @@ -71,11 +71,11 @@ dir.create(pkg_path) # Create fake package usethis::create_package(pkg_path, open = FALSE) -#> v Setting active project to 'C:/Users/PC/AppData/Local/Temp/RtmpuGUA7H/pkg.360c29787ba' -#> v Creating 'R/' -#> v Writing 'DESCRIPTION' -#> v Writing 'NAMESPACE' -#> v Setting active project to '' +#> ✔ Setting active project to '/tmp/RtmplTNCpQ/pkg.2579f749b154a' +#> ✔ Creating 'R/' +#> ✔ Writing 'DESCRIPTION' +#> ✔ Writing 'NAMESPACE' +#> ✔ Setting active project to '' # Create function no visible global variables and missing documented functions cat(" @@ -98,13 +98,11 @@ my_not_exported_doc <- function() { ", file = file.path(pkg_path, "R", "function.R")) attachment::att_amend_desc(path = pkg_path) -#> Updating pkg.360c29787ba documentation -#> i Loading pkg.360c29787ba -#> [+] 1 package(s) added: dplyr. +#> Updating pkg.2579f749b154a documentation +#> ℹ Loading pkg.2579f749b154aWriting ']8;;file:///tmp/RtmplTNCpQ/pkg.2579f749b154a/NAMESPACENAMESPACE]8;;'Writing ']8;;file:///tmp/RtmplTNCpQ/pkg.2579f749b154a/NAMESPACENAMESPACE]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_fun')my_fun.Rd]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_not_exported_doc')my_not_exported_doc.Rd]8;;'ℹ Loading pkg.2579f749b154a[+] 1 package(s) added: dplyr. # Files of the package -fs::dir_tree(pkg_path, recursive = TRUE) -#> Warning: `recursive` is deprecated, please use `recurse` instead +fs::dir_tree(pkg_path, recurse = TRUE) ``` - Find missing `@return` and find missing `@noRd` for not exported @@ -112,19 +110,24 @@ fs::dir_tree(pkg_path, recursive = TRUE) ``` r find_missing_tags(pkg_path) -#> i Loading pkg.360c29787ba -#> Writing NAMESPACE +#> ℹ Loading pkg.2579f749b154a #> Missing or empty return value for exported functions: my_fun +#> +#> +#> #> Doc available but need to choose between `@export` or `@noRd`: my_not_exported_doc -#> i Loading pkg.360c29787ba -#> Writing NAMESPACE -#> # A tibble: 2 x 11 -#> id filename topic has_export has_return return_value has_nord rdname_value -#> -#> 1 1 function~ my_f~ TRUE FALSE "" FALSE my_fun -#> 2 2 function~ my_n~ FALSE FALSE "" FALSE my_not_expo~ -#> # ... with 3 more variables: not_empty_return_value , -#> # test_has_export_and_return , test_has_export_or_has_nord +#> +#> +#> +#> ℹ Loading pkg.2579f749b154a +#> # A tibble: 2 × 11 +#> id filename topic has_e…¹ has_r…² retur…³ has_n…⁴ rdnam…⁵ not_e…⁶ test_…⁷ +#> +#> 1 1 function.R my_f… TRUE FALSE "" FALSE my_fun FALSE not_ok +#> 2 2 function.R my_n… FALSE FALSE "" FALSE my_not… FALSE ok +#> # … with 1 more variable: test_has_export_or_has_nord , and abbreviated +#> # variable names ¹​has_export, ²​has_return, ³​return_value, ⁴​has_nord, +#> # ⁵​rdname_value, ⁶​not_empty_return_value, ⁷​test_has_export_and_return ``` - Get global variables @@ -133,23 +136,27 @@ find_missing_tags(pkg_path) globals <- get_no_visible(pkg_path, quiet = TRUE) globals #> $globalVariables -#> # A tibble: 4 x 6 -#> notes fun is_function is_global_varia~ variable proposed -#> -#> 1 my_fun: no visible bindi~ my_f~ FALSE TRUE data " impor~ -#> 2 my_fun: no visible bindi~ my_f~ FALSE TRUE x -#> 3 my_fun: no visible bindi~ my_f~ FALSE TRUE y -#> 4 my_fun: no visible bindi~ my_f~ FALSE TRUE new_col +#> # A tibble: 4 × 6 +#> notes fun is_fu…¹ is_gl…² varia…³ propo…⁴ +#> +#> 1 my_fun: no visible binding for global v… my_f… FALSE TRUE data " impo… +#> 2 my_fun: no visible binding for global v… my_f… FALSE TRUE x +#> 3 my_fun: no visible binding for global v… my_f… FALSE TRUE y +#> 4 my_fun: no visible binding for global v… my_f… FALSE TRUE new_col +#> # … with abbreviated variable names ¹​is_function, ²​is_global_variable, +#> # ³​variable, ⁴​proposed #> #> $functions -#> # A tibble: 5 x 6 -#> notes fun is_function is_global_varia~ variable proposed -#> -#> 1 my_fun: no visible globa~ my_f~ TRUE FALSE %>% -#> 2 my_fun: no visible globa~ my_f~ TRUE FALSE mutate -#> 3 my_fun: no visible globa~ my_f~ TRUE FALSE ggplot -#> 4 my_fun: no visible globa~ my_f~ TRUE FALSE aes -#> 5 my_fun: no visible globa~ my_f~ TRUE FALSE geom_po~ +#> # A tibble: 5 × 6 +#> notes fun is_fu…¹ is_gl…² varia…³ propo…⁴ +#> +#> 1 my_fun: no visible global function defi… my_f… TRUE FALSE %>% +#> 2 my_fun: no visible global function defi… my_f… TRUE FALSE mutate +#> 3 my_fun: no visible global function defi… my_f… TRUE FALSE ggplot +#> 4 my_fun: no visible global function defi… my_f… TRUE FALSE aes +#> 5 my_fun: no visible global function defi… my_f… TRUE FALSE geom_p… +#> # … with abbreviated variable names ¹​is_function, ²​is_global_variable, +#> # ³​variable, ⁴​proposed ``` - Print globals to copy-paste @@ -161,7 +168,7 @@ print_globals(globals) #> my_fun: %>%, aes, geom_point, ggplot, mutate #> #> --- Potential GlobalVariables --- -#> -- code to copy to your R/globals.R file -- +#> -- code to copy to your globals.R file -- #> #> globalVariables(unique(c( #> # my_fun: @@ -173,6 +180,21 @@ print_globals(globals) `usethis::use_r("globals")`. Note that you can also transform all these variables with `.data[[variable]]` - Please note that this project is released with a [Contributor Code - of Conduct](CODE_OF_CONDUCT.md). By participating in this project - you agree to abide by its terms. +### Experimental: Check as CRAN with CRAN global variables + +Use the exploration of CRAN scripts by the RConsortium to check a +package as CRAN does it with their env. variables. See + for more +details. + +``` r +check_dir <- tempfile("example") +# Check the current directory +check_as_cran(check_dir = check_dir) +# Open directory with all outputs +utils::browseURL(check_dir) +``` + +Please note that this project is released with a [Contributor Code of +Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree +to abide by its terms. diff --git a/dev/dev_history.Rmd b/dev/dev_history/dev_history.Rmd similarity index 100% rename from dev/dev_history.Rmd rename to dev/dev_history/dev_history.Rmd diff --git a/dev/dev_history_2.Rmd b/dev/dev_history/dev_history_2.Rmd similarity index 100% rename from dev/dev_history_2.Rmd rename to dev/dev_history/dev_history_2.Rmd diff --git a/dev/flat_check_as_cran.Rmd b/dev/flat_check_as_cran.Rmd new file mode 100644 index 0000000..b2808c5 --- /dev/null +++ b/dev/flat_check_as_cran.Rmd @@ -0,0 +1,149 @@ +--- +title: "flat_check_as_cran.Rmd empty" +output: html_document +editor_options: + chunk_output_type: console +--- + +```{r development, include=FALSE} +library(testthat) +``` + +```{r development-load} +# Load already included functions if relevant +pkgload::load_all(export_all = FALSE) +``` + +# check_as_cran + +Use the exploration of CRAN scripts by the RConsortium to check a package as CRAN does it with their env. variables. See https://github.com/RConsortium/r-repositories-wg/issues/17 for more details. + +=> TODO: Run from the bash script ("inst/cran/bin"), having extra args. + +```{r function-check_as_cran} +#' Check your package with CRAN default values for environment variables +#' +#' @param pkg pkg directory to check +#' @param check_dir Where to store check outputs +#' @param scratch Where to store temporary files (cleaned after) +#' @param Ncpus Number of Cpus +#' @param as_command Whether to run the check as Linux command line, instead of directly in R +#' @param clean_before Whether to delete the previous check_dir +#' @param open Whether to open the check dir at the end of the process +#' +#' @return An object containing errors, warnings, and notes. +#' @export +#' +#' @examples +check_as_cran <- function(pkg = ".", check_dir, scratch, Ncpus = 1, as_command = FALSE, + clean_before = TRUE, + open = FALSE) { + pkg <- normalizePath(pkg) + + if (missing(check_dir)) {check_dir <- file.path(dirname(normalizePath(pkg)), "checkdir")} + if (isTRUE(clean_before) | !dir.exists(check_dir)) { + # if ( file.exists(check_dir)) {a <- try(file.remove(check_dir), silent = TRUE)} + if (dir.exists(check_dir)) { + unlink(check_dir, recursive = TRUE) + } + dir.create(check_dir) + } + + if (missing(scratch)) {scratch <- file.path(dirname(normalizePath(pkg)), "scratch")} + if (dir.exists(scratch)) { + unlink(scratch, recursive = TRUE) + } else { + dir.create(scratch) + } + + results <- the_check( + pkg = pkg, + check_dir = check_dir, + scratch = scratch, + Ncpus = Ncpus, + clean_before = clean_before + ) + + writeLines("\nDepends:") + tools::summarize_check_packages_in_dir_depends(check_dir) + writeLines("\nTimings:") + tools::summarize_check_packages_in_dir_timings(check_dir) + writeLines("\nResults:") + tools::summarize_check_packages_in_dir_results(check_dir) + writeLines("\nDetails:") + tools::check_packages_in_dir_details(check_dir) + message("\nSee all check outputs in: ", check_dir) + + if (isTRUE(open)) { + utils::browseURL(check_dir) + } + return(results) +} + + +#' @noRd +the_check <- function(pkg = ".", check_dir, scratch, Ncpus = 1, as_command = FALSE, clean_before = TRUE) { + + pkgbuild::build(path = pkg, dest_path = check_dir) + + envfile <- system.file("cran/CRAN_incoming/check.Renviron", package = "checkhelper") + # read.table does not read comment, which is good + envfile_table <- utils::read.table(envfile, sep = "=") + env_values <- as.list(t(envfile_table)[2,]) + names(env_values) <- as.list(t(envfile_table)[1,]) + + lib_dir <- system.file("cran/lib", package = "checkhelper") + + withr::with_envvar(new = env_values, { + if (!as_command) { + Sys.setenv("TMPDIR" = scratch) + check_unique(check_dir, lib_dir, scratch, Ncpus) + } else { + message("This may only run on Linux OS with sh") + # Run as command line for Linux only + lib_bin <- system.file("cran/bin", package = "checkhelper") + } + }) +} +``` + +```{r examples-check_as_cran, eval=FALSE} +#' \dontrun{ +check_dir <- tempfile("example") +# Check the current directory +check_as_cran(check_dir = check_dir) +# Open directory with all outputs +utils::browseURL(check_dir) +#' } +``` + +```{r tests-check_as_cran} +test_that("check_as_cran works", { + path <- suppressWarnings(create_pkg()) + check_dir <- tempfile("example") + + if (interactive()) { + expect_error(check_as_cran(pkg = path, check_dir = check_dir), regexp = NA) + } else { + check_callr <- function(pkg, check_dir) { + library(checkhelper) + check_as_cran(pkg = pkg, check_dir = check_dir) + } + + # need to run in another env. inside check in check + expect_error(callr::r(check_callr, args = list(pkg = path, check_dir = check_dir)), regexp = NA) + } + # check_as_cran(pkg = "/mnt/Data/github/ThinkR-open/attachment") + # Check that env is clean - only manually + # Sys.getenv("_R_CHECK_AUTOCONF_") + unlink(check_dir, recursive = TRUE) +}) +``` + + +```{r development-inflate, eval=FALSE} +# Run but keep eval=FALSE to avoid infinite loop +# Execute in the console directly +fusen::inflate(flat_file = "dev/flat_check_as_cran.Rmd", vignette_name = "RConsortium exploration: Check as CRAN") +``` + diff --git a/inst/cran/CRAN_incoming/CRAN_incoming.Rproj b/inst/cran/CRAN_incoming/CRAN_incoming.Rproj new file mode 100644 index 0000000..e83436a --- /dev/null +++ b/inst/cran/CRAN_incoming/CRAN_incoming.Rproj @@ -0,0 +1,16 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes diff --git a/inst/cran/CRAN_incoming/README.md b/inst/cran/CRAN_incoming/README.md new file mode 100644 index 0000000..deac20d --- /dev/null +++ b/inst/cran/CRAN_incoming/README.md @@ -0,0 +1,10 @@ +Incoming checks are run each time there is a new packages send to CRAN + +=> It seems that each member of CRAN runs a different set of test, depending on their OS + +Scripts are: + +- A Rscript that prepares the system and run the 'R CMD check" command: https://svn.r-project.org/R-dev-web/trunk/CRAN/QA/Kurt/lib/R/Scripts/check_CRAN_incoming.R +- It is amended with env. variables: https://svn.r-project.org/R-dev-web/trunk/CRAN/QA/Kurt/.R/check.Renviron + +=> It seems that they do not use the --as-cran tag to run the check. diff --git a/inst/cran/CRAN_incoming/check.Renviron b/inst/cran/CRAN_incoming/check.Renviron new file mode 100644 index 0000000..021a88c --- /dev/null +++ b/inst/cran/CRAN_incoming/check.Renviron @@ -0,0 +1,95 @@ +## KH's personal ~/.R/check.Renviron. +## Last updated on 2022-08-10 + +### Defaults for '--as-cran": commented out where not appropriate for +### all KH checks. +_R_CHECK_AUTOCONF_=true +## _R_CHECK_BASHISMS_=true +_R_CHECK_BOGUS_RETURN_=true +_R_CHECK_CODE_USAGE_VIA_NAMESPACES_=true +_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_=true +## _R_CHECK_CODOC_VARIABLES_IN_USAGES_=true +_R_CHECK_COMPILATION_FLAGS_=true +## _R_CHECK_CONNECTIONS_LEFT_OPEN_=true +_R_CHECK_DEPENDS_ONLY_DATA_=true +## _R_CHECK_DONTTEST_EXAMPLES_=true +_R_CHECK_DOT_FIRSTLIB_=true +_R_CHECK_FF_AS_CRAN_=true +_R_CHECK_FUTURE_FILE_TIMESTAMPS_=true +_R_CHECK_INSTALL_DEPENDS_=true +_R_CHECK_LIMIT_CORES_=true +_R_CHECK_MATRIX_DATA_=true +## _R_CHECK_NATIVE_ROUTINE_REGISTRATION_=true +_R_CHECK_NO_RECOMMENDED_=true +_R_CHECK_NO_STOP_ON_TEST_ERROR_=true +## _R_CHECK_ORPHANED_=true +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=true +_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_=true +## _R_CHECK_PACKAGES_USED_CRAN_INCOMING_NOTES_=true +_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_=true +_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_=true +_R_CHECK_PRAGMAS_=true +## _R_CHECK_R_DEPENDS_=warn +_R_CHECK_R_ON_PATH_=true +_R_CHECK_RD_VALIDATE_RD2HTML_=${_R_CHECK_RD_VALIDATE_RD2HTML_-true} +## _R_CHECK_RD_CONTENTS_KEYWORDS_=true +_R_CHECK_SCREEN_DEVICE_=stop +_R_CHECK_S3_METHODS_NOT_REGISTERED_=true +_R_CHECK_SHLIB_OPENMP_FLAGS_=true +_R_CHECK_TIMINGS_=10 +_R_CHECK_THINGS_IN_CHECK_DIR_=true +## _R_CHECK_THINGS_IN_TEMP_DIR_=true +_R_CHECK_VIGNETTE_TITLES_=true +## _R_CHECK_XREFS_PKGS_ARE_DECLARED_=true +## _R_CHECK_XREFS_MIND_SUSPECT_ANCHORS_=true +_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_=true + +_R_OPTIONS_STRINGS_AS_FACTORS_=${_R_OPTIONS_STRINGS_AS_FACTORS_-false} + +### Additional settings used for all KH checks. +_R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=true +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=true +_R_CHECK_CODE_ATTACH_=true +_R_CHECK_CODE_DATA_INTO_GLOBALENV_=true +_R_CHECK_CODETOOLS_PROFILE_="suppressPartialMatchArgs=false" +_R_CHECK_CRAN_INCOMING_CHECK_URLS_IN_PARALLEL_=true +_R_CHECK_DEPRECATED_DEFUNCT_=true +_R_CHECK_DOC_SIZES2_=true +_R_CHECK_DOTCODE_RETVAL_=true +_R_CHECK_EXECUTABLES_EXCLUSIONS_=false +## _R_CHECK_FF_CALLS_=registration +_R_CHECK_FUTURE_FILE_TIMESTAMPS_LEEWAY_=6h +_R_GC_FAIL_ON_ERROR_=true +_R_CHECK_LENGTH_1_CONDITION_="package:_R_CHECK_PACKAGE_NAME_,verbose" +## _R_CHECK_LENGTH_1_CONDITION_=${_R_CHECK_LENGTH_1_CONDITION_-warn} +## _R_CHECK_LENGTH_1_LOGIC2_="package:_R_CHECK_PACKAGE_NAME_,verbose" +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=true +_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_=true +_R_CHECK_PKG_SIZES_=false +_R_CHECK_R_DEPENDS_=true +_R_CHECK_RD_LINE_WIDTHS_=true +_R_CHECK_RD_MATH_RENDERING_=true +_R_CHECK_REPLACING_IMPORTS_=true +_R_CHECK_SERIALIZATION_=true +_R_CHECK_SRC_MINUS_W_IMPLICIT_=true +_R_CHECK_SUGGESTS_ONLY_=${_R_CHECK_SUGGESTS_ONLY_-true} +_R_CHECK_SYSTEM_CLOCK_=false +_R_CHECK_THINGS_IN_TEMP_DIR_EXCLUDE_="^(ompi|pulse|runtime-)" +_R_CHECK_TOPLEVEL_FILES_=true +_R_CHECK_VC_DIRS_=true +_R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_=true +_R_CHECK_XREFS_USE_ALIASES_FROM_CRAN_=true +## Outputs +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_VIGNETTES_NLINES_=10000 +## Timings +_R_CHECK_TIMINGS_=0 +_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_=2.5 +_R_CHECK_TEST_TIMING_=yes +_R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_=2.5 +_R_CHECK_VIGNETTE_TIMING_=yes +_R_CHECK_VIGNETTE_TIMING_CPU_TO_ELAPSED_THRESHOLD_=2.5 + +## FIXME: remove eventually ... +## _R_CLASS_MATRIX_ARRAY_=${_R_CLASS_MATRIX_ARRAY_-true} + diff --git a/inst/cran/CRAN_incoming/check_CRAN_incoming.R b/inst/cran/CRAN_incoming/check_CRAN_incoming.R new file mode 100644 index 0000000..9479136 --- /dev/null +++ b/inst/cran/CRAN_incoming/check_CRAN_incoming.R @@ -0,0 +1,282 @@ +check_dir <- file.path(normalizePath("~"), "tmp", "CRAN") +if (!dir.exists(check_dir)) { + dir.create(check_dir) + message(check_dir, " Created") +} + +# Place lib directory with all .sh files is +lib_dir <- "../lib/" + +user <- Sys.info()["user"] +if(user == "unknown") user <- Sys.getenv("LOGNAME") +Sys.setenv("R_USER_DATA_DIR" = + sprintf("/tmp/check-CRAN-incoming-%s/data", user), + "R_USER_CACHE_DIR" = + sprintf("/tmp/check-CRAN-incoming-%s/cache", user), + "R_USER_CONFIG_DIR" = + sprintf("/tmp/check-CRAN-incoming-%s/config", user)) + +Sys.setenv("_R_CHECK_INSTALL_DEPENDS_" = "true") + +Sys.setenv("R_GC_MEM_GROW" = "2", + "R_C_BOUNDS_CHECK" = "yes") + +## +## Need OMP thread limit as 3 instead of 4 when using OpenBLAS. +Sys.setenv("OMP_NUM_THREADS" = 3, # 4? + "OMP_THREAD_LIMIT" = 3, # 4? + "RCPP_PARALLEL_NUM_THREADS" = 4, + "POCL_KERNEL_CACHE" = 0, + "OMPI_MCA_btl_base_warn_component_unused" = 0 + ) +## Or maybe instead just +Sys.setenv("OPENBLAS_NUM_THREADS" = 1) +## ??? +## + +Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "false", + "_R_CHECK_PACKAGE_DEPENDS_IGNORE_MISSING_ENHANCES_" = "true") + +if(dir.exists(path <- file.path(normalizePath("~"), "tmp", "scratch"))) + Sys.setenv("TMPDIR" = path) + +check_args <- character() # No longer "--as-cran" ... +update_check_dir <- TRUE +use_check_stoplists <- FALSE +Ncpus <- 6 + +hostname <- system2("hostname", "-f", stdout = TRUE) +if(hostname == "xmanduin.wu.ac.at") { + Sys.setenv("_R_CHECK_EXAMPLE_TIMING_THRESHOLD_" = "10") + Ncpus <- 10 +} +if(hostname %in% c("anduin2.wu.ac.at", "anduin3.wu.ac.at")) { + Ncpus <- 28 +} + +Sys.setenv("_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_" = + Sys.getenv("_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_", + "true")) + +## +## Change eventually ... +Sys.setenv("_R_CHECK_NATIVE_ROUTINE_REGISTRATION_" = + Sys.getenv("_R_CHECK_NATIVE_ROUTINE_REGISTRATION_", + "false")) +## + +## +## Remove eventually ... +Sys.setenv("_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_" = + Sys.getenv("_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_", + "true")) +## + +## +## Remove eventually .. +Sys.setenv("_R_STOP_ON_XTFRM_DATA_FRAME_" = + Sys.getenv("_R_STOP_ON_XTFRM_DATA_FRAME_", + "true")) +## + +reverse <- NULL + +## +## Perhaps add a -p argument to be passed to getIncoming? +## Currently, -p KH/*.tar.gz is hard-wired. +## + +usage <- function() { + cat("Usage: check_CRAN_incoming [options]", + "", + "Run KH CRAN incoming checks.", + "", + "Options:", + " -h, --help print short help message and exit", + " -n do not update check dir", + " -s use stop lists", + " -c run CRAN incoming feasibility checks", + " -r also check strong reverse depends", + " -r=WHICH also check WHICH reverse depends", + " -N=N use N CPUs", + " -f=FLAVOR use flavor FLAVOR ('g' or 'c' for the GCC or Clang", + " defaults, 'g/v' or 'c/v' for the version 'v' ones)", + " -d=DIR use DIR as check dir (default: ~/tmp/CRAN)", + " -l run local incoming checks only", + " -a=ARGS pass ARGS to R CMD check", + "", + "The CRAN incoming feasibility checks are always used for CRAN", + "incoming checks (i.e., unless '-n' is given), and never when", + "checking the reverse dependencies.", + sep = "\n") +} + +check_args_db_from_stoplist_sh <- + function(stoplist_path = "../lib/check_R_stoplists.sh") + { + x <- system(paste(".", stoplist_path, "; set"), intern = TRUE) + x <- grep("^check_args_db_", x, value = TRUE) + db <- sub(".*='(.*)'$", "\\1", x) + names(db) <- + chartr("_", ".", sub("^check_args_db_([^=]*)=.*", "\\1", x)) + db + } + +args <- commandArgs(trailingOnly = TRUE) +if(any(ind <- (args %in% c("-h", "--help")))) { + usage() + q("no", runLast = FALSE) +} +if(any(ind <- (args == "-n"))) { + update_check_dir <- FALSE + args <- args[!ind] +} +if(any(ind <- (args == "-s"))) { + use_check_stoplists <- TRUE + args <- args[!ind] +} +run_CRAN_incoming_feasibility_checks <- update_check_dir +if(any(ind <- (args == "-c"))) { + run_CRAN_incoming_feasibility_checks <- TRUE + args <- args[!ind] +} +if(any(ind <- (args == "-r"))) { + reverse <- list() + args <- args[!ind] +} +if(any(ind <- (args == "-l"))) { + Sys.setenv("_R_CHECK_CRAN_INCOMING_SKIP_URL_CHECKS_IF_REMOTE_" = "true", + "_R_CHECK_CRAN_INCOMING_SKIP_DOI_CHECKS_" = "true") + args <- args[!ind] +} +if(any(ind <- startsWith(args, "-r="))) { + which <- substring(args[ind][1L], 4L) + reverse <- if(which == "most") { + list(which = list(c("Depends", "Imports", "LinkingTo"), + "Suggests"), + reverse = c(TRUE, FALSE)) + } else { + list(which = which) + } + args <- args[!ind] +} +if(any(ind <- startsWith(args, "-N="))) { + Ncpus <- list(which = substring(args[ind][1L], 4L)) + args <- args[!ind] +} +if(any(ind <- startsWith(args, "-d="))) { + check_dir <- substring(args[ind][1L], 4L) + args <- args[!ind] +} +if(any(ind <- startsWith(args, "-a="))) { + check_args <- substring(args[ind][1L], 4L) + args <- args[!ind] +} +if(length(args)) { + stop(paste("unknown option(s):", + paste(sQuote(args), collapse = ", "))) +} + +# if(update_check_dir) { +# unlink(check_dir, recursive = TRUE) +# if(system2("getIncoming", +# c("-p KH/*.tar.gz", "-d", check_dir), +# stderr = FALSE)) { +# message("no packages to check") +# q("no", status = 1, runLast = FALSE) +# } +# message("") +# } + + + +check_args_db <- if(use_check_stoplists) { + check_args_db_from_stoplist_sh(stoplist_path = file.path(lib_dir, "check_R_stoplists.sh")) +} else { + list() +} +check_env_common <- + c(paste0("LANG=", Sys.getenv("_R_CHECK_LANG_", "en_US.UTF-8")), + ## (allow checking with LANG different from en_US.UTF-8) + "LC_COLLATE=C", + "LANGUAGE=en@quot", + sprintf("_R_CHECK_CRAN_STATUS_SUMMARY_=%s", + Sys.getenv("_R_CHECK_CRAN_STATUS_SUMMARY_", "true")), + "_R_TOOLS_C_P_I_D_ADD_RECOMMENDED_MAYBE_=true", + ## These could be conditionalized according to hostname. + ## "R_SESSION_TIME_LIMIT_CPU=900", + ## "R_SESSION_TIME_LIMIT_ELAPSED=1800", + ## + ## Currently, tools::check_packages_in_dir() only uses + ## _R_INSTALL_PACKAGES_ELAPSED_TIMEOUT_ when installing + ## dependencies. + "_R_INSTALL_PACKAGES_ELAPSED_TIMEOUT_=90m", + ## + "_R_CHECK_ELAPSED_TIMEOUT_=30m", + "_R_CHECK_INSTALL_ELAPSED_TIMEOUT_=90m", + character() + ) +check_env <- + list(c(check_env_common, + "_R_CHECK_WARN_BAD_USAGE_LINES_=TRUE", + sprintf("_R_CHECK_CRAN_INCOMING_SKIP_VERSIONS_=%s", + !run_CRAN_incoming_feasibility_checks), + sprintf("_R_CHECK_CRAN_INCOMING_SKIP_DATES_=%s", + !run_CRAN_incoming_feasibility_checks), + "_R_CHECK_CODOC_VARIABLES_IN_USAGES_=true", + "_R_CHECK_CONNECTIONS_LEFT_OPEN_=true", + "_R_CHECK_CRAN_INCOMING_=true", + "_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_=true", + "_R_CHECK_CRAN_INCOMING_REMOTE_=true", + "_R_CHECK_CRAN_INCOMING_USE_ASPELL_=true", + "_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_=true", + "_R_CHECK_DATALIST_=true", + if(run_CRAN_incoming_feasibility_checks) + c("_R_CHECK_LENGTH_1_CONDITION_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose", + ## "_R_CHECK_LENGTH_1_LOGIC2_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose", + character()), + ## "_R_CHECK_ORPHANED_=true", + "_R_CHECK_PACKAGE_DEPENDS_IGNORE_MISSING_ENHANCES_=true", + "_R_CHECK_PACKAGES_USED_CRAN_INCOMING_NOTES_=true", + "_R_CHECK_RD_CONTENTS_KEYWORDS_=true", + "_R_CHECK_R_DEPENDS_=warn", + "_R_CHECK_THINGS_IN_TEMP_DIR_=true", + "_R_CHECK_BASHISMS_=true", + ## "_R_CHECK_XREFS_MIND_SUSPECT_ANCHORS_=true", + "_R_CHECK_URLS_SHOW_301_STATUS_=true", + "_R_CHECK_CODE_CLASS_IS_STRING_=true", + "_R_CHECK_NEWS_IN_PLAIN_TEXT_=true", + character()), + c(check_env_common, + ## + ## Remove eventually ... + "_R_CHECK_CRAN_INCOMING_=false", + ## + "_R_CHECK_CONNECTIONS_LEFT_OPEN_=false", + "_R_CHECK_THINGS_IN_TEMP_DIR_=false", + ## "_R_CHECK_XREFS_MIND_SUSPECT_ANCHORS_=false", + ## + character()) + ) + +if(!is.null(reverse)) + reverse$repos <- getOption("repos")["CRAN"] + +pfiles <- + tools::check_packages_in_dir(check_dir, + check_args = check_args, + check_args_db = check_args_db, + reverse = reverse, + xvfb = TRUE, + check_env = check_env, + Ncpus = Ncpus) + +if(length(pfiles)) { + writeLines("\nDepends:") + tools::summarize_check_packages_in_dir_depends(check_dir) + writeLines("\nTimings:") + tools::summarize_check_packages_in_dir_timings(check_dir) + writeLines("\nResults:") + tools::summarize_check_packages_in_dir_results(check_dir) +} + diff --git a/inst/cran/bin/check_CRAN_Incoming.sh b/inst/cran/bin/check_CRAN_Incoming.sh new file mode 100644 index 0000000..540642c --- /dev/null +++ b/inst/cran/bin/check_CRAN_Incoming.sh @@ -0,0 +1,166 @@ +#! /bin/sh + +check_dir="${HOME}/tmp/CRAN" +## R_check_library="${HOME}/tmp/R.check/Library" +R_check_library="${check_dir}/Library" +sh_scripts_dir="${HOME}/lib/bash" + +xvfb_run='xvfb-run -a --server-args="-screen 0 1024x768x24"' + +export _R_CHECK_CRAN_INCOMING_=true +export _R_CHECK_CRAN_INCOMING_USE_ASPELL_=true + +export R_GC_NGROWINCRFRAC=0.2 +export R_GC_VGROWINCRFRAC=0.2 + +update_check_dir=true +ignore_check_stoplist=false +check_reverse_depends=false +which_reverse_depends= + +R_exe="${HOME}/tmp/R/bin/R" +R_opts="--no-save --no-restore --slave" +cargs="--as-cran" + +while test -n "${1}"; do + case ${1} in + -n) + update_check_dir=false ;; + -f) + ignore_check_stoplist=true ;; + -r) + export _R_CHECK_CRAN_INCOMING_=false + cargs="" + ;; + -R=m*) + check_reverse_depends=true + which_reverse_depends="--most" + ;; + -R) + check_reverse_depends=true ;; + --exe) + R_exe="${2}" + shift ;; + *) + echo "unknown option '${1}'"; exit 1 ;; + esac + shift +done + +## rm -rf "${R_check_library}" +## mkdir -p "${R_check_library}" + +if ${update_check_dir}; then + rm -rf "${check_dir}" + getIncoming 2>/dev/null + mkdir -p "${R_check_library}" +fi + +cd ${check_dir} +packages=`ls *.tar.gz 2>/dev/null` + +if test -z "${packages}"; then + echo "No packages to check" + exit 0 +fi + +if ${check_reverse_depends}; then + cat "${HOME}/lib/R/Scripts/rdepends.R" \ + | ${R_exe} ${R_opts} --args ${packages} ${which_reverse_depends} +fi +rdepends=`ls *.tar.gz 2>/dev/null` +## Compute setdiff(rdepends, packages) ... +rdepends=`echo "${rdepends}\n${packages}" | sort | uniq -u` + +${ignore_check_stoplist} || . ${sh_scripts_dir}/check_R_stoplists.sh + +## +## We should really use the stoplists to figure out the '--install=no' +## packages (and not try installing them ...). On the other hand, we +## can ignore (most of) the '--install=fake' ones, as we can resolve +## dependencies against BioC and Omegahat, and hopefully will soon be +## able to handle most of the "takes too long" packages using package +## specific check options. +## +## Not quite perfect, though: but currently (2009-02-17) there seems to +## way pass a '--fake' via install.packages() to the INSTALL script. +## Otoh, there's really only three '--install=no' ones and finding the +## fake/no ones from the given .tar.gz file names in shell code really +## is a nuisance ... +## + +( + +## R-install +cat "${HOME}/lib/R/Scripts/install.R" \ + | R_LIBS="${R_check_library}" \ + ${R_exe} ${R_opts} --args ${packages} ${rdepends} +## No install timings for now. + +## export LAM_MPI_SESSION_SUFFIX=incoming + +export R_C_BOUNDS_CHECK=yes + +## R-check +for pfile in ${packages}; do + ## Get package specific check options. + pname=`echo ${pfile} | sed 's/_.*//'` + if ${ignore_check_stoplist}; then + pargs="" ; + else + pargs=`get_check_args ${pname}` + fi + echo -n "${pname}: " >> time_c.out + /usr/bin/time -o time_c.out -a \ + env LC_ALL=en_US.UTF-8 \ + _R_CHECK_WARN_BAD_USAGE_LINES_=TRUE \ + R_LIBS="${R_check_library}" \ + xvfb-run -a --server-args="-screen 0 1024x768x24" \ + ${R_exe} CMD check ${cargs} --timings ${pargs} ${pfile} + ## if test -n "${pargs}"; then + ## echo "* using check arguments '${pargs}'" \ + ## >> ${pname}.Rcheck/00check.log + ## fi +done +## For reverse depends, never run CRAN incoming checks (hence set +## _R_CHECK_CRAN_INCOMING_ to FALSE and do not use '--as-cran'), and +## rename output check dirs for clarity. +for pfile in ${rdepends}; do + ## Get package specific check options. + pname=`echo ${pfile} | sed 's/_.*//'` + if ${ignore_check_stoplist}; then + pargs="" ; + else + pargs=`get_check_args ${pname}` + fi + echo -n "rdepends_${pname}: " >> time_c.out + /usr/bin/time -o time_c.out -a \ + env LC_ALL=en_US.UTF-8 \ + _R_CHECK_WARN_BAD_USAGE_LINES_=TRUE \ + _R_CHECK_CRAN_INCOMING_=FALSE \ + R_LIBS="${R_check_library}" \ + xvfb-run -a --server-args="-screen 0 1024x768x24" \ + ${R_exe} CMD check --timings ${pargs} ${pfile} + ## if test -n "${pargs}"; then + ## echo "* using check arguments '${pargs}'" \ + ## >> ${pname}.Rcheck/00check.log + ## fi + mv ${pname}.Rcheck rdepends_${pname}.Rcheck +done + +## lamwipe -sessionsuffix incoming + +## Summarize. +echo "Package check summary depends:" +summarize_R_check_depends +echo +echo "Package check summary results:" +summarize_R_check_results +echo +echo "Package check timings:" +summarize_R_check_timings +## cat time_c.out | \ +## grep elapsed | sed 's/elapsed//' | \ +## awk ' { print $1, $4 } ' + +) 2>&1 | tee ~/tmp/CRAN_`date +%FT%T`.log diff --git a/inst/cran/lib/check_R_cp_logs.sh b/inst/cran/lib/check_R_cp_logs.sh new file mode 100644 index 0000000..00f3b7a --- /dev/null +++ b/inst/cran/lib/check_R_cp_logs.sh @@ -0,0 +1,123 @@ +#! /bin/sh + +check_dir="${HOME}/tmp/R.check" +target_dir="/srv/www/nosvn/R.check" +target_url="https://www.r-project.org/nosvn/R.check" +R_scripts_dir="${HOME}/lib/R/Scripts" + +R_flavors=" \ + r-devel-linux-x86_64-debian-clang + r-devel-linux-x86_64-debian-gcc + r-devel-linux-x86_64-fedora-clang + r-devel-linux-x86_64-fedora-gcc + r-devel-windows-x86_64 + r-patched-linux-x86_64 + r-release-linux-x86_64 + r-release-macos-arm64 + r-release-macos-x86_64 + r-release-windows-x86_64 + r-oldrel-macos-arm64 + r-oldrel-macos-x86_64 + r-oldrel-windows-ix86+x86_64 +" + +test -w ${target_dir} || exit 1 + +for flavor in ${R_flavors}; do + timestamp="${check_dir}/.cache/${flavor}/t_max.rds" + test -d "${target_dir}/${flavor}" && test -f "${timestamp}" && \ + test "${target_dir}/${flavor}" -nt "${timestamp}" && continue + case "${flavor}" in + *windows*) + mycat=iconv_from_latin1_to_utf8 ;; + *) + mycat=cat ;; + esac + mkdir -p ${target_dir}/${flavor} + ## Use for loops to avoid '/bin/rm: Argument list too long' ... + for f in ${target_dir}/${flavor}/*-00check.txt; do rm -f ${f}; done + for f in ${target_dir}/${flavor}/*-00install.txt; do rm -f ${f}; done + for f in ${target_dir}/${flavor}/*-00check.html; do rm -f ${f}; done + for f in ${target_dir}/${flavor}/*-00install.html; do rm -f ${f}; done + test -d ${check_dir}/${flavor}/PKGS || continue + check_dirs=`ls -d ${check_dir}/${flavor}/PKGS/*.Rcheck 2>/dev/null` + for d in ${check_dirs}; do + test -r ${d}/00check.log || continue + ## A real check log should start with '* using log directory': skip + ## everything else. + (head -1 ${d}/00check.log | grep -q '^\* using log directory') || continue + package=`basename ${d} .Rcheck` + cp ${d}/00check.log ${target_dir}/${flavor}/${package}-00check.txt + ## If installation failed, all the check log says is + ## Installation failed. + ## See '/var/mnt/.....' for details. + ## which is not too helpful. Provide the install log as well in + ## such a case, and massage the check log accordingly. + ## + ## We used to grep -E for + ## '^\*+ checking whether.*can be installed \.\.\. ERROR$' + ## '^\*+ checking whether.*can be installed \.\.\. WARNING$' + ## but that does not work for CRLF 00check.log files as produced by + ## Windows. We could preprocess using sed 's/\r//', but let's keep + ## things simple and add possible space before the end-of-string. + ## + url="${target_url}/${flavor}/${package}-00install.html" + msg="See '${url}' for details." + if grep -E \ + '^\*+ checking whether.*can be installed \.\.\. *(\[.*\])? *ERROR[[:space:]]*$' \ + ${d}/00check.log > /dev/null; then + (head -n -1 ${d}/00check.log; echo "${msg}") \ + > ${target_dir}/${flavor}/${package}-00check.txt + cp ${d}/00install.out \ + ${target_dir}/${flavor}/${package}-00install.txt + ## Also provide the install log and try pointing to it in case there + ## were installation warnings (only works for R 2.5.0 or better). + elif grep -E \ + '^\*+ checking whether.*can be installed \.\.\. *(\[.*\])? *WARNING[[:space:]]*' \ + ${d}/00check.log > /dev/null; then + sed "s|^See ['‘].*Rcheck/00install.out['’] for details.|${msg}|" \ + ${d}/00check.log > \ + ${target_dir}/${flavor}/${package}-00check.txt + cp ${d}/00install.out \ + ${target_dir}/${flavor}/${package}-00install.txt + ## If running the tests failed, provide the last 13 lines of the + ## offending test out file. Only works for 1.8 or better, as this + ## moves .Rout to .Rout.fail on error, and provided that the tests + ## results are available, which currently is no longer true when + ## collecting the results for different flavors on the cran server. + ## But from 2.4.0, this is also no longer necessary, as R CMD check + ## now record the same information in the check log. + elif grep -E '^\*+ checking tests \.\.\. ERROR[[:space:]]*$' \ + ${d}/00check.log > /dev/null; then + bad_test_out=`ls ${d}/tests/*.fail 2>/dev/null | head -1` + if test -n "${bad_test_out}"; then + bad_test_src=`basename ${bad_test_out} out.fail` + (echo "Running tests/${bad_test_src} failed."; + echo "Last 13 lines of output:"; echo; + tail -13 ${bad_test_out}) >> \ + ${target_dir}/${flavor}/${package}-00check.txt + fi + fi + done + ## + ## Should this unlink the .txt files after converting them to HTML? + ## + R --vanilla --slave <<-EOF + source("${R_scripts_dir}/check.R") + oldwin <- grepl("windows-ix86+x86_64", "${flavor}") + encoding <- if(oldwin) "latin1" else "UTF-8" + files <- list.files("${target_dir}/${flavor}", + pattern = "-00install.txt\$", full.names = TRUE) + for(f in files) + write_install_log_as_HTML(f, sub("txt\$", "html", f), encoding) + files <- list.files("${target_dir}/${flavor}", + pattern = "-00check.txt\$", full.names = TRUE) + for(f in files) + write_check_log_as_HTML(f, sub("txt\$", "html", f), oldwin) + EOF +done + +### Local Variables: *** +### mode: sh *** +### sh-basic-offset: 2 *** +### End: *** diff --git a/inst/cran/lib/check_R_stoplists.sh b/inst/cran/lib/check_R_stoplists.sh new file mode 100644 index 0000000..787bfb4 --- /dev/null +++ b/inst/cran/lib/check_R_stoplists.sh @@ -0,0 +1,758 @@ +## Data base of special flags to be employed for CRAN package checking. + +## Packages which depend on unavailable packages cannot be installed, +## and hence must be checked with '--install=no'. (This used to include +## all packages depending on packages from Bioconductor or Omegahat.) +## The same applies to reverse dependencies of such packages, of course. +## For sake of simplicity, we also use --install=no for packages with +## non-CRAN depends which cannot fully be installed. +## +## Packages which can otherwise not fully be installed must be checked +## with '--install=fake'. This includes +## * Packages which depend on unavailable external software (as +## hopefully recorded in the package DESCRIPTION SystemRequirements, +## and checked for using the package configure scripts) +## * Packages for which installation takes too long +## * Packages for which *loading* requires special system conditions +## * Reverse dependencies of such packages. +## (This operates under the assumption that installation does not run +## package code.) +## +## Packages for which *running* requires special system conditions are +## fully installed (unless this takes too long), but all run-time checks +## are turned off. +## +## Package run time tests which take too long are selectively turned off. +## +## We control the flags via a simple flag data base which for reasons of +## portability does not take advantage of Bash arrays. For convenience +## (to avoid iterating through the db) we record the fake/no install +## packages right away. + +no_run_time_checks_args="--no-examples --no-vignettes --no-tests" + +pkgs_install_fake_regexp= +pkgs_install_no_regexp= + +set_check_args () { + safe=`echo "${1}" | tr . _` + eval "check_args_db_${safe}='${2}'" + case "${2}" in + --install=fake) + pkgs_install_fake_regexp="${pkgs_install_fake_regexp}|${1}" ;; + --install=no) + pkgs_install_no_regexp="${pkgs_install_no_regexp}|${1}" ;; + esac +} +get_check_args () { + safe=`echo "${1}" | tr . _` + eval echo '${'check_args_db_${safe}'}' ; +} + +## As of 2021-10, this apparently checks ok "as is". +## ## Package Rmosek requires MOSEK (hence needs at least a fake install) +## ## and exports shared object symbols into the namespace (hence, no). +## ## As of 2019-01, apparently --install=fake is good enough ... +## ## set_check_args Rmosek "--install=no" +## set_check_args Rmosek "--install=fake" +## ## Package REBayes depends on Rmosek. +## ## set_check_args REBayes "--install=no" +## set_check_args REBayes "--install=fake" + +## Package RSAP needs SAP headers/libraries and exports shared object +## symbols into the namespace. +set_check_args RSAP "--install=no" # Archived + +## Packages which depend on Windows. +## Packages with OS_type 'windows' as of 2014-12-23: +## BiplotGUI excel.link installr MDSGUI R2MLwiN R2PPT R2wd RPyGeo +## RWinEdt +## Packages which depend on these: none. +## There really is no need to special-case these as +## * Checking on Linux automatically switches to --install=no. +## * Regular CRAN checking skips these packages (using OS_type for +## filtering available packages) [mostly to avoid false positives +## when checking Windows-specific content (Rd xrefs)]. +## +## Is this needed? +## Package excel.link depends on RDCOMClient (@Omegahat) which only +## works under Windows. +## set_check_args excel.link "--install=no" +## + +## Packages which depend on 64-bit Linux. +## (Archived in 2010.) +## set_check_args cmprskContin "--install=fake" + +## Package which depend on external software packages. +## Package FEST requires merlin. +set_check_args FEST "--install=fake" # Archived +## Package HiPLARM needs CUDA/PLASMA/MAGMA. +set_check_args HiPLARM "--install=fake" # Archived +## Package R2OpenBUGS requires OpenBugs: this has Ubuntu binaries at +## http://www.openbugs.info/w/Downloads but no Debian binaries. +## Re-activated 2014-12-18: no longer true. +## set_check_args R2OpenBUGS "--install=fake" +## Package RMark requires MARK which is not open source. +set_check_args RMark "--install=fake" +## Package RMongo requires MongoDB. +## Re-activated 2014-12-18. +## set_check_args RMongo "--install=fake" +## Package ROracle requires Oracle. +set_check_args ROracle "--install=fake" +## Packages ROracleUI ora depend on ROracle. +set_check_args ROracleUI "--install=fake" # Archived +set_check_args ora "--install=fake" +## Packages Rcplex cplexAPI require the CPLEX solvers. +set_check_args Rcplex "--install=fake" +set_check_args cplexAPI "--install=fake" +## Package Rlsf requires LSF. +set_check_args Rlsf "--install=fake" # Archived +## Package caretLSF depends on Rlsf. +set_check_args caretLSF "--install=fake" # Archived +## Packages that require CUDA: +## CARramps FSCUDA WideLM cudaBayesreg gmatrix gpda gputools iFes +## kmcudaR magma permGPU rpud +set_check_args CARramps "--install=fake" # Archived +set_check_args FSCUDA "--install=fake" # Archived +set_check_args WideLM "--install=fake" # Archived +set_check_args cudaBayesreg "--install=fake" # Archived +set_check_args gmatrix "--install=fake" # Archived +set_check_args gpda "--install=fake" # Archived +set_check_args gputools "--install=fake" # Archived +set_check_args iFes "--install=fake" # Archived +set_check_args kmcudaR "--install=fake" +set_check_args magma "--install=fake" # Archived +set_check_args permGPU "--install=fake" +set_check_args rpud "--install=fake" # Archived +## As of 2021-10, this apparently installs ok "as is". +## ## Package gcbd requires a lot (MKL, CUDA, ...) +## set_check_args gcbd "--install=fake" +## Package rLindo needs LINDO API 8.0 (no Debian package). +set_check_args rLindo "--install=fake" # Archived +## Package rsbml needs libsbml (no Debian package). +## (Moved from CRAN to Bioconductor.) +## set_check_args rsbml "--install=fake" +## Package ndvits needs TISEAN executables from +## http://www.mpipks-dresden.mpg.de/~tisean/. +## set_check_args ndvits "--install=fake" +## Package ncdf4 requires libnetcdf 4.1 or better, which as of +## 2010-02-24 is only in Debian experimental, and breaks RNetCDF. +## set_check_args ncdf4 "--install=fake" + +## As of 2021-10, this apparently installs ok "as is". +## ## Package localsolver needs localsolver. +## set_check_args localsolver "--install=fake" +## Package RElem needs Libelemental. +set_check_args RElem "--install=fake" # Archived + +## Packages for which *loading* requires special system conditions. +## Loading package Rmpi calls lamboot (which it really should not as +## this is implementation specific). However, fake installs seem to +## cause trouble for packages potentially using Rmpi ... +## set_check_args Rmpi "--install=fake" +## Loading package RScaLAPACK calls lamboot or mpdboot. +set_check_args RScaLAPACK "--install=fake" # Archived +## Loading package taskPR calls lamnodes. +## set_check_args taskPR "--install=fake" + +## Packages which take too long to install. +## set_check_args RQuantLib "--install=fake" + +## Packages for which *running* requires special system conditions. +## Package caRpools needs MAGeCK. +set_check_args caRpools "${no_run_time_checks_args}" +## Package caretNWS run-time depends on NWS. +set_check_args caretNWS "${no_run_time_checks_args}" # Archived +## Package sound requires access to audio devices. +## set_check_args sound "${no_run_time_checks_args}" +## Package rpvm might call PVM. +set_check_args rpvm "${no_run_time_checks_args}" # Archived +## Package npRmpi requires special MPI conditions. +set_check_args npRmpi "${no_run_time_checks_args}" # Archived +## Package nbconvertR requires ipython (>= 3.0), but as of 2015-07-10 +## Debian testing only has ipython 2.3.0. +## Re-activated 2018-09-25. +## set_check_args nbconvertR "${no_run_time_checks_args}" +## Package domino needs the domino command line client. +## Re-activated 2021-10-18: +## set_check_args domino "--no-tests" +## Package ROI.plugin.cplex needs CPLEX. +set_check_args ROI.plugin.cplex "--no-tests" +## As of 2016-01-04, the Intel OpenCL drivers do not yet support OpenCL +## 2.0 (needed for gpuR); using the Debian opencl-headers and AMD driver +## packages provides this, but finds no devices ... +## Re-activated 2022-01-09 (pocl back in unstable). +## set_check_args OpenCL "${no_run_time_checks_args}" +## Re-activated 2018-09-25. +## set_check_args CARrampsOcl "${no_run_time_checks_args}" +## Seems we have no OpenCL drivers which make current gpuR happy: +set_check_args gpuR "--no-tests" # Archived +## Package bayesCL needs OpenCL. +set_check_args bayesCL "${no_run_time_checks_args}" # Archived +## Package rbi needs LibBi . +## Re-activated 2021-11-18: +## set_check_args rbi "${no_run_time_checks_args}" +## Package IRATER needs ADMB . +set_check_args IRATER "${no_run_time_checks_args}" +## Package localsolver needs localsolver. +set_check_args localsolver "${no_run_time_checks_args}" + +## Packages which (may) cause trouble when running their code as part of +## R CMD check. + +## Package BACA keeps failing its vignette checks. +## Re-activated 2016-06-27. +## set_check_args BACA "--no-vignettes" + +## As of 2018-07, package BIEN keeps hanging in its tests. As of +## 2019-03, also in its vignettes ... +## Re-activated 2021-10-18. +## set_check_args BIEN "${no_run_time_checks_args}" + +## As of 2019-03, BMTME has problems in its tests. +## Re-activated 2021-10-18. +## set_check_args BMTME "--no-tests" + +## Package DSL needs a working Hadoop environment for its vignette. +## set_check_args DSL "--no-vignettes" + +## Package ElstonStewart keeps hanging. +## Re-activated 2016-06-27. +## set_check_args ElstonStewart "${no_run_time_checks_args}" + +## As of 2016-06, package GSE keeps hanging (at least when using the GCC +## 6 compilers). +## Re-activated 2018-09-25. +## set_check_args GSE "--no-examples" + +## As of 2018-11, package GetITRData keeps having trouble accessing web +## resources in its vignette. +set_check_args GetITRData "--no-vignettes" # Archived + +## Goslate keeps getting HTTP Error 503: Service Unavailable. +## Archived on 2016-04-07 +## set_check_args Goslate "--no-examples" + +## As of 2018-03, package NMF on all Debian systems fails to run its +## examples and/or vignettes with +## Error: memory could not be allocated for instance of type big.matrix +## Re-activated 2019-01-09. +## set_check_args NMF "${no_run_time_checks_args}" + +## Package NORMT3 keeps exploding memory on linux/amd64. +## Re-activated 2010-11-03. +## set_check_args NORMT3 "${no_run_time_checks_args}" + +## Package OjaNP (0.9-4) keeps hanging. +## Re-activated 2011-12-13. +## set_check_args OjaNP "${no_run_time_checks_args}" + +## As of 2016-10, package RFc keeps hanging. +set_check_args RFc "${no_run_time_checks_args}" # Archived + +## As of 2011-01, package RLastFM kept hanging on several platforms. +## Re-activated 2011-12-13. +## set_check_args RLastFM "${no_run_time_checks_args}" + +## Package Rgretl uses gretl, which apparently always creates ~/.gretl +## (acceptable) and ~/gretl (definitely not). +set_check_args Rgretl "${no_run_time_checks_args}" # Archived + +## Package Rlabkey had examples which require a LabKey server running on +## port 8080 of localhost. No longer as of 2010-08-24. +## set_check_args Rlabkey "${no_run_time_checks_args}" + +## As of 2016-11, package Rtts keeps hanging in its examples. +## Re-activated 2019-01-09. +## set_check_args Rtts "--no-examples" + +## Package SNPtools keeps hanging. +## Re-activated 2016-06-27. +## set_check_args SNPtools "${no_run_time_checks_args}" + +## Package TSdata needs data base run time functionality. +set_check_args TSdata "--no-vignettes" + +## Package TSjson keeps hanging. +## Archived on 2015-02-01. +## set_check_args TSjson "${no_run_time_checks_args}" + +## As of 2016-06, package XBRL keeps hanging. +## Re-activated 2016-07-03. +## set_check_args XBRL "${no_run_time_checks_args}" + +## As of 2012-03-03, package adegenet keeps hanging. +## set_check_args adegenet "${no_run_time_checks_args}" + +## As of 2019-03, package bazar keeps leaving an rscala process behind +## which blocks the umount of the read-only user library, and hence +## trashes subsequent check runs. +set_check_args bazar "${no_run_time_checks_args}" + +## Package beanplot keeps leaving a pdf viewer behind. +## Re-activated 2010-11-03. +## set_check_args beanplot "${no_run_time_checks_args}" + +## Package brew (1.0-2) keeps hanging. +## Re-activated 2011-12-13. +## set_check_args brew "${no_run_time_checks_args}" + +## Package catnet keeps hanging in its examples or vignettes. +## Re-activated 2019-01-09. +## set_check_args catnet "${no_run_time_checks_args}" + +## As of 2018-04, package ccaPP keeps hanging in its vignette, every now +## and then ... +## Re-activated 2021-10-18. +## set_check_args ccaPP "--no-vignettes" + +## Package celsius (1.0.7) keeps hanging, most likely due to slow web +## access to http://celsius.genomics.ctrl.ucla.edu. +## Archived on 2010-07-30. +## set_check_args celsius "${no_run_time_checks_args}" + +## Package climdex.pcic (1.0-3) keeps segfaulting when running +## tests/bootstrap.R, which manages to hang the check process(es). +## Re-activated 2019-01-09. +## set_check_args climdex.pcic "--no-tests" + +## As of 2017-12, package clustermq fails its tests and leaves testthat +## child processes behind. +## Re-activated 2017-12-19. +## set_check_args clustermq "--no-tests" + +## As of 2016-11, package coop keeps failing its tests. +## Re-activated 2019-01-09. +## set_check_args coop "--no-tests" + +## As if 2020-11, data.table has yet another error from testing things +## it should not test for. As these problems never get fixed in a +## timely manner, best to avoid finding these. +set_check_args data.table "--no-tests" + +## As of 2016-08, package distrom keeps hanging. +## Re-activated 2019-01-09. +## set_check_args distrom "${no_run_time_checks_args}" + +## As of 2016-09, Rmpi tests in doRNG seem to hang. +## Re-activated 2019-01-09. +## set_check_args doRNG "--no-tests" + +## Package dynGraph leaves a JVM behind. +set_check_args dynGraph "${no_run_time_checks_args}" # Archived + +## As of 2018-04, package edarf keeps failing its tests with lots of +## output. +## Re-activated 2019-01-09. +## set_check_args edarf "--no-tests" + +## As of 2016-11, package easyPubMed keeps hanging. +## Re-activated 2019-01-23. +## set_check_args easyPubMed "--no-examples" + +## As of 2017-06, package eyetrackingR keeps hanging. +## Re-activated 2019-01-09. +## set_check_args eyetrackingR "${no_run_time_checks_args}" + +## Package feature (1.1.9) kept hanging on at least one ix86 platform +## (late May 2007). +## Re-activated 2010-11-03. +## set_check_args feature "${no_run_time_checks_args}" + +## Package fitbitScraper needs an API key for running its vignette. +set_check_args fitbitScraper "--no-vignettes" + +## Package fscaret (1.0) hangs on 2013-06-14. +## Re-activated 2013-06-17. +## set_check_args fscaret "${no_run_time_checks_args}" + +## Package gcbd needs gputools for its vignettes. +set_check_args gcbd "--no-vignettes" + +## As of 2017-09, package harvestr fails its tests as often as not. +## Re-activated 2019-01-09. +## set_check_args harvestr "--no-tests" + +## Package httpRequest kept causing internet access trouble. +## set_check_args httpRequest "${no_run_time_checks_args}" + +## Package hwriter keeps hanging the browser. +## Apparently (2009-02-11) not any more ... +## set_check_args hwriter "${no_run_time_checks_args}" + +## Package junr needs little CPU but lots of elapsed time to run its +## vignettes and tests. +## Re-activated 2019-01-09. +## set_check_args junr "--no-vignettes --no-tests" + +## As of 2016-11, package largeVis keeps hanging. +set_check_args largeVis "${no_run_time_checks_args}" # Archived + +## As of 2019-11, package lifecontingencies keeps failing in its +## vignettes (problems in pandoc?). +## Re-activated 2021-10-18. +## set_check_args lifecontingencies "--no-vignettes" + +## As of 2010-01, package meboot hung amd64 check processes. +## Re-activated 2011-12-13. +## set_check_args meboot "${no_run_time_checks_args}" + +## As of 2018-08, package metaBMA keeps hanging. +## Re-activated 2019-01-09. +## set_check_args metaBMA "--no-vignettes" + +## Package multicore leaves child processes behind. +set_check_args multicore "${no_run_time_checks_args}" # Archived + +## As of 2017-05-01, package nzelect again hangs in its vignettes. +## Re-activated 2019-01-09. +## set_check_args nzelect "--no-vignettes" + +## As of 2019-01, package odpc keeps hanging in its tests on most of the +## regular check runs. +## Re-activated 2021-10-18: +## set_check_args odpc "--no-tests" + +## Package patchDVI contains a vignette with Japanese text which +## requires a localized version of LaTeX for processing. +## set_check_args patchDVI "--no-build-vignettes" + +## As of 2018-03, package pbmcapply keeps eating its example input. +## Re-activated 2019-01-09. +## set_check_args pbmcapply "--no-examples" + +## As of 2016-07, package pdfetch keeps hanging. +## Re-activated 2019-01-09. +## set_check_args pdfetch "${no_run_time_checks_args}" + +## As of 2016-02-26, package plotly allocates too much VM. +## Re-activated 2016-06-27. +## set_check_args plotly "--no-tests" + +## Package ptinpoly (2.0) keeps hanging +## Re-activated 2016-06-27. +## set_check_args ptinpoly "${no_run_time_checks_args}" + +## As of 2015-05-05, package raincpc keeps hanging in its vignettes +## checks. +## Re-activated 2016-06-27. +## set_check_args raincpc "--no-vignettes" + +## Package random keeps failing its tests at random with +## URL 'https://www.random.org/integers/?num=100&min=1&max=100&col=5&base=10&format=plain&rnd=new': status was '503 Service Unavailable' +## Re-activated 2019-01-09. +## set_check_args random "--no-tests" + +## As of 2018-10, package rcongresso often has trouble accessing +## web resources. +set_check_args rcongresso "${no_run_time_checks_args}" # Archived + +## As of 2016-03, package rentrez keeps having trouble accessing +## web reources. +## Re-activated 2016-06-27. +## set_check_args rentrez "--no-vignettes" + +## As of 2019-12, package restfulr has strange problems in the tests. +set_check_args restfulr "--no-tests" + +## As of 2018-04, package roadoi keeps having problems accessing +## api.oadoi.org. +## Re-activated 2019-01-09. +## set_check_args roadoi "--no-vignettes" + +## As of 2016-05, package robreg3S keeps hanging. +## Re-activated 2019-01-09. +## set_check_args robreg3S "${no_run_time_checks_args}" + +## As of 2016-06, package robustvarComp keeps hanging (at least when +## using the GCC 6 compilers). +## Re-activated 2018-09-25. +## set_check_args robustvarComp "--no-examples" + +## As of 2017-09, package rprev times out rebuilding its vignettes. +## Re-activated 2019-01-09. +## set_check_args rprev "--no-vignettes" + +## As of 2019-12, package rsolr has strange problems in its vignettes. +## Running the tests downloads 150MB into the R user dir, so skip too. +## Re-activated 2022-05-18. +## set_check_args rsolr "--no-vignettes --no-tests" +## As of 2022-06, the tests sometimes run forever, so turn off again. +set_check_args rsolr "--no-tests" + +## As of 2018-08, package runjags keeps hanging in its examples (and the +## tests already took too long). +## Re-activated 2019-01-09. +## set_check_args runjags "${no_run_time_checks_args}" + +## Package rslurm needs SLURM for its vignettes. +## Re-activated 2017-10-21. +## set_check_args rslurm "--no-vignettes" + +## As of 2015-11-28, package rstatscn keeps hanging. +## Re-activated 2016-06-27. +## set_check_args rstatscn "--no-examples" + +## As of 2016-03-14, package rusda keeps having trouble accessing +## web reources. +## Re-activated 2016-06-27. +## set_check_args rusda "${no_run_time_checks_args}" + +## As of 2016-09, Rmpi tests in simsalapar (tstTGforecasts.R) seem to +## hang. +## Re-activated 2021-10-18. +## set_check_args simsalapar "--no-tests" + +## As of 2017-06-26, spatgraphs keeps hanging in its examples when +## compiled with GCC 7 (Debian 7.1.0-9). +## Re-activated 2018-09-25. +## set_check_args spatgraphs "--no-examples" + +## Package speedglm keeps failing its examples due to problems with web +## access to http://dssm.unipa.it/enea/data1.txt. +## Re-activated 2016-06-27. +## set_check_args speedglm "--no-examples" + +## As of 2016-07, package strataG keeps hanging. +set_check_args strataG "--no-vignettes" # Archived + +## As of 2019-01, package superml keeps hitting the total check timeout +## (interestingly, only on gimli2 ...). +## Re-activated 2021-10-18. +## set_check_args superml "--no-vignettes" + +## As of 2019-01, package surveysd keeps hitting the total check timeout +## (interestingly, only on gimli2 ...). +## Re-activated 2021-10-18. +## set_check_args surveysd "--no-tests" + +## As of 2016-11, package systemicrisk keeps hanging in its vignettes. +## Re-activated 2019-01-09. +## set_check_args systemicrisk "--no-vignettes" + +## As of 2018-08, package tidybayes keeps hanging. +## Re-activated 2019-01-09. +## set_check_args tidybayes "--no-tests" + +## +## As of 2020-10, package tiledb seems to cause trouble? +## set_check_args tiledb "${no_run_time_checks_args}" +## set_check_args tiledb "--no-vignettes --no-tests" +## + +## Package titan requires interaction. +## Re-activated 2010-11-03. +## set_check_args titan "${no_run_time_checks_args}" + +## Package vardpoor uses an unstable web resource in its examples. +## Re-activated 2019-01-09. +## set_check_args vardpoor "--no-examples" + +## Packages which keep having problems accessing maps.googleapis.com. +## Re-activated 2019-01-25. +## set_check_args FLightR "--no-examples --no-tests" +## set_check_args LearnGeom "--no-examples" +## set_check_args OutbreakTools "--no-examples --no-vignettes" # Archived +## set_check_args PWFSLSmoke "--no-vignettes" +## set_check_args RapidPolygonLookup "--no-vignettes" +## set_check_args RgoogleMaps "--no-examples" +## set_check_args SensusR "--no-examples" +## set_check_args census "--no-examples --no-vignettes" # Archived +## set_check_args earthtones "--no-vignettes --no-tests" +## set_check_args ggmap "--no-examples" +## set_check_args ggvoronoi "--no-vignettes" +## set_check_args moveVis "--no-tests" +## set_check_args placement "--no-examples" # Archived +## set_check_args stormwindmodel "--no-vignettes" + +## Packages for which run-time checks take too long. +## set_check_args Bergm "${no_run_time_checks_args}" +## set_check_args GenABEL "${no_run_time_checks_args}" +## set_check_args IsoGene "${no_run_time_checks_args}" +## set_check_args SubpathwayMiner "${no_run_time_checks_args}" +## set_check_args degreenet "${no_run_time_checks_args}" +## set_check_args ensembleBMA "${no_run_time_checks_args}" +## set_check_args eqtl "${no_run_time_checks_args}" +## set_check_args expectreg "${no_run_time_checks_args}" +## set_check_args fields "${no_run_time_checks_args}" +## set_check_args gamm4 "${no_run_time_checks_args}" +## set_check_args geozoo "${no_run_time_checks_args}" +## set_check_args ks "${no_run_time_checks_args}" +## set_check_args latentnet "${no_run_time_checks_args}" +## set_check_args mixtools "${no_run_time_checks_args}" +## set_check_args np "${no_run_time_checks_args}" +## set_check_args pscl "${no_run_time_checks_args}" +## set_check_args rWMBAT "${no_run_time_checks_args}" +## set_check_args sna "${no_run_time_checks_args}" +## set_check_args speff2trial "${no_run_time_checks_args}" +## set_check_args surveillance "${no_run_time_checks_args}" +## set_check_args ttime "${no_run_time_checks_args}" + +FQDN=`hostname -f` +case ${FQDN} in + xmgyges.wu.ac.at) + ## Package BRugs requires OpenBugs which currently is only + ## available for amd64. + ## [As of 2012-03-14, not any more ...] + ## Packages BTSPAS and tdm depend on BRugs. + ## set_check_args BRugs "--install=fake" + ## set_check_args BTSPAS "--install=fake" + ## set_check_args tdm "--install=fake" + ## Package OpenCL requires OpenCL headers and libraries. + ## Intel's SDK is only available for amd64. + set_check_args OpenCL "--install=fake" + ## Package lokern keeps hanging in its tests. + set_check_args lokern "--no-tests" + ;; +esac + +## Packages for which some run-time checks take too long ... +set_check_args BASS "--no-vignettes" +## set_check_args BB "--no-vignettes" +set_check_args Bclim "--no-vignettes" # Archived +## set_check_args GLIDE "--no-vignettes" +set_check_args GPareto "--no-vignettes" +## set_check_args GSM "--no-tests" +set_check_args GiANT "--no-vignettes" # Archived +## Re-activated 2021-10-18: +## set_check_args HTLR "--no-vignettes" +set_check_args HTSSIP "--no-vignettes" +## set_check_args MSIseq "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args ModelMap "--no-vignettes" +## set_check_args NITPicker "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args NNS "--no-vignettes" +set_check_args NetworkChange "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args PowerTOST "--no-vignettes" +set_check_args RBrownie "--no-vignettes" # Archived +set_check_args RSuite "--no-vignettes" # Archived +## set_check_args STAR "--no-vignettes" +## set_check_args SensMixed "--no-tests" +## set_check_args TBSSurvival "--no-tests" +set_check_args TrajDataMining "--no-tests" +set_check_args TropFishR "--no-vignettes" +## set_check_args VSE "--no-vignettes" +set_check_args amen "--no-vignettes" +set_check_args aptg "--no-vignettes" +set_check_args bark "--no-examples" # Archived +## Re-activated 2021-10-18: +## set_check_args colorednoise "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args comorbidity "--no-tests" +set_check_args crmPack "--no-vignettes" +set_check_args ctmm "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args ctsem "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args dismo "--no-vignettes" +set_check_args ergm "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args expss "--no-tests" +## set_check_args fCopulae "--no-tests" +set_check_args fmlogcondens "--no-vignettes" # Archived +set_check_args fxregime "--no-vignettes" +set_check_args glmmsr "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args gtfs2gps "--no-tests" +## set_check_args heemod "--no-tests" +set_check_args hetGP "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args httk "--no-vignettes" +## set_check_args hydrolinks "--no-vignettes" +set_check_args iSubpathwayMiner "--no-vignettes" # Archived +## set_check_args icosa "--no-vignettes" +set_check_args ifaTools "--no-tests --no-vignettes" +set_check_args ivmte "--no-vignettes" +set_check_args knockoff "--no-vignettes" +set_check_args laGP "--no-vignettes" +set_check_args lolog "--no-vignettes" +set_check_args mazeinda "--no-vignettes" +set_check_args mcemGLM "--no-vignettes" +## set_check_args mediation "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args micEconCES "--no-vignettes" +set_check_args misreport "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args morse "--no-vignettes" +set_check_args mrdrc "--no-tests" # Archived +set_check_args onemap "--no-vignettes" +set_check_args optimall "--no-vignettes" +## set_check_args ordinalgmifs "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args patentsview "--no-vignettes" +set_check_args phybreak "--no-vignettes" # Archived +set_check_args phylosim "--no-vignettes" # Archived +## Re-activated 2021-10-18: +## set_check_args pmc "--no-vignettes" +## set_check_args portfolioSim "--no-vignettes" +set_check_args psychomix "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args segclust2d "--no-vignettes" +set_check_args segmentr "--no-vignettes" +set_check_args simulator "--no-vignettes" # Archived +## Re-activated 2021-10-18: +## set_check_args smooth "--no-vignettes" +set_check_args sommer "--no-vignettes" +set_check_args sperrorest "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args spikeSlabGAM "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args spsurvey "--no-vignettes" +set_check_args stapler "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args steps "--no-tests" +## set_check_args superml "--no-vignettes" +set_check_args survPen "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args tergm "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args textmineR "--no-vignettes" +set_check_args tgp "--no-vignettes" +## Re-activated 2021-10-18: +## set_check_args tvReg "--no-vignettes" +set_check_args twang "--no-vignettes" +set_check_args xtractomatic "--no-vignettes" # Archived +## set_check_args PerformanceAnalytics "--no-examples --no-vignettes" +## set_check_args Rcgmin "--no-tests" +## set_check_args Rvmmin "--no-tests" +## set_check_args TESS "--no-vignettes" +## set_check_args TilePlot "--no-examples" +## set_check_args TriMatch "--no-vignettes" +## set_check_args Zelig "--no-vignettes" +## set_check_args abc "--no-vignettes" +## set_check_args amei "--no-vignettes" +## set_check_args bcool "--no-vignettes" +## set_check_args caret "--no-vignettes" +## set_check_args catnet "--no-vignettes" +## set_check_args crimCV "--no-examples" +## set_check_args crs "--no-vignettes" +## set_check_args dmt "--no-vignettes" +## set_check_args fanplot "--no-vignettes" +## set_check_args geiger "--no-vignettes" +## set_check_args ggstatsplot "--no-vignettes" +## set_check_args lossDev "--no-vignettes" +## set_check_args mcmc "--no-vignettes" +## set_check_args metaMA "--no-vignettes" +## set_check_args pomp "--no-tests" +## set_check_args rebmix "--no-vignettes" +## set_check_args runjags "--no-tests" +## set_check_args unmarked "--no-vignettes" + +## Done. + +if test -n "${pkgs_install_fake_regexp}"; then + pkgs_install_fake_regexp=` + echo "${pkgs_install_fake_regexp}" | sed 's/^|/^(/; s/$/)$/;'` +fi +if test -n "${pkgs_install_no_regexp}"; then + pkgs_install_no_regexp=` + echo "${pkgs_install_no_regexp}" | sed 's/^|/^(/; s/$/)$/;'` +fi + +### Local Variables: *** +### mode: sh *** +### sh-basic-offset: 2 *** +### End: *** diff --git a/inst/cran/lib/check_R_summary.sh b/inst/cran/lib/check_R_summary.sh new file mode 100644 index 0000000..ac6000e --- /dev/null +++ b/inst/cran/lib/check_R_summary.sh @@ -0,0 +1,22 @@ +#! /bin/sh + +check_dir="${HOME}/tmp/R.check" +write_dir="${check_dir}/web" +target_dir="/srv/ftp/pub/R/web/checks" +R_scripts_dir="${HOME}/lib/R/Scripts" + +rm -rf "${write_dir}" && mkdir "${write_dir}" + +R --slave --no-save < +## Adjust when 3.2.2 is released. +## Used for the manuals ... adjust as needed. +## flavors="prerel patched release" +## flavors="patched release" +flavors="patched" +## +## +## This needed +## flavors="patched" +## prior to the 3.0.2 release. +## + +## +## Keeps this in sync with +## lib/bash/check_R_cp_logs.sh +## lib/R/Scripts/check.R +## as well as +## CRAN-package-list +## (or create a common data base eventually ...) +## + +## Rsync daily check results for the various "flavors" using KH's +## check-R/check-R-ng layout. + +echo ${!} > ${lock_file} + +## r-devel-linux-x86_64-debian-clang +sh ${HOME}/lib/bash/rsync_daily_check_flavor.sh \ + gimli.wu.ac.at::R.check/r-devel-clang/ \ + ${check_dir}/r-devel-linux-x86_64-debian-clang/ + +## r-devel-linux-x86_64-debian-gcc +sh ${HOME}/lib/bash/rsync_daily_check_flavor.sh \ + gimli2.wu.ac.at::R.check/r-devel-gcc/ \ + ${check_dir}/r-devel-linux-x86_64-debian-gcc/ + +## r-prerel-linux-x86_64 +sh ${HOME}/lib/bash/rsync_daily_check_flavor.sh \ + gimli.wu.ac.at::R.check/r-patched-gcc/ \ + ${check_dir}/r-patched-linux-x86_64/ + +## r-release-linux-x86_64 +sh ${HOME}/lib/bash/rsync_daily_check_flavor.sh \ + gimli.wu.ac.at::R.check/r-release-gcc/ \ + ${check_dir}/r-release-linux-x86_64/ + +## Hand-crafted procedures for getting the results for other layouts. + +## r-devel-linux-x86_64-fedora-clang +mkdir -p "${check_dir}/r-devel-linux-x86_64-fedora-clang" +(cd "${check_dir}/r-devel-linux-x86_64-fedora-clang"; + rsync -q --times \ + --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ + r-proj@gannet.stats.ox.ac.uk::Rlogs/clang-times.tab .; + rsync -q --times \ + --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ + r-proj@gannet.stats.ox.ac.uk::Rlogs/clang.tar.xz .; + test clang.tar.xz -nt PKGS && \ + rm -rf PKGS && mkdir PKGS && cd PKGS && tar xf ../clang.tar.xz) + +## r-devel-linux-x86_64-fedora-gcc +mkdir -p "${check_dir}/r-devel-linux-x86_64-fedora-gcc" +(cd "${check_dir}/r-devel-linux-x86_64-fedora-gcc"; + rsync -q --times \ + --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ + r-proj@gannet.stats.ox.ac.uk::Rlogs/gcc-times.tab .; + rsync -q --times \ + --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ + r-proj@gannet.stats.ox.ac.uk::Rlogs/gcc.tar.xz .; + test gcc.tar.xz -nt PKGS && \ + rm -rf PKGS && mkdir PKGS && cd PKGS && tar xf ../gcc.tar.xz) + +## r-devel-windows-x86_64 +mkdir -p "${check_dir}/r-devel-windows-x86_64/PKGS" +rsync --recursive --delete --times \ + 129.217.206.10::CRAN-bin-windows-check/4.3/ \ + ${check_dir}/r-devel-windows-x86_64/PKGS + +## ## r-devel-windows-x86_64-new-TK +## mkdir -p "${check_dir}/r-devel-windows-x86_64-new-TK/PKGS" +## rsync --recursive --delete --times \ +## /home/kalibera/winutf8/ucrt3/CRAN/checks/gcc10-UCRT/export/ \ +## ${check_dir}/r-devel-windows-x86_64-new-TK/PKGS + +## r-release-windows-x86_64 +mkdir -p "${check_dir}/r-release-windows-x86_64/PKGS" +rsync --recursive --delete --times \ + 129.217.206.10::CRAN-bin-windows-check/4.2/ \ + ${check_dir}/r-release-windows-x86_64/PKGS + +## r-release-macos-arm64 +mkdir -p "${check_dir}/r-release-macos-arm64/PKGS" +## FIXME nz.build.rsync.urbanek.info +rsync --recursive --delete --times \ + --include="/*.Rcheck" \ + --include="/*.Rcheck/00[a-z]*" \ + --include="/*VERSION" \ + --include="/00_*" \ + --exclude="*" \ + cran@nz.build.rsync.urbanek.info:/data/results/big-sur-arm64/results/4.2/ \ + ${check_dir}/r-release-macos-arm64/PKGS/ + +## r-release-macos-x86_64 +mkdir -p "${check_dir}/r-release-macos-x86_64/PKGS" +## FIXME nz.build.rsync.urbanek.info +rsync --recursive --delete --times \ + --include="/*.Rcheck" \ + --include="/*.Rcheck/00[a-z]*" \ + --include="/*VERSION" \ + --include="/00_*" \ + --exclude="*" \ + cran@nz.build.rsync.urbanek.info:/data/results/high-sierra/4.2/ \ + ${check_dir}/r-release-macos-x86_64/PKGS/ + +## Discontinued as of 2021-12. +## ## r-patched-solaris-x86 +## mkdir -p "${check_dir}/r-patched-solaris-x86/PKGS" +## (cd "${check_dir}/r-patched-solaris-x86"; +## rsync -q --times \ +## --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ +## r-proj@gannet.stats.ox.ac.uk::Rlogs/Solx86-times.tab .; +## rsync -q --times \ +## --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ +## r-proj@gannet.stats.ox.ac.uk::Rlogs/Solx86.tar.xz .; +## test Solx86.tar.xz -nt PKGS && \ +## rm -rf PKGS && mkdir PKGS && cd PKGS && tar xf ../Solx86.tar.xz) + +## r-oldrel-windows-ix86+x86_64 +mkdir -p "${check_dir}/r-oldrel-windows-ix86+x86_64/PKGS" +rsync --recursive --delete --times \ + 129.217.206.10::CRAN-bin-windows-check/4.1/ \ + ${check_dir}/r-oldrel-windows-ix86+x86_64/PKGS + +## r-oldrel-macos-arm64 +mkdir -p "${check_dir}/r-oldrel-macos-arm64/PKGS" +## FIXME nz.build.rsync.urbanek.info +rsync --recursive --delete --times \ + --include="/*.Rcheck" \ + --include="/*.Rcheck/00[a-z]*" \ + --include="/*VERSION" \ + --include="/00_*" \ + --exclude="*" \ + cran@nz.build.rsync.urbanek.info:/data/results/big-sur-arm64/results/4.1/ \ + ${check_dir}/r-oldrel-macos-arm64/PKGS/ + +## r-oldrel-macos-x86_64 +mkdir -p "${check_dir}/r-oldrel-macos-x86_64/PKGS" +## FIXME nz.build.rsync.urbanek.info +rsync --recursive --delete --times \ + --include="/*.Rcheck" \ + --include="/*.Rcheck/00[a-z]*" \ + --include="/*VERSION" \ + --include="/00_*" \ + --exclude="*" \ + cran@nz.build.rsync.urbanek.info:/data/results/high-sierra/4.1/ \ + ${check_dir}/r-oldrel-macos-x86_64/PKGS/ + +## BDR memtests +## mkdir -p "${check_dir}/bdr-memtests" +## rsync -q --recursive --delete --times \ +## --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ +## r-proj@gannet.stats.ox.ac.uk::Rlogs/memtests/ \ +## ${check_dir}/bdr-memtests + +## Issues +mkdir -p "${check_dir}/issues/" +rsync -q --recursive --delete --times \ + --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ + r-proj@gannet.stats.ox.ac.uk::Rlogs/memtests/*.csv \ + ${check_dir}/issues +## rsync -q --recursive --delete --times \ +## --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ +## r-proj@gannet.stats.ox.ac.uk::Rlogs/noLD/*.csv \ +## ${check_dir}/issues +## rsync -q --recursive --delete --times \ +## --password-file="${HOME}/lib/bash/rsync_password_file_gannet.txt" \ +## r-proj@gannet.stats.ox.ac.uk::Rlogs/LTO.csv \ +## ${check_dir}/issues + +wget -q \ + https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/rchk.csv \ + -O ${check_dir}/issues/rchk.csv +wget -q \ + https://raw.githubusercontent.com/kalibera/cran-checks/master/rcnst/rcnst.csv \ + -O ${check_dir}/issues/rcnst.csv +wget -q \ + https://raw.githubusercontent.com/kalibera/cran-checks/master/rlibro/rlibro.csv \ + -O ${check_dir}/issues/rlibro.csv + +## Dbs. + +mkdir -p "${check_dir}/dbs" +rsync -q --recursive --times \ + gimli.wu.ac.at::R.check/*.rds \ + ${check_dir}/dbs +rsync -q --recursive --times \ + gimli2.wu.ac.at::R.check/*.rds \ + ${check_dir}/dbs +R --slave --no-save < + %\VignetteIndexEntry{rconsortium-exploration-check-as-cran} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(checkhelper) +``` + + + +# check_as_cran + +Use the exploration of CRAN scripts by the RConsortium to check a package as CRAN does it with their env. variables. See https://github.com/RConsortium/r-repositories-wg/issues/17 for more details. + +=> TODO: Run from the bash script ("inst/cran/bin"), having extra args. + + +```{r examples-check_as_cran, eval = FALSE} +#' \dontrun{ +check_dir <- tempfile("example") +# Check the current directory +check_as_cran(check_dir = check_dir) +# Open directory with all outputs +utils::browseURL(check_dir) +#' } +``` + From 0352bc207eb580ae4b9aae86d2c11817c2c8a8c9 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Wed, 21 Sep 2022 19:49:07 +0200 Subject: [PATCH 2/4] fix: Ci and documentation tags: fix, ci, doc Why? - Need to run CI on main, not master anymore --- .github/workflows/R-CMD-check.yaml | 72 ++++++++-------------------- .github/workflows/pkgdown.yaml | 56 +++++++++++----------- .github/workflows/test-coverage.yaml | 41 +++++----------- NEWS.md | 8 ++-- README.Rmd | 2 +- README.md | 13 +++-- 6 files changed, 74 insertions(+), 118 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 10c51d1..52c2b27 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,12 +1,10 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - master + branches: [main, master] pull_request: - branches: - - master + branches: [main, master] name: R-CMD-check @@ -20,62 +18,32 @@ jobs: fail-fast: false matrix: config: + - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@master - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index e33cc40..f861c76 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,47 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: master + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: name: pkgdown jobs: pkgdown: - runs-on: macOS-latest + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-pandoc@master - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true - - name: Cache R packages - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + extra-packages: any::pkgdown, local::. + needs: website - - name: Install dependencies + - name: Build site run: | - remotes::install_deps(dependencies = TRUE) + install.packages("remotes") remotes::install_github("ThinkR-open/thinkrtemplate") - install.packages("pkgdown") + pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} - - name: Install package - run: R CMD INSTALL . - - - name: Deploy package - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 25a9989..4b65418 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,46 +1,31 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - master + branches: [main, master] pull_request: - branches: - - master + branches: [main, master] name: test-coverage jobs: test-coverage: - runs-on: macOS-latest + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@master - - - uses: r-lib/actions/setup-pandoc@master - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + use-public-rspm: true - - name: Install dependencies - run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") - shell: Rscript {0} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr + needs: coverage - name: Test coverage - run: covr::codecov() + run: covr::codecov(quiet = FALSE) shell: Rscript {0} diff --git a/NEWS.md b/NEWS.md index 3b90221..d0ad674 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ -# checkhelper 0.0.0.9000 +# checkhelper 0.0.1 -* Print code to add to 'globals.R' -* Extract "no visibles" from notes of rcmdcheck() +* Check with same variables and parameters as CRAN (#21) +* Find missing tags in your roxygen skeletons with `find_missing_tags()` +* Print code to add to 'globals.R' with `print_globals()` +* Extract "no visibles" from notes of `rcmdcheck()` * Added a `NEWS.md` file to track changes to the package. diff --git a/README.Rmd b/README.Rmd index 8e079fa..285077a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -5,7 +5,7 @@ output: github_document -[![R build status](https://github.com/ThinkR-open/checkhelper/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/checkhelper/actions) +[![R-CMD-check](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/ThinkR-open/checkhelper/branch/master/graph/badge.svg)](https://codecov.io/gh/ThinkR-open/checkhelper?branch=master) diff --git a/README.md b/README.md index da5d9b6..f4ec271 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ -[![R build -status](https://github.com/ThinkR-open/checkhelper/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/checkhelper/actions) +[![R-CMD-check](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/ThinkR-open/checkhelper/branch/master/graph/badge.svg)](https://codecov.io/gh/ThinkR-open/checkhelper?branch=master) @@ -71,7 +70,7 @@ dir.create(pkg_path) # Create fake package usethis::create_package(pkg_path, open = FALSE) -#> ✔ Setting active project to '/tmp/RtmplTNCpQ/pkg.2579f749b154a' +#> ✔ Setting active project to '/tmp/RtmpiWQuWQ/pkg.2681653ace3ee' #> ✔ Creating 'R/' #> ✔ Writing 'DESCRIPTION' #> ✔ Writing 'NAMESPACE' @@ -98,8 +97,8 @@ my_not_exported_doc <- function() { ", file = file.path(pkg_path, "R", "function.R")) attachment::att_amend_desc(path = pkg_path) -#> Updating pkg.2579f749b154a documentation -#> ℹ Loading pkg.2579f749b154aWriting ']8;;file:///tmp/RtmplTNCpQ/pkg.2579f749b154a/NAMESPACENAMESPACE]8;;'Writing ']8;;file:///tmp/RtmplTNCpQ/pkg.2579f749b154a/NAMESPACENAMESPACE]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_fun')my_fun.Rd]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_not_exported_doc')my_not_exported_doc.Rd]8;;'ℹ Loading pkg.2579f749b154a[+] 1 package(s) added: dplyr. +#> Updating pkg.2681653ace3ee documentation +#> ℹ Loading pkg.2681653ace3eeWriting ']8;;file:///tmp/RtmpiWQuWQ/pkg.2681653ace3ee/NAMESPACENAMESPACE]8;;'Writing ']8;;file:///tmp/RtmpiWQuWQ/pkg.2681653ace3ee/NAMESPACENAMESPACE]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_fun')my_fun.Rd]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_not_exported_doc')my_not_exported_doc.Rd]8;;'ℹ Loading pkg.2681653ace3ee[+] 1 package(s) added: dplyr. # Files of the package fs::dir_tree(pkg_path, recurse = TRUE) @@ -110,7 +109,7 @@ fs::dir_tree(pkg_path, recurse = TRUE) ``` r find_missing_tags(pkg_path) -#> ℹ Loading pkg.2579f749b154a +#> ℹ Loading pkg.2681653ace3ee #> Missing or empty return value for exported functions: my_fun #> #> @@ -119,7 +118,7 @@ find_missing_tags(pkg_path) #> #> #> -#> ℹ Loading pkg.2579f749b154a +#> ℹ Loading pkg.2681653ace3ee #> # A tibble: 2 × 11 #> id filename topic has_e…¹ has_r…² retur…³ has_n…⁴ rdnam…⁵ not_e…⁶ test_…⁷ #> From dc27712a1291e1a6a3bbc7cb800406f8fd055ada Mon Sep 17 00:00:00 2001 From: StatnMap Date: Wed, 21 Sep 2022 19:57:49 +0200 Subject: [PATCH 3/4] Bump to v0.0.1 --- DESCRIPTION | 2 +- README.Rmd | 8 +++++++- README.md | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ce4573e..2e2e5cb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: checkhelper Title: Deal with check outputs -Version: 0.0.0.9000 +Version: 0.0.1 Authors@R: c( person("Sebastien", "Rochette", , "sebastien@thinkr.fr", role = c("aut", "cre")), person("Vincent", "Guyader", , "vincent@thinkr.fr", role = "aut") diff --git a/README.Rmd b/README.Rmd index 285077a..c32c687 100644 --- a/README.Rmd +++ b/README.Rmd @@ -26,8 +26,14 @@ knitr::opts_chunk$set( ## Installation -You can install the last version of checkhelper from github with: +You can install the last version of checkhelper from r-universe with: +```r +install.packages('checkhelper', repos = 'https://thinkr-open.r-universe.dev') +``` + + +Or from GitHub: ``` r remotes::install_github("thinkr-open/checkhelper") ``` diff --git a/README.md b/README.md index f4ec271..fed41c5 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,13 @@ Complete documentation in the {pkgdown} site: ## Installation -You can install the last version of checkhelper from github with: +You can install the last version of checkhelper from r-universe with: + +``` r +install.packages('checkhelper', repos = 'https://thinkr-open.r-universe.dev') +``` + +Or from GitHub: ``` r remotes::install_github("thinkr-open/checkhelper") @@ -70,7 +76,7 @@ dir.create(pkg_path) # Create fake package usethis::create_package(pkg_path, open = FALSE) -#> ✔ Setting active project to '/tmp/RtmpiWQuWQ/pkg.2681653ace3ee' +#> ✔ Setting active project to '/tmp/RtmpT2YnX3/pkg.26be9459ed409' #> ✔ Creating 'R/' #> ✔ Writing 'DESCRIPTION' #> ✔ Writing 'NAMESPACE' @@ -97,8 +103,8 @@ my_not_exported_doc <- function() { ", file = file.path(pkg_path, "R", "function.R")) attachment::att_amend_desc(path = pkg_path) -#> Updating pkg.2681653ace3ee documentation -#> ℹ Loading pkg.2681653ace3eeWriting ']8;;file:///tmp/RtmpiWQuWQ/pkg.2681653ace3ee/NAMESPACENAMESPACE]8;;'Writing ']8;;file:///tmp/RtmpiWQuWQ/pkg.2681653ace3ee/NAMESPACENAMESPACE]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_fun')my_fun.Rd]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_not_exported_doc')my_not_exported_doc.Rd]8;;'ℹ Loading pkg.2681653ace3ee[+] 1 package(s) added: dplyr. +#> Updating pkg.26be9459ed409 documentation +#> ℹ Loading pkg.26be9459ed409Writing ']8;;file:///tmp/RtmpT2YnX3/pkg.26be9459ed409/NAMESPACENAMESPACE]8;;'Writing ']8;;file:///tmp/RtmpT2YnX3/pkg.26be9459ed409/NAMESPACENAMESPACE]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_fun')my_fun.Rd]8;;'Writing ']8;;ide:run:pkgload::dev_help('my_not_exported_doc')my_not_exported_doc.Rd]8;;'ℹ Loading pkg.26be9459ed409[+] 1 package(s) added: dplyr. # Files of the package fs::dir_tree(pkg_path, recurse = TRUE) @@ -109,7 +115,7 @@ fs::dir_tree(pkg_path, recurse = TRUE) ``` r find_missing_tags(pkg_path) -#> ℹ Loading pkg.2681653ace3ee +#> ℹ Loading pkg.26be9459ed409 #> Missing or empty return value for exported functions: my_fun #> #> @@ -118,7 +124,7 @@ find_missing_tags(pkg_path) #> #> #> -#> ℹ Loading pkg.2681653ace3ee +#> ℹ Loading pkg.26be9459ed409 #> # A tibble: 2 × 11 #> id filename topic has_e…¹ has_r…² retur…³ has_n…⁴ rdnam…⁵ not_e…⁶ test_…⁷ #> From 3da1e25011913be9d63973c1df39b2519bf4e0d4 Mon Sep 17 00:00:00 2001 From: StatnMap Date: Wed, 21 Sep 2022 20:11:33 +0200 Subject: [PATCH 4/4] fix: show path of the file in notes tags: fix, test Why? Some specific option of checks may show path of the file What? Clean path for extraction of function name --- R/ch_list_globals.R | 3 ++- devstuff_history.R | 2 +- tests/testthat/test-checkhelper.R | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/ch_list_globals.R b/R/ch_list_globals.R index e41b4fe..1064dd2 100644 --- a/R/ch_list_globals.R +++ b/R/ch_list_globals.R @@ -62,7 +62,8 @@ get_notes <- function(path = ".", checks, ...) { res <- tibble(notes = strsplit(notes_with_globals_return, "RETURN")[[1]]) %>% # res <- tibble(notes = strsplit(notes_with_globals, "\n")[[1]]) %>% mutate( - fun = str_extract(notes, ".+(?=:)"), + # Maybe a path in parenthesis ? + fun = str_extract(notes, "(\\s*\\(.*\\)\\s){0,1}.+(?=:)"), is_function = grepl("no visible global function definition", notes), is_global_variable = grepl("no visible binding for global variable", notes), variable = str_extract(notes, "(?<=\\u2018).+(?=\\u2019)|(?<=\\u0027).+(?=\\u0027)"), diff --git a/devstuff_history.R b/devstuff_history.R index 0b330e3..0bd0b38 100644 --- a/devstuff_history.R +++ b/devstuff_history.R @@ -68,7 +68,7 @@ usethis::use_vignette("deal-with-check-outputs") devtools::build_vignettes() devtools::load_all() -rcmdcheck::rcmdcheck() +rcmdcheck::rcmdcheck(args = (c("--no-manual", "--as-cran"))) devtools::check(vignettes = FALSE) covr::package_coverage() diff --git a/tests/testthat/test-checkhelper.R b/tests/testthat/test-checkhelper.R index af2ff44..8815d95 100644 --- a/tests/testthat/test-checkhelper.R +++ b/tests/testthat/test-checkhelper.R @@ -25,7 +25,7 @@ path <- suppressWarnings(create_pkg()) # withr::local_environment({ # test_env({ - globals <- checkhelper::get_no_visible(path, quiet = TRUE) + globals <- get_no_visible(path, quiet = TRUE, args = (c("--no-manual", "--as-cran"))) # saveRDS(globals,"C:\\Users\\seb44\\AppData\\Local\\Temp\\RtmpqI9biW\\checkpackage\\globals.rds") # })