summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/__init__.py40
-rw-r--r--scripts/lib/devtool/standard.py18
-rw-r--r--scripts/lib/devtool/upgrade.py9
3 files changed, 56 insertions, 11 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
302def 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('"')
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index b7f278f394..14e87b95a4 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -30,7 +30,7 @@ import errno
30import glob 30import glob
31import filecmp 31import filecmp
32from collections import OrderedDict 32from collections import OrderedDict
33from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, DevtoolError 33from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, DevtoolError
34from devtool import parse_recipe 34from devtool import parse_recipe
35 35
36logger = logging.getLogger('devtool') 36logger = logging.getLogger('devtool')
@@ -407,7 +407,7 @@ def extract(args, config, basepath, workspace):
407 return 1 407 return 1
408 408
409 srctree = os.path.abspath(args.srctree) 409 srctree = os.path.abspath(args.srctree)
410 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, rd, tinfoil) 410 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil)
411 logger.info('Source tree extracted to %s' % srctree) 411 logger.info('Source tree extracted to %s' % srctree)
412 412
413 if initial_rev: 413 if initial_rev:
@@ -431,7 +431,7 @@ def sync(args, config, basepath, workspace):
431 return 1 431 return 1
432 432
433 srctree = os.path.abspath(args.srctree) 433 srctree = os.path.abspath(args.srctree)
434 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, config, rd, tinfoil) 434 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, True, config, basepath, workspace, args.fixed_setup, rd, tinfoil)
435 logger.info('Source tree %s synchronized' % srctree) 435 logger.info('Source tree %s synchronized' % srctree)
436 436
437 if initial_rev: 437 if initial_rev:
@@ -442,7 +442,7 @@ def sync(args, config, basepath, workspace):
442 tinfoil.shutdown() 442 tinfoil.shutdown()
443 443
444 444
445def _extract_source(srctree, keep_temp, devbranch, sync, config, d, tinfoil): 445def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil):
446 """Extract sources of a recipe""" 446 """Extract sources of a recipe"""
447 import oe.recipeutils 447 import oe.recipeutils
448 import oe.patch 448 import oe.patch
@@ -711,7 +711,7 @@ def modify(args, config, basepath, workspace):
711 initial_rev = None 711 initial_rev = None
712 commits = [] 712 commits = []
713 if not args.no_extract: 713 if not args.no_extract:
714 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, rd, tinfoil) 714 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil)
715 if not initial_rev: 715 if not initial_rev:
716 return 1 716 return 1
717 logger.info('Source tree extracted to %s' % srctree) 717 logger.info('Source tree extracted to %s' % srctree)
@@ -773,6 +773,8 @@ def modify(args, config, basepath, workspace):
773 for commit in commits: 773 for commit in commits:
774 f.write('# commit: %s\n' % commit) 774 f.write('# commit: %s\n' % commit)
775 775
776 update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn])
777
776 _add_md5(config, pn, appendfile) 778 _add_md5(config, pn, appendfile)
777 779
778 logger.info('Recipe %s now set up to build from %s' % (pn, srctree)) 780 logger.info('Recipe %s now set up to build from %s' % (pn, srctree))
@@ -1802,7 +1804,7 @@ def register_commands(subparsers, context):
1802 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") 1804 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true")
1803 parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")') 1805 parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")')
1804 parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true") 1806 parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true")
1805 parser_modify.set_defaults(func=modify) 1807 parser_modify.set_defaults(func=modify, fixed_setup=context.fixed_setup)
1806 1808
1807 parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', 1809 parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe',
1808 description='Extracts the source for an existing recipe', 1810 description='Extracts the source for an existing recipe',
@@ -1811,7 +1813,7 @@ def register_commands(subparsers, context):
1811 parser_extract.add_argument('srctree', help='Path to where to extract the source tree') 1813 parser_extract.add_argument('srctree', help='Path to where to extract the source tree')
1812 parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (default "%(default)s")') 1814 parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (default "%(default)s")')
1813 parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 1815 parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
1814 parser_extract.set_defaults(func=extract) 1816 parser_extract.set_defaults(func=extract, fixed_setup=context.fixed_setup)
1815 1817
1816 parser_sync = subparsers.add_parser('sync', help='Synchronize the source tree for an existing recipe', 1818 parser_sync = subparsers.add_parser('sync', help='Synchronize the source tree for an existing recipe',
1817 description='Synchronize the previously extracted source tree for an existing recipe', 1819 description='Synchronize the previously extracted source tree for an existing recipe',
@@ -1821,7 +1823,7 @@ def register_commands(subparsers, context):
1821 parser_sync.add_argument('srctree', help='Path to the source tree') 1823 parser_sync.add_argument('srctree', help='Path to the source tree')
1822 parser_sync.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout') 1824 parser_sync.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout')
1823 parser_sync.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 1825 parser_sync.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
1824 parser_sync.set_defaults(func=sync) 1826 parser_sync.set_defaults(func=sync, fixed_setup=context.fixed_setup)
1825 1827
1826 parser_rename = subparsers.add_parser('rename', help='Rename a recipe file in the workspace', 1828 parser_rename = subparsers.add_parser('rename', help='Rename a recipe file in the workspace',
1827 description='Renames the recipe file for a recipe in the workspace, changing the name or version part or both, ensuring that all references within the workspace are updated at the same time. Only works when the recipe file itself is in the workspace, e.g. after devtool add. Particularly useful when devtool add did not automatically determine the correct name.', 1829 description='Renames the recipe file for a recipe in the workspace, changing the name or version part or both, ensuring that all references within the workspace are updated at the same time. Only works when the recipe file itself is in the workspace, e.g. after devtool add. Particularly useful when devtool add did not automatically determine the correct name.',
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 39d0bd72db..f1b3ff0a99 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -33,7 +33,7 @@ sys.path = sys.path + [devtool_path]
33 33
34import oe.recipeutils 34import oe.recipeutils
35from devtool import standard 35from devtool import standard
36from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build 36from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs
37 37
38logger = logging.getLogger('devtool') 38logger = logging.getLogger('devtool')
39 39
@@ -418,7 +418,7 @@ def upgrade(args, config, basepath, workspace):
418 418
419 rf = None 419 rf = None
420 try: 420 try:
421 rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, rd, tinfoil) 421 rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil)
422 rev2, md5, sha256, srcbranch = _extract_new_source(args.version, srctree, args.no_patch, 422 rev2, md5, sha256, srcbranch = _extract_new_source(args.version, srctree, args.no_patch,
423 args.srcrev, args.srcbranch, args.branch, args.keep_temp, 423 args.srcrev, args.srcbranch, args.branch, args.keep_temp,
424 tinfoil, rd) 424 tinfoil, rd)
@@ -432,6 +432,9 @@ def upgrade(args, config, basepath, workspace):
432 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, 432 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
433 copied, config.workspace_path, rd) 433 copied, config.workspace_path, rd)
434 standard._add_md5(config, pn, af) 434 standard._add_md5(config, pn, af)
435
436 update_unlockedsigs(basepath, workspace, [pn], args.fixed_setup)
437
435 logger.info('Upgraded source extracted to %s' % srctree) 438 logger.info('Upgraded source extracted to %s' % srctree)
436 logger.info('New recipe is %s' % rf) 439 logger.info('New recipe is %s' % rf)
437 finally: 440 finally:
@@ -457,4 +460,4 @@ def register_commands(subparsers, context):
457 group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") 460 group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true")
458 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") 461 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true")
459 parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 462 parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
460 parser_upgrade.set_defaults(func=upgrade) 463 parser_upgrade.set_defaults(func=upgrade, fixed_setup=context.fixed_setup)