Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: vdr-plugin.eclass
Date: Fri, 05 Oct 2007 14:06:14
Message-Id: E1Idnfd-000538-Og@stork.gentoo.org
1 zzam 07/10/05 13:56:49
2
3 Modified: vdr-plugin.eclass
4 Log:
5 General cleanup of eclass: No longer support older versions of vdrplugin-rebuild and gentoo-vdr-scripts. Now use eselect-vdr to enable plugins. Small quoting cleanup.
6
7 Revision Changes Path
8 1.50 eclass/vdr-plugin.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.50&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.50&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?r1=1.49&r2=1.50
13
14 Index: vdr-plugin.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v
17 retrieving revision 1.49
18 retrieving revision 1.50
19 diff -u -r1.49 -r1.50
20 --- vdr-plugin.eclass 16 Aug 2007 17:59:21 -0000 1.49
21 +++ vdr-plugin.eclass 5 Oct 2007 13:56:49 -0000 1.50
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2005 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.49 2007/08/16 17:59:21 zzam Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.50 2007/10/05 13:56:49 zzam Exp $
27 #
28 # Author:
29 # Matthias Schwarzott <zzam@g.o>
30 @@ -73,41 +73,20 @@
31 S="${WORKDIR}/${VDRPLUGIN}-${PV}"
32
33 # depend on headers for DVB-driver
34 -RDEPEND=">=media-tv/gentoo-vdr-scripts-0.3.4-r1"
35 -DEPEND="media-tv/linuxtv-dvb-headers"
36 +DEPEND=">=media-tv/gentoo-vdr-scripts-0.3.8
37 + >=media-tv/vdrplugin-rebuild-0.2
38 + >=app-admin/eselect-vdr-0.0.2
39 + media-tv/linuxtv-dvb-headers"
40
41
42 -# this code is from linux-mod.eclass
43 -update_vdrplugindb() {
44 - local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/
45 -
46 - if [[ ! -f ${VDRPLUGINDB_DIR}/vdrplugindb ]]; then
47 - [[ ! -d ${VDRPLUGINDB_DIR} ]] && mkdir -p ${VDRPLUGINDB_DIR}
48 - touch ${VDRPLUGINDB_DIR}/vdrplugindb
49 - fi
50 - if [[ -z $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then
51 - einfo "Adding plugin to vdrplugindb."
52 - echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${VDRPLUGINDB_DIR}/vdrplugindb
53 - fi
54 -}
55 -
56 -remove_vdrplugindb() {
57 - local VDRPLUGINDB_DIR=${ROOT}/var/lib/vdrplugin-rebuild/
58 -
59 - if [[ -n $(grep ${CATEGORY}/${PN}-${PVR} ${VDRPLUGINDB_DIR}/vdrplugindb) ]]; then
60 - einfo "Removing ${CATEGORY}/${PN}-${PVR} from vdrplugindb."
61 - sed -ie "/.*${CATEGORY}\/${P}.*/d" ${VDRPLUGINDB_DIR}/vdrplugindb
62 - fi
63 -}
64 -
65 # New method of storing plugindb
66 # Called from src_install
67 # file maintained by normal portage-methods
68 create_plugindb_file() {
69 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
70 - local DB_FILE=${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}
71 - insinto ${NEW_VDRPLUGINDB_DIR}
72 - cat <<-EOT > ${D}/${DB_FILE}
73 + local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
74 + insinto "${NEW_VDRPLUGINDB_DIR}"
75 + cat <<-EOT > "${D}/${DB_FILE}"
76 VDRPLUGIN_DB=1
77 CREATOR=ECLASS
78 EBUILD=${CATEGORY}/${PN}
79 @@ -123,20 +102,20 @@
80 delete_orphan_plugindb_file() {
81 #elog Testing for orphaned plugindb file
82 local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
83 - local DB_FILE=${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}
84 + local DB_FILE="${ROOT}/${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
85
86 # file exists
87 [[ -f ${DB_FILE} ]] || return
88
89 # will portage handle the file itself
90 - if grep -q CREATOR=ECLASS ${DB_FILE}; then
91 + if grep -q CREATOR=ECLASS "${DB_FILE}"; then
92 #elog file owned by eclass - don't touch it
93 return
94 fi
95
96 elog "Removing orphaned plugindb-file."
97 elog "\t#rm ${DB_FILE}"
98 - rm ${DB_FILE}
99 + rm "${DB_FILE}"
100 }
101
102
103 @@ -145,14 +124,14 @@
104 # Danger: Not using $ROOT here, as compile will also not use it !!!
105 # If vdr in $ROOT and / differ, plugins will not run anyway
106
107 - insinto ${VDR_CHECKSUM_DIR}
108 + insinto "${VDR_CHECKSUM_DIR}"
109 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
110 - newins ${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}
111 + newins "${VDR_CHECKSUM_DIR}/header-md5-vdr header-md5-${PN}"
112 else
113 if type -p md5sum >/dev/null 2>&1; then
114 - cd ${S}
115 + cd "${S}"
116 (
117 - cd ${VDR_INCLUDE_DIR}
118 + cd "${VDR_INCLUDE_DIR}"
119 md5sum *.h libsi/*.h|LC_ALL=C sort --key=2
120 ) > header-md5-${PN}
121 doins header-md5-${PN}
122 @@ -185,8 +164,8 @@
123 USE_GETTEXT=0
124 fi
125
126 - VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h)
127 - APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' ${VDR_INCLUDE_DIR}/config.h)
128 + VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
129 + APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
130 [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}"
131
132 einfo "Building ${PF} against vdr-${VDRVERSION}"
133 @@ -213,11 +192,11 @@
134 base_src_unpack
135 ;;
136 patchmakefile)
137 - if ! cd ${S}; then
138 + if ! cd "${S}"; then
139 ewarn "There seems to be no plugin-directory with the name ${S##*/}"
140 ewarn "Perhaps you find one among these:"
141 cd "${WORKDIR}"
142 - ewarn "$(/bin/ls -1 ${WORKDIR})"
143 + ewarn "$(/bin/ls -1 "${WORKDIR}")"
144 die "Could not change to plugin-source-directory!"
145 fi
146
147 @@ -265,17 +244,17 @@
148 touch ${WORKDIR}/.vdr-plugin_makefile_patched
149 ;;
150 add_local_patch)
151 - cd ${S}
152 + cd "${S}"
153 if test -d "${VDR_LOCAL_PATCHES_DIR}/${PN}"; then
154 echo
155 einfo "Applying local patches"
156 - for LOCALPATCH in ${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}/*.{diff,patch}; do
157 + for LOCALPATCH in "${VDR_LOCAL_PATCHES_DIR}/${PN}/${PV}"/*.{diff,patch}; do
158 test -f "${LOCALPATCH}" && epatch "${LOCALPATCH}"
159 done
160 fi
161 ;;
162 i18n)
163 - cd ${S}
164 + cd "${S}"
165 if [[ ${USE_GETTEXT} = 0 ]]; then
166 # Remove i18n Target if using older vdr
167 sed -i Makefile \
168 @@ -283,7 +262,7 @@
169 elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then
170 einfo "Converting translations to gettext"
171
172 - local i18n_tool=/usr/share/vdr/bin/i18n-to-gettext.pl
173 + local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl"
174 if [[ ! -x ${i18n_tool} ]]; then
175 eerror "Missing ${i18n_tool}"
176 eerror "Please re-emerge vdr"
177 @@ -292,7 +271,7 @@
178
179 # call i18n-to-gettext tool
180 # take all texts missing tr call into special file
181 - ${i18n_tool} 2>/dev/null \
182 + "${i18n_tool}" 2>/dev/null \
183 |sed -e '/^"/!d' \
184 -e '/^""$/d' \
185 -e 's/\(.*\)/trNOOP(\1)/' \
186 @@ -302,7 +281,7 @@
187 # now the missing calls are listed in
188 # dummy-translations-trNOOP.c
189 if [[ -s dummy-translations-trNOOP.c ]]; then
190 - ${i18n_tool} &>/dev/null
191 + "${i18n_tool}" &>/dev/null
192 fi
193
194 # now use the modified Makefile
195 @@ -316,8 +295,8 @@
196
197 vdr-plugin_copy_source_tree() {
198 pushd . >/dev/null
199 - cp -r ${S} ${T}/source-tree
200 - cd ${T}/source-tree
201 + cp -r "${S}" "${T}"/source-tree
202 + cd "${T}"/source-tree
203 cp "${WORKDIR}"/Makefile.before Makefile
204 sed -i Makefile \
205 -e "s:^DVBDIR.*$:DVBDIR = ${DVB_INCLUDE_DIR}:" \
206 @@ -329,11 +308,11 @@
207
208 vdr-plugin_install_source_tree() {
209 einfo "Installing sources"
210 - destdir=${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}
211 - insinto ${destdir}-${PV}
212 - doins -r ${T}/source-tree/*
213 + destdir="${VDRSOURCE_DIR}/vdr-${VDRVERSION}/PLUGINS/src/${VDRPLUGIN}"
214 + insinto "${destdir}-${PV}"
215 + doins -r "${T}"/source-tree/*
216
217 - dosym ${VDRPLUGIN}-${PV} ${destdir}
218 + dosym "${VDRPLUGIN}-${PV}" "${destdir}"
219 }
220
221 vdr-plugin_src_compile() {
222 @@ -354,7 +333,7 @@
223 eerror "Please report this at bugs.gentoo.org."
224 die "vdr-plugin_src_unpack not called!"
225 fi
226 - cd ${S}
227 + cd "${S}"
228
229 emake ${BUILD_PARAMS} \
230 ${VDRPLUGIN_MAKE_TARGET:-all} \
231 @@ -372,20 +351,20 @@
232 cd "${WORKDIR}"
233
234 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
235 - local mname=${P}-Makefile
236 - cp "${S}"/Makefile ${mname}.patched
237 - cp Makefile.before ${mname}.before
238 + local mname="${P}-Makefile"
239 + cp "${S}"/Makefile "${mname}.patched"
240 + cp Makefile.before "${mname}.before"
241
242 - diff -u ${mname}.before ${mname}.patched > ${mname}.diff
243 + diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
244
245 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
246 - doins ${mname}.diff
247 + doins "${mname}.diff"
248
249 insinto "/usr/share/vdr/maintainer-data/makefile-before"
250 - doins ${mname}.before
251 + doins "${mname}.before"
252
253 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
254 - doins ${mname}.patched
255 + doins "${mname}.patched"
256
257 fi
258
259 @@ -426,99 +405,30 @@
260 create_plugindb_file
261 }
262
263 -vdr-plugin_pkg_postinst() {
264 - if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
265 - update_vdrplugindb
266 - fi
267 - elog
268 - elog "The vdr plugin ${VDRPLUGIN} has now been installed."
269 - elog "To activate execute the following command:"
270 +vdr-plugin_print_enable_command() {
271 + ewarn "emerge --config ${PN} is deprecated"
272 elog
273 - elog " emerge --config ${PN}"
274 + elog "To activate this vdr-plugin execute the following command:"
275 + elog "\teselect vdr-plugin enable ${PN#vdr-}"
276 elog
277 +}
278 +
279 +vdr-plugin_pkg_postinst() {
280 + vdr-plugin_print_enable_command
281 +
282 if [[ -n "${VDR_CONFD_FILE}" ]]; then
283 - elog "And have a look at the config-file"
284 - elog "/etc/conf.d/vdr.${VDRPLUGIN}"
285 + elog "Please have a look at the config-file"
286 + elog "\t/etc/conf.d/vdr.${VDRPLUGIN}"
287 elog
288 fi
289 }
290
291 vdr-plugin_pkg_postrm() {
292 - if has_version "<=media-tv/vdrplugin-rebuild-0.1"; then
293 - remove_vdrplugindb
294 - fi
295 delete_orphan_plugindb_file
296 }
297
298 -vdr-plugin_pkg_config_final() {
299 - diff ${conf_orig} ${conf}
300 - rm ${conf_orig}
301 -}
302 -
303 -vdr-plugin_pkg_config_old() {
304 - elog "Using interface of gentoo-vdr-scripts-0.3.6 and older"
305 - if [[ -z "${INSTALLPLUGIN}" ]]; then
306 - INSTALLPLUGIN="${VDRPLUGIN}"
307 - fi
308 - # First test if plugin is already inside PLUGINS
309 - local conf=/etc/conf.d/vdr
310 - conf_orig=${conf}.before_emerge_config
311 - cp ${conf} ${conf_orig}
312 -
313 - elog "Reading ${conf}"
314 - if ! grep -q "^PLUGINS=" ${conf}; then
315 - local LINE=$(sed ${conf} -n -e '/^#.*PLUGINS=/=' | tail -n 1)
316 - if [[ -n "${LINE}" ]]; then
317 - sed -e ${LINE}'a PLUGINS=""' -i ${conf}
318 - else
319 - echo 'PLUGINS=""' >> ${conf}
320 - fi
321 - unset LINE
322 - fi
323 -
324 - unset PLUGINS
325 - PLUGINS=$(source /etc/conf.d/vdr; echo ${PLUGINS})
326 -
327 - active=0
328 - for p in ${PLUGINS}; do
329 - if [[ "${p}" == "${INSTALLPLUGIN}" ]]; then
330 - active=1
331 - break;
332 - fi
333 - done
334 -
335 - if [[ "${active}" == "1" ]]; then
336 - elog "${INSTALLPLUGIN} already activated"
337 - echo
338 - read -p "Do you want to deactivate ${INSTALLPLUGIN} (yes/no) " answer
339 - if [[ "${answer}" != "yes" ]]; then
340 - elog "aborted"
341 - return
342 - fi
343 - elog "Removing ${INSTALLPLUGIN} from active plugins."
344 - local LINE=$(sed ${conf} -n -e '/^PLUGINS=.*\<'${INSTALLPLUGIN}'\>/=' | tail -n 1)
345 - sed -i ${conf} -e ${LINE}'s/\<'${INSTALLPLUGIN}'\>//' \
346 - -e ${LINE}'s/ \( \)*/ /g' \
347 - -e ${LINE}'s/ "/"/g' \
348 - -e ${LINE}'s/" /"/g'
349 -
350 - vdr-plugin_pkg_config_final
351 - return
352 - fi
353 -
354 -
355 - elog "Adding ${INSTALLPLUGIN} to active plugins."
356 - local LINE=$(sed ${conf} -n -e '/^PLUGINS=/=' | tail -n 1)
357 - sed -i ${conf} -e ${LINE}'s/^PLUGINS=" *\(.*\)"/PLUGINS="\1 '${INSTALLPLUGIN}'"/' \
358 - -e ${LINE}'s/ \( \)*/ /g' \
359 - -e ${LINE}'s/ "/"/g' \
360 - -e ${LINE}'s/" /"/g'
361 -
362 - vdr-plugin_pkg_config_final
363 -}
364 -
365 -vdr-plugin_pkg_config_new() {
366 - elog "Using interface introduced with gentoo-vdr-scripts-0.3.7"
367 +vdr-plugin_pkg_config_legacy() {
368 + elog "Using old interface to gentoo-vdr-scripts-0.3.7"
369 if [[ -z "${INSTALLPLUGIN}" ]]; then
370 INSTALLPLUGIN="${VDRPLUGIN}"
371 fi
372 @@ -556,11 +466,10 @@
373 }
374
375 vdr-plugin_pkg_config() {
376 - if has_version ">media-tv/gentoo-vdr-scripts-0.3.6"; then
377 - vdr-plugin_pkg_config_new
378 - else
379 - vdr-plugin_pkg_config_old
380 - fi
381 + vdr-plugin_print_enable_command
382 +
383 + einfo "Calling this now"
384 + eselect vdr-plugin enable "${PN#vdr-}"
385 }
386
387 fix_vdr_libsi_include()
388
389
390
391 --
392 gentoo-commits@g.o mailing list