diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-01-07 00:15:54 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-11 15:41:46 +0000 |
commit | 38ed03975347424558fc02d2973eb4adc88ced85 (patch) | |
tree | 048dd6d6e3ea39ba241302868aab24106e98a329 | |
parent | 532f42985f9dfb600b6a501436bddff746388640 (diff) | |
download | poky-38ed03975347424558fc02d2973eb4adc88ced85.tar.gz |
devtool: reset: support recipes with BBCLASSEXTEND
If the recipe file itself was created in the workspace, and it uses
BBCLASSEXTEND (e.g. through devtool add --also-native), then we need to
clean the other variants as well.
(From OE-Core rev: e1bf6a30679a83d4dbcf37276204f639541e95f9)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/devtool/__init__.py | 24 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 13 |
2 files changed, 35 insertions, 2 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 7f16e17935..253e4d5e35 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
@@ -214,3 +214,27 @@ def recipe_to_append(recipefile, config, wildcard=False): | |||
214 | appendpath = os.path.join(config.workspace_path, 'appends') | 214 | appendpath = os.path.join(config.workspace_path, 'appends') |
215 | appendfile = os.path.join(appendpath, appendname + '.bbappend') | 215 | appendfile = os.path.join(appendpath, appendname + '.bbappend') |
216 | return appendfile | 216 | return appendfile |
217 | |||
218 | def get_bbclassextend_targets(recipefile, pn): | ||
219 | """ | ||
220 | Cheap function to get BBCLASSEXTEND and then convert that to the | ||
221 | list of targets that would result. | ||
222 | """ | ||
223 | import bb.utils | ||
224 | |||
225 | values = {} | ||
226 | def get_bbclassextend_varfunc(varname, origvalue, op, newlines): | ||
227 | values[varname] = origvalue | ||
228 | return origvalue, None, 0, True | ||
229 | with open(recipefile, 'r') as f: | ||
230 | bb.utils.edit_metadata(f, ['BBCLASSEXTEND'], get_bbclassextend_varfunc) | ||
231 | |||
232 | targets = [] | ||
233 | bbclassextend = values.get('BBCLASSEXTEND', '').split() | ||
234 | if bbclassextend: | ||
235 | for variant in bbclassextend: | ||
236 | if variant == 'nativesdk': | ||
237 | targets.append('%s-%s' % (variant, pn)) | ||
238 | elif variant in ['native', 'cross', 'crosssdk']: | ||
239 | targets.append('%s-%s' % (pn, variant)) | ||
240 | return targets | ||
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index e26ce5a6fb..5390f51095 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -28,7 +28,7 @@ import scriptutils | |||
28 | import errno | 28 | import errno |
29 | import glob | 29 | import glob |
30 | from collections import OrderedDict | 30 | from collections import OrderedDict |
31 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, DevtoolError | 31 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, DevtoolError |
32 | from devtool import parse_recipe | 32 | from devtool import parse_recipe |
33 | 33 | ||
34 | logger = logging.getLogger('devtool') | 34 | logger = logging.getLogger('devtool') |
@@ -1203,8 +1203,17 @@ def reset(args, config, basepath, workspace): | |||
1203 | logger.info('Cleaning sysroot for recipe %s...' % recipes[0]) | 1203 | logger.info('Cleaning sysroot for recipe %s...' % recipes[0]) |
1204 | else: | 1204 | else: |
1205 | logger.info('Cleaning sysroot for recipes %s...' % ', '.join(recipes)) | 1205 | logger.info('Cleaning sysroot for recipes %s...' % ', '.join(recipes)) |
1206 | # If the recipe file itself was created in the workspace, and | ||
1207 | # it uses BBCLASSEXTEND, then we need to also clean the other | ||
1208 | # variants | ||
1209 | targets = [] | ||
1210 | for recipe in recipes: | ||
1211 | targets.append(recipe) | ||
1212 | recipefile = workspace[recipe]['recipefile'] | ||
1213 | if recipefile: | ||
1214 | targets.extend(get_bbclassextend_targets(recipefile, recipe)) | ||
1206 | try: | 1215 | try: |
1207 | exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(recipes)) | 1216 | exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(targets)) |
1208 | except bb.process.ExecutionError as e: | 1217 | except bb.process.ExecutionError as e: |
1209 | raise DevtoolError('Command \'%s\' failed, output:\n%s\nIf you ' | 1218 | raise DevtoolError('Command \'%s\' failed, output:\n%s\nIf you ' |
1210 | 'wish, you may specify -n/--no-clean to ' | 1219 | 'wish, you may specify -n/--no-clean to ' |