Discussion:
[gentoo-science] Re: new eclass to install R modules, such as Rcpp.
Benda Xu
2018-01-13 04:06:37 UTC
Permalink
Hi Marco,

Let's move the discussion to the gentoo-science public mailing list.

Replied below.
In gentoo there is no way to install R modules, such as Rcpp
http://rcpp.org.
I think it should be easy to prepare an ebuild to do the trick.
perhaps, the best way should be to have a specific eclass.
The following lines may be sufficent to prepare a basic Rutils.eclass
...
cloc3Lnv ~ # cat /usr/local/portage/eclass/Rutils.eclass |grep -v ^#|grep -v ^$
EXPORT_FUNCTIONS src_unpack src_compile src_install
DEPEND="dev-lang/R"
Rutils_src_unpack() {
mkdir -p "$S"
}
Rutils_src_compile() {
CMD="install.packages(pkgs='${PN}',repos='${CRAN_REPO_URI}', lib='${S}')"
/usr/bin/R -q -e "$CMD"
}
Rutils_src_install() {
R_LIBRARY="${ED}/usr/lib/R/library"
mkdir -p "$R_LIBRARY"
mv "${PN}" "${R_LIBRARY}"
}
...
...
cloc3Lnv ~ # cat /usr/local/portage/sci-misc/Rcpp/Rcpp-9999.ebuild
|grep -v ^#|grep -v ^$
EAPI=6
inherit Rutils
DESCRIPTION="Seamless R and C++ Integration"
HOMEPAGE="http://rcpp.org"
SRC_URI=""
CRAN_REPO_URI="https://ftp.gwdg.de/pub/misc/cran"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="
"
RDEPEND="${CDEPEND}
"
Please consider the opportunity to add a Rutils.eclass to portage.
Thanks for the suggestion! That's what we are doing in R_Overlay,

https://wiki.gentoo.org/wiki/Project:Science/Overlay

It is available via layman. It has an eclass very similar to your
proposal.

https://github.com/gentoo-mirror/R_Overlay/blob/master/eclass/R-packages.eclass

The R_Overlay is automatically generated from CRAN and BIOC.

Cheers,
Benda
Benda Xu
2018-01-16 07:53:16 UTC
Permalink
Hi Marco,
wonderfull.
your eclass is surely better than mine, but I found a little difference.
your ebuilds for R packages need a specific SRC_URI, while mine eclass
finds automatically the current version of the package by itself.
It looks like your eclass is downloading from CRAN in
Rutils_src_compile(). For the sake of reproducible builds, ebuilds
should use local files during the build:

https://devmanual.gentoo.org/ebuild-writing/functions/index.html

Is it possible to instruct R install.package() to "fetch only", or
"print download URL"?
I don't know if this is a good or a bad feature, but I think may it be
usefull to implement a -9999.ebuild version of the package.
The -9999.ebuild has a special meaning of 'live' ebuild that the source
is a version-controlled repository. The devmanual discuss the cvs case:

https://devmanual.gentoo.org/ebuild-writing/functions/src_unpack/cvs-sources/index.html#disadvantages-of-cvs-sources

CRAN is not a version-controlled repository. It's packages are
versioned and released. Therefore I prefer creating versioned ebuilds
to the live ones.


Thanks for your eclass, it is a very neat write-up.

Yours,
Benda

Loading...