[R-pkg-devel] is R CMD build --compact-vignettes working as expected?

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Thu Oct 8 02:42:08 CEST 2020



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.

   I wasn't saying you had. My count of three was Bolker (me), Fox, Nash.

   cheers
     Ben

> 
> 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 using r-project.org mailing list
>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>>
>>>> ______________________________________________
>>>> R-package-devel using r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>>
>>>
>



More information about the R-package-devel mailing list