[Rd] Apply .Rbuildignore before copying files in R CMD build

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Aug 29 21:58:11 CEST 2024


On 2024-08-29 3:34 p.m., Gábor Csárdi wrote:
> On Thu, Aug 29, 2024 at 12:12 AM Duncan Murdoch
> <murdoch.duncan using gmail.com> wrote:
> [...]
>> I think the reason is simplicity.  The build process can add, delete or
>> modify files.  You wouldn't want that to happen on the original source
>> files, so R copies the files to a temporary location to run things.
>>
>> If it applied .Rbuildignore first, then important files for the build
>> might not be available, and the build could fail.
> 
> AFAICT the ignored files are deleted right after the copy, so they
> are not present during the build process. (But FIXME.)

I think some builds do that, but builds of packages with vignettes 
generally do an install of the package, and that might need the ignored 
files.  There could be other situations too.

You probably know this, but for the benefit of those who don't:  you can 
read the build operations in the 1100 line function 
tools:::.build_packages, which starts here: 
https://github.com/wch/r-source/blob/1bdf2503322b43ce8698008eb5bc1f55bc8a58c2/src/library/tools/R/build.R#L93

The prepare_pkg() function is run between the copy and the cleanup, and 
it might do a package install.

Duncan Murdoch



More information about the R-devel mailing list