diff options
-rw-r--r-- | dev-perl/CGI/CGI-4.220.0-r1.ebuild | 33 | ||||
-rw-r--r-- | eclass/perl-functions.eclass | 35 | ||||
-rw-r--r-- | eclass/perl-module.eclass | 294 |
3 files changed, 277 insertions, 85 deletions
diff --git a/dev-perl/CGI/CGI-4.220.0-r1.ebuild b/dev-perl/CGI/CGI-4.220.0-r1.ebuild new file mode 100644 index 00000000000..9d2500eac0a --- /dev/null +++ b/dev-perl/CGI/CGI-4.220.0-r1.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +DIST_AUTHOR=LEEJO +DIST_VERSION=4.22 +inherit perl-module + +DESCRIPTION="Simple Common Gateway Interface Class" + +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="test" + +RDEPEND=" + virtual/perl-Carp + virtual/perl-Encode + virtual/perl-Exporter + >=virtual/perl-File-Spec-0.820.0 + virtual/perl-File-Temp + >=dev-perl/HTML-Parser-3.690.0 + virtual/perl-if + >=virtual/perl-parent-0.225.0 +" +DEPEND="${RDEPEND} + virtual/perl-ExtUtils-MakeMaker + test? ( + >=virtual/perl-Test-Simple-0.980.0 + dev-perl/Test-Warn + ) +" diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass index c38ed6c4a65..75684731836 100644 --- a/eclass/perl-functions.eclass +++ b/eclass/perl-functions.eclass @@ -106,17 +106,46 @@ perl_delete_packlist() { debug-print-function $FUNCNAME "$@" perl_set_version if [[ -d ${D}/${VENDOR_ARCH} ]] ; then - find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \ - -o \( -name '*.bs' -a -empty \) \) -delete + find "${D}/${VENDOR_ARCH}" -type f -a -name .packlist -delete + perl_delete_emptybsdir + fi +} + +# @FUNCTION: perl_delete_emptybsdir +# @USAGE: perl_delete_emptybsdir +# @DESCRIPTION: +# Look through ${D} for empty .bs files and empty directories, +# and get rid of items found. +perl_delete_emptybsdir() { + debug-print-function $FUNCNAME "$@" + perl_set_version + if [[ -d ${D}/${VENDOR_ARCH} ]] ; then + find "${D}/${VENDOR_ARCH}" -type f \ + -a -name '*.bs' -a -empty -delete find "${D}" -depth -mindepth 1 -type d -empty -delete fi } +# @FUNCTION: perl_fix_packlist +# @USAGE: perl_fix_packlist +# @DESCRIPTION: +# Look through ${D} for .packlist text files containing the temporary installation +# folder (i.e. ${D}). If the pattern is found, silently replace it with `/'. +perl_fix_packlist() { + debug-print-function $FUNCNAME "$@" + + find "${D}" -type f -name '.packlist' -print0 | while read -rd '' f ; do + if file "${f}" | grep -q -i " text" ; then + sed -i -e "s:${D}:/:g" "${f}" + fi + done +} + # @FUNCTION: perl_remove_temppath # @USAGE: perl_remove_temppath # @DESCRIPTION: # Look through ${D} for text files containing the temporary installation -# folder (i.e. ${D}). If the pattern is found (i.e. " text"), replace it with `/'. +# folder (i.e. ${D}). If the pattern is found, replace it with `/' and warn. perl_remove_temppath() { debug-print-function $FUNCNAME "$@" diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass index 5a476d2a754..8b2f3a44b62 100644 --- a/eclass/perl-module.eclass +++ b/eclass/perl-module.eclass @@ -7,21 +7,42 @@ # perl@gentoo.org # @AUTHOR: # Seemant Kulleen <seemant@gentoo.org> -# Andreas K. Huettel <dilfridge@gentoo.org> -# @BLURB: eclass for perl modules +# Andreas K. Hüttel <dilfridge@gentoo.org> +# @BLURB: eclass for installing Perl module distributions # @DESCRIPTION: -# The perl-module eclass is designed to allow easier installation of perl -# modules, and their incorporation into the Gentoo Linux system. +# The perl-module eclass is designed to allow easier installation of Perl +# module distributions, and their incorporation into the Gentoo Linux system. # All exported functions from perl-functions.eclass (inherited here) # explicitly also belong to the interface of perl-module.eclass. +# If your package does not use any Perl-specific build system (as, e.g., +# ExtUtils::MakeMaker or Module::Build), we recommend to use perl-functions.eclass +# instead. -inherit eutils multiprocessing unpacker perl-functions +case ${EAPI:-0} in + 5) + inherit eutils multiprocessing unpacker perl-functions + PERL_EXPF="src_unpack src_prepare src_configure src_compile src_test src_install" + ;; + 6) + inherit multiprocessing perl-functions + PERL_EXPF="src_prepare src_configure src_compile src_test src_install" + ;; + *) + die "EAPI=${EAPI} is not supported by perl-module.eclass" + ;; +esac -PERL_EXPF="src_unpack src_prepare src_configure src_compile src_test src_install" +# @ECLASS-VARIABLE: GENTOO_DEPEND_ON_PERL +# @DESCRIPTION: +# This variable controls whether a runtime and build time dependency on +# dev-lang/perl is automatically added by the eclass. It defaults to yes. +# Set to no to disable, set to noslotop to add a perl dependency without +# slot operator (EAPI=6). All packages installing into the vendor_perl +# path must use yes here. -case "${EAPI:-0}" in +case ${EAPI:-0} in 5) - [[ ${CATEGORY} == "perl-core" ]] && \ + [[ ${CATEGORY} == perl-core ]] && \ PERL_EXPF+=" pkg_postinst pkg_postrm" case "${GENTOO_DEPEND_ON_PERL:-yes}" in @@ -37,44 +58,112 @@ case "${EAPI:-0}" in RDEPEND="${DEPEND}" ;; esac + + case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in + yes) + EXPORT_FUNCTIONS ${PERL_EXPF} + ;; + no) + debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no" + ;; + *) + die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass" + ;; + esac ;; - *) - die "EAPI=${EAPI} is not supported by perl-module.eclass" - ;; -esac + 6) + [[ ${CATEGORY} == perl-core ]] && \ + PERL_EXPF+=" pkg_postinst pkg_postrm" + + case "${GENTOO_DEPEND_ON_PERL:-yes}" in + yes) + DEPEND="dev-lang/perl:=" + RDEPEND="dev-lang/perl:=" + ;; + noslotop) + DEPEND="dev-lang/perl" + RDEPEND="dev-lang/perl" + ;; + esac + + if [[ "${GENTOO_DEPEND_ON_PERL_SUBSLOT}" ]]; then + eerror "GENTOO_DEPEND_ON_PERL_SUBSLOT is banned in EAPI=6. If you don't want a slot operator" + die "set GENTOO_DEPEND_ON_PERL=noslotop instead." + fi + + if [[ "${PERL_EXPORT_PHASE_FUNCTIONS}" ]]; then + eerror "PERL_EXPORT_PHASE_FUNCTIONS is banned in EAPI=6. Use perl-module.eclass if you need" + die "phase functions, perl-functions.eclass if not." + fi -case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in - yes) EXPORT_FUNCTIONS ${PERL_EXPF} ;; - no) - debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no" - ;; *) - die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass" + die "EAPI=${EAPI:-0} is not supported by perl-module.eclass" ;; esac LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}" -if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then - : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}} - S=${MY_S:-${WORKDIR}/${MY_P}} -fi +# @ECLASS-VARIABLE: DIST_NAME +# @DESCRIPTION: +# (EAPI=6) This variable provides a way to override PN for the calculation of S, +# SRC_URI, and HOMEPAGE. Defaults to PN. -[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \ - MODULE_A="${MY_P:-${P}}.${MODULE_A_EXT:-tar.gz}" -[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ - SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" -[[ -z "${HOMEPAGE}" ]] && \ - HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/" +# @ECLASS-VARIABLE: DIST_VERSION +# @DESCRIPTION: +# (EAPI=6) This variable provides a way to override PV for the calculation of S and SRC_URI. +# Use it to provide the non-normalized, upstream version number. Defaults to PV. +# Named MODULE_VERSION in EAPI=5. + +# @ECLASS-VARIABLE: DIST_A_EXT +# @DESCRIPTION: +# (EAPI=6) This variable provides a way to override the distfile extension for the calculation of +# SRC_URI. Defaults to tar.gz. Named MODULE_A_EXT in EAPI=5. + +# @ECLASS-VARIABLE: DIST_A +# @DESCRIPTION: +# (EAPI=6) This variable provides a way to override the distfile name for the calculation of +# SRC_URI. Defaults to ${DIST_NAME}-${DIST_VERSION}.${DIST_A_EXT} Named MODULE_A in EAPI=5. + +# @ECLASS-VARIABLE: DIST_AUTHOR +# @DESCRIPTION: +# (EAPI=6) This variable sets the module author name for the calculation of +# SRC_URI. Named MODULE_AUTHOR in EAPI=5. + +if [[ ${EAPI:-0} == 5 ]]; then + if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then + : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}} + S=${MY_S:-${WORKDIR}/${MY_P}} + fi + MODULE_NAME=${MY_PN:-${PN}} + MODULE_P=${MY_P:-${P}} + + [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \ + MODULE_A="${MODULE_P}.${MODULE_A_EXT:-tar.gz}" + [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ + SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" + [[ -z "${HOMEPAGE}" ]] && \ + HOMEPAGE="http://search.cpan.org/dist/${MODULE_NAME}/" + + SRC_TEST="skip" +else + DIST_NAME=${DIST_NAME:-${PN}} + DIST_P=${DIST_NAME}-${DIST_VERSION:-${PV}} + S=${WORKDIR}/${DIST_P} + + [[ -z "${SRC_URI}" && -z "${DIST_A}" ]] && \ + DIST_A="${DIST_P}.${DIST_A_EXT:-tar.gz}" + [[ -z "${SRC_URI}" && -n "${DIST_AUTHOR}" ]] && \ + SRC_URI="mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${DIST_SECTION:+${DIST_SECTION}/}${DIST_A}" + [[ -z "${HOMEPAGE}" ]] && \ + HOMEPAGE="http://search.cpan.org/dist/${DIST_NAME}/" +fi SRC_PREP="no" -SRC_TEST="skip" PREFER_BUILDPL="yes" pm_echovar="" -perlinfo_done=false # @FUNCTION: perl-module_src_unpack # @USAGE: perl-module_src_unpack @@ -83,7 +172,7 @@ perlinfo_done=false # This function is to be called during the ebuild src_unpack() phase. perl-module_src_unpack() { debug-print-function $FUNCNAME "$@" - + [[ ${EAPI:-0} == 5 ]] || die "perl-module_src_unpack is banned in EAPI=6 or later" unpacker_src_unpack } @@ -94,15 +183,20 @@ perl-module_src_unpack() { # This function is to be called during the ebuild src_prepare() phase. perl-module_src_prepare() { debug-print-function $FUNCNAME "$@" - [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" - debug-print "$FUNCNAME: applying user patches" - epatch_user + + if [[ ${EAPI:-0} == 5 ]] ; then + [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" + debug-print "$FUNCNAME: applying user patches" + epatch_user + else + default + fi + if [[ ${PERL_RM_FILES[@]} ]]; then debug-print "$FUNCNAME: stripping unneeded files" perl_rm_files "${PERL_RM_FILES[@]}" fi perl_fix_osx_extra - esvn_clean } # @FUNCTION: perl-module_src_configure @@ -113,7 +207,9 @@ perl-module_src_prepare() { perl-module_src_configure() { debug-print-function $FUNCNAME "$@" - [[ ${SRC_PREP} = yes ]] && return 0 + if [[ ${EAPI:-0} == 5 && ${SRC_PREP} == yes ]]; then + return 0 + fi SRC_PREP="yes" perl_check_env @@ -134,29 +230,21 @@ perl-module_src_configure() { if grep -q '\(use\|require\)\s*Module::Build::Tiny' Build.PL ; then einfo "Using Module::Build::Tiny" if [[ ${DEPEND} != *dev-perl/Module-Build-Tiny* && ${PN} != Module-Build-Tiny ]]; then - eqawarn "QA Notice: The ebuild uses Module::Build::Tiny but doesn't depend on it." - eqawarn " Add dev-perl/Module-Build-Tiny to DEPEND!" - if [[ -n ${PERLQAFATAL} ]]; then - eerror "Bailing out due to PERLQAFATAL=1"; - die - fi + eerror "QA Notice: The ebuild uses Module::Build::Tiny but doesn't depend on it." + die " Add dev-perl/Module-Build-Tiny to DEPEND!" fi else einfo "Using Module::Build" if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${DEPEND} != *dev-perl/Module-Build* && ${PN} != Module-Build ]] ; then - eqawarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it." - eqawarn " Add dev-perl/Module-Build to DEPEND!" - if [[ -n ${PERLQAFATAL} ]]; then - eerror "Bailing out due to PERLQAFATAL=1"; - die - fi + eerror "QA Notice: The ebuild uses Module::Build but doesn't depend on it." + die " Add dev-perl/Module-Build to DEPEND!" fi fi set -- \ --installdirs=vendor \ --libdoc= \ --destdir="${D}" \ - --create_packlist=0 \ + --create_packlist=1 \ "${myconf_local[@]}" einfo "perl Build.PL" "$@" perl Build.PL "$@" <<< "${pm_echovar}" \ @@ -208,42 +296,81 @@ perl-module_src_compile() { fi } +# @ECLASS-VARIABLE: DIST_TEST +# @DESCRIPTION: +# (EAPI=6) Variable that controls if tests are run in the test phase +# at all, and if yes under which conditions. Defaults to "do parallel" +# If neither "do" nor "parallel" is recognized, tests are skipped. +# (In EAPI=5 the variable is called SRC_TEST, defaults to "skip", and +# recognizes fewer options.) +# The following space-separated keywords are recognized: +# do : run tests +# parallel : run tests in parallel +# verbose : increase test verbosity +# network : do not try to disable network tests + +# @ECLASS-VARIABLE: DIST_TEST_OVERRIDE +# @DESCRIPTION: +# (EAPI=6) Variable that controls if tests are run in the test phase +# at all, and if yes under which conditions. It is intended for use in +# make.conf or the environment by ebuild authors during testing, and +# accepts the same values as DIST_TEST. If set, it overrides DIST_TEST +# completely. DO NOT USE THIS IN EBUILDS! + # @FUNCTION: perl-module_src-test # @USAGE: perl-module_src_test() # @DESCRIPTION: -# 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/portage/make.conf | ENV -# -# or 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 -# +# This code attempts to work out your threadingness and runs tests +# according to the settings of DIST_TEST using Test::Harness. perl-module_src_test() { debug-print-function $FUNCNAME "$@" - if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then - if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then + local my_test_control + local my_test_verbose + + if [[ ${EAPI:-0} == 5 ]] ; then + my_test_control=${SRC_TEST} + my_test_verbose=${TEST_VERBOSE:-0} + if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then + if has "${my_test_verbose}" 0 && has 'parallel' ${my_test_control} ; then + export HARNESS_OPTIONS=j$(makeopts_jobs) + einfo "Test::Harness Jobs=$(makeopts_jobs)" + fi + else + einfo Skipping tests due to SRC_TEST=${SRC_TEST} + return 0 + fi + else + [[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE} + my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} + + if ! has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then + einfo Skipping tests due to DIST_TEST=${my_test_control} + return 0 + fi + + if has verbose ${my_test_control} ; then + my_test_verbose=1 + else + my_test_verbose=0 + fi + + if has parallel ${my_test_control} ; then export HARNESS_OPTIONS=j$(makeopts_jobs) einfo "Test::Harness Jobs=$(makeopts_jobs)" fi - ${perlinfo_done} || perl_set_version - if [[ -f Build ]] ; then - ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" - elif [[ -f Makefile ]] ; then - emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" + + # this might sometimes work... + if ! has network ${my_test_control} ; then + export NO_NETWORK_TESTING=1 fi fi + + perl_set_version + if [[ -f Build ]] ; then + ./Build test verbose=${my_test_verbose} || die "test failed" + elif [[ -f Makefile ]] ; then + emake test TEST_VERBOSE=${my_test_verbose} || die "test failed" + fi } # @FUNCTION: perl-module_src_install @@ -280,7 +407,12 @@ perl-module_src_install() { perl_delete_module_manpages perl_delete_localpod - perl_delete_packlist + if [[ ${EAPI:-0} == 5 ]] ; then + perl_delete_packlist + else + perl_fix_packlist + perl_delete_emptybsdir + fi perl_remove_temppath for f in Change* CHANGES README* TODO FAQ ${mydoc}; do @@ -300,9 +432,8 @@ perl-module_src_install() { perl-module_pkg_postinst() { debug-print-function $FUNCNAME "$@" if [[ ${CATEGORY} != perl-core ]] ; then - eqawarn "perl-module.eclass: You are calling perl-module_pkg_postinst outside the perl-core category." - eqawarn " This does not do anything; the call can be safely removed." - return 0 + eerror "perl-module.eclass: You are calling perl-module_pkg_postinst outside the perl-core category." + die " This does not do anything; the call can be removed." fi perl_link_duallife_scripts } @@ -317,9 +448,8 @@ perl-module_pkg_postinst() { perl-module_pkg_postrm() { debug-print-function $FUNCNAME "$@" if [[ ${CATEGORY} != perl-core ]] ; then - eqawarn "perl-module.eclass: You are calling perl-module_pkg_postrm outside the perl-core category." - eqawarn " This does not do anything; the call can be safely removed." - return 0 + eerror "perl-module.eclass: You are calling perl-module_pkg_postrm outside the perl-core category." + die " This does not do anything; the call can be removed." fi perl_link_duallife_scripts } |