diff options
| author | Randy Witt <randy.e.witt@linux.intel.com> | 2016-05-10 10:46:27 +1200 | 
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-17 21:28:32 +0100 | 
| commit | da9e793fd7497e63404c987d68e3b630a89fc1c2 (patch) | |
| tree | 82d2952a9df3cf05ab21242923a73be61914fbc9 | |
| parent | a89e4e27ba3f4bc3d1c649b3b8ad8ddc4d227d0d (diff) | |
| download | openembedded-core-da9e793fd7497e63404c987d68e3b630a89fc1c2.tar.gz openembedded-core-da9e793fd7497e63404c987d68e3b630a89fc1c2.tar.bz2 openembedded-core-da9e793fd7497e63404c987d68e3b630a89fc1c2.zip | |
devtool: Fix build-sdk when pn doesn't match filename
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.
(From OE-Core rev: d58a326b6960be14b8a049253559aec9582b7d0d)
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/devtool | 5 | ||||
| -rw-r--r-- | scripts/lib/devtool/build_image.py | 24 | 
2 files changed, 24 insertions, 5 deletions
| diff --git a/scripts/devtool b/scripts/devtool index 4780390654..9ac6e798d2 100755 --- a/scripts/devtool +++ b/scripts/devtool @@ -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) diff --git a/scripts/lib/devtool/build_image.py b/scripts/lib/devtool/build_image.py index e51d766474..1e5d09b39e 100644 --- a/scripts/lib/devtool/build_image.py +++ b/scripts/lib/devtool/build_image.py @@ -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: | 
