Today, a package that has an HTML vignette (but no PDF vignette) failed R CMD check --as-cran on a system without qpdf. I think the warning originates here [1], due to a premature check for the existence of qpdf [2]. Setting R_QPDF=true (as in /bin/true) helped, but perhaps it's possible to check qpdf existence only when it matters.

I have attached a patch (untested) that could serve as a starting point. The code links correspond to SVN revision 69500. Thanks.


Best regards

Kirill


[1] https://github.com/wch/r-source/blob/f42ee5e7ecf89a245afd6619b46483f1e3594ab7/src/library/tools/R/check.R#L322-L326, [2] https://github.com/wch/r-source/blob/f42ee5e7ecf89a245afd6619b46483f1e3594ab7/src/library/tools/R/check.R#L4426-L4428
diff --git src/library/tools/R/check.R src/library/tools/R/check.R
index a508453..e4e5027 100644
--- src/library/tools/R/check.R
+++ src/library/tools/R/check.R
@@ -319,11 +319,7 @@ setRlibs <-
                      paste("  file", paste(sQuote(miss[f]), collapse = ", "),
                            "will not be installed: please remove it\n"))
         }
-        if (dir.exists("inst/doc")) {
-            if (R_check_doc_sizes) check_doc_size()
-            else if (as_cran)
-                warningLog(Log, "'qpdf' is needed for checks on size reduction of PDFs")
-        }
+        if (R_check_doc_sizes && dir.exists("inst/doc")) check_doc_size()
         if (dir.exists("inst/doc") && do_install) check_doc_contents()
         if (dir.exists("vignettes")) check_vign_contents(ignore_vignettes)
         if (!ignore_vignettes) {
@@ -2129,12 +2125,18 @@ setRlibs <-
 
     check_doc_size <- function()
     {
-        ## Have already checked that inst/doc exists and qpdf can be found
+        ## Have already checked that inst/doc exists
         pdfs <- dir('inst/doc', pattern="\\.pdf",
                     recursive = TRUE, full.names = TRUE)
         pdfs <- setdiff(pdfs, "inst/doc/Rplots.pdf")
         if (length(pdfs)) {
             checkingLog(Log, "sizes of PDF files under 'inst/doc'")
+            if (!nzchar(Sys.which(Sys.getenv("R_QPDF", "qpdf")))) {
+                if (as_cran)
+                    warningLog(Log, "'qpdf' is needed for checks on size reduction of PDFs")
+                return()
+            }
+
             any <- FALSE
             td <- tempfile('pdf')
             dir.create(td)
@@ -4424,8 +4426,7 @@ setRlibs <-
     	config_val_to_logical(Sys.getenv("_R_CHECK_PKG_SIZES_", "TRUE")) &&
         nzchar(Sys.which("du"))
     R_check_doc_sizes <-
-    	config_val_to_logical(Sys.getenv("_R_CHECK_DOC_SIZES_", "TRUE")) &&
-        nzchar(Sys.which(Sys.getenv("R_QPDF", "qpdf")))
+    	config_val_to_logical(Sys.getenv("_R_CHECK_DOC_SIZES_", "TRUE"))
     R_check_doc_sizes2 <-
     	config_val_to_logical(Sys.getenv("_R_CHECK_DOC_SIZES2_", "FALSE"))
     R_check_code_assign_to_globalenv <-

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to