devtool: ensure recipes devtool is working on are unlocked within the eSDK

Alongside reworking the way devtool extracts source, we now need to
ensure that within the extensible SDK where task signatures are locked,
the signatures of the tasks for the recipes being worked on get unlocked
at the right time or otherwise we'll now get taskhash mismatches when
running devtool modify on a recipe that was included in the eSDK such as
the kernel (due to a separate bug). The existing mechanism for
auto-unlocking recipes was a little weak and was happening too late, so
I've reimplemented it so that:
(a) it gets triggered immediately when the recipe/append is created
(b) we avoid writing to the unlocked signatures file unnecessarily
    (since it's a global configuration file) and
(c) within the eSDK configuration we whitelist SIGGEN_UNLOCKED_RECIPES
    to avoid unnecessary reparses every time we perform one of the
    devtool operations that does need to change this list.

Fixes [YOCTO #11883] (not the underlying cause, but this manifestation
of the issue).

(From OE-Core rev: 4e9a0be32fc30fb87d65da7cd1a4015c99533aff)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2017-09-06 21:55:01 +12:00
committed by Richard Purdie
parent 10af6d86b3
commit 3fde63363a
5 changed files with 59 additions and 31 deletions

View File

@@ -297,3 +297,43 @@ def replace_from_file(path, old, new):
except ValueError:
pass
write_file(path, "\n".join(new_contents))
def update_unlockedsigs(basepath, workspace, fixed_setup, extra=None):
""" This function will make unlocked-sigs.inc match the recipes in the
workspace plus any extras we want unlocked. """
if not fixed_setup:
# Only need to write this out within the eSDK
return
if not extra:
extra = []
confdir = os.path.join(basepath, 'conf')
unlockedsigs = os.path.join(confdir, 'unlocked-sigs.inc')
# Get current unlocked list if any
values = {}
def get_unlockedsigs_varfunc(varname, origvalue, op, newlines):
values[varname] = origvalue
return origvalue, None, 0, True
if os.path.exists(unlockedsigs):
with open(unlockedsigs, 'r') as f:
bb.utils.edit_metadata(f, ['SIGGEN_UNLOCKED_RECIPES'], get_unlockedsigs_varfunc)
unlocked = sorted(values.get('SIGGEN_UNLOCKED_RECIPES', []))
# If the new list is different to the current list, write it out
newunlocked = sorted(list(workspace.keys()) + extra)
if unlocked != newunlocked:
bb.utils.mkdirhier(confdir)
with open(unlockedsigs, 'w') as f:
f.write("# DO NOT MODIFY! YOUR CHANGES WILL BE LOST.\n" +
"# This layer was created by the OpenEmbedded devtool" +
" utility in order to\n" +
"# contain recipes that are unlocked.\n")
f.write('SIGGEN_UNLOCKED_RECIPES += "\\\n')
for pn in newunlocked:
f.write(' ' + pn)
f.write('"')