Gentoo Archives: gentoo-dev

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

Replies

Subject Author
Re: [gentoo-dev] perl-module.class review Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>