commit: 5778e18ce802eadc134be8da814893287fd06d8c Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> AuthorDate: Wed May 11 10:18:19 2022 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> CommitDate: Wed May 11 11:29:17 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5778e18c
octaveforge.eclass: add octaveforge_src_test() Closes: https://bugs.gentoo.org/843536 Closes: https://bugs.gentoo.org/843521 Closes: https://bugs.gentoo.org/843518 Closes: https://bugs.gentoo.org/843515 Closes: https://bugs.gentoo.org/843512 Closes: https://bugs.gentoo.org/843509 Closes: https://bugs.gentoo.org/843503 Closes: https://bugs.gentoo.org/843500 Closes: https://bugs.gentoo.org/843497 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com> eclass/octaveforge.eclass | 125 +++++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/eclass/octaveforge.eclass b/eclass/octaveforge.eclass index fb708e3a7..bb6176be9 100644 --- a/eclass/octaveforge.eclass +++ b/eclass/octaveforge.eclass @@ -17,7 +17,7 @@ case ${EAPI} in *) die "${ECLASS}: EAPI ${EAPI} unsupported." esac -EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_prerm pkg_postrm +EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install src_test pkg_postinst pkg_prerm pkg_postrm # @ECLASS-VARIABLE: REPO_URI # @DESCRIPTION: @@ -103,65 +103,21 @@ octaveforge_src_compile() { # @FUNCTION: octaveforge_src_install # @DESCRIPTION: # function to install the octave package -# documentation to docsdir octaveforge_src_install() { - TMPDIR="${T}" - DESTDIR="${D}" - DISTPKG='Gentoo' + DESTDIR="${D}" _octaveforge_pkg_install || die +} - pushd ../ || die - if [[ "X${DISTPKG}X" != "XX" ]]; then - stripcmd=" - unlink(pkg('local_list')); - unlink(pkg('global_list')); - " - fi - if [[ "X${DESTDIR}X" = "XX" ]]; then - cmd=" - warning('off','all'); - pkg('install','${OCT_PACKAGE}'); - l=pkg('list'); - disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir); - ${stripcmd} - " - oct_pkgdir=$(octavecommand "${cmd}" || die) - else - cmd="disp(fullfile(__octave_config_info__('datadir'),'octave'));" - shareprefix=${DESTDIR}/$(octavecommand "${cmd}" || die) - cmd="disp(fullfile(__octave_config_info__('libdir'),'octave'));" - libprefix=${DESTDIR}/$(octavecommand "${cmd}" || die) - octprefix="${shareprefix}/packages" || die - archprefix="${libprefix}/packages" || die - if [[ ! -e "${octprefix}" ]]; then - mkdir -p "${octprefix}" || die - fi - if [[ ! -e "${archprefix}" ]]; then - mkdir -p "${archprefix}" || die - fi - cmd=" - warning('off','all'); - pkg('prefix','${octprefix}','${archprefix}'); - pkg('global_list',fullfile('${shareprefix}','octave_packages')); - pkg('local_list',fullfile('${shareprefix}','octave_packages')); - pkg('install','-nodeps','-verbose','${OCT_PACKAGE}'); - " - octavecommand "${cmd}" || die - cmd=" - warning('off','all'); - pkg('prefix','${octprefix}','${archprefix}'); - pkg('global_list',fullfile('${shareprefix}','octave_packages')); - pkg('local_list',fullfile('${shareprefix}','octave_packages')); - l=pkg('list'); - disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir); - ${stripcmd} - " - oct_pkgdir=$(octavecommand "${cmd}" || die) - fi - export oct_pkgdir +octaveforge_src_test() { + DESTDIR="${T}" _octaveforge_pkg_install || die - if [[ -d doc/ ]]; then - dodoc -r doc/* - fi + # cargo culted from Fedora + cmd=" + pkg('load','${PN}'); + oruntests('${oct_pkgdir}'); + unlink(pkg('local_list')); + unlink(pkg('global_list')); + " + octavecommand "${cmd}" || die 'failed testing' } # @FUNCTION: octaveforge_pkg_postinst @@ -226,3 +182,58 @@ fi EOF chmod 0755 "configure" || die } + +_octaveforge_pkg_install() { + TMPDIR="${T}" + DISTPKG='Gentoo' + + pushd ../ || die + if [[ "X${DISTPKG}X" != "XX" ]]; then + stripcmd=" + unlink(pkg('local_list')); + unlink(pkg('global_list')); + " + fi + if [[ "X${DESTDIR}X" = "XX" ]]; then + cmd=" + warning('off','all'); + pkg('install','${OCT_PACKAGE}'); + l=pkg('list'); + disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir); + ${stripcmd} + " + oct_pkgdir=$(octavecommand "${cmd}" || die) + else + cmd="disp(fullfile(__octave_config_info__('datadir'),'octave'));" + shareprefix=${DESTDIR}/$(octavecommand "${cmd}" || die) + cmd="disp(fullfile(__octave_config_info__('libdir'),'octave'));" + libprefix=${DESTDIR}/$(octavecommand "${cmd}" || die) + octprefix="${shareprefix}/packages" || die + archprefix="${libprefix}/packages" || die + if [[ ! -e "${octprefix}" ]]; then + mkdir -p "${octprefix}" || die + fi + if [[ ! -e "${archprefix}" ]]; then + mkdir -p "${archprefix}" || die + fi + cmd=" + warning('off','all'); + pkg('prefix','${octprefix}','${archprefix}'); + pkg('global_list',fullfile('${shareprefix}','octave_packages')); + pkg('local_list',fullfile('${shareprefix}','octave_packages')); + pkg('install','-nodeps','-verbose','${OCT_PACKAGE}'); + " + octavecommand "${cmd}" || die + cmd=" + warning('off','all'); + pkg('prefix','${octprefix}','${archprefix}'); + pkg('global_list',fullfile('${shareprefix}','octave_packages')); + pkg('local_list',fullfile('${shareprefix}','octave_packages')); + l=pkg('list'); + disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir); + ${stripcmd} + " + oct_pkgdir=$(octavecommand "${cmd}" || die) + fi + export oct_pkgdir +}
