Hints for building GNU R packages

This page assembles some hints about GNU R packages.

Packaging template

Usually packaging GNU R code is very simple when using r-base-dev. A typical debian/control file looks like this:

Source: r-<repository>-<name>
Maintainer: Packaging team <packaging-team@lists.alioth.debian.org>
Uploaders: uploader <uploader@debian.org>
Section: gnu-r
Priority: optional
Build-Depends: debhelper (>= 9),
               <more r-* packages>
Standards-Version: 3.9.4
Vcs-Browser: http://anonscm.debian.org/viewvc/<team-dir>
Vcs-Svn: svn://anonscm.debian.org/<team-dir>
Homepage: http://cran.org/<location-on-cran>

Package: r-<repository>-<name>
Architecture: all
Depends: ${R:Depends},
         <more r-* packages>
Description: GNU R package ...
 long description

A typical debian/rules file looks like this:

 #!/usr/bin/make -f

 include /usr/share/R/debian/r-cran.mk

In both cases above usually repository=cran which is the default in debian/rules (so this line is not needed). You might like to set it to bioc for BioConductor packages.

Feel free to check out a rich set of examples for instance in the repository of the SVN repository of Debian Med team.

Specifics of GNU R packages

RData files (*.rda) in source packages

It seems to be a frequently discussed topic between R package maintainers and ftpmaster that several R packages are containing RData files which somehow are looking like binary files without source for people not familiar with R. However, for people who are working with R this is a non-issue because these so called serialized R objects can be input and manipulated in R by humans, I guess in the same way that png files can be edited using image manipulation programs.

There is some decision on R datasets from ftpmaster that adds some requirements the maintainer needs to check in case the upstream source contains RDate files.

Relevant hint: Since GNU R upstream sources are usually quite good documented in very many cases the according RData files are documented inside the docs. It is a very good idea to grep for the file name of the files and check the according hits whether all questions you need to answer are just answered there.

Usage of the ${R:Depends} variable

In 659163 the ${R:Depends} variable was used to simplify the versioned dependency in R packages. It seems that the current implementation which contains a hardcoded dependency to the version of the r-base-dev package:

dpkg-query -W -f='$${Version}' r-base-dev

under some circumstances creates to strict dependencies which in turn requires a rebuild of packages that could be avoided if the variable would simply regard an R API version like it was originally suggested:

R --version | head -n1 | perl -ne 'print / +([0-9]\.[0-9]+\.[0-9])/'