/[gentoo-x86]/eclass/perl-module.eclass
Gentoo

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.161 - (hide annotations) (download)
Wed Dec 17 16:40:53 2014 UTC (3 years, 8 months ago) by dilfridge
Branch: MAIN
Changes since 1.160: +2 -7 lines
Remove code paths that are not called anymore

1 dilfridge 1.140 # Copyright 1999-2014 Gentoo Foundation
2 vapier 1.30 # Distributed under the terms of the GNU General Public License v2
3 dilfridge 1.161 # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.160 2014/12/13 21:06:07 dilfridge Exp $
4 tove 1.113
5     # @ECLASS: perl-module.eclass
6     # @MAINTAINER:
7     # perl@gentoo.org
8 vapier 1.131 # @AUTHOR:
9     # Seemant Kulleen <seemant@gentoo.org>
10 tove 1.113 # @BLURB: eclass for perl modules
11     # @DESCRIPTION:
12 seemant 1.1 # The perl-module eclass is designed to allow easier installation of perl
13     # modules, and their incorporation into the Gentoo Linux system.
14 seemant 1.3
15 zlogene 1.139 inherit eutils multiprocessing unpacker
16 tove 1.124 [[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
17 tove 1.117
18 dilfridge 1.161 PERL_EXPF="src_unpack src_prepare src_configure src_compile src_test src_install"
19 tove 1.113
20     case "${EAPI:-0}" in
21 dilfridge 1.144 4|5)
22 tove 1.117 [[ ${CATEGORY} == "perl-core" ]] && \
23 tove 1.124 PERL_EXPF+=" pkg_postinst pkg_postrm"
24 tove 1.113
25     case "${GENTOO_DEPEND_ON_PERL:-yes}" in
26 dilfridge 1.138 yes)
27     case "${EAPI:-0}" in
28     5)
29     case "${GENTOO_DEPEND_ON_PERL_SUBSLOT:-yes}" in
30     yes)
31     DEPEND="dev-lang/perl:=[-build(-)]"
32     ;;
33     *)
34     DEPEND="dev-lang/perl[-build(-)]"
35     ;;
36     esac
37     ;;
38     *)
39 mattst88 1.137 DEPEND="|| ( >=dev-lang/perl-5.16 <dev-lang/perl-5.16[-build] )"
40 tove 1.113 ;;
41 dilfridge 1.138 esac
42     RDEPEND="${DEPEND}"
43     ;;
44 tove 1.113 esac
45     ;;
46 tove 1.123 *)
47 tove 1.127 die "EAPI=${EAPI} is not supported by perl-module.eclass"
48 tove 1.123 ;;
49 tove 1.113 esac
50 danarmak 1.13
51 dilfridge 1.147 case "${EAPI:-0}" in
52     5)
53     ;;
54     *)
55     ewarn
56     ewarn "******************************************************************"
57     ewarn "${EBUILD}:"
58     ewarn "Support for EAPI=${EAPI:-0} in perl-module.eclass will be removed"
59     ewarn "on 1/Feb/2015. Please fix your overlay ebuilds to use EAPI=5."
60     ewarn "******************************************************************"
61     ewarn
62     ;;
63     esac
64 dilfridge 1.142
65 tove 1.124 case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in
66     yes)
67     EXPORT_FUNCTIONS ${PERL_EXPF}
68     ;;
69     no)
70     debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no"
71     ;;
72     *)
73 tove 1.127 die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass"
74 tove 1.124 ;;
75     esac
76 tove 1.117
77 dilfridge 1.158 LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
78 robbat2 1.109
79 tove 1.127 if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
80     : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}}
81     S=${MY_S:-${WORKDIR}/${MY_P}}
82     fi
83 tove 1.130
84 robbat2 1.128 [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \
85     MODULE_A="${MY_P:-${P}}.${MODULE_A_EXT:-tar.gz}"
86 tove 1.113 [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
87 tove 1.123 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
88 tove 1.113 [[ -z "${HOMEPAGE}" ]] && \
89 tove 1.118 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
90 mcummings 1.66
91 azarah 1.11 SRC_PREP="no"
92 rac 1.55 SRC_TEST="skip"
93 mcummings 1.97 PREFER_BUILDPL="yes"
94 azarah 1.11
95 mcummings 1.101 pm_echovar=""
96 tove 1.113 perlinfo_done=false
97 seemant 1.35
98 monsieurp 1.150 # @FUNCTION: perl-module_src_unpack
99     # @USAGE: perl-module_src_unpack
100     # @DESCRIPTION:
101     # Unpack the ebuild tarball(s).
102     # This function is to be called during the ebuild src_unpack() phase.
103 mcummings 1.102 perl-module_src_unpack() {
104 tove 1.123 debug-print-function $FUNCNAME "$@"
105 dilfridge 1.141
106 zlogene 1.139 unpacker_src_unpack
107 tove 1.113 }
108    
109 monsieurp 1.150 # @FUNCTION: perl-module_src_prepare
110     # @USAGE: perl-module_src_prepare
111     # @DESCRIPTION:
112     # Get the ebuild sources ready.
113     # This function is to be called during the ebuild src_prepare() phase.
114 tove 1.113 perl-module_src_prepare() {
115 tove 1.123 debug-print-function $FUNCNAME "$@"
116 zlogene 1.139 [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
117     debug-print "$FUNCNAME: applying user patches"
118     epatch_user
119 monsieurp 1.145 if [[ ${PERL_RM_FILES[@]} ]]; then
120     debug-print "$FUNCNAME: stripping unneeded files"
121     perl_rm_files "${PERL_RM_FILES[@]}"
122     fi
123 tove 1.123 perl_fix_osx_extra
124 tove 1.113 esvn_clean
125     }
126    
127 monsieurp 1.150 # @FUNCTION: perl-module_src_configure
128     # @USAGE: perl-module_src_configure
129     # @DESCRIPTION:
130     # Configure the ebuild sources.
131     # This function is to be called during the ebuild src_configure() phase.
132 tove 1.113 perl-module_src_configure() {
133 tove 1.123 debug-print-function $FUNCNAME "$@"
134 mcummings 1.102
135 tove 1.117 [[ ${SRC_PREP} = yes ]] && return 0
136 tove 1.113 SRC_PREP="yes"
137 rac 1.60
138 tove 1.123 perl_set_version
139 rac 1.60
140 tove 1.130 [[ -z ${pm_echovar} ]] && export PERL_MM_USE_DEFAULT=1
141 mcummings 1.90 # Disable ExtUtils::AutoInstall from prompting
142     export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
143 rac 1.64
144 tove 1.127 if [[ $(declare -p myconf 2>&-) != "declare -a myconf="* ]]; then
145     local myconf_local=(${myconf})
146     else
147     local myconf_local=("${myconf[@]}")
148     fi
149    
150     if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL ]] ; then
151 mcummings 1.97 einfo "Using Module::Build"
152 tove 1.120 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then
153 tove 1.126 eqawarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
154     eqawarn " Add virtual/perl-Module-Build to DEPEND!"
155 tove 1.127 if [[ -n ${PERLQAFATAL} ]]; then
156     eerror "Bailing out due to PERLQAFATAL=1";
157     die;
158     fi
159 tove 1.120 fi
160 tove 1.123 set -- \
161 tove 1.113 --installdirs=vendor \
162     --libdoc= \
163     --destdir="${D}" \
164     --create_packlist=0 \
165 tove 1.127 "${myconf_local[@]}"
166 tove 1.123 einfo "perl Build.PL" "$@"
167     perl Build.PL "$@" <<< "${pm_echovar}" \
168 tove 1.127 || die "Unable to build!"
169 tove 1.113 elif [[ -f Makefile.PL ]] ; then
170 mcummings 1.85 einfo "Using ExtUtils::MakeMaker"
171 tove 1.123 set -- \
172     PREFIX=${EPREFIX}/usr \
173 tove 1.113 INSTALLDIRS=vendor \
174     INSTALLMAN3DIR='none' \
175     DESTDIR="${D}" \
176 tove 1.127 "${myconf_local[@]}"
177 tove 1.123 einfo "perl Makefile.PL" "$@"
178     perl Makefile.PL "$@" <<< "${pm_echovar}" \
179 tove 1.127 || die "Unable to build!"
180 mcummings 1.88 fi
181 tove 1.113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
182 mcummings 1.88 einfo "No Make or Build file detected..."
183 mcummings 1.85 return
184 mcummings 1.43 fi
185 azarah 1.11 }
186    
187 dilfridge 1.159 # @FUNCTION: perl-module_src_prep
188     # @USAGE: perl-module_src_prep
189     # @DESCRIPTION:
190     # Configure the ebuild sources (bis).
191     #
192     # This function is still around for historical reasons
193     # and will be soon deprecated.
194     #
195     # Please use the function above instead, perl-module_src_configure().
196     perl-module_src_prep() {
197     debug-print-function $FUNCNAME "$@"
198 dilfridge 1.160 ewarn "perl-modules.eclass: perl-module_src_prep is deprecated and will be removed. Please use perl-module_src_configure instead."
199 dilfridge 1.159 perl-module_src_configure
200     }
201    
202 monsieurp 1.150 # @FUNCTION: perl-module_src_compile
203     # @USAGE: perl-module_src_compile
204     # @DESCRIPTION:
205     # Compile the ebuild sources.
206     # This function is to be called during the ebuild src_compile() phase.
207 aliz 1.15 perl-module_src_compile() {
208 tove 1.123 debug-print-function $FUNCNAME "$@"
209     perl_set_version
210 tove 1.113
211 tove 1.127 if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
212     local mymake_local=(${mymake})
213     else
214     local mymake_local=("${mymake[@]}")
215     fi
216    
217 tove 1.113 if [[ -f Build ]] ; then
218     ./Build build \
219 tove 1.127 || die "Compilation failed"
220 tove 1.113 elif [[ -f Makefile ]] ; then
221 tove 1.127 set -- \
222 tove 1.113 OTHERLDFLAGS="${LDFLAGS}" \
223 tove 1.127 "${mymake_local[@]}"
224     einfo "emake" "$@"
225     emake "$@" \
226     || die "Compilation failed"
227 tove 1.113 # OPTIMIZE="${CFLAGS}" \
228 mcummings 1.43 fi
229 seemant 1.8 }
230    
231 monsieurp 1.150 # @FUNCTION: perl-module_src-test
232     # @USAGE: perl-module_src_test()
233     # @DESCRIPTION:
234     # This code attempts to work out your threadingness from MAKEOPTS
235     # and apply them to Test::Harness.
236 tove 1.117 #
237 monsieurp 1.150 # If you want more verbose testing, set TEST_VERBOSE=1
238     # in your bashrc | /etc/portage/make.conf | ENV
239 tove 1.117 #
240 monsieurp 1.150 # or ebuild writers:
241     # If you wish to enable default tests w/ 'make test' ,
242 tove 1.117 #
243 monsieurp 1.150 # SRC_TEST="do"
244 tove 1.117 #
245 monsieurp 1.150 # If you wish to have threads run in parallel ( using the users makeopts )
246     # all of the following have been tested to work.
247 tove 1.117 #
248 monsieurp 1.150 # SRC_TEST="do parallel"
249     # SRC_TEST="parallel"
250     # SRC_TEST="parallel do"
251     # SRC_TEST=parallel
252 tove 1.117 #
253 aliz 1.15 perl-module_src_test() {
254 tove 1.123 debug-print-function $FUNCNAME "$@"
255 tove 1.117 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
256     if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
257 vapier 1.132 export HARNESS_OPTIONS=j$(makeopts_jobs)
258     einfo "Test::Harness Jobs=$(makeopts_jobs)"
259 tove 1.117 fi
260 tove 1.123 ${perlinfo_done} || perl_set_version
261 tove 1.113 if [[ -f Build ]] ; then
262 tove 1.117 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
263 tove 1.113 elif [[ -f Makefile ]] ; then
264 tove 1.117 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
265 mcummings 1.68 fi
266 mcummings 1.43 fi
267 seemant 1.1 }
268    
269 monsieurp 1.150 # @FUNCTION: perl-module_src_install
270     # @USAGE: perl-module_src_install
271     # @DESCRIPTION:
272     # Install a Perl ebuild.
273     # This function is to be called during the ebuild src_install() phase.
274 aliz 1.15 perl-module_src_install() {
275 tove 1.123 debug-print-function $FUNCNAME "$@"
276    
277     perl_set_version
278    
279 tove 1.113 local f
280 swegener 1.76
281 tove 1.114 if [[ -z ${mytargets} ]] ; then
282     case "${CATEGORY}" in
283     dev-perl|perl-core) mytargets="pure_install" ;;
284     *) mytargets="install" ;;
285     esac
286     fi
287 swegener 1.76
288 tove 1.127 if [[ $(declare -p myinst 2>&-) != "declare -a myinst="* ]]; then
289     local myinst_local=(${myinst})
290     else
291     local myinst_local=("${myinst[@]}")
292     fi
293    
294 tove 1.113 if [[ -f Build ]] ; then
295     ./Build ${mytargets} \
296     || die "./Build ${mytargets} failed"
297     elif [[ -f Makefile ]] ; then
298 tove 1.127 emake "${myinst_local[@]}" ${mytargets} \
299     || die "emake ${myinst_local[@]} ${mytargets} failed"
300 tove 1.113 fi
301    
302 tove 1.123 perl_delete_module_manpages
303     perl_delete_localpod
304     perl_delete_packlist
305     perl_remove_temppath
306 mcummings 1.20
307 tove 1.123 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
308 tove 1.117 [[ -s ${f} ]] && dodoc ${f}
309 mcummings 1.98 done
310 mcummings 1.65
311 tove 1.123 perl_link_duallife_scripts
312 seemant 1.35 }
313    
314 monsieurp 1.150 # @FUNCTION: perl-module_pkg_setup
315     # @USAGE: perl-module_pkg_setup
316     # @DESCRIPTION:
317 dilfridge 1.153 # This function was to be called during the pkg_setup() phase.
318     # Deprecated, to be removed. Where it is called, place a call to perl_set_version instead.
319 seemant 1.35 perl-module_pkg_setup() {
320 tove 1.123 debug-print-function $FUNCNAME "$@"
321 dilfridge 1.154 ewarn "perl-modules.eclass: perl-module_pkg_setup is deprecated and will be removed. Please use perl_set_version instead."
322 tove 1.123 perl_set_version
323 seemant 1.35 }
324    
325 monsieurp 1.150 # @FUNCTION: perl-module_pkg_preinst
326     # @USAGE: perl-module_pkg_preinst
327     # @DESCRIPTION:
328 dilfridge 1.153 # This function was to be called during the pkg_preinst() phase.
329     # Deprecated, to be removed. Where it is called, place a call to perl_set_version instead.
330 seemant 1.35 perl-module_pkg_preinst() {
331 tove 1.123 debug-print-function $FUNCNAME "$@"
332 dilfridge 1.155 ewarn "perl-modules.eclass: perl-module_pkg_preinst is deprecated and will be removed. Please use perl_set_version instead."
333 tove 1.123 perl_set_version
334 seemant 1.35 }
335    
336 monsieurp 1.150 # @FUNCTION: perl-module_pkg_postinst
337     # @USAGE: perl-module_pkg_postinst
338     # @DESCRIPTION:
339 dilfridge 1.156 # This function is to be called during the pkg_postinst() phase. It only does
340     # useful things for the perl-core category, where it handles the file renaming and symbolic
341     # links that prevent file collisions for dual-life packages installing scripts.
342     # In any other category it immediately exits.
343 tove 1.117 perl-module_pkg_postinst() {
344 tove 1.123 debug-print-function $FUNCNAME "$@"
345 dilfridge 1.156 if [[ ${CATEGORY} != perl-core ]] ; then
346     eqawarn "perl-module.eclass: You are calling perl-module_pkg_postinst outside the perl-core category."
347     eqawarn " This does not do anything; the call can be safely removed."
348     return 0
349     fi
350 tove 1.123 perl_link_duallife_scripts
351 tove 1.117 }
352 seemant 1.35
353 monsieurp 1.150 # @FUNCTION: perl-module_pkg_prerm
354     # @USAGE: perl-module_pkg_prerm
355     # @DESCRIPTION:
356 dilfridge 1.156 # This function was to be called during the pkg_prerm() phase.
357     # It does not do anything. Deprecated, to be removed.
358 tove 1.123 perl-module_pkg_prerm() {
359     debug-print-function $FUNCNAME "$@"
360 dilfridge 1.157 ewarn "perl-module.eclass: perl-module_pkg_prerm does not do anything and will be removed. Please remove the call."
361 tove 1.123 }
362 seemant 1.35
363 monsieurp 1.150 # @FUNCTION: perl-module_pkg_postrm
364     # @USAGE: perl-module_pkg_postrm
365     # @DESCRIPTION:
366 dilfridge 1.156 # This function is to be called during the pkg_postrm() phase. It only does
367     # useful things for the perl-core category, where it handles the file renaming and symbolic
368     # links that prevent file collisions for dual-life packages installing scripts.
369     # In any other category it immediately exits.
370 tove 1.117 perl-module_pkg_postrm() {
371 tove 1.123 debug-print-function $FUNCNAME "$@"
372 dilfridge 1.156 if [[ ${CATEGORY} != perl-core ]] ; then
373     eqawarn "perl-module.eclass: You are calling perl-module_pkg_postrm outside the perl-core category."
374     eqawarn " This does not do anything; the call can be safely removed."
375     return 0
376     fi
377 tove 1.123 perl_link_duallife_scripts
378 tove 1.117 }
379 tove 1.124
380 dilfridge 1.148 # @FUNCTION: perl_set_version
381     # @USAGE: perl_set_version
382     # @DESCRIPTION:
383     # Extract version information and installation paths from the current Perl
384     # interpreter.
385     #
386     # This sets the following variables: PERL_VERSION, SITE_ARCH, SITE_LIB,
387     # ARCH_LIB, VENDOR_LIB, VENDOR_ARCH
388     #
389     # This function used to be called perlinfo as well.
390 tove 1.124 perl_set_version() {
391     debug-print-function $FUNCNAME "$@"
392     debug-print "$FUNCNAME: perlinfo_done=${perlinfo_done}"
393     ${perlinfo_done} && return 0
394     perlinfo_done=true
395    
396     local f version install{{site,vendor}{arch,lib},archlib}
397     eval "$(perl -V:{version,install{{site,vendor}{arch,lib},archlib}} )"
398     PERL_VERSION=${version}
399     SITE_ARCH=${installsitearch}
400     SITE_LIB=${installsitelib}
401     ARCH_LIB=${installarchlib}
402     VENDOR_LIB=${installvendorlib}
403     VENDOR_ARCH=${installvendorarch}
404     }
405    
406 monsieurp 1.149 # @FUNCTION: perlinfo
407     # @USAGE: perlinfo
408     # @DESCRIPTION:
409 monsieurp 1.150 # This function is deprecated.
410 monsieurp 1.149 #
411 monsieurp 1.150 # Please use the function above instead, perl_set_version().
412 monsieurp 1.149 perlinfo() {
413 tove 1.124 debug-print-function $FUNCNAME "$@"
414 dilfridge 1.151 ewarn "perl-modules.eclass: perlinfo is deprecated and will be removed. Please use perl_set_version instead."
415 monsieurp 1.149 perl_set_version
416 tove 1.124 }
417    
418 dilfridge 1.148 # @FUNCTION: perl_delete_localpod
419     # @USAGE: perl_delete_localpod
420     # @DESCRIPTION:
421     # Remove stray perllocal.pod files in the temporary install directory D.
422     #
423     # This function used to be called fixlocalpod as well.
424 tove 1.124 perl_delete_localpod() {
425     debug-print-function $FUNCNAME "$@"
426    
427     find "${D}" -type f -name perllocal.pod -delete
428     find "${D}" -depth -mindepth 1 -type d -empty -delete
429     }
430    
431 monsieurp 1.149 # @FUNCTION: fixlocalpod
432     # @USAGE: fixlocalpod
433     # @DESCRIPTION:
434     # This function is deprecated.
435     #
436 monsieurp 1.150 # Please use the function above instead, perl_delete_localpod().
437 monsieurp 1.149 fixlocalpod() {
438     debug-print-function $FUNCNAME "$@"
439 dilfridge 1.152 ewarn "perl-modules.eclass: fixlocalpod is deprecated and will be removed. Please use perl_delete_localpod instead."
440 monsieurp 1.149 perl_delete_localpod
441     }
442    
443     # @FUNCTION: perl_fix_osx_extra
444     # @USAGE: perl_fix_osx_extra
445     # @DESCRIPTION:
446 monsieurp 1.150 # Look through ${S} for AppleDouble encoded files and get rid of them.
447 tove 1.124 perl_fix_osx_extra() {
448     debug-print-function $FUNCNAME "$@"
449    
450     local f
451     find "${S}" -type f -name "._*" -print0 | while read -rd '' f ; do
452     einfo "Removing AppleDouble encoded Macintosh file: ${f#${S}/}"
453     rm -f "${f}"
454     f=${f#${S}/}
455     grep -q "${f}" "${S}"/MANIFEST && \
456     elog "AppleDouble encoded Macintosh file in MANIFEST: ${f#${S}/}"
457     done
458     }
459    
460 monsieurp 1.149 # @FUNCTION: perl_delete_module_manpages
461     # @USAGE: perl_delete_module_manpages
462 monsieurp 1.150 # @DESCRIPTION:
463 monsieurp 1.149 # Bump off manpages installed by the current module such as *.3pm files as well
464     # as empty directories.
465 tove 1.124 perl_delete_module_manpages() {
466     debug-print-function $FUNCNAME "$@"
467    
468     if [[ -d "${ED}"/usr/share/man ]] ; then
469     find "${ED}"/usr/share/man -type f -name "*.3pm" -delete
470     find "${ED}"/usr/share/man -depth -type d -empty -delete
471     fi
472     }
473    
474 monsieurp 1.150 # @FUNCTION: perl_delete_packlist
475     # @USAGE: perl_delete_packlist
476     # @DESCRIPTION:
477     # Look through ${D} for .packlist files, empty .bs files and empty directories,
478     # and get rid of items found.
479 tove 1.124 perl_delete_packlist() {
480     debug-print-function $FUNCNAME "$@"
481     perl_set_version
482 tove 1.125 if [[ -d ${D}/${VENDOR_ARCH} ]] ; then
483     find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \
484 tove 1.124 -o \( -name '*.bs' -a -empty \) \) -delete
485 tove 1.125 find "${D}" -depth -mindepth 1 -type d -empty -delete
486 tove 1.124 fi
487     }
488    
489 monsieurp 1.150 # @FUNCTION: perl_remove_temppath
490     # @USAGE: perl_remove_temppath
491     # @DESCRIPTION:
492     # Look through ${D} for text files containing the temporary installation
493     # folder (i.e. ${D}). If the pattern is found (i.e. " text"), replace it with `/'.
494 tove 1.124 perl_remove_temppath() {
495     debug-print-function $FUNCNAME "$@"
496    
497     find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
498     if file "${f}" | grep -q -i " text" ; then
499     grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
500     sed -i -e "s:${D}:/:g" "${f}"
501     fi
502     done
503     }
504    
505 monsieurp 1.145 # @FUNCTION: perl_rm_files
506     # @USAGE: perl_rm_files "file_1" "file_2"
507     # @DESCRIPTION:
508     # Remove certain files from a Perl release and remove them from the MANIFEST
509     # while we're there.
510     #
511     # Most useful in src_prepare for nuking bad tests, and is highly recommended
512     # for any tests like 'pod.t', 'pod-coverage.t' or 'kwalitee.t', as what they
513     # test is completely irrelevant to end users, and frequently fail simply
514     # because the authors of Test::Pod... changed their recommendations, and thus
515     # failures are only useful feedback to Authors, not users.
516     #
517     # Removing from MANIFEST also avoids needless log messages warning
518     # users about files "missing from their kit".
519     perl_rm_files() {
520     debug-print-function $FUNCNAME "$@"
521     local skipfile="${T}/.gentoo_makefile_skip"
522     local manifile="${S}/MANIFEST"
523     local manitemp="${T}/.gentoo_manifest_temp"
524     oldifs="$IFS"
525     IFS="\n"
526     for filename in "$@"; do
527     einfo "Removing un-needed ${filename}";
528     # Remove the file
529     rm -f "${S}/${filename}"
530     [[ -e "${manifile}" ]] && echo "${filename}" >> "${skipfile}"
531     done
532     if [[ -e "${manifile}" && -e "${skipfile}" ]]; then
533     einfo "Fixing Manifest"
534     grep -v -F -f "${skipfile}" "${manifile}" > "${manitemp}"
535     mv -f -- "${manitemp}" "${manifile}"
536     rm -- "${skipfile}";
537     fi
538     IFS="$oldifs"
539     }
540    
541 monsieurp 1.150 # @FUNCTION: perl_link_duallife_scripts
542     # @USAGE: perl_link_duallife_scripts
543     # @DESCRIPTION:
544 dilfridge 1.156 # Moves files and generates symlinks so dual-life packages installing scripts do not
545     # lead to file collisions. Mainly for use in pkg_postinst and pkg_postrm, and makes
546     # only sense for perl-core packages.
547 tove 1.124 perl_link_duallife_scripts() {
548     debug-print-function $FUNCNAME "$@"
549     if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then
550     return 0
551     fi
552    
553     local i ff
554     if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
555     for i in "${DUALLIFESCRIPTS[@]}" ; do
556 tove 1.130 alternatives_auto_makesym "/${i}" "/${i}-[0-9]*"
557     done
558     for i in "${DUALLIFEMAN[@]}" ; do
559     ff=`echo "${EROOT}"/${i%.1}-${PV}-${P}.1*`
560 tove 1.124 ff=${ff##*.1}
561 tove 1.130 alternatives_auto_makesym "/${i}${ff}" "/${i%.1}-[0-9]*"
562 tove 1.124 done
563     else
564     pushd "${ED}" > /dev/null
565     for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
566     mv ${i}{,-${PV}-${P}} || die
567 tove 1.130 #DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
568     DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i}
569     done
570     for i in $(find usr/share/man/man1 -maxdepth 1 -type f 2>/dev/null) ; do
571     mv ${i} ${i%.1}-${PV}-${P}.1 || die
572     DUALLIFEMAN[${#DUALLIFEMAN[*]}]=${i}
573 tove 1.124 done
574     popd > /dev/null
575     fi
576     }

  ViewVC Help
Powered by ViewVC 1.1.20