summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-05-08 15:26:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-28 09:44:15 +0100
commit520c455b83159bf9d6159f2667c8e601890dc9b6 (patch)
tree16da739acc18d719b03c07188de2e857f2cc78e9
parentb317d79fb7a058582f587e24463a1b67f38aec37 (diff)
downloadast2050-yocto-poky-520c455b83159bf9d6159f2667c8e601890dc9b6.zip
ast2050-yocto-poky-520c455b83159bf9d6159f2667c8e601890dc9b6.tar.gz
devtool: if workspace layer exists, still ensure it's in bblayers.conf
When we run devtool, if the workspace layer already exists but isn't in bblayers.conf (perhaps because it was previously created but subsequently removed from bblayers.conf by the user) then we should add it and notify the user, otherwise devtool operations won't work. (From OE-Core master rev: 313b622a6c6613092ed18a2158e090521344f6c0) (From OE-Core rev: 2904c1130ea7cc1abde0609f1ba1394e0f31a6fa) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/devtool36
1 files changed, 22 insertions, 14 deletions
diff --git a/scripts/devtool b/scripts/devtool
index 841831c..0100eb8 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -2,7 +2,7 @@
# OpenEmbedded Development tool
#
-# Copyright (C) 2014 Intel Corporation
+# Copyright (C) 2014-2015 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -99,6 +99,8 @@ def read_workspace():
else:
logger.info('Creating workspace layer in %s' % config.workspace_path)
_create_workspace(config.workspace_path, config, basepath)
+ if not context.fixed_setup:
+ _enable_workspace_layer(config.workspace_path, config, basepath)
logger.debug('Reading workspace in %s' % config.workspace_path)
externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-[^ =]+)? =.*$')
@@ -116,9 +118,11 @@ 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, args.create_only)
+ _create_workspace(workspacedir, config, basepath)
+ if not args.create_only:
+ _enable_workspace_layer(workspacedir, config, basepath)
-def _create_workspace(workspacedir, config, basepath, create_only=False):
+def _create_workspace(workspacedir, config, basepath):
import bb
confdir = os.path.join(workspacedir, 'conf')
@@ -146,17 +150,21 @@ def _create_workspace(workspacedir, config, basepath, create_only=False):
f.write('\nIf you no longer need to use devtool you can remove the path to this\n')
f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n')
f.write('layer, if you wish).\n')
- if not create_only:
- # Add the workspace layer to bblayers.conf
- bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf')
- if not os.path.exists(bblayers_conf):
- logger.error('Unable to find bblayers.conf')
- return -1
- bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path)
- if config.workspace_path != workspacedir:
- # Update our config to point to the new location
- config.workspace_path = workspacedir
- config.write()
+
+def _enable_workspace_layer(workspacedir, config, basepath):
+ """Ensure the workspace layer is in bblayers.conf"""
+ import bb
+ bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf')
+ if not os.path.exists(bblayers_conf):
+ logger.error('Unable to find bblayers.conf')
+ return -1
+ _, added = bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path)
+ if added:
+ logger.info('Enabling workspace layer in bblayers.conf')
+ if config.workspace_path != workspacedir:
+ # Update our config to point to the new location
+ config.workspace_path = workspacedir
+ config.write()
def main():
OpenPOWER on IntegriCloud