Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] perl eclass review - EAPI=3 + new helper eclass
Date: Tue, 30 Mar 2010 15:49:02
Message-Id: b41005391003300848t4a7d6e0cya39199fc1eb95a18@mail.gmail.com
In Reply to: [gentoo-dev] perl eclass review - EAPI=3 + new helper eclass by Torsten Veller
1 On Tue, Mar 30, 2010 at 4:11 AM, Torsten Veller <ml-en@××××××.net> wrote:
2 > The perl-module.eclass must be updated to support EAPI=3 [1] and
3 > a new eclass will be added which does contain some (more or less) useful
4 > stand-alone functions split from the old perl-module.eclass without
5 > exporting phase functions.
6 > Functions used in ebuilds that don't need the exported default phases
7 > are perlinfo() and fixlocalpod().
8 >
9 >
10 > Below is the new eclass, working title is perl-helper.eclass.
11 > A diff between the the current and the new perl-module.eclass can be
12 > found at [2]. Both are in use in the perl-experimental overlay [3].
13 >
14 >
15 > Please review! If someone can come up with better names, either the
16 > perl-helper.eclass or the functions named perl_*, please tell me.
17 > I tried to make the perl-helper functions more unique but the
18 > meaningfulness is open to question.
19
20 It is obvious what many of the functions do (I can read shell, yay!)
21 but it is not obvious to me why they exist or why I would want to call
22 them. Why do I want to delete AppleDouble files? What are dual-life
23 scripts and why do I want to symlink them? Why would I want to delete
24 packfiles? Some documentation would be nice h ere.
25
26 -A
27
28 >
29 >
30 > Thanks
31 >
32 >
33 > [1] https://bugs.gentoo.org/310453
34 > [2] http://dev.gentoo.org/~tove/files/perl-module.diff
35 > [3] http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=tree;f=eclass;hb=HEAD
36 >
37 >
38 >
39 > # Copyright 1999-2010 Gentoo Foundation
40 > # Distributed under the terms of the GNU General Public License v2
41 > # $Header: $
42 >
43 > [[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
44 >
45 > perlinfo() {
46 >        debug-print-function $FUNCNAME "$@"
47 >        perl_set_version
48 > }
49 >
50 > perl_set_version() {
51 >        debug-print-function $FUNCNAME "$@"
52 >        debug-print "$FUNCNAME: perlinfo_done=${perlinfo_done}"
53 >        ${perlinfo_done} && return 0
54 >        perlinfo_done=true
55 >
56 >        local f version install{{site,vendor}{arch,lib},archlib}
57 >        eval "$(perl -V:{version,install{{site,vendor}{arch,lib},archlib}} )"
58 >        PERL_VERSION=${version}
59 >        SITE_ARCH=${installsitearch}
60 >        SITE_LIB=${installsitelib}
61 >        ARCH_LIB=${installarchlib}
62 >        VENDOR_LIB=${installvendorlib}
63 >        VENDOR_ARCH=${installvendorarch}
64 > }
65 >
66 > fixlocalpod() {
67 >        debug-print-function $FUNCNAME "$@"
68 >        perl_delete_localpod
69 > }
70 >
71 > perl_delete_localpod() {
72 >        debug-print-function $FUNCNAME "$@"
73 >
74 >        find "${D}" -type f -name perllocal.pod -delete
75 >        find "${D}" -depth -mindepth 1 -type d -empty -delete
76 > }
77 >
78 > perl_fix_osx_extra() {
79 >        debug-print-function $FUNCNAME "$@"
80 >
81 >        # Remove "AppleDouble encoded Macintosh file"
82 >        local f
83 >        find "${S}" -type f -name "._*" -print0 | while read -rd '' f ; do
84 >                einfo "Removing AppleDouble encoded Macintosh file: ${f#${S}/}"
85 >                rm -f "${f}"
86 >                f=${f#${S}/}
87 >        #       f=${f//\//\/}
88 >        #       f=${f//\./\.}
89 >        #       sed -i "/${f}/d" "${S}"/MANIFEST || die
90 >                grep -q "${f}" "${S}"/MANIFEST && \
91 >                        elog "AppleDouble encoded Macintosh file in MANIFEST: ${f#${S}/}"
92 >        done
93 > }
94 >
95 > perl_delete_module_manpages() {
96 >        debug-print-function $FUNCNAME "$@"
97 >
98 >        perl_set_eprefix
99 >
100 >        if [[ -d "${ED}"/usr/share/man ]] ; then
101 > #               einfo "Cleaning out stray man files"
102 >                find "${ED}"/usr/share/man -type f -name "*.3pm" -delete
103 >                find "${ED}"/usr/share/man -depth -type d -empty -delete
104 >        fi
105 > }
106 >
107 > perl_delete_packlist() {
108 >        debug-print-function $FUNCNAME "$@"
109 >        perl_set_version
110 >        if [[ -d ${D}/${VENDOR_LIB} ]] ; then
111 >                find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
112 >                        -o \( -name '*.bs' -a -empty \) \) -delete
113 >                find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
114 >        fi
115 > }
116 >
117 > perl_remove_temppath() {
118 >        debug-print-function $FUNCNAME "$@"
119 >
120 >        find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
121 >                if file "${f}" | grep -q -i " text" ; then
122 >                        grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
123 >                        sed -i -e "s:${D}:/:g" "${f}"
124 >                fi
125 >        done
126 > }
127 >
128 > perl_link_duallife_scripts() {
129 >        debug-print-function $FUNCNAME "$@"
130 >        if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then
131 >                return 0
132 >        fi
133 >
134 >        perl_set_eprefix
135 >
136 >        local i ff
137 >        if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
138 >                for i in "${DUALLIFESCRIPTS[@]}" ; do
139 >                        alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*"
140 >                        ff=`echo "${EROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*`
141 >                        ff=${ff##*.1}
142 >                        alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*"
143 >                done
144 >        else
145 >                pushd "${ED}" > /dev/null
146 >                for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
147 >                        mv ${i}{,-${PV}-${P}} || die
148 >                        DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
149 >                        if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then
150 >                                mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die
151 >                        fi
152 >                done
153 >                popd > /dev/null
154 >        fi
155 > }
156 >
157 > perl_set_eprefix() {
158 >        debug-print-function $FUNCNAME "$@"
159 >        case ${EAPI:-0} in
160 >                0|1|2)
161 >                        if ! use prefix; then
162 >                                EPREFIX=
163 >                                ED=${D}
164 >                                EROOT=${ROOT}
165 >                        fi
166 >                        ;;
167 >        esac
168 > }
169 >
170 >

Replies

Subject Author
[gentoo-dev] Re: perl eclass review - EAPI=3 + new helper eclass Torsten Veller <ml-en@××××××.net>