summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2016-05-10 10:46:27 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-17 21:29:30 +0100
commit5d11ed7162074b1d64e9840210fa563a16f39018 (patch)
tree347ececab3a1babf7cdf1fa5af5673358340331d /scripts
parent22f8a46d2dcbeaaa4e93bb5ba97acf8c9c3f9524 (diff)
downloadpoky-5d11ed7162074b1d64e9840210fa563a16f39018.tar.gz
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) (From OE-Core rev: da9e793fd7497e63404c987d68e3b630a89fc1c2) 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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/devtool5
-rw-r--r--scripts/lib/devtool/build_image.py24
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):
86 with open(self.config_file, 'w') as f: 86 with open(self.config_file, 'w') as f:
87 self.config_obj.write(f) 87 self.config_obj.write(f)
88 88
89 def set(self, section, option, value):
90 if not self.config_obj.has_section(section):
91 self.config_obj.add_section(section)
92 self.config_obj.set(section, option, value)
93
89class Context: 94class Context:
90 def __init__(self, **kwargs): 95 def __init__(self, **kwargs):
91 self.__dict__.update(kwargs) 96 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 @@
18"""Devtool plugin containing the build-image subcommand.""" 18"""Devtool plugin containing the build-image subcommand."""
19 19
20import os 20import os
21import errno
21import logging 22import logging
22 23
23from bb.process import ExecutionError 24from bb.process import ExecutionError
@@ -72,13 +73,17 @@ def build_image(args, config, basepath, workspace):
72 return result 73 return result
73 74
74def build_image_task(config, basepath, workspace, image, add_packages=None, task=None, extra_append=None): 75def build_image_task(config, basepath, workspace, image, add_packages=None, task=None, extra_append=None):
75 appendfile = os.path.join(config.workspace_path, 'appends',
76 '%s.bbappend' % image)
77
78 # remove <image>.bbappend to make sure setup_tinfoil doesn't 76 # remove <image>.bbappend to make sure setup_tinfoil doesn't
79 # break because of it 77 # break because of it
80 if os.path.isfile(appendfile): 78 target_basename = config.get('SDK', 'target_basename', '')
81 os.unlink(appendfile) 79 if target_basename:
80 appendfile = os.path.join(config.workspace_path, 'appends',
81 '%s.bbappend' % target_basename)
82 try:
83 os.unlink(appendfile)
84 except OSError as exc:
85 if exc.errno != errno.ENOENT:
86 raise
82 87
83 tinfoil = setup_tinfoil(basepath=basepath) 88 tinfoil = setup_tinfoil(basepath=basepath)
84 rd = parse_recipe(config, tinfoil, image, True) 89 rd = parse_recipe(config, tinfoil, image, True)
@@ -88,6 +93,15 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
88 if not bb.data.inherits_class('image', rd): 93 if not bb.data.inherits_class('image', rd):
89 raise TargetNotImageError() 94 raise TargetNotImageError()
90 95
96 # Get the actual filename used and strip the .bb and full path
97 target_basename = rd.getVar('FILE', True)
98 target_basename = os.path.splitext(os.path.basename(target_basename))[0]
99 config.set('SDK', 'target_basename', target_basename)
100 config.write()
101
102 appendfile = os.path.join(config.workspace_path, 'appends',
103 '%s.bbappend' % target_basename)
104
91 outputdir = None 105 outputdir = None
92 try: 106 try:
93 if workspace or add_packages: 107 if workspace or add_packages: