aboutsummaryrefslogtreecommitdiffstats
path: root/meta-mentor-common/classes/mentor-updates-check.bbclass
blob: 9da0e6477f3106186270ee6d3f7864dba6b1f909 (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
# ---------------------------------------------------------------------------------------------------------------------
# SPDX-License-Identifier: MIT
# ---------------------------------------------------------------------------------------------------------------------

# If any of these layers are available, but not included in BBLAYERS, warn
UPDATES_CHECK_LAYERS ?= "\
    ${MELDIR}/updates/update-*/ \
    ${MELDIR}/update-*/ \
    ${MELDIR}/meta-mentor-cve \
"
UPDATES_CHECK_LAYERS[type] = "list"

check_for_updates () {
    import glob

    layerpaths = []
    for pattern in oe.data.typed_value('UPDATES_CHECK_LAYERS', d):
        layerpaths.extend(glob.glob(pattern))

    if not layerpaths:
        return

    missing = set()
    bblayers = d.getVar('BBLAYERS', True).split()
    bblayers = set(os.path.realpath(p) for p in bblayers)
    for lpath in layerpaths:
        if not os.path.exists(os.path.join(lpath, 'conf', 'layer.conf')):
            continue
        if os.path.realpath(lpath) not in bblayers:
            missing.add(lpath)

    if missing:
        bb.warn("Update layers are available, but not configured. Please add to your bblayers.conf:\n  %s" % '\n  '.join(missing))
}
check_for_updates[eventmask] = "bb.event.ConfigParsed"
addhandler check_for_updates