From hb at biostat.ucsf.edu  Thu Dec 20 22:14:13 2012
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Thu, 20 Dec 2012 22:14:13 +0100
Subject: [Rd] How to make an <pkg>/configure file executable on Windows/NTFS?
Message-ID: <CAFDcVCRkkFkCb+wZyhY5cDai5fiGedieLR+E-Fb40FDW9xNAyg@mail.gmail.com>

Hi,

in my package, I've got a 'configure' file in the root, e.g.
aroma.affymetrix/configure. (I've also got a configure.win, which
works just fine on Windows). This file must be executable (has a
proper file mode) for 'R CMD INSTALL'/install.packages() to work,
otherwise one gets:

* installing *source* package 'aroma.affymetrix' ...
ERROR: 'configure' exists but is not executable -- see the 'R
Installation and Administration Manual'

*** I build my packages/tar balls on Windows.  Is there are way to
build it such that aroma.affymetrix/configure is executable?


*** Looking at the code
(http://svn.r-project.org/R/trunk/src/library/tools/R/install.R),
there is

if (file_test("-x", "configure")) {
  cmd <- paste(paste(configure_vars, collapse = " "), "./configure",
paste(configure_args, collapse = " "))
  if (debug) message("configure command: ", sQuote(cmd), domain = NA)
  res <- system(cmd)
  if (res) pkgerrmsg("configuration failed", pkg_name)
}  else if (file.exists("configure"))
  errmsg("'configure' exists but is not executable -- see the 'R
Installation and Administration Manual'")

Would it be possible to automatically try to update the file
permissions if not enough, e.g.

if (file_test("-x", "configure")) Sys,chmod("configure", mode="777")
if (file_test("-x", "configure")) {
  ...
}  else if (file.exists("configure"))
  errmsg("'configure' exists but is not executable -- see the 'R
Installation and Administration Manual'")

This would solve the practical problem of not being able to(?) build
tar balls with an executable configure on Windows.  I can also see
how this avoids problems where the file mode on an SVN repository
(think R-forge etc) is overridden by a user on, say, Windows.


*** Related, what about adding support for a cross-platform
<pkg>/configure.R script that is executed by R/Rscript during
installation?

Thank you,

Henrik



[Rd] How to make an <pkg>/configure file executable on Windows/NTFS?
Henrik Bengtsson