summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/classes/obmc-phosphor-utils.bbclass
blob: 036af9b17cb55b6e6e85647d24035f1405549c7c (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
# Helper functions for checking feature variables.

inherit utils


def df_enabled(feature, value, d):
    return base_contains("DISTRO_FEATURES", feature, value, "", d)


def mf_enabled(feature, value, d):
    return base_contains("MACHINE_FEATURES", feature, value, "", d)


def cf_enabled(feature, value, d):
    return value if df_enabled(feature, value, d) \
        and mf_enabled(feature, value, d) \
            else ""


def set_append(d, var, val, sep=' '):
    values = (d.getVar(var, True) or '').split(sep)
    if filter(bool, values):
        d.appendVar(var, '%s%s' %(sep, val))
    else:
        d.setVar(var, val)


def listvar_to_list(d, list_var, sep=' '):
    return filter(bool, (d.getVar(list_var, True) or '').split(sep))
OpenPOWER on IntegriCloud