diff options
author | Andreas Müller <schnitzeltony@gmail.com> | 2019-10-28 00:35:31 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-10-27 23:10:00 -0700 |
commit | 5cd17f68fcc4f5bd7807172eda4cf24c5f3e8aae (patch) | |
tree | d6dbfc9d8ef0d128cd0a2255e9fe7ca752d63abe | |
parent | 8f2a81bbfec19b5f56c6753afdf172241628d8c2 (diff) | |
download | meta-openembedded-5cd17f68fcc4f5bd7807172eda4cf24c5f3e8aae.tar.gz |
gnome-help.bbclass: Handle gnome-help files with new distro feature 'helpfiles'
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@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-gnome/classes/gnome-help.bbclass | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/meta-gnome/classes/gnome-help.bbclass b/meta-gnome/classes/gnome-help.bbclass new file mode 100644 index 0000000000..967091ba45 --- /dev/null +++ b/meta-gnome/classes/gnome-help.bbclass | |||
@@ -0,0 +1,69 @@ | |||
1 | # Class to pack gnome help files or delete them during install | ||
2 | # There are the following cases: | ||
3 | # | ||
4 | # if 'helpfiles' not in DISTRO_FEATURES | ||
5 | # delete all help contants during install | ||
6 | # else | ||
7 | # if PACKAGE_NO_HELP_SPLIT == 1 | ||
8 | # pack all help files to ${PN}-help | ||
9 | # else | ||
10 | # pack all help files to ${PN}-help-<lingua> | ||
11 | |||
12 | FILES_${PN}-help = "${datadir}/*/translations" | ||
13 | |||
14 | # Dummy to get yelp build & PACKAGE_NO_HELP_SPLIT set 1 | ||
15 | PACKAGES_append = " ${PN}-help" | ||
16 | FILES_${PN}-help = "${datadir}/help" | ||
17 | RRECOMMENDS_${PN}-help = "${@bb.utils.contains('DISTRO_FEATURES','helpfiles','yelp','',d)}" | ||
18 | |||
19 | do_install_append() { | ||
20 | if ${@bb.utils.contains('DISTRO_FEATURES','helpfiles','false','true',d)}; then | ||
21 | rm -rf ${D}${datadir}/help/* | ||
22 | fi | ||
23 | } | ||
24 | |||
25 | python gnome_do_split_help() { | ||
26 | if bb.utils.contains('DISTRO_FEATURES', 'helpfiles', False, True, d): | ||
27 | return | ||
28 | |||
29 | if (d.getVar('PACKAGE_NO_HELP_SPLIT') == '1'): | ||
30 | # all help files go to ${ | ||
31 | bb.debug(1, "package requested not splitting help-files") | ||
32 | return | ||
33 | |||
34 | packages = (d.getVar('PACKAGES') or "").split() | ||
35 | datadir = d.getVar('datadir') | ||
36 | dvar = d.getVar('PKGD') | ||
37 | pn = d.getVar('PN') | ||
38 | |||
39 | if pn + '-help' in packages: | ||
40 | packages.remove(pn + '-help') | ||
41 | |||
42 | helpdir = os.path.join(dvar + datadir, 'help') | ||
43 | |||
44 | if not cpath.isdir(helpdir): | ||
45 | bb.warn("No help files in this package - remove gnome-help from inherit?") | ||
46 | return | ||
47 | |||
48 | helps = os.listdir(helpdir) | ||
49 | |||
50 | summary = d.getVar('SUMMARY') or pn | ||
51 | description = d.getVar('DESCRIPTION') or "" | ||
52 | locale_section = d.getVar('LOCALE_SECTION') | ||
53 | mlprefix = d.getVar('MLPREFIX') or "" | ||
54 | for l in sorted(helps): | ||
55 | ln = legitimize_package_name(l) | ||
56 | pkg = pn + '-help-' + ln | ||
57 | packages.append(pkg) | ||
58 | d.setVar('FILES_' + pkg, os.path.join(datadir, 'help', l)) | ||
59 | d.setVar('RRECOMMENDS_' + pkg, '%syelp' % mlprefix) | ||
60 | d.setVar('SUMMARY_' + pkg, '%s - %s help' % (summary, l)) | ||
61 | d.setVar('DESCRIPTION_' + pkg, '%s This package contains language help files for the %s locale.' % (description, l)) | ||
62 | if locale_section: | ||
63 | d.setVar('SECTION_' + pkg, locale_section) | ||
64 | |||
65 | d.setVar('PACKAGES', ' '.join(packages)) | ||
66 | } | ||
67 | |||
68 | PACKAGESPLITFUNCS_prepend = "gnome_do_split_help " | ||
69 | |||