[OE-core] [PATCH 2/2] devtool: Fix build-sdk when pn doesn't match filename

Randy Witt randy.e.witt at linux.intel.com
Mon May 2 00:13:03 UTC 2016


If an image with the filename foo.bb could be built using the name "bar"
instead, then build-sdk would fail to create the derivative sdk.

This was because the code assumed that the file name matched the target,
which is not necessarily the case.

Signed-off-by: Randy Witt <randy.e.witt at linux.intel.com>
---
 scripts/devtool                    |  3 +++
 scripts/lib/devtool/build_image.py | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/scripts/devtool b/scripts/devtool
index 4780390..f090427 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -86,6 +86,9 @@ class ConfigHandler(object):
         with open(self.config_file, 'w') as f:
             self.config_obj.write(f)
 
+    def set(self, section, option, value):
+        self.config_obj.set(section, option, value)
+
 class Context:
     def __init__(self, **kwargs):
         self.__dict__.update(kwargs)
diff --git a/scripts/lib/devtool/build_image.py b/scripts/lib/devtool/build_image.py
index e51d766..0f8ca93 100644
--- a/scripts/lib/devtool/build_image.py
+++ b/scripts/lib/devtool/build_image.py
@@ -72,12 +72,12 @@ def build_image(args, config, basepath, workspace):
     return result
 
 def build_image_task(config, basepath, workspace, image, add_packages=None, task=None, extra_append=None):
-    appendfile = os.path.join(config.workspace_path, 'appends',
-                              '%s.bbappend' % image)
-
     # remove <image>.bbappend to make sure setup_tinfoil doesn't
     # break because of it
-    if os.path.isfile(appendfile):
+    target_basename = config.get('SDK', 'target_basename', '')
+    if target_basename:
+        appendfile = os.path.join(config.workspace_path, 'appends',
+                                  '%s.bbappend' % target_basename)
         os.unlink(appendfile)
 
     tinfoil = setup_tinfoil(basepath=basepath)
@@ -88,6 +88,14 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
     if not bb.data.inherits_class('image', rd):
         raise TargetNotImageError()
 
+    # Get the actual filename used and strip the .bb and full path
+    target_basename = rd.getVar('FILE', True)
+    target_basename = os.path.basename(target_basename).rsplit('.', 1)[0]
+    config.set('SDK', 'target_basename', target_basename)
+
+    appendfile = os.path.join(config.workspace_path, 'appends',
+                              '%s.bbappend' % target_basename)
+
     outputdir = None
     try:
         if workspace or add_packages:
-- 
2.5.5




More information about the Openembedded-core mailing list