[oe] [PATCH 07/41] gnome-help.bbclass: Handle gnome-help files with new distro feature 'helpfiles'
Andreas Müller
schnitzeltony at gmail.com
Thu May 23 06:48:25 UTC 2019
Gnome help file generation cannot be configured so handle files properly
* Add a new distro feature 'helpfiles':
If set: split help file into ${PN}-help-*
If not set: delete help files on installation
* Append ${PN}-help-.* to PACKAGES_DYNAMIC
Once accepted / applied it takes a on-line patch to add help files based on
IMAGE_LINGUAS.
Signed-off-by: Andreas Müller <schnitzeltony at gmail.com>
---
meta-gnome/classes/gnome-help.bbclass | 71 +++++++++++++++++++++++++++
meta-gnome/conf/layer.conf | 3 ++
2 files changed, 74 insertions(+)
create mode 100644 meta-gnome/classes/gnome-help.bbclass
diff --git a/meta-gnome/classes/gnome-help.bbclass b/meta-gnome/classes/gnome-help.bbclass
new file mode 100644
index 000000000..3d45465fc
--- /dev/null
+++ b/meta-gnome/classes/gnome-help.bbclass
@@ -0,0 +1,71 @@
+# Class to pack or delete gnome help files
+# For 'helpfiles' not in DISTRO_FEATURES: delete help files
+# else pack help files in ${PN}-help-<lingua>
+
+# default location
+GNOME_HELP_FILES ??= "${datadir}/help"
+
+FILES_${PN}-help = "${datadir}/*/translations"
+
+HELPBASEPN ??= "${PN}"
+
+# Dummy to get yelp build
+PACKAGES_append = " ${HELPBASEPN}-help"
+RRECOMMENDS_${HELPBASEPN}-help = "${@bb.utils.contains('DISTRO_FEATURES','helpfiles','yelp','',d)}"
+
+do_install_append() {
+ if ${@bb.utils.contains('DISTRO_FEATURES','helpfiles','false','true',d)}; then
+ rm -rf ${D}${datadir}/help*
+ fi
+}
+
+python gnome_do_split_help() {
+ if bb.utils.contains('DISTRO_FEATURES', 'helpfiles', False, True, d):
+ return
+
+ if (d.getVar('PACKAGE_NO_LOCALE') == '1'):
+ bb.debug(1, "package requested not splitting locales")
+ return
+
+ packages = (d.getVar('PACKAGES') or "").split()
+
+ datadir = d.getVar('datadir')
+ if not datadir:
+ bb.note("datadir not defined")
+ return
+
+ dvar = d.getVar('PKGD')
+ pn = d.getVar('HELPBASEPN')
+
+ if pn + '-help' in packages:
+ packages.remove(pn + '-help')
+
+ helpdir = os.path.join(dvar + datadir, 'help')
+
+ if not cpath.isdir(helpdir):
+ bb.debug(1, "No help files in this package")
+ return
+
+ helps = os.listdir(helpdir)
+
+ summary = d.getVar('SUMMARY') or pn
+ description = d.getVar('DESCRIPTION') or ""
+ locale_section = d.getVar('LOCALE_SECTION')
+ mlprefix = d.getVar('MLPREFIX') or ""
+ for l in sorted(helps):
+ ln = legitimize_package_name(l)
+ pkg = pn + '-help-' + ln
+ packages.append(pkg)
+ d.setVar('FILES_' + pkg, os.path.join(datadir, 'help', l))
+ d.setVar('RRECOMMENDS_' + pkg, '%syelp' % mlprefix)
+ d.setVar('SUMMARY_' + pkg, '%s - %s help' % (summary, l))
+ d.setVar('DESCRIPTION_' + pkg, '%s This package contains language help files for the %s locale.' % (description, l))
+ if locale_section:
+ d.setVar('SECTION_' + pkg, locale_section)
+
+ d.setVar('PACKAGES', ' '.join(packages))
+
+}
+
+PACKAGESPLITFUNCS_prepend = "gnome_do_split_help "
+
diff --git a/meta-gnome/conf/layer.conf b/meta-gnome/conf/layer.conf
index 0b68232de..75e8d3225 100644
--- a/meta-gnome/conf/layer.conf
+++ b/meta-gnome/conf/layer.conf
@@ -19,3 +19,6 @@ LAYERSERIES_COMPAT_gnome-layer = "thud warrior"
# Sanity check for meta-gnome layer.
# Setting SKIP_META_GNOME_SANITY_CHECK to "1" would skip the bbappend files check.
INHERIT += "sanity-meta-gnome"
+
+# Help files
+PACKAGES_DYNAMIC_append = " ^${PN}-help-.*"
--
2.20.1
More information about the Openembedded-devel
mailing list