From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1MpRBQ-0000gs-DW for garchives@archives.gentoo.org; Sun, 20 Sep 2009 18:30:48 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 004BAE06B0; Sun, 20 Sep 2009 18:30:47 +0000 (UTC) Received: from smtprelay09.ispgateway.de (smtprelay09.ispgateway.de [80.67.31.43]) by pigeon.gentoo.org (Postfix) with ESMTP id A8F42E06B0 for ; Sun, 20 Sep 2009 18:30:46 +0000 (UTC) Received: from [80.134.77.175] (helo=bullet.localdomain) by smtprelay09.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MpRDv-000278-Jj for gentoo-dev@lists.gentoo.org; Sun, 20 Sep 2009 20:33:23 +0200 Received: by bullet.localdomain (Postfix, from userid 1000) id 3665119568; Sun, 20 Sep 2009 20:28:54 +0200 (CEST) Date: Sun, 20 Sep 2009 20:28:54 +0200 From: Torsten Veller To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] perl-module.class review Message-ID: <20090920202135.TAde89f.tv@veller.net> Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <20090920182031.GA2962@veller.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090920182031.GA2962@veller.net> X-Face: ===_______=8)_=8)_______A_very_very_nice_face_______=8)_=8)_______=== Jabber-ID: tove@jabber.ccc.de X-PGP-Fingerprint: 0416 3C11 8D79 65B9 AAD0 2065 BBC7 14D1 9C67 CD96 User-Agent: Mutt/1.5.20 (2009-08-17) X-Df-Sender: 1067115 X-Archives-Salt: b7dbba40-465a-411b-819a-d12fef96d98e X-Archives-Hash: a14652b5de0e725519eafdc0d411b6a0 Attached is a diff of the current and the prospective perl-module.class. Please review. Thanks. --- perl-module.eclass +++ perl-module.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.116 2009/03/29 17:32:31 tove Exp $ # @@ -13,13 +13,18 @@ # modules, and their incorporation into the Gentoo Linux system. inherit eutils base +[[ ${CATEGORY} == "perl-core" ]] && inherit alternatives + +EXPORTED_FUNCTIONS="src_unpack src_compile src_test src_install" case "${EAPI:-0}" in 0|1) - EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack + EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm" ;; 2) - EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install + EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" + [[ ${CATEGORY} == "perl-core" ]] && \ + EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} pkg_postinst pkg_postrm" case "${GENTOO_DEPEND_ON_PERL:-yes}" in yes) @@ -30,6 +35,8 @@ ;; esac +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} + DESCRIPTION="Based on the $ECLASS eclass" LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}" @@ -56,7 +63,7 @@ perl-module_src_unpack() { base_src_unpack unpack - has "${EAPI:-0}" 0 1 && perl-module_src_prepare + has src_prepare ${EXPORTED_FUNCTIONS} || perl-module_src_prepare } perl-module_src_prepare() { @@ -110,7 +117,7 @@ perl-module_src_compile() { ${perlinfo_done} || perlinfo - has "${EAPI:-0}" 0 1 && perl-module_src_prep + has src_configure ${EXPORTED_FUNCTIONS} || perl-module_src_prep if [[ -f Build ]] ; then ./Build build \ @@ -124,13 +131,38 @@ fi } +# For testers: +# This code attempts to work out your threadingness from MAKEOPTS +# and apply them to Test::Harness. +# +# If you want more verbose testing, set TEST_VERBOSE=1 +# in your bashrc | /etc/make.conf | ENV +# +# For ebuild writers: +# If you wish to enable default tests w/ 'make test' , +# +# SRC_TEST="do" +# +# If you wish to have threads run in parallel ( using the users makeopts ) +# all of the following have been tested to work. +# +# SRC_TEST="do parallel" +# SRC_TEST="parallel" +# SRC_TEST="parallel do" +# SRC_TEST=parallel +# + perl-module_src_test() { - if [[ "${SRC_TEST}" == "do" ]] ; then + if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then + if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then + export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" ) + einfo "Test::Harness Jobs=${HARNESS_OPTIONS}" + fi ${perlinfo_done} || perlinfo if [[ -f Build ]] ; then - ./Build test || die "test failed" + ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" elif [[ -f Makefile ]] ; then - emake test || die "test failed" + emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" fi fi } @@ -162,7 +194,7 @@ fixlocalpod - for f in Change* CHANGES README* ${mydoc}; do + for f in Change* CHANGES README* TODO ${mydoc}; do [[ -s "${f}" ]] && dodoc ${f} done @@ -174,10 +206,12 @@ find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do if file "${f}" | grep -q -i " text" ; then -if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi + grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}" sed -i -e "s:${D}:/:g" "${f}" fi done + + linkduallifescripts } perl-module_pkg_setup() { @@ -188,20 +222,21 @@ ${perlinfo_done} || perlinfo } -perl-module_pkg_postinst() { : ; } -# einfo "Man pages are not installed for most modules now." -# einfo "Please use perldoc instead." -#} +perl-module_pkg_postinst() { + linkduallifescripts +} -perl-module_pkg_prerm() { : ; } +perl-module_pkg_postrm() { + linkduallifescripts +} -perl-module_pkg_postrm() { : ; } +perl-module_pkg_prerm() { : ; } perlinfo() { perlinfo_done=true - local f version install{site{arch,lib},archlib,vendor{arch,lib}} - for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do + local f version install{{site,vendor}{arch,lib},archlib} + for f in version install{{site,vendor}{arch,lib},archlib} ; do eval "$(perl -V:${f} )" done PERL_VERSION=${version} @@ -216,3 +251,29 @@ find "${D}" -type f -name perllocal.pod -delete find "${D}" -depth -mindepth 1 -type d -empty -delete } + +linkduallifescripts() { + if [[ ${CATEGORY} != "perl-core" ]] || ! has_version ">=dev-lang/perl-5.10.1" ; then + return 0 + fi + + local i ff + if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then + for i in "${DUALLIFESCRIPTS[@]}" ; do + alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*" + ff=`echo "${ROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*` + ff=${ff##*.1} + alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*" + done + else + pushd "${D}" > /dev/null + for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do + mv ${i}{,-${PV}-${P}} || die + DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/} + if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then + mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die + fi + done + popd > /dev/null + fi +}