blob: 036af9b17cb55b6e6e85647d24035f1405549c7c [file] [log] [blame]
Brad Bishop93fb5352015-09-09 03:59:20 +00001# Helper functions for checking feature variables.
2
3inherit utils
4
Brad Bishop6ba6a512016-07-10 19:44:42 -04005
Brad Bishop93fb5352015-09-09 03:59:20 +00006def df_enabled(feature, value, d):
Brad Bishop6ba6a512016-07-10 19:44:42 -04007 return base_contains("DISTRO_FEATURES", feature, value, "", d)
8
Brad Bishop93fb5352015-09-09 03:59:20 +00009
10def mf_enabled(feature, value, d):
Brad Bishop6ba6a512016-07-10 19:44:42 -040011 return base_contains("MACHINE_FEATURES", feature, value, "", d)
12
Brad Bishop93fb5352015-09-09 03:59:20 +000013
14def cf_enabled(feature, value, d):
Brad Bishop6ba6a512016-07-10 19:44:42 -040015 return value if df_enabled(feature, value, d) \
16 and mf_enabled(feature, value, d) \
17 else ""
Brad Bishop9dc56712016-07-07 15:56:02 -040018
19
20def set_append(d, var, val, sep=' '):
21 values = (d.getVar(var, True) or '').split(sep)
22 if filter(bool, values):
23 d.appendVar(var, '%s%s' %(sep, val))
24 else:
25 d.setVar(var, val)
26
27
28def listvar_to_list(d, list_var, sep=' '):
29 return filter(bool, (d.getVar(list_var, True) or '').split(sep))