Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 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 | |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 12 | # Dummy to get yelp build & PACKAGE_NO_HELP_SPLIT set 1 |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 13 | PACKAGES:append = " ${PN}-help" |
| 14 | FILES:${PN}-help = "${datadir}/help" |
| 15 | RRECOMMENDS:${PN}-help = "${@bb.utils.contains('DISTRO_FEATURES','helpfiles','yelp','',d)}" |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 16 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 17 | do_install:append() { |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 18 | if ${@bb.utils.contains('DISTRO_FEATURES','helpfiles','false','true',d)}; then |
| 19 | rm -rf ${D}${datadir}/help/* |
| 20 | fi |
| 21 | } |
| 22 | |
| 23 | python 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) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 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)) |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 60 | if locale_section: |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 61 | d.setVar('SECTION:' + pkg, locale_section) |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 62 | |
| 63 | d.setVar('PACKAGES', ' '.join(packages)) |
| 64 | } |
| 65 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 66 | PACKAGESPLITFUNCS:prepend = "gnome_do_split_help " |
Brad Bishop | 93c3acf | 2019-10-29 09:48:15 -0400 | [diff] [blame] | 67 | |