blob: 9c4771ddc08af08227e21809f4236beddafb396a [file] [log] [blame]
Brad Bishop93c3acf2019-10-29 09:48:15 -04001# 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
Brad Bishop93c3acf2019-10-29 09:48:15 -040012# Dummy to get yelp build & PACKAGE_NO_HELP_SPLIT set 1
13PACKAGES_append = " ${PN}-help"
14FILES_${PN}-help = "${datadir}/help"
15RRECOMMENDS_${PN}-help = "${@bb.utils.contains('DISTRO_FEATURES','helpfiles','yelp','',d)}"
16
17do_install_append() {
18 if ${@bb.utils.contains('DISTRO_FEATURES','helpfiles','false','true',d)}; then
19 rm -rf ${D}${datadir}/help/*
20 fi
21}
22
23python gnome_do_split_help() {
24 if bb.utils.contains('DISTRO_FEATURES', 'helpfiles', False, True, d):
25 return
26
27 if (d.getVar('PACKAGE_NO_HELP_SPLIT') == '1'):
28 # all help files go to ${
29 bb.debug(1, "package requested not splitting help-files")
30 return
31
32 packages = (d.getVar('PACKAGES') or "").split()
33 datadir = d.getVar('datadir')
34 dvar = d.getVar('PKGD')
35 pn = d.getVar('PN')
36
37 if pn + '-help' in packages:
38 packages.remove(pn + '-help')
39
40 helpdir = os.path.join(dvar + datadir, 'help')
41
42 if not cpath.isdir(helpdir):
43 bb.warn("No help files in this package - remove gnome-help from inherit?")
44 return
45
46 helps = os.listdir(helpdir)
47
48 summary = d.getVar('SUMMARY') or pn
49 description = d.getVar('DESCRIPTION') or ""
50 locale_section = d.getVar('LOCALE_SECTION')
51 mlprefix = d.getVar('MLPREFIX') or ""
52 for l in sorted(helps):
53 ln = legitimize_package_name(l)
54 pkg = pn + '-help-' + ln
55 packages.append(pkg)
56 d.setVar('FILES_' + pkg, os.path.join(datadir, 'help', l))
57 d.setVar('RRECOMMENDS_' + pkg, '%syelp' % mlprefix)
58 d.setVar('SUMMARY_' + pkg, '%s - %s help' % (summary, l))
59 d.setVar('DESCRIPTION_' + pkg, '%s This package contains language help files for the %s locale.' % (description, l))
60 if locale_section:
61 d.setVar('SECTION_' + pkg, locale_section)
62
63 d.setVar('PACKAGES', ' '.join(packages))
64}
65
66PACKAGESPLITFUNCS_prepend = "gnome_do_split_help "
67