Gentoo Archives: gentoo-dev

From: Martin Dummer <martin.dummer@×××.net>
To: gentoo-dev@l.g.o
Cc: Joerg Bornkessel <hd_brummy@g.o>
Subject: [gentoo-dev] [PATCH] vdr-plugin-2.eclass: add EAPI8 support, EAPI7+ fixes
Date: Sun, 27 Jun 2021 15:50:52
Message-Id: e31a53a2-4541-d7c2-9ed7-5504fa2c980d@gmx.net
In Reply to: Re: [gentoo-dev] vdr-plugin-2.eclass QA fix, please review, bug 778815 by Sam James
1 please review and comment.
2
3 I will open a github PR for code changes later.
4
5
6 From d5f6916d7fdd194e0c2ab11eea0d48ecb01d122c Mon Sep 17 00:00:00 2001
7
8 From: Martin Dummer <martin.dummer@×××.net>
9 Date: Sun, 27 Jun 2021 17:05:23 +0200
10 Subject: [PATCH] vdr-plugin-2.eclass: add EAPI8 support, EAPI7+ fixes
11
12 - add EAPI8 support, no changes necessary
13 - add BDEPEND=pkgconfig
14 - remove outdated version numbers from (R)DEPEND
15 - fix calling of pkg-config
16 - add many "|| die" which should have been here already for EAPI7
17
18 Signed-off-by: Martin Dummer <martin.dummer@×××.net>
19 ---
20  eclass/vdr-plugin-2.eclass | 53 ++++++++++++++++++++++----------------
21  1 file changed, 31 insertions(+), 22 deletions(-)
22
23 diff --git a/eclass/vdr-plugin-2.eclass b/eclass/vdr-plugin-2.eclass
24 index 3f3acc41208..41e43ff34ee 100644
25 --- a/eclass/vdr-plugin-2.eclass
26 +++ b/eclass/vdr-plugin-2.eclass
27 @@ -76,7 +76,7 @@
28  inherit flag-o-matic toolchain-funcs unpacker
29  
30  case ${EAPI:-0} in
31 -       5|6|7)
32 +       5|6|7|8)
33         ;;
34         *) die "EAPI ${EAPI} unsupported."
35         ;;
36 @@ -97,10 +97,11 @@ DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on
37 vdr-plugin-2.eclass)"
38  S="${WORKDIR}/${VDRPLUGIN}-${PV}"
39  
40  # depend on headers for DVB-driver and vdr-scripts
41 -DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
42 +BDEPEND="dev-util/pkgconfig"
43 +DEPEND="media-tv/gentoo-vdr-scripts
44         virtual/linuxtv-dvb-headers"
45 -RDEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
46 -       >=app-eselect/eselect-vdr-0.0.2"
47 +RDEPEND="media-tv/gentoo-vdr-scripts
48 +       app-eselect/eselect-vdr"
49  
50  if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
51         IUSE="${IUSE} vdr"
52 @@ -151,7 +152,7 @@ vdr_create_header_checksum_file() {
53         local CHKSUM="header-md5-vdr"
54  
55         if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
56 -               cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
57 +               cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}" ||
58 die "Could not copy header-md5-vdr"
59         elif type -p md5sum >/dev/null 2>&1; then
60                 (
61                         cd "${VDR_INCLUDE_DIR}"
62 @@ -179,7 +180,8 @@ fix_vdr_libsi_include() {
63         for f; do
64                 sed -i "${f}" \
65                         -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
66 -                       -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
67 +                       -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:' \
68 +                       || die "sed failed while fixing include of
69 libsi-headers"
70         done
71  }
72  
73 @@ -192,7 +194,7 @@ fix_vdr_libsi_include() {
74  vdr_patchmakefile() {
75         einfo "Patching Makefile"
76         [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
77 -       cp Makefile "${WORKDIR}"/Makefile.before
78 +       cp Makefile "${WORKDIR}"/Makefile.before || die "Failed to copy
79 Makefile"
80  
81         # plugin makefiles use VDRDIR in strange ways
82         # assumptions:
83 @@ -216,14 +218,16 @@ vdr_patchmakefile() {
84                 -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
85                 \
86                 -e 's:-I$(DVBDIR)/include::' \
87 -               -e 's:-I$(DVBDIR)::'
88 +               -e 's:-I$(DVBDIR)::' \
89 +               || die "sed failed to set \$VDRDIR"
90  
91         if ! grep -q APIVERSION Makefile; then
92                 ebegin "  Converting to APIVERSION"
93                 sed -i Makefile \
94                         -e 's:^APIVERSION = :APIVERSION ?= :' \
95                         -e
96 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
97 -                       -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne
98 '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
99 +                       -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne
100 '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"'
101 $(VDRDIR)/config.h)' \
102 +                       || die "sed failed to change APIVERSION"
103                 eend $?
104         fi
105  
106 @@ -231,13 +235,15 @@ vdr_patchmakefile() {
107         # Do not overwrite CXXFLAGS, add LDFLAGS if missing
108         sed -i Makefile \
109                 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
110 -               -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
111 +               -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:' \
112 +               || die "sed failed to fix compile-flags"
113  
114         # Disabling file stripping, the package manager takes care of it
115         sed -i Makefile \
116                 -e '/@.*strip/d' \
117                 -e '/strip \$(LIBDIR)\/\$@/d' \
118 -               -e 's/STRIP.*=.*$/STRIP = true/'
119 +               -e 's/STRIP.*=.*$/STRIP = true/' \
120 +               || die "sed failed to fix file stripping"
121  
122         # Use a file instead of a variable as single-stepping via ebuild
123         # destroys environment.
124 @@ -318,14 +324,15 @@ vdr_i18n() {
125                 if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
126                         eqawarn "Forced to keep i18n.o"
127                 else
128 -                       sed -i "s:i18n.o::g" Makefile
129 +                       sed -i "s:i18n.o::g" Makefile || die "sed failed
130 to remove i18n from Makefile"
131                         eqawarn "OBJECT i18n.o found, removed per sed"
132                 fi
133         fi
134  
135         local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
136         if [[ -n ${I18N_STRING} ]]; then
137 -               sed -i
138 "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const
139 tI18nPhrase:" i18n.h
140 +               sed -i
141 "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const
142 tI18nPhrase:" i18n.h \
143 +                       || die "sed failed to replace tI18nPhrase"
144                 eqawarn "obsolete tI18nPhrase found, disabled per sed,
145 please recheck"
146         fi
147  }
148 @@ -341,7 +348,8 @@ vdr_remove_i18n_include() {
149         local f
150         for f; do
151                 sed -i "${f}" \
152 -               -e "s:^#include[[:space:]]*\"i18n.h\"://:"
153 +               -e "s:^#include[[:space:]]*\"i18n.h\"://:" \
154 +               || die "sed failed to remove i18n_include"
155         done
156  
157         eqawarn "removed i18n.h include in ${@}"
158 @@ -393,7 +401,8 @@ vdr-plugin-2_pkg_setup() {
159         append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
160 -D_LARGEFILE64_SOURCE
161  
162         # Where should the plugins live in the filesystem
163 -       VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr)
164 +       local PKG__CONFIG=$(tc-getPKG_CONFIG)
165 +       VDR_PLUGIN_DIR=$($PKG__CONFIG --variable=libdir vdr)
166  
167         VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
168  
169 @@ -405,7 +414,7 @@ vdr-plugin-2_pkg_setup() {
170  
171         TMP_LOCALE_DIR="${T}/tmp-locale"
172  
173 -       LOCDIR=$(pkg-config --variable=locdir vdr)
174 +       LOCDIR=$($PKG__CONFIG --variable=locdir vdr)
175  
176         if ! has_vdr; then
177                 # set to invalid values to detect abuses
178 @@ -422,7 +431,7 @@ vdr-plugin-2_pkg_setup() {
179         fi
180  
181         VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}'
182 "${VDR_INCLUDE_DIR}"/config.h)
183 -       APIVERSION=$(pkg-config --variable=apiversion vdr)
184 +       APIVERSION=$($PKG__CONFIG --variable=apiversion vdr)
185  
186         einfo "Compiling against"
187         einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
188 @@ -551,10 +560,11 @@ vdr-plugin-2_src_install() {
189  
190         if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
191                 local mname="${P}-Makefile"
192 -               cp "${S}"/Makefile "${mname}.patched"
193 -               cp Makefile.before "${mname}.before"
194 +               cp "${S}"/Makefile "${mname}.patched" || die "could not
195 copy to Makefile.patched"
196 +               cp Makefile.before "${mname}.before" || die "could not
197 copy to Makefile.before"
198  
199                 diff -u "${mname}.before" "${mname}.patched" >
200 "${mname}.diff"
201 +               [[ $? -ge 2 ]] && die "problem with diff"
202  
203                 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
204                 doins "${mname}.diff"
205 @@ -564,7 +574,6 @@ vdr-plugin-2_src_install() {
206  
207                 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
208                 doins "${mname}.patched"
209 -
210         fi
211  
212         cd "${S}" || die "could not change to plugin source directory
213 (src_install)"
214 @@ -589,11 +598,11 @@ vdr-plugin-2_src_install() {
215                 local linguas
216                 for linguas in ${LINGUAS[*]}; do
217                 insinto "${LOCDIR}"
218 -               cp -r --parents ${linguas}* ${D%/}/${LOCDIR}
219 +               cp -r --parents ${linguas}* ${D%/}/${LOCDIR} || die
220 "could not copy linguas files"
221                 done
222         fi
223  
224 -       cd "${D%/}/usr/$(get_libdir)/vdr/plugins" || die "could not
225 change to D/usr/libdir/vdr/plugins"
226 +       cd "${D%/}/usr/$(get_libdir)/vdr/plugins" || die "could not
227 change to \$D/usr/libdir/vdr/plugins"
228  
229         # create list of all created plugin libs
230         vdr_plugin_list=""
231 --
232 2.32.0

Replies