[Rd] ordering in R CMD build & R CMD Rdindex

Paul Gilbert pgilbert@bank-banque-canada.ca
Thu, 15 Jun 2000 12:25:42 -0400

This is a synopsis for the r-devel archives of my solution to the problem that

R CMD Rdindex zzz/man/* >INDEX
R CMD build zzz

do not always result in the same order, which causes make problems outlined
further below. The source of the problem was suggested by Brian Ripley:

BDR>The shell expands the * before Rdindex ever gets hold of it. And what it
BDR>does re locales is an installation default (assuming it is a Solaris shell
BDR>not bash or tcsh, for both of which NLS support is optional).

The need to build INDEX separately from using the one generated by build is
so that R INSTALL zzz does not require R CMD build zzz first. This means
that code changes can be tested separately from documentation changes and
vice versa, thus remakes are faster.

INDEX needs to be generated in the same order as produced by
R CMD build or build's diff comparison suggests that the index is out
of date and suggests using --force. Using --force rewrites INDEX which
causes make to think the install is out of date, so the next make always starts
at the beginning again.

The * expansion (in Solaris sh) does not seem to recognize LC (locale)
settings. Sort does, but some of the output of R CMD Rdindex is on two
lines, so sorting the output does not work. It is possible to
   ls -1 man/* | sort
and get the locale sort order, but it does not seem possible to feed this
into "R CMD Rdindex". ( LC_COLLATE is not adequate for sort, LC_ALL is needed.)

The fix is to generate INDEX in the C order imposed by the
 Solaris sh expansion of *, then set LC_ALL=C for R CMD build.

Paul Gilbert

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch