summaryrefslogtreecommitdiffstats
path: root/scripts
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-05-16 22:31:51 +0100
commit4075192fc585dfa7e5f90b83a4685c5c4a7f4a8f (patch)
tree8f1c9eb7dbb528a409aa709dd53473e2bdabfdc4 /scripts
parent293c82baa454c5cb4d2ed00c2764e2c279cee6aa (diff)
downloadpoky-4075192fc585dfa7e5f90b83a4685c5c4a7f4a8f.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 rev: 313b622a6c6613092ed18a2158e090521344f6c0) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/devtool36
1 files changed, 22 insertions, 14 deletions
diff --git a/scripts/devtool b/scripts/devtool
index 841831c410..0100eb8360 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -2,7 +2,7 @@
2 2
3# OpenEmbedded Development tool 3# OpenEmbedded Development tool
4# 4#
5# Copyright (C) 2014 Intel Corporation 5# Copyright (C) 2014-2015 Intel Corporation
6# 6#
7# This program is free software; you can redistribute it and/or modify 7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as 8# it under the terms of the GNU General Public License version 2 as
@@ -99,6 +99,8 @@ def read_workspace():
99 else: 99 else:
100 logger.info('Creating workspace layer in %s' % config.workspace_path) 100 logger.info('Creating workspace layer in %s' % config.workspace_path)
101 _create_workspace(config.workspace_path, config, basepath) 101 _create_workspace(config.workspace_path, config, basepath)
102 if not context.fixed_setup:
103 _enable_workspace_layer(config.workspace_path, config, basepath)
102 104
103 logger.debug('Reading workspace in %s' % config.workspace_path) 105 logger.debug('Reading workspace in %s' % config.workspace_path)
104 externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-[^ =]+)? =.*$') 106 externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-[^ =]+)? =.*$')
@@ -116,9 +118,11 @@ def create_workspace(args, config, basepath, workspace):
116 workspacedir = os.path.abspath(args.layerpath) 118 workspacedir = os.path.abspath(args.layerpath)
117 else: 119 else:
118 workspacedir = os.path.abspath(os.path.join(basepath, 'workspace')) 120 workspacedir = os.path.abspath(os.path.join(basepath, 'workspace'))
119 _create_workspace(workspacedir, config, basepath, args.create_only) 121 _create_workspace(workspacedir, config, basepath)
122 if not args.create_only:
123 _enable_workspace_layer(workspacedir, config, basepath)
120 124
121def _create_workspace(workspacedir, config, basepath, create_only=False): 125def _create_workspace(workspacedir, config, basepath):
122 import bb 126 import bb
123 127
124 confdir = os.path.join(workspacedir, 'conf') 128 confdir = os.path.join(workspacedir, 'conf')
@@ -146,17 +150,21 @@ def _create_workspace(workspacedir, config, basepath, create_only=False):
146 f.write('\nIf you no longer need to use devtool you can remove the path to this\n') 150 f.write('\nIf you no longer need to use devtool you can remove the path to this\n')
147 f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n') 151 f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n')
148 f.write('layer, if you wish).\n') 152 f.write('layer, if you wish).\n')
149 if not create_only: 153
150 # Add the workspace layer to bblayers.conf 154def _enable_workspace_layer(workspacedir, config, basepath):
151 bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf') 155 """Ensure the workspace layer is in bblayers.conf"""
152 if not os.path.exists(bblayers_conf): 156 import bb
153 logger.error('Unable to find bblayers.conf') 157 bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf')
154 return -1 158 if not os.path.exists(bblayers_conf):
155 bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path) 159 logger.error('Unable to find bblayers.conf')
156 if config.workspace_path != workspacedir: 160 return -1
157 # Update our config to point to the new location 161 _, added = bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path)
158 config.workspace_path = workspacedir 162 if added:
159 config.write() 163 logger.info('Enabling workspace layer in bblayers.conf')
164 if config.workspace_path != workspacedir:
165 # Update our config to point to the new location
166 config.workspace_path = workspacedir
167 config.write()
160 168
161 169
162def main(): 170def main():