diff options
Diffstat (limited to 'import-layers/yocto-poky/bitbake/lib/bb/data.py')
-rw-r--r-- | import-layers/yocto-poky/bitbake/lib/bb/data.py | 95 |
1 files changed, 23 insertions, 72 deletions
diff --git a/import-layers/yocto-poky/bitbake/lib/bb/data.py b/import-layers/yocto-poky/bitbake/lib/bb/data.py index c56965c60..134afaacc 100644 --- a/import-layers/yocto-poky/bitbake/lib/bb/data.py +++ b/import-layers/yocto-poky/bitbake/lib/bb/data.py @@ -78,59 +78,6 @@ def initVar(var, d): """Non-destructive var init for data structure""" d.initVar(var) - -def setVar(var, value, d): - """Set a variable to a given value""" - d.setVar(var, value) - - -def getVar(var, d, exp = False): - """Gets the value of a variable""" - return d.getVar(var, exp) - - -def renameVar(key, newkey, d): - """Renames a variable from key to newkey""" - d.renameVar(key, newkey) - -def delVar(var, d): - """Removes a variable from the data set""" - d.delVar(var) - -def appendVar(var, value, d): - """Append additional value to a variable""" - d.appendVar(var, value) - -def setVarFlag(var, flag, flagvalue, d): - """Set a flag for a given variable to a given value""" - d.setVarFlag(var, flag, flagvalue) - -def getVarFlag(var, flag, d): - """Gets given flag from given var""" - return d.getVarFlag(var, flag, False) - -def delVarFlag(var, flag, d): - """Removes a given flag from the variable's flags""" - d.delVarFlag(var, flag) - -def setVarFlags(var, flags, d): - """Set the flags for a given variable - - Note: - setVarFlags will not clear previous - flags. Think of this method as - addVarFlags - """ - d.setVarFlags(var, flags) - -def getVarFlags(var, d): - """Gets a variable's flags""" - return d.getVarFlags(var) - -def delVarFlags(var, d): - """Removes a variable's flags""" - d.delVarFlags(var) - def keys(d): """Return a list of keys in d""" return d.keys() @@ -174,7 +121,7 @@ def inheritFromOS(d, savedenv, permitted): for s in savedenv.keys(): if s in permitted: try: - d.setVar(s, savedenv.getVar(s, True), op = 'from env') + d.setVar(s, savedenv.getVar(s), op = 'from env') if s in exportlist: d.setVarFlag(s, "export", True, op = 'auto env export') except TypeError: @@ -194,7 +141,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): try: if all: oval = d.getVar(var, False) - val = d.getVar(var, True) + val = d.getVar(var) except (KeyboardInterrupt, bb.build.FuncFailed): raise except Exception as exc: @@ -249,7 +196,7 @@ def emit_env(o=sys.__stdout__, d = init(), all=False): keys = sorted((key for key in d.keys() if not key.startswith("__")), key=isfunc) grouped = groupby(keys, isfunc) for isfunc, keys in grouped: - for key in keys: + for key in sorted(keys): emit_var(key, o, d, all and not isfunc) and o.write('\n') def exported_keys(d): @@ -261,9 +208,9 @@ def exported_vars(d): k = list(exported_keys(d)) for key in k: try: - value = d.getVar(key, True) + value = d.getVar(key) except Exception as err: - bb.warn("%s: Unable to export ${%s}: %s" % (d.getVar("FILE", True), key, err)) + bb.warn("%s: Unable to export ${%s}: %s" % (d.getVar("FILE"), key, err)) continue if value is not None: @@ -273,13 +220,13 @@ def emit_func(func, o=sys.__stdout__, d = init()): """Emits all items in the data store in a format such that it can be sourced by a shell.""" keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func", False)) - for key in keys: + for key in sorted(keys): emit_var(key, o, d, False) o.write('\n') emit_var(func, o, d, False) and o.write('\n') - newdeps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func, True)) - newdeps |= set((d.getVarFlag(func, "vardeps", True) or "").split()) + newdeps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func)) + newdeps |= set((d.getVarFlag(func, "vardeps") or "").split()) seen = set() while newdeps: deps = newdeps @@ -288,8 +235,8 @@ def emit_func(func, o=sys.__stdout__, d = init()): for dep in deps: if d.getVarFlag(dep, "func", False) and not d.getVarFlag(dep, "python", False): emit_var(dep, o, d, False) and o.write('\n') - newdeps |= bb.codeparser.ShellParser(dep, logger).parse_shell(d.getVar(dep, True)) - newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) + newdeps |= bb.codeparser.ShellParser(dep, logger).parse_shell(d.getVar(dep)) + newdeps |= set((d.getVarFlag(dep, "vardeps") or "").split()) newdeps -= seen _functionfmt = """ @@ -312,7 +259,7 @@ def emit_func_python(func, o=sys.__stdout__, d = init()): pp = bb.codeparser.PythonParser(func, logger) pp.parse_python(d.getVar(func, False)) newdeps = pp.execs - newdeps |= set((d.getVarFlag(func, "vardeps", True) or "").split()) + newdeps |= set((d.getVarFlag(func, "vardeps") or "").split()) seen = set() while newdeps: deps = newdeps @@ -324,7 +271,7 @@ def emit_func_python(func, o=sys.__stdout__, d = init()): pp = bb.codeparser.PythonParser(dep, logger) pp.parse_python(d.getVar(dep, False)) newdeps |= pp.execs - newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) + newdeps |= set((d.getVarFlag(dep, "vardeps") or "").split()) newdeps -= seen def update_data(d): @@ -348,12 +295,14 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): def handle_contains(value, contains, d): newvalue = "" for k in sorted(contains): - l = (d.getVar(k, True) or "").split() - for word in sorted(contains[k]): - if word in l: - newvalue += "\n%s{%s} = Set" % (k, word) + l = (d.getVar(k) or "").split() + for item in sorted(contains[k]): + for word in item.split(): + if not word in l: + newvalue += "\n%s{%s} = Unset" % (k, item) + break else: - newvalue += "\n%s{%s} = Unset" % (k, word) + newvalue += "\n%s{%s} = Set" % (k, item) if not newvalue: return value if not value: @@ -366,7 +315,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): if varflags.get("python"): parser = bb.codeparser.PythonParser(key, logger) if value and "\t" in value: - logger.warning("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE", True))) + logger.warning("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE"))) parser.parse_python(value, filename=varflags.get("filename"), lineno=varflags.get("lineno")) deps = deps | parser.references deps = deps | (keys & parser.execs) @@ -410,6 +359,8 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): deps |= set((vardeps or "").split()) deps -= set(varflags.get("vardepsexclude", "").split()) + except bb.parse.SkipRecipe: + raise except Exception as e: bb.warn("Exception during build_dependencies for %s" % key) raise @@ -421,7 +372,7 @@ def generate_dependencies(d): keys = set(key for key in d if not key.startswith("__")) shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export", False) and not d.getVarFlag(key, "unexport", False)) - varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True) + varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS') deps = {} values = {} |