Skip to contentSkip to conversation

extensible sdk fixes

PATCH New Randy Witt 2 participants 5 messages May 2, 2016 – May 9, 2016

lore
Share & tools
lore

Randy Witt

author
#0 lore raw

cover extensible sdk fixes

Fixes for the building a derivative sdk from the extensible sdk.

The following changes since commit f7b520878babbaa7527151f22c031ae160512753:

poky: Switch to post release name/version (2016-04-29 07:58:46 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib rewitt/esdk-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=rewitt/esdk-fixes

Randy Witt (2):
populate_sdk_ext: Change lockedsigs task mismatch to a warning
devtool: Fix build-sdk when pn doesn't match filename

 meta/classes/populate_sdk_ext.bbclass |  2 +-
 scripts/devtool                       |  3 +++
 scripts/lib/devtool/build_image.py    | 16 ++++++++++++----
 3 files changed, 16 insertions(+), 5 deletions(-)
Signature · 1 line
2.5.5
author
#1 lore raw

PATCH 1/2 populate_sdk_ext: Change lockedsigs task mismatch to a warning

It has been determined that it is highly likely that users might get signatures that don't match in an extensible sdk. This doesn't necessarily happen with oe-core, so we can set the mismatch to an error during testing if we like.

However, for the case where users are creating their own sdks, we don't need an error halting their progress. locked-sigs will still function as it should.

---
 meta/classes/populate_sdk_ext.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/populate_sdk_ext.bbclass +1 -1
index 87518d1..935d4e5 100644
@@ -221,7 +221,7 @@ python copy_buildsystem () {
 
             # Error if the sigs in the locked-signature file don't match
             # the sig computed from the metadata.
-            f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "error"\n\n')
+            f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n\n')
 
             # Hide the config information from bitbake output (since it's fixed within the SDK)
             f.write('BUILDCFG_HEADER = ""\n')
Signature · 1 line
2.5.5
author
#2 lore raw

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

In reply to Randy Witt

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.

---
 scripts/devtool                    |  3 +++
 scripts/lib/devtool/build_image.py | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
scripts/devtool +3 -0
index 4780390..f090427 100755
@@ -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)
scripts/lib/devtool/build_image.py +12 -4
index e51d766..0f8ca93 100644
@@ -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:
Signature · 1 line
2.5.5
#3 lore raw

PATCH v2 1/1 devtool: Fix build-sdk when pn doesn't match filename

From: Randy Witt <[email protected]>

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.

---

Changes since v1:
* Ignore bbappend not existing when attempting to delete it, since that will be the case if devtool build-sdk is run a second time
* Call config.write() so setting gets written out at the right time
* Use os.path.splitext() rather than rsplit() - no difference in operation but if there's a function to do this we should use it

 scripts/devtool                    |  3 +++
 scripts/lib/devtool/build_image.py | 24 +++++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)
scripts/devtool +3 -0
index 4780390..f090427 100755
@@ -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)
scripts/lib/devtool/build_image.py +19 -5
index e51d766..1e5d09b 100644
@@ -18,6 +18,7 @@
 """Devtool plugin containing the build-image subcommand."""
 
 import os
+import errno
 import logging
 
 from bb.process import ExecutionError
@@ -72,13 +73,17 @@ 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):
-        os.unlink(appendfile)
+    target_basename = config.get('SDK', 'target_basename', '')
+    if target_basename:
+        appendfile = os.path.join(config.workspace_path, 'appends',
+                                  '%s.bbappend' % target_basename)
+        try:
+            os.unlink(appendfile)
+        except OSError as exc:
+            if exc.errno != errno.ENOENT:
+                raise
 
     tinfoil = setup_tinfoil(basepath=basepath)
     rd = parse_recipe(config, tinfoil, image, True)
@@ -88,6 +93,15 @@ 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.splitext(os.path.basename(target_basename))[0]
+    config.set('SDK', 'target_basename', target_basename)
+    config.write()
+
+    appendfile = os.path.join(config.workspace_path, 'appends',
+                              '%s.bbappend' % target_basename)
+
     outputdir = None
     try:
         if workspace or add_packages:
Signature · 1 line
2.5.5
#4 lore raw

PATCH v3 1/1 devtool: Fix build-sdk when pn doesn't match filename

From: Randy Witt <[email protected]>

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.

---

Changes since v2:
* Ensure we create the config section in ConfigHandler.set() if it doesn't already exist

 scripts/devtool                    |  5 +++++
 scripts/lib/devtool/build_image.py | 24 +++++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)
scripts/devtool +5 -0
index 4780390..9ac6e79 100755
@@ -86,6 +86,11 @@ class ConfigHandler(object):
         with open(self.config_file, 'w') as f:
             self.config_obj.write(f)
 
+    def set(self, section, option, value):
+        if not self.config_obj.has_section(section):
+            self.config_obj.add_section(section)
+        self.config_obj.set(section, option, value)
+
 class Context:
     def __init__(self, **kwargs):
         self.__dict__.update(kwargs)
scripts/lib/devtool/build_image.py +19 -5
index e51d766..1e5d09b 100644
@@ -18,6 +18,7 @@
 """Devtool plugin containing the build-image subcommand."""
 
 import os
+import errno
 import logging
 
 from bb.process import ExecutionError
@@ -72,13 +73,17 @@ 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):
-        os.unlink(appendfile)
+    target_basename = config.get('SDK', 'target_basename', '')
+    if target_basename:
+        appendfile = os.path.join(config.workspace_path, 'appends',
+                                  '%s.bbappend' % target_basename)
+        try:
+            os.unlink(appendfile)
+        except OSError as exc:
+            if exc.errno != errno.ENOENT:
+                raise
 
     tinfoil = setup_tinfoil(basepath=basepath)
     rd = parse_recipe(config, tinfoil, image, True)
@@ -88,6 +93,15 @@ 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.splitext(os.path.basename(target_basename))[0]
+    config.set('SDK', 'target_basename', target_basename)
+    config.write()
+
+    appendfile = os.path.join(config.workspace_path, 'appends',
+                              '%s.bbappend' % target_basename)
+
     outputdir = None
     try:
         if workspace or add_packages:
Signature · 1 line
2.5.5