cran2crux: ports for R modules

I use R in my work and I wanted to find a way to easily create CRUX ports for system-wide installation of its modules. Having them managed by the distro’s packaging system has its advantages: I can check them with revdep or use custom settings at build time. However, I did not find a ready solution, so I wrote a tool myself, called cran2crux (for detailed info, check it’s page). The cran2crux script automatically generates CRUX port(s) for R modules available from CRAN. On my TODO list is making it work with Bioconductor, as well.

The idea behind cran2crux is not new, it is exactly the same as with the cpan2crux tool that generates ports for building perl modules. For guidelines about building R modules outside the R environment, I checked the Arch Linux wiki. The port created for a Module is named r4-module, so it has r4- prefix, followed by the name in lowercase. I was hesitant about the prefix, because both Arch and Debian use the r-module convention. However, since CRUX names its perl modules as p5-module, and we are at R version 4.* at the moment, I decided that r4- would fit better.

I prepared a port for cran2crux, available from my repo. After install, a few settings should be configured in /etc/cran2crux.conf, as described at the project’s page. The tool has two options, that deal with dependencies: -r will create ports for dependencies, while -ro will also create ports for optional dependencies. This is all done recursively in a number of iterations that can be increased by providing an integer after the -r or -ro option (the higher the integer the deeper dependencies resolution goes). For example, I created a port for Seurat (Tools for Single Cell Genomics) and its dependencies, which generated about 140 ports. Asking the tool to do the same including optional deps will result in thousands of ports.

As an example, to create a port for Seurat only:

cran2crux Seurat

To also create ports for Seurat’s dependencies:

cran2crux Seurat -r

And this will create also ports for optional dependencies (I increase the number of dependencies search iterations to 15, do deps resolution goes deeper):

cran2crux Seurat -ro 15

I am currently building an r4-modules repo, which at some point might be added to portdb.



Leave a comment