[oe] [PATCH 1/2] gnome-help.bbclass: Handle gnome-help files with new distro feature 'helpfiles'
Khem Raj
raj.khem at gmail.com
Sun Oct 27 06:08:09 UTC 2019
On Sat, Oct 26, 2019 at 11:34 AM Andreas Müller <schnitzeltony at gmail.com> wrote:
>
> Now that we can build gnome help files, let our users decide what to do with
> them:
>
> if 'helpfiles' not in DISTRO_FEATURES
> delete all help contents during install
> else
> if PACKAGE_NO_HELP_SPLIT == 1
> pack all help files to ${PN}-help
> else
> pack help files to ${PN}-help-<lingua>
>
> Signed-off-by: Andreas Müller <schnitzeltony at gmail.com>
> ---
> meta-gnome/classes/gnome-help.bbclass | 69 +++++++++++++++++++++++++++
> meta-gnome/conf/layer.conf | 3 ++
> 2 files changed, 72 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..967091ba4
> --- /dev/null
> +++ b/meta-gnome/classes/gnome-help.bbclass
> @@ -0,0 +1,69 @@
> +# Class to pack gnome help files or delete them during install
> +# There are the following cases:
> +#
> +# if 'helpfiles' not in DISTRO_FEATURES
> +# delete all help contants during install
> +# else
> +# if PACKAGE_NO_HELP_SPLIT == 1
> +# pack all help files to ${PN}-help
> +# else
> +# pack all help files to ${PN}-help-<lingua>
> +
> +FILES_${PN}-help = "${datadir}/*/translations"
> +
> +# Dummy to get yelp build & PACKAGE_NO_HELP_SPLIT set 1
> +PACKAGES_append = " ${PN}-help"
> +FILES_${PN}-help = "${datadir}/help"
> +RRECOMMENDS_${PN}-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_HELP_SPLIT') == '1'):
> + # all help files go to ${
> + bb.debug(1, "package requested not splitting help-files")
> + return
> +
> + packages = (d.getVar('PACKAGES') or "").split()
> + datadir = d.getVar('datadir')
> + dvar = d.getVar('PKGD')
> + pn = d.getVar('PN')
> +
> + if pn + '-help' in packages:
> + packages.remove(pn + '-help')
> +
> + helpdir = os.path.join(dvar + datadir, 'help')
> +
> + if not cpath.isdir(helpdir):
> + bb.warn("No help files in this package - remove gnome-help from inherit?")
> + 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 862d622ee..c4d4574bc 100644
> --- a/meta-gnome/conf/layer.conf
> +++ b/meta-gnome/conf/layer.conf
> @@ -15,3 +15,6 @@ LAYERVERSION_gnome-layer = "1"
> LAYERDEPENDS_gnome-layer = "core openembedded-layer networking-layer"
>
> LAYERSERIES_COMPAT_gnome-layer = "thud warrior zeus"
> +
> +# GNOME Help files
> +PACKAGES_DYNAMIC_append = " ^${PN}-help-.*"
if we put this in layer.conf it will appear at global config meta
data, since it remains pertinent to gnome
perhaps its best to add it in gnome related bbclass maybe
> --
> 2.21.0
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
More information about the Openembedded-devel
mailing list