]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: reset: support recipes with BBCLASSEXTEND
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 6 Jan 2016 11:15:54 +0000 (00:15 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 11 Jan 2016 15:41:07 +0000 (15:41 +0000)
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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/__init__.py
scripts/lib/devtool/standard.py

index 7f16e17935dccb1b5ab132549d5ba5c404dfcdcb..253e4d5e35c4f579927a3c99dcc590eaa1aae2e0 100644 (file)
@@ -214,3 +214,27 @@ def recipe_to_append(recipefile, config, wildcard=False):
     appendpath = os.path.join(config.workspace_path, 'appends')
     appendfile = os.path.join(appendpath, appendname + '.bbappend')
     return appendfile
+
+def get_bbclassextend_targets(recipefile, pn):
+    """
+    Cheap function to get BBCLASSEXTEND and then convert that to the
+    list of targets that would result.
+    """
+    import bb.utils
+
+    values = {}
+    def get_bbclassextend_varfunc(varname, origvalue, op, newlines):
+        values[varname] = origvalue
+        return origvalue, None, 0, True
+    with open(recipefile, 'r') as f:
+        bb.utils.edit_metadata(f, ['BBCLASSEXTEND'], get_bbclassextend_varfunc)
+
+    targets = []
+    bbclassextend = values.get('BBCLASSEXTEND', '').split()
+    if bbclassextend:
+        for variant in bbclassextend:
+            if variant == 'nativesdk':
+                targets.append('%s-%s' % (variant, pn))
+            elif variant in ['native', 'cross', 'crosssdk']:
+                targets.append('%s-%s' % (pn, variant))
+    return targets
index e26ce5a6fbc54f127793233a5629788453da3556..5390f5109556086a9f3ad30a554c9d9ead9aabac 100644 (file)
@@ -28,7 +28,7 @@ import scriptutils
 import errno
 import glob
 from collections import OrderedDict
-from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, DevtoolError
+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
 from devtool import parse_recipe
 
 logger = logging.getLogger('devtool')
@@ -1203,8 +1203,17 @@ def reset(args, config, basepath, workspace):
             logger.info('Cleaning sysroot for recipe %s...' % recipes[0])
         else:
             logger.info('Cleaning sysroot for recipes %s...' % ', '.join(recipes))
+        # If the recipe file itself was created in the workspace, and
+        # it uses BBCLASSEXTEND, then we need to also clean the other
+        # variants
+        targets = []
+        for recipe in recipes:
+            targets.append(recipe)
+            recipefile = workspace[recipe]['recipefile']
+            if recipefile:
+                targets.extend(get_bbclassextend_targets(recipefile, recipe))
         try:
-            exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(recipes))
+            exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(targets))
         except bb.process.ExecutionError as e:
             raise DevtoolError('Command \'%s\' failed, output:\n%s\nIf you '
                                 'wish, you may specify -n/--no-clean to '