Gentoo Archives: gentoo-dev

From: Joerg Bornkessel <hd_brummy@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] eclass/vdr-plugin-2.eclass EAPI=6 changes, plz review
Date: Sun, 22 May 2016 21:22:16
Message-Id: 574222F7.7080206@astrali.lan
In Reply to: Re: [gentoo-dev] eclass/vdr-plugin-2.eclass EAPI=6 changes, plz review by "Michał Górny"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA512
3
4 Am 17.05.2016 um 08:17 schrieb Michał Górny:
5
6 > However, a few general suggestions:
7 >
8 > 1. Split this into multiple commits. Generic cleanup should happen
9 > separately from EAPI 6 support. And it would probably be a good
10 > idea to remove features one at a time, so that reverting would be
11 > possible.
12
13 its my plan, step by step
14 >
15 > 2. Prefer logic that evaluates to true for future EAPIs. For
16 > example, instead of [[ ${EAPI} == 6 ]], it's better to say !=
17 > [012345], so that we won't have to extend the list with every new
18 > EAPI if nothing changes.
19
20 done
21 >
22 > 3. Please namespace the eclass functions. Using generic names is
23 > really asking for trouble. vdr_ prefix should be sufficient.
24
25 ToDo
26 >
27 > 4. Please kill that src_util helper. It makes the logic terribly
28 > hard to follow, and there's really no reason to use case over
29 > separate functions.
30
31 yepp, this takes my also a lot of headattack by the rewrite from
32 vdr-plugin to vdr-plugin-2 eclass
33
34 ToDo...
35 >
36 > 5. There are some missing || die, for example after cd.
37
38 done
39
40 <snipp 2nd review>
41 - --- vdr-plugin-2.eclass 2016-05-22 22:27:12.081956660 +0200
42 +++ vdr-plugin-2.eclass.new 2016-05-22 23:10:11.908404939 +0200
43 @@ -1,4 +1,4 @@
44 - -# Copyright 1999-2015 Gentoo Foundation
45 +# Copyright 1999-2016 Gentoo Foundation
46 # Distributed under the terms of the GNU General Public License v2
47 # $Id$
48
49 @@ -90,7 +90,7 @@
50 # @CODE
51
52 # Applying your own local/user patches:
53 - -# This is done by using the
54 +# This is done by using the
55 # (EAPI = 4,5) epatch_user() function of the eutils.eclass,
56 # (EAPI = 6) eapply_user function integrated in EAPI = 6.
57 # Simply add your patches into one of these directories:
58 @@ -104,10 +104,7 @@
59 inherit flag-o-matic toolchain-funcs unpacker
60
61 case ${EAPI:-0} in
62 - - 4|5)
63 - - ;;
64 - - 6)
65 - - ewarn "EAPI 6 support for test purpose only, plz report bugs to
66 vdr@g.o"
67 + 4|5|6)
68 ;;
69 *) die "EAPI ${EAPI} unsupported."
70 ;;
71 @@ -145,6 +142,7 @@
72 # Called from src_install
73 # file maintained by normal portage-methods
74 create_plugindb_file() {
75 + #ToDo: rename this to vdr_...
76 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
77 local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
78 insinto "${NEW_VDRPLUGINDB_DIR}"
79 @@ -156,6 +154,7 @@
80 # EBUILD=${CATEGORY}/${PN}
81 # EBUILD_V=${PVR}
82 # EOT
83 +# obsolet? fix me later...
84 {
85 echo "VDRPLUGIN_DB=1"
86 echo "CREATOR=ECLASS"
87 @@ -166,6 +165,7 @@
88 }
89
90 create_header_checksum_file() {
91 + #ToDo: rename this to vdr_...
92 # Danger: Not using $ROOT here, as compile will also not use it !!!
93 # If vdr in $ROOT and / differ, plugins will not run anyway
94
95 @@ -232,6 +232,7 @@
96 #sed -i Makefile \
97 # -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
98 # -e 's:-I$(DVBDIR)/include:-I$(DVBDIR):'
99 + # obsolet? fix me later...
100 if ! grep -q APIVERSION Makefile; then
101 ebegin " Converting to APIVERSION"
102 @@ -260,6 +261,7 @@
103 }
104
105 dev_check() {
106 + # ToDo: rename this to vdr_...; IMPORTANT: check availabel
107 plugins, if we use this function in the tree...
108 # A lot useful debug infos
109 # set VDR_MAINTAINER_MODE="1" in make.conf
110 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
111 @@ -268,6 +270,7 @@
112 }
113
114 gettext_missing() {
115 + #ToDo: remane this to vdr_...
116 # plugins without converting to gettext
117
118 local GETTEXT_MISSING=$( grep xgettext Makefile )
119 @@ -277,6 +280,7 @@
120 }
121
122 detect_po_dir() {
123 + # ToDo: remane this to vdr_...
124 # helper function
125
126 [[ -f po ]] && local po_dir="${S}"
127 @@ -287,9 +291,10 @@
128 }
129
130 linguas_support() {
131 + # ToDo: remane this to vdr_...
132 # Patching Makefile for linguas support.
133 # Only locales, enabled through the LINGUAS (make.conf) variable will
134 be
135 - -# "compiled" and installed.
136 +# compiled and installed.
137
138 einfo "Patching for Linguas support"
139 einfo "available Languages for ${P} are:"
140 @@ -311,12 +316,9 @@
141 vdr_i18n() {
142 # i18n handling was deprecated since >=media-video/vdr-1.5.9,
143 # finally with >=media-video/vdr-1.7.27 it has been dropped entirely
144 and some
145 - -# plugins will fail to "compile" because they're still using the old
146 variant.
147 +# plugins will fail to compile because they're still using the old
148 variant.
149 # Simply remove the i18n.o object from Makefile (OBJECT) and
150 # remove "static const tI18nPhrase*" from i18n.h.
151 - -#
152 - -# Plugins that are still using the old method will be pmasked until
153 they're
154 - -# fixed or in case of maintainer timeout they'll be masked for removal
155 .
156
157 gettext_missing
158
159 @@ -348,6 +350,7 @@
160 }
161
162 remove_i18n_include() {
163 + # ToDo: rename this to vdr_...; IMPORTANT!!! We use this in the tree
164 # remove uneeded i18.n includes
165
166 local f
167 @@ -391,6 +394,7 @@
168
169 # Plugins need to be compiled with position independent code,
170 otherwise linking
171 # VDR against it will fail
172 + # depricated if fi, as we have only >=vdr-2 in the tree, fix me
173 later...
174 if has_version ">=media-video/vdr-1.7.13"; then
175 append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
176 - -D_LARGEFILE64_SOURCE
177 fi
178 @@ -452,15 +456,15 @@
179 unpacker_src_unpack
180 ;;
181 add_local_patch)
182 - - cd "${S}" || die "Could not change to
183 plugin-source-directory!"
184 - - if [[ ${EAPI} == 6 ]]; then
185 + cd "${S}" || die "Could not change to
186 plugin-source-directory (src_util)"
187 + if [[ ${EAPI} != [45] ]]; then
188 eapply_user
189 else
190 epatch_user
191 fi
192 ;;
193 patchmakefile)
194 - - cd "${S}" || die "Could not change to
195 plugin-source-directory!"
196 + cd "${S}" || die "Could not change to
197 plugin-source-directory (src_util)"
198 vdr_patchmakefile
199 ;;
200 i18n)
201 @@ -500,7 +504,9 @@
202 die "vdr-plugin-2_src_prepare not called!"
203 die "vdr-plugin-2_src_prepare not called!"
204 fi
205
206 - - [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
207 + [[ ${EAPI} == [45] ]] && [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]
208 }"
209 + [[ ${EAPI} != [45] ]] && [[ ${PATCHES[@]} ]] && eapply "${PATCHES[@]
210 }"
211 +
212 debug-print "$FUNCNAME: applying user patches"
213
214 vdr-plugin-2_src_util prepare
215 @@ -520,16 +526,14 @@
216 eerror "Please report this at bugs.gentoo.org."
217 die "vdr-plugin-2_src_compile not called!"
218 fi
219 - - cd "${S}"
220 + cd "${S}" || die "could not change to plugin source
221 directory (src_compile)"
222
223 - - BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-all
224 }}
225 - - emake ${BUILD_PARAMS} \
226 - - ${BUILD_TARGETS} \
227 - - LOCALEDIR="${TMP_LOCALE_DIR}" \
228 - - LOCDIR="${TMP_LOCALE_DIR}" \
229 - - LIBDIR="${S}" \
230 - - TMPDIR="${T}" \
231 - - || die "emake failed"
232 + emake all ${BUILD_PARAMS} \
233 + LOCALEDIR="${TMP_LOCALE_DIR}" \
234 + LOCDIR="${TMP_LOCALE_DIR}" \
235 + LIBDIR="${S}" \
236 + TMPDIR="${T}" \
237 + || die "emake all failed"
238 ;;
239 esac
240
241 @@ -546,7 +550,7 @@
242 die "vdr-plugin-2_src_install not called!"
243 fi
244
245 - - cd "${WORKDIR}"
246 + cd "${WORKDIR}" || die "could not change to plugin workdir
247 directory (src_install)"
248
249 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
250 local mname="${P}-Makefile"
251 @@ -566,16 +570,15 @@
252
253 fi
254
255 - - cd "${S}"
256 + cd "${S}" || die "could not change to plugin source directory
257 (src_install)"
258
259 local SOFILE_STRING=$(grep SOFILE Makefile)
260 if [[ -n ${SOFILE_STRING} ]]; then
261 - - BUILD_TARGETS=${BUILD_TARGETS:-${VDRPLUGIN_MAKE_TARGET:-install
262 }}
263 - - einstall ${BUILD_PARAMS} \
264 - - ${BUILD_TARGETS} \
265 - - TMPDIR="${T}" \
266 - - DESTDIR="${D}" \
267 - - || die "einstall (makefile target) failed"
268 + emake install \
269 + ${BUILD_PARAMS} \
270 + TMPDIR="${T}" \
271 + DESTDIR="${D}" \
272 + || die "emake install (makefile target) failed"
273 else
274 dev_check "Plugin use still the old Makefile handling"
275 insinto "${VDR_PLUGIN_DIR}"
276 @@ -584,7 +587,7 @@
277
278 if [[ -d ${TMP_LOCALE_DIR} ]]; then
279 einfo "Installing locales"
280 - - cd "${TMP_LOCALE_DIR}"
281 + cd "${TMP_LOCALE_DIR}" || die "could not change to TMP_LOCALE_DI
282 R"
283
284 local linguas
285 for linguas in ${LINGUAS[*]}; do
286 @@ -593,7 +596,7 @@
287 done
288 fi
289
290 - - cd "${D}/usr/$(get_libdir)/vdr/plugins"
291 + cd "${D}/usr/$(get_libdir)/vdr/plugins" || die "could not change
292 to D/usr/libdir/vdr/plugins"
293
294 # create list of all created plugin libs
295 vdr_plugin_list=""
296 @@ -604,14 +607,19 @@
297 vdr_plugin_list="${vdr_plugin_list} ${p_name}"
298 done
299
300 - - cd "${S}"
301 + cd "${S}" || die "could not change to plugin source directory
302 (src_install)"
303
304 create_header_checksum_file ${vdr_plugin_list}
305 create_plugindb_file ${vdr_plugin_list}
306
307 - - local docfile
308 - - for docfile in README* HISTORY CHANGELOG; do
309 - - [[ -f ${docfile} ]] && dodoc ${docfile}
310 + local commondoc=( README* HISTORY CHANGELOG )
311 + for docfile in "${commondoc[@]}"; do
312 + if [[ ${EAPI} == "6" ]]; then
313 + local DOCS="${DOCS} ${docfile}"
314 + [[ -f ${docfile} ]] && einstalldocs "${DOCS[@]}"
315 + else
316 + [[ -f ${docfile} ]] && dodoc ${docfile}
317 + fi
318 done
319
320 # if VDR_CONFD_FILE is empty and ${FILESDIR}/confd exists take it
321 </snapp>
322
323 Regards
324
325 /dev/joerg
326 - --
327 Joerg Bornkessel <hd_brummy@g.o>
328 GnuPG Key: 0x93EB5F4DAA5832A1
329 Fingerprint: 0E0A A1EE 1DF4 41D7 A3F5 21C2 93EB 5F4D AA58 32A1
330 -----BEGIN PGP SIGNATURE-----
331 Version: GnuPG v2.1
332 Comment: Signed-off-by: Jörg Bornkessel <hd_brummy@g.o>
333
334 iQJ8BAEBCgBmBQJXQiLtXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
335 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQwRTBBQTFFRTFERjQ0MUQ3QTNGNTIxQzI5
336 M0VCNUY0REFBNTgzMkExAAoJEJPrX02qWDKhQXcP/jNRQr/6Q5Jb6UEvR8pSXI52
337 Xgl33SMwVtN8eckVYBH3E/xwV82QhJ3QnPqGasFPdnOT/fZBw9rHP8fHCrW+lXlg
338 LcGicaEgWj7ZuE77PA4Vo44LrAhL2DHgLSnU20BPvOaDtVBY9bwTQPuzTzfg0mrz
339 kNo1eJPh8Ptsqn89AJqegs14uRulrYAMsQVNty/X7vkZxv237J0lhqN+wNoJRpON
340 NisWqPJl2ENq1fZaLakCneC9ghjeJytu8+5YNTW5fjfAAWcyXMIjtxgIcjBZb/TE
341 jAek3uJhivDfykRq9v07G+s125kNel48cK6tR09A24JTtzW4govA+0p7P+KYVt38
342 bLxFGqgNEkevFgZ9w8y0zg3keYo6sjTWcijmQ1InXX9Yn4NgbiabX2Xh2i4OAbNS
343 g0E9TGUZ+MGhCgq2PC8BRPgzPMyCsq1iZM4C1Q3zVvFyj6AF2Hh6kRUMXVHyUhUi
344 BERo2xZNr9WZFki6yXASKVvpUNbWbuhtyk21Wo7rPr+yBhx0zTNjnAMglTWJ1FQE
345 N0xNp9EDUkU18OgRiNgYi57a2shf9xxYULKBFowUVeJ6t4DlYUx9HnTmaVR9F4HI
346 1xzUIVjkA2LU2Vx57DGZV3ZwjyVca/OfbwiTmNr/J0e25oIVseH4exUBYlaucuM0
347 JResc4NvRm6T+uLS6g9x
348 =o4K0
349 -----END PGP SIGNATURE-----

Attachments

File name MIME type
vdr-plugin-2.eclass.diff text/plain

Replies

Subject Author
Re: [gentoo-dev] eclass/vdr-plugin-2.eclass EAPI=6 changes, plz review "Michał Górny" <mgorny@g.o>