Requested packages are not installed when DESCRIPTION is autogenerated in `before_script`

I am currently trying to update an old .travis.yml to work with the native support for building R packages on Travis. This package (the R interface for igraph) first needs to prepare some files before the R package can be build. This is done by simply running make before building the R package. I thought it would be best to call make during before_script, but for some reason that yields the error:

No DESCRIPTION file found, user must supply their own install and script steps

Alternatively, I tried to use before_install, but that results in the error that some of the requested packages are not installed (in particular roxygen2 and devtools). Using install instead yields the same error. The devtools package is not specifically requested, so perhaps that simply needs to be added. However, the roxygen2 package is explicitly listed under r_packages, so that should be installed.

All in all, the before_script seems the most logical choice. I would expect roxygen2 to be installed when before_script gets executed, but that does not seem to be the case from the log files. In fact, make as listed under before_script even does not get executed, which I don’t fully understand. Perhaps that before_install gets executed before the r_packages section gets executed, but that is not 100% clear to me. I can imagine that having a custom install section prevents sections such as r_packages from being executed. So, the failure of the latter two options could perhaps be explained, but I don’t fully understand the failure when using before_script.

Any help would be greatly appreciated, pinging @jeroen and @jimhester here as requested. Thank you for any response!

From the Travis build script for R I think I now what the problem is. The DESCRIPTION file gets generated by calling make, but the DESCRIPTION file needs to be present before the install section starts:

The catch-22 situation is that (some) dependencies as included under r_packages, r_github_packages and bioc_packages should be installed before calling make. In other words, make should be called at line 207.

I’ll see how I can work around this. It probably will require to us to manually install the required packages for calling make during before_install.

I guess you can provide a blank DESCRIPTION to the install stage, then install package’s own deps manually, that’s going to be the least custom code.

I have solved it by installing the required package for make manually during before_install, it turned out there were only two.

before_install:
  - Rscript -e 'install.packages(c("roxygen2", "devtools"))'
  - make

This required less effort than providing an empty DESCRIPTION and manually installing all other dependencies.

1 Like