diff options
-rwxr-xr-x | scripts/devtool | 36 |
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 | ||
121 | def _create_workspace(workspacedir, config, basepath, create_only=False): | 125 | def _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 | 154 | def _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 | ||
162 | def main(): | 170 | def main(): |