commit:     49ec79fcc3863ca26369ceb1ded509c0cdc36165
Author:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
AuthorDate: Tue Dec 23 17:50:54 2014 +0000
Commit:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
CommitDate: Tue Dec 23 18:01:25 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=49ec79fc

perl-module.eclass: Unify Module::Build and MBTiny logic with --pure parameter, 
improving QA checks in the process

---
 eclass/perl-module.eclass | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
index 70f7d0f..593a030 100644
--- a/eclass/perl-module.eclass
+++ b/eclass/perl-module.eclass
@@ -145,11 +145,20 @@ perl-module_src_configure() {
        fi
 
        if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL 
]] ; then
-               einfo "Using Module::Build"
-               if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != 
Module-Build ]] ; then
-                       eqawarn "QA Notice: The ebuild uses Module::Build but 
doesn't depend on it."
-                       eqawarn "           Add virtual/perl-Module-Build to 
DEPEND!"
-                       perl_qafatal "modulebuild"
+               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!"
+                               perl_qafatal "modulebuildtiny"
+                       fi
+               else
+                       einfo "Using Module::Build"
+                       if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} 
!= Module-Build ]] ; then
+                               eqawarn "QA Notice: The ebuild uses 
Module::Build but doesn't depend on it."
+                               eqawarn "           Add 
virtual/perl-Module-Build to DEPEND!"
+                               perl_qafatal "modulebuild"
+                       fi
                fi
                set -- \
                        --installdirs=vendor \
@@ -317,23 +326,22 @@ perl-module_src_install() {
 
        local f
 
-       if [[ -z ${mytargets} ]] ; then
+       if [[ -f Build ]]; then
+               mytargets="${mytargets:-install}"
+               mbparams="${mbparams:---pure}"
+               einfo "./Build ${mytargets} ${mbparams}"
+               ./Build ${mytargets} ${mbparams} \
+                       || die "./Build ${mytargets} ${mbparams} failed"
+       elif [[ -f Makefile ]]; then
                case "${CATEGORY}" in
                        dev-perl|perl-core) mytargets="pure_install" ;;
                        *)                  mytargets="install" ;;
                esac
-       fi
-
-       if [[ $(declare -p myinst 2>&-) != "declare -a myinst="* ]]; then
-               local myinst_local=(${myinst})
-       else
-               local myinst_local=("${myinst[@]}")
-       fi
-
-       if [[ -f Build ]] ; then
-               ./Build ${mytargets} \
-                       || die "./Build ${mytargets} failed"
-       elif [[ -f Makefile ]] ; then
+               if [[ $(declare -p myinst 2>&-) != "declare -a myinst="* ]]; 
then
+                       local myinst_local=(${myinst})
+               else
+                       local myinst_local=("${myinst[@]}")
+               fi
                emake "${myinst_local[@]}" ${mytargets} \
                        || die "emake ${myinst_local[@]} ${mytargets} failed"
        fi

Reply via email to