Say I have an R package on GitHub that I expect users to install with devtools::install_github
. I'd like packageVersion
or some element of packageDescription
to reflect the specific commit that was installed. This answer describes how a Git commit hash can be transformed into a version number that R will accept, and how a DESCRIPTION can be generated by Make. Does this mean that install_github
and similar functions automatically make
before checking for the DESCRIPTION? What other ways are there to hook into install_github
or its subroutines to generate the DESCRIPTION dynamically, or change the effect of the DESCRIPTION, before the actual installation?
Asked
Active
Viewed 114 times
1

Kodiologist
- 2,984
- 18
- 33
-
Interesting question. As far as I am aware, the `install_XXX` family of functions do not transform the repo in any way (no `make`) but simply install whatever is there. However, the commit hash must be stored somewhere since `install_XXX` will warn you if you try to re-install from the same commit (`"Hash has not changed"`). – asachet Dec 09 '19 at 17:27
-
@asac Huh, in that case, I wonder how `install_github` works on a repository that has code that needs to be compiled (in C, C++, Fortran, or something else). – Kodiologist Dec 09 '19 at 20:40
-
Good point, you must be right. This would be documented in the [R manual about packages](https://cran.r-project.org/doc/manuals/R-exts.html). (5 minutes later...) At a first glance, looks like you can provide a `Makevars` file. See [this section in particular](https://cran.r-project.org/doc/manuals/R-exts.html#Using-Makevars). More generally, [you can provide a `configure` shell script](https://cran.r-project.org/doc/manuals/R-exts.html#Configure-and-cleanup) which is run before `R CMD INSTALL`. – asachet Dec 10 '19 at 09:12