[R] Customizing the package build process

Ross Boylan ross at biostat.ucsf.edu
Tue Nov 22 22:13:52 CET 2005


I've made a package for which R CMD build isn't producing very
satisfactory results.  I'll get to the details in a moment.

I wonder if it would make sense to have my own makefiles (which already
exist and are doing quite a lot) produce the .tar.gz file ordinarily
produced by R CMD build.  As far as I can tell, R CMD build basically
tars up of the project directory after running some checks.  I could run
R CMD check separately.

There are two main problems with the results of R CMD build.  First, it
has lots of files that I don't want included (the input files used to
generate configure, miscellaneous garbage, other stuff not suitable for
distribution).  Second, I have data files as both "data.gz" and "data".
R puts "data" into the .tar.gz file and sensibly ignores the .gz file.
Unfortunately, my makefiles assume the existence of the "data.gz" files,
and so may have trouble after the .tar.gz is unpacked and there are no
"data.gz" files.

My bias would ordinarily be to piggy back on the R build system as much
as possible.  In principle, this could get me extra features (binary
builds, MS Windows builds) and it would track the things R build does
beyond tarring files.  But in this case using the R build system seems
quite ugly.  I could in principle use .Rbuildignore, probably generated
dynamically, to exclude files.  That doesn't solve the 2nd problem
(data.gz becomes data).

So does the alternative of doing the tar'ing myself make sense?

Is there another option that could hook into the R CMD build process
more deeply than the use of .Rbuildignore?

I suppose another option would be to do a clean checkout of the sources
for my package, run a special makefile target that would create the
necessary files and delete all unwanted files, and then do a regular R
CMD build.  This might still have trouble with "data.gz".

P.S. Previous list postings advised that R CMD install was a better way
to produce binaries than R CMD build --binary.  The former command
doesn't seem to have any options for making binaries; has that facility
been removed?

Second question: my reading is that .Rbuildignore is only read in the
package root directory, and will have no effect below that.  Is that
correct?  Per directory .Rbuildignore's would be convenient..

-- 
Ross Boylan                                      wk:  (415) 514-8146
185 Berry St #5700                               ross at biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 514-8150
University of California, San Francisco
San Francisco, CA 94107-1739                     hm:  (415) 550-1062




More information about the R-help mailing list