data: Move warning code to the first loop for performance
PATCH 1/1 data: Move warning code to the first loop for performance
By doing this we can take advantage of the expansion cache before starting write operations on the data store.
bitbake/lib/bb/data.py +5 -5
@@ -156,17 +156,17 @@ def expandKeys(alterdata, readdata = None): if key == ekey: continue todolist[key] = ekey + newval = alterdata.getVar(ekey, 0) + if newval: + val = alterdata.getVar(key, 0) + if val is not None and newval is not None: + bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval)) # These two for loops are split for performance to maximise the # usefulness of the expand cache for key in todolist: ekey = todolist[key] - newval = alterdata.getVar(ekey, 0) - if newval: - val = alterdata.getVar(key, 0) - if val is not None and newval is not None: - bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval)) alterdata.renameVar(key, ekey) def inheritFromOS(d, savedenv, permitted):
Quoted 10 lines · Richard Purdie
By doing this we can take advantage of the expansion cache before starting write operations on the data store.
Signed-off-by Richard Purdie <[email protected]>bitbake/lib/bb/data.py +0
-0
bitbake/lib/bb/data.py def expandKeys(alterdata, readdata = None): · line 162
Quoted 7 lines
bitbake/lib/bb/data.py +4
-0@@ -156,17 +156,17 @@ def expandKeys(alterdata, readdata = None): if key == ekey: continue todolist[key] = ekey + newval = alterdata.getVar(ekey, 0) + if newval: + val = alterdata.getVar(key, 0) + if val is not None and newval is not None:
newval cannot ever be None in this if.
Thanks,
Quoted 17 lines
bitbake/lib/bb/data.py +1
-5+ bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval)) # These two for loops are split for performance to maximise the # usefulness of the expand cache for key in todolist: ekey = todolist[key] - newval = alterdata.getVar(ekey, 0) - if newval: - val = alterdata.getVar(key, 0) - if val is not None and newval is not None: - bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval)) alterdata.renameVar(key, ekey)def
inheritFromOS(d, savedenv, permitted):
Quoted 6 lines · Bernhard Reutner-Fischer
Quoted 5 lines · Richard Purdie
By doing this we can take advantage of the expansion cache before starting write operations on the data store.
Signed-off-by Richard Purdie <[email protected]>
Quoted 14 lines
bitbake/lib/bb/data.py def expandKeys(alterdata, readdata = None): · line 162
Quoted 12 lines
bitbake/lib/bb/data.py +4
-0@@ -156,17 +156,17 @@ def expandKeys(alterdata, readdata = None): if key == ekey: continue todolist[key] = ekey + newval = alterdata.getVar(ekey, 0) + if newval: + val = alterdata.getVar(key, 0) + if val is not None and newval is not None:newval cannot ever be None in this if.
True, to be fair I just moved the code although I probably was responsible for the original too.
I'll tweak it, thanks.
Cheers,
Richard