From 632562820965f4181b281852b7b4943c6fbdbf1a Mon Sep 17 00:00:00 2001 From: Robert Greener Date: Wed, 6 Jul 2022 13:21:40 +0100 Subject: [PATCH] eclass/R-packages: Add CRAN_PN variable This can be overridden in the ebuilds, but if its not defined it is the package name with _ substituted with periods. This maintains the existing behaviour. Signed-off-by: Robert Greener --- eclass/R-packages.eclass | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eclass/R-packages.eclass b/eclass/R-packages.eclass index 982920f437..1665203d19 100644 --- a/eclass/R-packages.eclass +++ b/eclass/R-packages.eclass @@ -22,9 +22,10 @@ esac EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_postinst CRAN_PV=${CRAN_PV:-$PV} +CRAN_PN=${CRAN_PN:-${PN//_/.}} -SRC_URI="mirror://cran/src/contrib/${PN}_${CRAN_PV}.tar.gz" -HOMEPAGE="https://cran.r-project.org/package=${PN}" +SRC_URI="mirror://cran/src/contrib/${CRAN_PN}_${CRAN_PV}.tar.gz" +HOMEPAGE="https://cran.r-project.org/package=${CRAN_PN}" SLOT="0" @@ -50,8 +51,8 @@ _movelink() { # function to unpack R packages into the right folder R-packages_src_unpack() { unpack ${A} - if [[ -d "${PN//_/.}" ]] && [[ ! -d "${P}" ]]; then - mv "${PN//_/.}" "${P}" || die + if [[ -d "${CRAN_PN}" ]] && [[ ! -d "${P}" ]]; then + mv "${CRAN_PN}" "${P}" || die fi } @@ -101,7 +102,7 @@ R-packages_src_compile() { # documentation and examples to docsdir, symlinked back to R site-library (to allow access from within R) # everything else to R site-library R-packages_src_install() { - pushd "${T}/R/${PN//_/.}" || die + pushd "${T}/R/${CRAN_PN}" || die local DOCS_DIR="/usr/share/doc/${PF}" @@ -132,7 +133,7 @@ R-packages_src_install() { rm -rf tests test || die insinto "/usr/$(get_libdir)/R/site-library" - doins -r "${T}/R/${PN//_/.}" + doins -r "${T}/R/${CRAN_PN}" } # @FUNCTION: R-packages_pkg_postinst