aboutsummaryrefslogtreecommitdiffstats
path: root/meta-gnome/classes/gnome-help.bbclass
blob: 750670ae244dd0543783b5b66fa199eb1284b9a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 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>

# 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 "