When I tried that on MacOS, it did the gs compression with gs_quality
set to "none", which does nothing. I don't know what quality CRAN uses,
but for me setting the environment variable GS_QUALITY=screen made a big
difference.
Duncan Murdoch
On 08/10/2020 11:10 a.m., John Fox wrote:
Dear Ben,
Actually, what I used was --compact-vignettes="both", with qpdf and gs
installed on my Windows and Mac machines, and that apparently didn't
work for me.
Best,
John
On 2020-10-07 10:06 p.m., Ben Bolker wrote:
OK, I think I see the problem. tl;dr use --compact-vignettes="both"
when building the vignettes.
--compact-vignettes by default only tries qpdf.
when the R CMD check --as-cran is run, it tries both qpdf and gs.
Since gs (apparently, in this case) compresses more aggressively than
qpdf, it succeeds in compressing further, and the check complains.
From R CMD build --help:
--compact-vignettes= try to compact PDF files under inst/doc:
"no" (default), "qpdf", "gs", "gs+qpdf", "both"
--compact-vignettes same as --compact-vignettes=qpdf
I don't know if this is worth documenting somewhere, or modifying the
behaviour to make "both" the default for --compact-vignettes ?
On 10/7/20 8:35 PM, Duncan Murdoch wrote:
On 07/10/2020 8:32 p.m., Ben Bolker wrote:
Thanks for the tip, I'll take a look.
Given that three relatively experienced package authors all seem to
have experienced similar issues, it seems that maybe this is worth
figuring out/maybe I'm not just doing something boneheaded.
Just to clarify: I've never noticed the problem you mention. I just
know how to debug R CMD build.
Duncan
cheers
Ben
On 10/7/20 8:31 PM, Duncan Murdoch wrote:
I don't know the answer to your question, but you can debug the
--compact-vignettes option as follows.
debug(tools::compactPDF)
tools:::.build_packages(c("--compact-vignettes", "pkgdir"))
where "pkgdir" is the directory of the source of your package. Add
extra options to the build as separate elements of the argument to
.build(): this function is called after args have been parsed.
When I do that, I see that it rejects the compaction, because none of
mine benefit much from it: it wants at least a 10% and 10K reduction.
But Ben's example met those criteria. When I trick it into accepting
the compaction, it does put the compacted PDF into the tarball.
Duncan Murdoch
On 07/10/2020 6:03 p.m., John Fox wrote:
Dear Ben,
On 2020-10-07 5:26 p.m., Ben Bolker wrote:
I hope so too. The (annoying) workaround is to compact the
vignette
yourself (using qpdf directly or using tools::compactPDF), then use
no-build-vignettes. The problem there is whatever's supposed to
happen
with building vignette indices. The uuuuugly workaround, I guess,
is to
build the tarball, compact the vignettes oneself, then *replace*
them in
the tarball. (Obviously I can automate that, but it seems as
though it
would be unnecessary if I knew what was going on ...)
I've used both of these workarounds and agree that it would be nice to
avoid them. After all, what is the --compact-vignettes argument for?
Best,
John
cheers
Ben
On 10/7/20 4:10 PM, John Fox wrote:
Dear Ben,
I was hoping that someone would pick up on this problem, because
I've
experienced the same issue of --compact-vignettes apparently
ignored,
e.g., with the Rcmdr package under R 4.0.2 on both macOS and
Windows.
Best,
John
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/
On 2020-10-05 1:09 p.m., Ben Bolker wrote:
Am I confused, or doing something wrong, or ... ?
I have qpdf installed, and am running R CMD build with
--compact-vignettes, but the PDF in the tarball doesn't seem to be
compressed despite the fact that the output messages say
"compacting
vignettes ..."
$ R CMD build --compact-vignettes lme4
* checking for file ‘lme4/DESCRIPTION’ ... OK
* preparing ‘lme4’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
* saving partial Rd database
* creating vignettes ... OK
Warning: ‘inst/doc’ files
‘lmerperf.html’, ‘lmer.pdf’, ‘PLSvGLS.pdf’, ‘Theory.pdf’
ignored as vignettes have been rebuilt.
Run R CMD build with --no-build-vignettes to prevent
rebuilding.
* compacting vignettes and other PDF files
* cleaning src
* checking for LF line-endings in source and make files and shell
scripts
* checking for empty or unneeded directories
* building ‘lme4_1.1-24.tar.gz’
The copy of lmer.pdf in the resulting tarball is 900K or so:
$ tar ztvf lme4_1.1-24.tar.gz lme4/inst/doc/lmer.pdf
-rw-r--r-- bolker/bolker 907022 2020-10-05 12:59
lme4/inst/doc/lmer.pdf
The previously built (and manually compacted) version of
lmer.pdf
in the tarball is 500K:
$ ls -l lme4/inst/doc/lmer.pdf
-rw-r--r-- 1 bolker bolker 495199 Oct 3 22:15
lme4/inst/doc/lmer.pdf
Is 'R CMD build' confused by the presence of a pre-built
PDF in
the inst/doc directory? Or am I somehow mistaken about how this is
supposed to work?
I would just use --no-build-vignettes and submit the
tarball with
the previously built/compressed PDF, but I'm trying to avoid a
"Package has a VignetteBuilder field but no prebuilt vignette
index"
NOTE, which I assume is missing because I built without building
vignettes ... ?
As always, enlightenment is welcome.
cheers
Ben Bolker
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel