diff options
Diffstat (limited to 'scripts/devtool')
-rwxr-xr-x | scripts/devtool | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/scripts/devtool b/scripts/devtool index af4811b9221..60ea3e82985 100755 --- a/scripts/devtool +++ b/scripts/devtool @@ -104,6 +104,7 @@ def read_workspace(): for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): with open(fn, 'r') as f: pnvalues = {} + pn = None for line in f: res = externalsrc_re.match(line.rstrip()) if res: @@ -123,6 +124,9 @@ def read_workspace(): elif line.startswith('# srctreebase: '): pnvalues['srctreebase'] = line.split(':', 1)[1].strip() if pnvalues: + if not pn: + raise DevtoolError("Found *.bbappend in %s, but could not determine EXTERNALSRC:pn-*. " + "Maybe still using old syntax?" % config.workspace_path) if not pnvalues.get('srctreebase', None): pnvalues['srctreebase'] = pnvalues['srctree'] logger.debug('Found recipe %s' % pnvalues) @@ -133,17 +137,27 @@ def create_workspace(args, config, basepath, workspace): workspacedir = os.path.abspath(args.layerpath) else: workspacedir = os.path.abspath(os.path.join(basepath, 'workspace')) - _create_workspace(workspacedir, config, basepath) + layerseries = None + if args.layerseries: + layerseries = args.layerseries + _create_workspace(workspacedir, config, basepath, layerseries) if not args.create_only: _enable_workspace_layer(workspacedir, config, basepath) -def _create_workspace(workspacedir, config, basepath): +def _create_workspace(workspacedir, config, basepath, layerseries=None): import bb confdir = os.path.join(workspacedir, 'conf') if os.path.exists(os.path.join(confdir, 'layer.conf')): logger.info('Specified workspace already set up, leaving as-is') else: + if not layerseries: + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + layerseries = tinfoil.config_data.getVar('LAYERSERIES_CORENAMES') + finally: + tinfoil.shutdown() + # Add a config file bb.utils.mkdirhier(confdir) with open(os.path.join(confdir, 'layer.conf'), 'w') as f: @@ -155,7 +169,7 @@ def _create_workspace(workspacedir, config, basepath): f.write('BBFILE_PATTERN_workspacelayer = "^$' + '{LAYERDIR}/"\n') f.write('BBFILE_PATTERN_IGNORE_EMPTY_workspacelayer = "1"\n') f.write('BBFILE_PRIORITY_workspacelayer = "99"\n') - f.write('LAYERSERIES_COMPAT_workspacelayer = "${LAYERSERIES_COMPAT_core}"\n') + f.write('LAYERSERIES_COMPAT_workspacelayer = "%s"\n' % layerseries) # Add a README file with open(os.path.join(workspacedir, 'README'), 'w') as f: f.write('This layer was created by the OpenEmbedded devtool utility in order to\n') @@ -285,8 +299,9 @@ def main(): return 2 # Search BBPATH first to allow layers to override plugins in scripts_path - for path in global_args.bbpath.split(':') + [scripts_path]: - pluginpath = os.path.join(path, 'lib', 'devtool') + pluginpaths = [os.path.join(path, 'lib', 'devtool') for path in global_args.bbpath.split(':') + [scripts_path]] + context.pluginpaths = pluginpaths + for pluginpath in pluginpaths: scriptutils.load_plugins(logger, plugins, pluginpath) subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') @@ -305,6 +320,7 @@ def main(): description='Sets up a new workspace. NOTE: other devtool subcommands will create a workspace automatically as needed, so you only need to use %(prog)s if you want to specify where the workspace should be located.', group='advanced') parser_create_workspace.add_argument('layerpath', nargs='?', help='Path in which the workspace layer should be created') + parser_create_workspace.add_argument('--layerseries', help='Layer series the workspace should be set to be compatible with') parser_create_workspace.add_argument('--create-only', action="store_true", help='Only create the workspace layer, do not alter configuration') parser_create_workspace.set_defaults(func=create_workspace, no_workspace=True) @@ -314,10 +330,10 @@ def main(): args = parser.parse_args(unparsed_args, namespace=global_args) - if not getattr(args, 'no_workspace', False): - read_workspace() - try: + if not getattr(args, 'no_workspace', False): + read_workspace() + ret = args.func(args, config, basepath, workspace) except DevtoolError as err: if str(err): |