[aur-general] Packaging all CRAN packages for R

Eli Schwartz eschwartz at archlinux.org
Sun May 27 02:24:03 UTC 2018

On 05/26/2018 12:04 PM, Alex Branham via aur-general wrote:
> Hi all -
> I'd like to use pacman to manage R packages, similar to how you can for
> other languages (e.g. the python packages are all named python-*). There
> are some packages available already, but not many (I count about 130
> currently). I wrote a script[1] that generates PKGBUILDS for all the
> packages on the Comprehensive R Archive Network (CRAN). There's 12,593
> packages on CRAN as of today.
> If you evaluate the script, then call write_all_pkgbuilds(), R will put
> each PKGBUILD into PKGBUILDS/r-cran-<pkgname>/PKGBUILD. Here's an
> example of the output.[2] It doesn't generate .SRCINFO or setup a git
> repo (yet). It also doesn't take into account (yet) that there are
> already 130ish R packages on the AUR. I named them r-cran-* rather than
> r-* because 1) it's clearer where the packages are coming from and 2)
> it's a pain to search for r-*
> Is this something people would like to have in the AUR? I figured I
> should ask before adding ~12.5k packages.
> Any and all comments/feedback appreciated!
> Thanks,
> Alex

If you're generating PKGBUILDs for upload to the AUR, they should be
well-written. As observed, injecting "cran" into the name is confusing,
I think anyone looking for an R package will know how to find it based
on the rest of the name component.

I doubt anyone is just looking randomly to see which R packages are
available, but if they are, the most effective way would be to download
https://aur.archlinux.org/packages.gz and use regular expressions to
find packages matching the pattern ^r-

This would find the regardless of whether they mentioned cran, and in a
highly effective manner.

> Footnotes:
> [1]  https://github.com/jabranham/r-cran-pkgbuilds/blob/master/gen-R-PKGBUILDS.R
> [2]
> # Maintainer: Alex Branham <email-address-removed>
> _cranname=A3
> _cranver=1.0.0
> pkgname=r-cran-a3
> pkgver=1.0.0

Why is cryanver different from pkgver?

> pkgrel=1
> pkgdesc="Supplies tools for tabulating and analyzing the results of predictive models. The methods employed are applicable to virtually any predictive model and make comparisons between different methodologies straightforward."

pkgdesc should be 80 chars, not 218

> url="https://cran.r-project.org/web/packages/${_cranname}/index.html"
> arch=('x86_64')
> license=('GPL')
> depends=('r-cran-xtable' 'r-cran-pbapply')
> optdepends=('r-cran-randomforest' 'r-cran-e1071')
> source=("https://cran.r-project.org/src/contrib/${_cranname}_${_cranver}.tar.gz")
> md5sums=('027ebdd8affce8f0effaecfcd5f5ade2')
> package() {
>   mkdir -p ${pkgdir}/usr/lib/R/library
>   cd ${srcdir}
>   R CMD INSTALL ${_cranname} -l ${pkgdir}/usr/lib/R/library
> }

This compiles source code into x86_64 ELF executable code, in the
package() step?

Also ${srcdir} without quotes will guaranteedly break on at least some
users who build from directories which contain spaces. You carefully
quote array assignments, which do *not* contain spaces (note, I'm not
saying this was the wrong decision!) then neglect to do so for the only
two variables which contain content not under your control!

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20180526/7e0e76b1/attachment.asc>

More information about the aur-general mailing list