1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# Class for packagegroup (package group) recipes
8
9# By default, only the packagegroup package itself is in PACKAGES.
10# -dbg and -dev flavours are handled by the anonfunc below.
11# This means that packagegroup recipes used to build multiple packagegroup
12# packages have to modify PACKAGES after inheriting packagegroup.bbclass.
13PACKAGES = "${PN}"
14
15# By default, packagegroup packages do not depend on a certain architecture.
16# Only if dependencies are modified by MACHINE_FEATURES, packages
17# need to be set to MACHINE_ARCH before inheriting packagegroup.bbclass
18PACKAGE_ARCH ?= "all"
19
20# Fully expanded - so it applies the overrides as well
21PACKAGE_ARCH_EXPANDED := "${PACKAGE_ARCH}"
22
23LICENSE ?= "MIT"
24
25inherit_defer ${@oe.utils.ifelse(d.getVar('PACKAGE_ARCH_EXPANDED') == 'all', 'allarch', '')}
26
27# This automatically adds -dbg and -dev flavours of all PACKAGES
28# to the list. Their dependencies (RRECOMMENDS) are handled as usual
29# by package_depchains in a following step.
30# Also mark all packages as ALLOW_EMPTY
31python () {
32    packages = d.getVar('PACKAGES').split()
33    if d.getVar('PACKAGEGROUP_DISABLE_COMPLEMENTARY') != '1':
34        types = ['', '-dbg', '-dev']
35        if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d):
36            types.append('-ptest')
37        packages = [pkg + suffix for pkg in packages
38                    for suffix in types]
39        d.setVar('PACKAGES', ' '.join(packages))
40    for pkg in packages:
41        d.setVar('ALLOW_EMPTY:%s' % pkg, '1')
42}
43
44# We don't want to look at shared library dependencies for the
45# dbg packages
46DEPCHAIN_DBGDEFAULTDEPS = "1"
47
48# We only need the packaging tasks - disable the rest
49deltask do_fetch
50deltask do_unpack
51deltask do_patch
52deltask do_configure
53deltask do_compile
54deltask do_install
55deltask do_populate_sysroot
56
57do_create_runtime_spdx[deptask] = "do_create_spdx"
58do_create_runtime_spdx[rdeptask] = ""
59
60INHIBIT_DEFAULT_DEPS = "1"
61
62python () {
63    if bb.data.inherits_class('nativesdk', d):
64        return
65    initman = d.getVar("VIRTUAL-RUNTIME_init_manager")
66    if initman and initman in ['sysvinit', 'systemd'] and not bb.utils.contains('DISTRO_FEATURES', initman, True, False, d):
67        bb.fatal("Please ensure that your setting of VIRTUAL-RUNTIME_init_manager (%s) matches the entries enabled in DISTRO_FEATURES" % initman)
68}
69
70CVE_PRODUCT = ""
71