diff options
Diffstat (limited to 'scripts/lib/devtool/__init__.py')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 14170cb69e..94e3d7d4b3 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
@@ -297,3 +297,43 @@ def replace_from_file(path, old, new): | |||
297 | except ValueError: | 297 | except ValueError: |
298 | pass | 298 | pass |
299 | write_file(path, "\n".join(new_contents)) | 299 | write_file(path, "\n".join(new_contents)) |
300 | |||
301 | |||
302 | def update_unlockedsigs(basepath, workspace, fixed_setup, extra=None): | ||
303 | """ This function will make unlocked-sigs.inc match the recipes in the | ||
304 | workspace plus any extras we want unlocked. """ | ||
305 | |||
306 | if not fixed_setup: | ||
307 | # Only need to write this out within the eSDK | ||
308 | return | ||
309 | |||
310 | if not extra: | ||
311 | extra = [] | ||
312 | |||
313 | confdir = os.path.join(basepath, 'conf') | ||
314 | unlockedsigs = os.path.join(confdir, 'unlocked-sigs.inc') | ||
315 | |||
316 | # Get current unlocked list if any | ||
317 | values = {} | ||
318 | def get_unlockedsigs_varfunc(varname, origvalue, op, newlines): | ||
319 | values[varname] = origvalue | ||
320 | return origvalue, None, 0, True | ||
321 | if os.path.exists(unlockedsigs): | ||
322 | with open(unlockedsigs, 'r') as f: | ||
323 | bb.utils.edit_metadata(f, ['SIGGEN_UNLOCKED_RECIPES'], get_unlockedsigs_varfunc) | ||
324 | unlocked = sorted(values.get('SIGGEN_UNLOCKED_RECIPES', [])) | ||
325 | |||
326 | # If the new list is different to the current list, write it out | ||
327 | newunlocked = sorted(list(workspace.keys()) + extra) | ||
328 | if unlocked != newunlocked: | ||
329 | bb.utils.mkdirhier(confdir) | ||
330 | with open(unlockedsigs, 'w') as f: | ||
331 | f.write("# DO NOT MODIFY! YOUR CHANGES WILL BE LOST.\n" + | ||
332 | "# This layer was created by the OpenEmbedded devtool" + | ||
333 | " utility in order to\n" + | ||
334 | "# contain recipes that are unlocked.\n") | ||
335 | |||
336 | f.write('SIGGEN_UNLOCKED_RECIPES += "\\\n') | ||
337 | for pn in newunlocked: | ||
338 | f.write(' ' + pn) | ||
339 | f.write('"') | ||