Gentoo Archives: gentoo-commits

From: "Torsten Veller (tove)" <tove@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: perl-module.eclass
Date: Sun, 27 Sep 2009 07:00:35
Message-Id: E1MrnkH-0000kP-6N@stork.gentoo.org
1 tove 09/09/27 07:00:33
2
3 Modified: perl-module.eclass
4 Log:
5 Uses alternatives.eclass for dual life scripts, SRC_TEST=parallel for parallel testing and TEST_VERBOSE=1 to show details of test execution
6
7 Revision Changes Path
8 1.117 eclass/perl-module.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/perl-module.eclass?rev=1.117&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/perl-module.eclass?rev=1.117&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/perl-module.eclass?r1=1.116&r2=1.117
13
14 Index: perl-module.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v
17 retrieving revision 1.116
18 retrieving revision 1.117
19 diff -u -r1.116 -r1.117
20 --- perl-module.eclass 29 Mar 2009 17:32:31 -0000 1.116
21 +++ perl-module.eclass 27 Sep 2009 07:00:32 -0000 1.117
22 @@ -1,6 +1,6 @@
23 -# Copyright 1999-2004 Gentoo Foundation
24 +# Copyright 1999-2009 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.116 2009/03/29 17:32:31 tove Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.117 2009/09/27 07:00:32 tove Exp $
28 #
29 # Author: Seemant Kulleen <seemant@g.o>
30
31 @@ -13,13 +13,18 @@
32 # modules, and their incorporation into the Gentoo Linux system.
33
34 inherit eutils base
35 +[[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
36 +
37 +PERL_EXPF="src_unpack src_compile src_test src_install"
38
39 case "${EAPI:-0}" in
40 0|1)
41 - EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
42 + PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
43 ;;
44 2)
45 - EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
46 + PERL_EXPF="${PERL_EXPF} src_prepare src_configure"
47 + [[ ${CATEGORY} == "perl-core" ]] && \
48 + PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm"
49
50 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
51 yes)
52 @@ -30,6 +35,8 @@
53 ;;
54 esac
55
56 +EXPORT_FUNCTIONS ${PERL_EXPF}
57 +
58 DESCRIPTION="Based on the $ECLASS eclass"
59
60 LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}"
61 @@ -56,7 +63,7 @@
62
63 perl-module_src_unpack() {
64 base_src_unpack unpack
65 - has "${EAPI:-0}" 0 1 && perl-module_src_prepare
66 + has src_prepare ${PERL_EXPF} || perl-module_src_prepare
67 }
68
69 perl-module_src_prepare() {
70 @@ -71,7 +78,7 @@
71 }
72
73 perl-module_src_prep() {
74 - [[ "${SRC_PREP}" = "yes" ]] && return 0
75 + [[ ${SRC_PREP} = yes ]] && return 0
76 SRC_PREP="yes"
77
78 ${perlinfo_done} || perlinfo
79 @@ -80,7 +87,7 @@
80 # Disable ExtUtils::AutoInstall from prompting
81 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
82
83 - if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then
84 + if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
85 einfo "Using Module::Build"
86 perl Build.PL \
87 --installdirs=vendor \
88 @@ -110,7 +117,7 @@
89 perl-module_src_compile() {
90 ${perlinfo_done} || perlinfo
91
92 - has "${EAPI:-0}" 0 1 && perl-module_src_prep
93 + has src_configure ${PERL_EXPF} || perl-module_src_prep
94
95 if [[ -f Build ]] ; then
96 ./Build build \
97 @@ -124,13 +131,38 @@
98 fi
99 }
100
101 +# For testers:
102 +# This code attempts to work out your threadingness from MAKEOPTS
103 +# and apply them to Test::Harness.
104 +#
105 +# If you want more verbose testing, set TEST_VERBOSE=1
106 +# in your bashrc | /etc/make.conf | ENV
107 +#
108 +# For ebuild writers:
109 +# If you wish to enable default tests w/ 'make test' ,
110 +#
111 +# SRC_TEST="do"
112 +#
113 +# If you wish to have threads run in parallel ( using the users makeopts )
114 +# all of the following have been tested to work.
115 +#
116 +# SRC_TEST="do parallel"
117 +# SRC_TEST="parallel"
118 +# SRC_TEST="parallel do"
119 +# SRC_TEST=parallel
120 +#
121 +
122 perl-module_src_test() {
123 - if [[ "${SRC_TEST}" == "do" ]] ; then
124 + if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
125 + if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
126 + export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
127 + einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
128 + fi
129 ${perlinfo_done} || perlinfo
130 if [[ -f Build ]] ; then
131 - ./Build test || die "test failed"
132 + ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
133 elif [[ -f Makefile ]] ; then
134 - emake test || die "test failed"
135 + emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
136 fi
137 fi
138 }
139 @@ -162,11 +194,11 @@
140
141 fixlocalpod
142
143 - for f in Change* CHANGES README* ${mydoc}; do
144 - [[ -s "${f}" ]] && dodoc ${f}
145 + for f in Change* CHANGES README* TODO ${mydoc}; do
146 + [[ -s ${f} ]] && dodoc ${f}
147 done
148
149 - if [[ -d "${D}/${VENDOR_LIB}" ]] ; then
150 + if [[ -d ${D}/${VENDOR_LIB} ]] ; then
151 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
152 -o \( -name '*.bs' -a -empty \) \) -delete
153 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
154 @@ -174,10 +206,12 @@
155
156 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
157 if file "${f}" | grep -q -i " text" ; then
158 -if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi
159 + grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
160 sed -i -e "s:${D}:/:g" "${f}"
161 fi
162 done
163 +
164 + linkduallifescripts
165 }
166
167 perl-module_pkg_setup() {
168 @@ -188,20 +222,21 @@
169 ${perlinfo_done} || perlinfo
170 }
171
172 -perl-module_pkg_postinst() { : ; }
173 -# einfo "Man pages are not installed for most modules now."
174 -# einfo "Please use perldoc instead."
175 -#}
176 +perl-module_pkg_postinst() {
177 + linkduallifescripts
178 +}
179
180 perl-module_pkg_prerm() { : ; }
181
182 -perl-module_pkg_postrm() { : ; }
183 +perl-module_pkg_postrm() {
184 + linkduallifescripts
185 +}
186
187 perlinfo() {
188 perlinfo_done=true
189
190 - local f version install{site{arch,lib},archlib,vendor{arch,lib}}
191 - for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do
192 + local f version install{{site,vendor}{arch,lib},archlib}
193 + for f in version install{{site,vendor}{arch,lib},archlib} ; do
194 eval "$(perl -V:${f} )"
195 done
196 PERL_VERSION=${version}
197 @@ -216,3 +251,29 @@
198 find "${D}" -type f -name perllocal.pod -delete
199 find "${D}" -depth -mindepth 1 -type d -empty -delete
200 }
201 +
202 +linkduallifescripts() {
203 + if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.10.1" ; then
204 + return 0
205 + fi
206 +
207 + local i ff
208 + if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
209 + for i in "${DUALLIFESCRIPTS[@]}" ; do
210 + alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*"
211 + ff=`echo "${ROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*`
212 + ff=${ff##*.1}
213 + alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*"
214 + done
215 + else
216 + pushd "${D}" > /dev/null
217 + for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
218 + mv ${i}{,-${PV}-${P}} || die
219 + DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
220 + if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then
221 + mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die
222 + fi
223 + done
224 + popd > /dev/null
225 + fi
226 +}