|
| 1 | +# Copyright 1999-2020 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=6 |
| 5 | + |
| 6 | +DIST_AUTHOR=SHAY |
| 7 | +DIST_VERSION=1.42 |
| 8 | +inherit depend.apache perl-module |
| 9 | + |
| 10 | +DESCRIPTION="Test.pm wrapper with helpers for testing Apache" |
| 11 | + |
| 12 | +LICENSE="Apache-2.0" |
| 13 | +SLOT="0" |
| 14 | +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" |
| 15 | +IUSE="test" |
| 16 | +RESTRICT="!test? ( test )" |
| 17 | + |
| 18 | +DEPEND="virtual/perl-ExtUtils-MakeMaker" |
| 19 | + |
| 20 | +need_apache |
| 21 | + |
| 22 | +PATCHES=( |
| 23 | + "${FILESDIR}/${PN}-1.400.0-catfile-import.patch" |
| 24 | + "${FILESDIR}/${PN}-1.400.0-phpclient.patch" |
| 25 | +) |
| 26 | + |
| 27 | +pkg_setup() { |
| 28 | + perl_set_version |
| 29 | +} |
| 30 | + |
| 31 | +src_install() { |
| 32 | + # This is to avoid conflicts with a deprecated Apache::Test stepping |
| 33 | + # in and causing problems/install errors |
| 34 | + if [ -f "${S}"/.mypacklist ]; |
| 35 | + then |
| 36 | + rm -f "${S}"/.mypacklist |
| 37 | + fi |
| 38 | + perl-module_src_install |
| 39 | +} |
| 40 | +# Parallel tests seem to be bad. |
| 41 | +DIST_TEST="do" |
| 42 | + |
| 43 | +optdep_notice() { |
| 44 | + local i |
| 45 | + elog "This package has several modules which may require additional dependencies" |
| 46 | + elog "to use. However, it is up to you to install them separately if you need this" |
| 47 | + elog "optional functionality:" |
| 48 | + elog |
| 49 | + i="$(if has_version 'www-apache/mod_perl'; then echo '[I]'; else echo '[ ]'; fi)" |
| 50 | + elog " $i www-apache/mod_perl" |
| 51 | + elog " - Running Perl code natively in Apache via" |
| 52 | + elog " Apache::TestHandler, Apache::TestReportPerl, or Apache::TestSmokePerl" |
| 53 | + |
| 54 | + if use test; then |
| 55 | + elog |
| 56 | + elog "This module will perform additional tests if these dependencies are" |
| 57 | + elog "pre-installed" |
| 58 | + fi |
| 59 | +} |
| 60 | +src_test() { |
| 61 | + optdep_notice |
| 62 | + echo |
| 63 | + local MODULES=( |
| 64 | + "Apache::Test ${DIST_VERSION}" |
| 65 | + "Apache::Test5005compat 0.01" |
| 66 | + "Apache::TestBuild" |
| 67 | + "Apache::TestClient" |
| 68 | + "Apache::TestCommon" |
| 69 | + "Apache::TestCommonPost" |
| 70 | + "Apache::TestConfig" |
| 71 | + "Apache::TestConfigC" |
| 72 | + "Apache::TestConfigPHP" |
| 73 | + "Apache::TestConfigParrot" |
| 74 | + "Apache::TestConfigParse" |
| 75 | + "Apache::TestConfigPerl" |
| 76 | + "Apache::TestHarness" |
| 77 | + "Apache::TestHarnessPHP" |
| 78 | + "Apache::TestMB" |
| 79 | + "Apache::TestMM" |
| 80 | + "Apache::TestPerlDB" |
| 81 | + "Apache::TestReport" |
| 82 | + "Apache::TestRequest" |
| 83 | + "Apache::TestRun" |
| 84 | + "Apache::TestRunPHP 1.00" |
| 85 | + "Apache::TestRunParrot 1.00" |
| 86 | + "Apache::TestRunPerl 1.00" |
| 87 | + "Apache::TestSSLCA" |
| 88 | + "Apache::TestServer" |
| 89 | + "Apache::TestSmoke" |
| 90 | + "Apache::TestSort" |
| 91 | + "Apache::TestTrace 0.01" |
| 92 | + "Apache::TestUtil 0.02" |
| 93 | + "Bundle::ApacheTest ${DISTVERSION}" |
| 94 | + ) |
| 95 | + has_version "www-apache/mod_perl" && MODULES+=( |
| 96 | + "Apache::TestHandler" |
| 97 | + "Apache::TestReportPerl" |
| 98 | + "Apache::TestSmokePerl" |
| 99 | + ) |
| 100 | + local failed=() |
| 101 | + for dep in "${MODULES[@]}"; do |
| 102 | + ebegin "Compile testing ${dep}" |
| 103 | + perl -Mblib="${S}" -M"${dep} ()" -e1 |
| 104 | + eend $? || failed+=( "$dep" ) |
| 105 | + done |
| 106 | + if [[ ${failed[@]} ]]; then |
| 107 | + echo |
| 108 | + eerror "One or more modules failed compile:"; |
| 109 | + for dep in "${failed[@]}"; do |
| 110 | + eerror " ${dep}" |
| 111 | + done |
| 112 | + die "Failing due to module compilation errors"; |
| 113 | + fi |
| 114 | + perl_rm_files t/more/02testmore.t t/more/04testmore.t |
| 115 | + perl-module_src_test |
| 116 | +} |
| 117 | +pkg_postinst() { |
| 118 | + use test || optdep_notice |
| 119 | +} |
0 commit comments