Gentoo Archives: gentoo-dev

From: Martin Dummer <martin.dummer@×××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Please review changes for vdr-plugin-2.eclass
Date: Tue, 22 Jun 2021 09:12:38
Message-Id: 7a13eb4b-93c6-5338-f3cf-44152596a08f@gmx.net
In Reply to: [gentoo-dev] Please review changes for vdr-plugin-2.eclass by Martin Dummer
1 Am 17.05.21 um 18:11 schrieb Martin Dummer:
2 > So please take a view on the intended changes to  vdr-plugin-2.eclass -
3 > add documentation to satisfy pkgcheck.
4 >
5 > It is placed here:
6 >
7 > https://github.com/gentoo/gentoo/pull/20845
8 >
9
10 Due to very little feedback I post here the intended changes to
11 vdr-plugin-2.eclass on the dev mailing list.
12
13 Please take a look. If some devs with github accounts could add a review
14 or approval on the pull request, this would be nice.
15
16 ==============================================================================================
17
18 commit b19db356742510f880ab1b2d9840043c95cca768
19 Author: Martin Dummer <martin.dummer@×××.net>
20 Date:   2021-05-17 01:15:33 +0200
21
22     vdr-plugin-2.eclass: fix pkgcheck findings in documentation
23    
24     Add documentation to eclass functions and variables as found by
25 pkgcheck,
26     no functional changes.
27    
28     pkgcheck reported:
29     EclassDocMissingFunc: vdr-plugin-2: undocumented functions: has_vdr,
30       vdr-plugin-2_print_enable_command, vdr-plugin-2_src_util,
31       vdr_create_header_checksum_file, vdr_create_plugindb_file,
32 vdr_detect_po_dir,
33       vdr_gettext_missing, vdr_i18n, vdr_linguas_support, vdr_patchmakefile
34     EclassDocMissingVar: vdr-plugin-2: undocumented variables:
35 COMMON_DEPEND, VDRPLUGIN
36    
37     Signed-off-by: Martin Dummer <martin.dummer@×××.net>
38
39 diff --git a/eclass/vdr-plugin-2.eclass b/eclass/vdr-plugin-2.eclass
40 index e2aee26c423..187114438df 100644
41 --- a/eclass/vdr-plugin-2.eclass
42 +++ b/eclass/vdr-plugin-2.eclass
43 @@ -14,6 +14,12 @@
44  # @DESCRIPTION:
45  # Eclass for easing maintenance of vdr plugin ebuilds
46  
47 +# @ECLASS-VARIABLE: VDRPLUGIN
48 +# @INTERNAL
49 +# @DESCRIPTION:
50 +# The name of the vdr plugin, plain name without "vdr-" or "plugin"
51 prefix or suffix.
52 +# This variable is derived from ${PN}
53 +
54  # @ECLASS-VARIABLE: VDR_CONFD_FILE
55  # @DEFAULT_UNSET
56  # @DESCRIPTION:
57 @@ -54,28 +60,6 @@
58  # PO_SUBDIR="bla foo/bla"
59  # @CODE
60  
61 -# @FUNCTION: fix_vdr_libsi_include
62 -# @DESCRIPTION:
63 -# Plugins failed on compile with wrong path of libsi includes,
64 -# this can be fixed by 'function + space separated list of files'
65 -#
66 -# Example:
67 -# @CODE
68 -# fix_vdr_libsi_include bla.c foo.c
69 -# @CODE
70 -
71 -# @FUNCTION: vdr_remove_i18n_include
72 -# @DESCRIPTION:
73 -# Compile will fail if plugin still use the old i18n language handling,
74 -# most parts are fixed by vdr-plugin-2.eclass internal functions itself.
75 -# Remove unneeded i18.n includes from files, if they are still wrong there,
76 -# this can be fixed by 'function + space separated list of files"
77 -#
78 -# Example:
79 -# @CODE
80 -# vdr_remove_i18n_include bla.n foo.n
81 -# @CODE
82 -
83  # Applying your own local/user patches:
84  # This is done by using the
85  # (EAPI = 5) epatch_user() function of the eutils.eclass,
86 @@ -112,12 +96,10 @@ DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on
87 vdr-plugin-2.eclass)"
88  # Works in most cases
89  S="${WORKDIR}/${VDRPLUGIN}-${PV}"
90  
91 -# depend on headers for DVB-driver
92 -COMMON_DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2"
93 -
94 -DEPEND="${COMMON_DEPEND}
95 +# depend on headers for DVB-driver and vdr-scripts
96 +DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
97         virtual/linuxtv-dvb-headers"
98 -RDEPEND="${COMMON_DEPEND}
99 +RDEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
100         >=app-eselect/eselect-vdr-0.0.2"
101  
102  if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
103 @@ -126,9 +108,13 @@ if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
104         RDEPEND="vdr? ( ${RDEPEND} )"
105  fi
106  
107 +# @FUNCTION: vdr_create_plugindb_file
108 +# @INTERNAL
109 +# @USAGE: <plugin name> [more plugin names]
110 +# @DESCRIPTION:
111  # New method of storing plugindb
112 -#   Called from src_install
113 -#   file maintained by normal portage-methods
114 +# Called from src_install
115 +# file maintained by normal portage-methods
116  vdr_create_plugindb_file() {
117         local NEW_VDRPLUGINDB_DIR=/usr/share/vdr/vdrplugin-rebuild/
118         local DB_FILE="${NEW_VDRPLUGINDB_DIR}/${CATEGORY}-${PF}"
119 @@ -151,6 +137,13 @@ vdr_create_plugindb_file() {
120         } > "${D%/}/${DB_FILE}"
121  }
122  
123 +# @FUNCTION: vdr_create_header_checksum_file
124 +# @USAGE:
125 +# @INTERNAL
126 +# @DESCRIPTION:
127 +# Create a file with md5 checksums of .h header files of the plugin
128 being compiled.
129 +# The checksum files are used to detect if a plugin is compiled against
130 the current
131 +# vdr binary.
132  vdr_create_header_checksum_file() {
133         # Danger: Not using $ROOT here, as compile will also not use it !!!
134         # If vdr in $ROOT and / differ, plugins will not run anyway
135 @@ -175,6 +168,11 @@ vdr_create_header_checksum_file() {
136         done
137  }
138  
139 +# @FUNCTION: fix_vdr_libsi_include
140 +# @USAGE: <filename> [more filenames]
141 +# @DESCRIPTION:
142 +# Plugins failed on compile with wrong path of libsi includes,
143 +# this can be fixed by 'function + space separated list of files'
144  fix_vdr_libsi_include() {
145         eqawarn "Fixing include of libsi-headers"
146         local f
147 @@ -185,6 +183,12 @@ fix_vdr_libsi_include() {
148         done
149  }
150  
151 +# @FUNCTION: vdr_patchmakefile
152 +# @USAGE:
153 +# @INTERNAL
154 +# @DESCRIPTION:
155 +# fix Makefile of the plugin for common mistakes often made by the
156 authors or fix
157 +# missing things introduced with new vdr versions
158  vdr_patchmakefile() {
159         einfo "Patching Makefile"
160         [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
161 @@ -240,6 +244,11 @@ vdr_patchmakefile() {
162         touch "${WORKDIR}"/.vdr-plugin_makefile_patched
163  }
164  
165 +# @FUNCTION: vdr_gettext_missing
166 +# @USAGE:
167 +# @INTERNAL
168 +# @DESCRIPTION:
169 +# emit a warning when a plugin is using the old localization methods
170  vdr_gettext_missing() {
171         # plugins without converting to gettext
172  
173 @@ -249,10 +258,13 @@ vdr_gettext_missing() {
174         fi
175  }
176  
177 +# @FUNCTION: vdr_detect_po_dir
178 +# @INTERNAL
179 +# @USAGE:
180 +# @DESCRIPTION:
181 +# helper function to find the
182 +# DIR ${S}/po or DIR ${S]/_subdir_/po
183  vdr_detect_po_dir() {
184 -#      helper function to find the
185 -#      DIR ${S}/po or DIR ${S]/_subdir_/po
186 -
187         [[ -f po ]] && local po_dir="${S}"
188         local po_subdir=( ${S}/${PO_SUBDIR} )
189         local f
190 @@ -260,10 +272,14 @@ vdr_detect_po_dir() {
191         pofile_dir=( ${po_dir} ${po_subdir[*]} )
192  }
193  
194 +# @FUNCTION: vdr_linguas_support
195 +# @INTERNAL
196 +# @USAGE:
197 +# @DESCRIPTION:
198 +# Patching Makefile for linguas support.
199 +# Only locales, enabled through the LINGUAS (make.conf) variable will be
200 +# compiled and installed.
201  vdr_linguas_support() {
202 -#      Patching Makefile for linguas support.
203 -#      Only locales, enabled through the LINGUAS (make.conf) variable
204 will be
205 -#      compiled and installed.
206  
207         einfo "Patching for Linguas support"
208         einfo "available Languages for ${P} are:"
209 @@ -284,13 +300,16 @@ vdr_linguas_support() {
210         strip-linguas ${PLUGIN_LINGUAS} en
211  }
212  
213 +# @FUNCTION: vdr_i18n
214 +# @INTERNAL
215 +# @USAGE:
216 +# @DESCRIPTION:
217 +# i18n handling was deprecated since >=media-video/vdr-1.5.9,
218 +# finally with >=media-video/vdr-1.7.27 it has been dropped entirely
219 and some
220 +# plugins will fail to compile because they're still using the old variant.
221 +# Simply remove the i18n.o object from Makefile (OBJECT) and
222 +# remove "static const tI18nPhrase*" from i18n.h.
223  vdr_i18n() {
224 -#      i18n handling was deprecated since >=media-video/vdr-1.5.9,
225 -#      finally with >=media-video/vdr-1.7.27 it has been dropped
226 entirely and some
227 -#      plugins will fail to compile because they're still using the old
228 variant.
229 -#      Simply remove the i18n.o object from Makefile (OBJECT) and
230 -#      remove "static const tI18nPhrase*" from i18n.h.
231 -
232         vdr_gettext_missing
233  
234         local I18N_OBJECT=$( grep i18n.o Makefile )
235 @@ -311,9 +330,14 @@ vdr_i18n() {
236         fi
237  }
238  
239 +# @FUNCTION: vdr_remove_i18n_include
240 +# @USAGE: <filename> [more filenames]
241 +# @DESCRIPTION:
242 +# Compile will fail if plugin still use the old i18n language handling,
243 +# most parts are fixed by vdr-plugin-2.eclass internal functions itself.
244 +# Remove unneeded i18n.h includes from files, if they are still wrong
245 there,
246 +# this can be fixed by this function with a space separated list of files
247  vdr_remove_i18n_include() {
248 -       # remove uneeded i18.n includes
249 -
250         local f
251         for f; do
252                 sed -i "${f}" \
253 @@ -323,6 +347,11 @@ vdr_remove_i18n_include() {
254         eqawarn "removed i18n.h include in ${@}"
255  }
256  
257 +# @FUNCTION: vdr-plugin-2_print_enable_command
258 +# @INTERNAL
259 +# @USAGE:
260 +# @DESCRIPTION:
261 +# print out a hint how to enable this plugin
262  vdr-plugin-2_print_enable_command() {
263         local p_name c=0 l=""
264         for p_name in ${vdr_plugin_list}; do
265 @@ -340,6 +369,12 @@ vdr-plugin-2_print_enable_command() {
266         elog
267  }
268  
269 +# @FUNCTION: has_vdr
270 +# @INTERNAL
271 +# @USAGE:
272 +# @RETURN: 0=header file found   1=header file not found
273 +# @DESCRIPTION:
274 +# safety check if vdr header file exists
275  has_vdr() {
276         [[ -f "${VDR_INCLUDE_DIR}"/config.h ]]
277  }
278 @@ -401,6 +436,10 @@ vdr-plugin-2_pkg_setup() {
279         fi
280  }
281  
282 +# @FUNCTION: vdr-plugin-2_src_util
283 +# @USAGE: [ list of wanted eclass helper functions to call ]
284 +# @DESCRIPTION:
285 +# wrapper function to call other functions in this eclass
286  vdr-plugin-2_src_util() {
287         while [ "$1" ]; do
288                 case "$1" in