Skip to content

Building Packages on Windows using .Rbuildignore

5 messages · Gabor Grothendieck, Duncan Murdoch

#
I have some questions about building packages in Windows 
when using .Rbuildignore .  The part of the process that
is of interest here is the part that creates the source
tree from the tree that contains the .Rbuildignore file.
That is, the part of the process that does a build of
the original tree creating a .tar.gz and then extracts
this file into a source directory that can be used by
check, build --binary and install.

1. makefiles

I was developing some batch files for myself using R CMD ...
but then noticed the Windows makefiles.

- Do the makefiles take into account the situation above?

- If so, do I need to do anything special to use them this way?

2. configure.win

Also I noticed reference to configure.win in the Extensions
manual and am not sure if that can be used to address this.
I tried creating a one line configure.win which just does
an echo of a fixed string "echo XYZ" but I did not see XYZ
during my R CMD install.

- Is configure.win supposed to be written using Windows batch commands
  or UNIX-like commands?

- where does it go.  (I tried putting it in the same directory as
  my DESCRIPTION file.)

- is it a suitable device for handling the .Rbuildignore issue?

Thanks.
#
On Wed, 17 Nov 2004 18:10:20 +0000 (UTC), Gabor Grothendieck
<ggrothendieck@myway.com> wrote :
I don't think I understand exactly what you're asking.
It is run under "sh", not the standard Windows interpreter, so
"UNIX-like".  

I just tried it with "Rcmd install", and I did see the message echoed.
I didn't see it for "Rcmd build", because that doesn't build the
package, it just puts it in a tarball, but "Rcmd build --binary" does
run it.
It should be in the same directory as DESCRIPTION.
What's the issue exactly?

Duncan Murdoch
#
Duncan Murdoch <murdoch <at> stats.uwo.ca> writes:

: 
: On Wed, 17 Nov 2004 18:10:20 +0000 (UTC), Gabor Grothendieck
: <ggrothendieck <at> myway.com> wrote :
: 
: >
: >I have some questions about building packages in Windows 
: >when using .Rbuildignore .  The part of the process that
: >is of interest here is the part that creates the source
: >tree from the tree that contains the .Rbuildignore file.
: >That is, the part of the process that does a build of
: >the original tree creating a .tar.gz and then extracts
: >this file into a source directory that can be used by
: >check, build --binary and install.
: >
: >1. makefiles
: >
: >I was developing some batch files for myself using R CMD ...
: >but then noticed the Windows makefiles.
: >
: >- Do the makefiles take into account the situation above?
: >
: >- If so, do I need to do anything special to use them this way?
: 
: I don't think I understand exactly what you're asking.  

If one does not use .Rbuildignore then with a pure R package
one can run off the original source files, in this case
in /wherever/mypkg, like this:
...without .Rbuildignore ...
R CMD install /wherever/mypkg
R CMD check /wherever/mypkg
R CMD build /wherever/mypkg
R CMD build /wherever/mypkg --binary

but if one DOES use .Rbuildignore then one must first build the
package to remove the .Rbuildignore cited files and then run off
the built files which were created by unpacking the tar.gz file.
Below we build the files in /wherever/mypkg and put the resulting
.tar.gz in the current diretory and then unpack it and run the
remaining commands off the unpacked directory (unlike the previous
case where we ran everything off the original directory, viz.
/wherever/mypkg):

... with .Rbuildignore ...

R CMD build /wherever/mypkg
tar xvzf mypkg_0.9-1.tar.gz

... now that we have created a new source directory, mypkg, without
... the .Rbuildignore files we can proceed by running off of that.
... Note that mypkg is different than /wherever/mypkg as the former
... does not contain the ignored files.
R CMD install mypkg
R CMD check mypkg
R CMD build mypkg --binary

I was writing a batch file to handle this second case for me
but was wondering if I was just duplicating work that has
already been done or can easily be done with existing makefiles
or somehow using configure.win.


: 
: >2. configure.win
: >
: >Also I noticed reference to configure.win in the Extensions
: >manual and am not sure if that can be used to address this.
: >I tried creating a one line configure.win which just does
: >an echo of a fixed string "echo XYZ" but I did not see XYZ
: >during my R CMD install.
: >
: >- Is configure.win supposed to be written using Windows batch commands
: >  or UNIX-like commands?
: 
: It is run under "sh", not the standard Windows interpreter, so
: "UNIX-like".  
: 
: I just tried it with "Rcmd install", and I did see the message echoed.
: I didn't see it for "Rcmd build", because that doesn't build the
: package, it just puts it in a tarball, but "Rcmd build --binary" does
: run it.
: 
: >
: >- where does it go.  (I tried putting it in the same directory as
: >  my DESCRIPTION file.)
: 
: It should be in the same directory as DESCRIPTION.
: 
: >- is it a suitable device for handling the .Rbuildignore issue?
: 
: What's the issue exactly?
: 
: Duncan Murd
#
On Wed, 17 Nov 2004 20:44:48 +0000 (UTC), Gabor Grothendieck
<ggrothendieck@myway.com> wrote :
... or what happens?  I still don't know exactly what you are claiming
goes wrong.  

It might be that the behaviour should be changed, or maybe there's an
existing workaround, but I'd like to see a clear statement of the
problem first.

Duncan Murdoch
#
Duncan Murdoch <murdoch <at> stats.uwo.ca> writes:
QUESTION

I am not claiming anything is wrong.  I was simply describing what
processing is needed to build a package that only uses R, noting that
such processing is different if one uses .Rbuildignore.  My question
was to ask:

- are there already scripts, makefiles or some other software or hooks
  such as configure.win to streamline this

EXAMPLE

For example, in
  http://tolstoy.newcastle.edu.au/R/help/04/11/6729.html
John Fox provided a batch file that automated package creation in the
case that there is only R code and one does not use .Rbuildignore.
I do use .Rbuildignore and need to do the analogous.   Most of my
past two posts described the manual commands that must be done in
each of these two cases to make clear what the process that I want
to streamline is and how it differs in these two cases.

DIFFERENCE BETWEEN USING .RBUILDIGNORE AND NOT

The reason that the processing is different according to whether one
uses .Rbuildignore or not is that 
  R CMD build 
takes the .Rbuildignore file into account but 
  R CMD install
  R CMD check
  R CMD build --binary 
do not take .Rbuildignore into account.
Certainly its desirable to streamline this whole situation with a 
makefile, script or hook or perhaps one could modify the individual
commands: R CMD install, R CMD check and R CMD build --binary to 
take .Rbuildignore into account, possibly via a switch/flag.  However,
all I was asking about is what is already there.

Thanks.