aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/copy_buildsystem.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-02 23:44:21 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-04 17:11:00 +0000
commit59e207ff6dd4b50a8905e14bc9292cf2794f4e7a (patch)
tree20a030693fa60bd5ca55d03ed9afa5fb50f9a526 /meta/lib/oe/copy_buildsystem.py
parente8f6db9436dfc923e236f2cbc08f357e3b24fd5d (diff)
downloadopenembedded-core-contrib-59e207ff6dd4b50a8905e14bc9292cf2794f4e7a.tar.gz
devtool: add build-sdk subcommand
Add a build-sdk command which is only available within the extensible SDK that builds a derivative extensible SDK. The idea is recipes in the workspace become a part of the new SDK - for example, this allows taking a vendor provided SDK, adding a few libs and then producing a new SDK with those included. When normally building the extensible SDK, the workspace is excluded; here we need to copy into the new SDK (renaming it in the process); the recipes' task signatures become locked and thus the sources are no longer needed, so they are removed along with the workspace bbappends which would interfere with the locked signatures. Additionally we need to just copy the configuration files (i.e. local.conf and auto.conf) rather than filtering and appending to them since that work has already been done when constructing the original SDK. The extra sstate artifacts from workspace recipes are also determined and copied into the new SDK in minimal mode (on the assumption that you won't set up a new sstate mirror). This reuses some code from build-image, so that needed to be generalised to allow that. Implements [YOCTO #8892]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/copy_buildsystem.py')
-rw-r--r--meta/lib/oe/copy_buildsystem.py59
1 files changed, 53 insertions, 6 deletions
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py
index 5074a43cb9..dd0e6641e3 100644
--- a/meta/lib/oe/copy_buildsystem.py
+++ b/meta/lib/oe/copy_buildsystem.py
@@ -20,7 +20,7 @@ class BuildSystem(object):
self.layerdirs = d.getVar('BBLAYERS', True).split()
self.layers_exclude = (d.getVar('SDK_LAYERS_EXCLUDE', True) or "").split()
- def copy_bitbake_and_layers(self, destdir):
+ def copy_bitbake_and_layers(self, destdir, workspace_name=None):
# Copy in all metadata layers + bitbake (as repositories)
layers_copied = []
bb.utils.mkdirhier(destdir)
@@ -34,6 +34,14 @@ class BuildSystem(object):
if layer_exclude in layers:
layers.remove(layer_exclude)
+ workspace_newname = workspace_name
+ if workspace_newname:
+ layernames = [os.path.basename(layer) for layer in layers]
+ extranum = 0
+ while workspace_newname in layernames:
+ extranum += 1
+ workspace_newname = '%s-%d' % (workspace_name, extranum)
+
corebase_files = self.d.getVar('COREBASE_FILES', True).split()
corebase_files = [corebase + '/' +x for x in corebase_files]
# Make sure bitbake goes in
@@ -42,18 +50,24 @@ class BuildSystem(object):
for layer in layers:
layerconf = os.path.join(layer, 'conf', 'layer.conf')
+ layernewname = os.path.basename(layer)
+ workspace = False
if os.path.exists(layerconf):
with open(layerconf, 'r') as f:
if f.readline().startswith("# ### workspace layer auto-generated by devtool ###"):
- bb.plain("NOTE: Excluding local workspace layer %s from %s" % (layer, self.context))
- continue
+ if workspace_newname:
+ layernewname = workspace_newname
+ workspace = True
+ else:
+ bb.plain("NOTE: Excluding local workspace layer %s from %s" % (layer, self.context))
+ continue
# If the layer was already under corebase, leave it there
# since layers such as meta have issues when moved.
layerdestpath = destdir
if corebase == os.path.dirname(layer):
layerdestpath += '/' + os.path.basename(corebase)
- layerdestpath += '/' + os.path.basename(layer)
+ layerdestpath += '/' + layernewname
layer_relative = os.path.relpath(layerdestpath,
destdir)
@@ -73,6 +87,38 @@ class BuildSystem(object):
else:
_smart_copy(layer, layerdestpath)
+ if workspace:
+ # Make some adjustments original workspace layer
+ # Drop sources (recipe tasks will be locked, so we don't need them)
+ srcdir = os.path.join(layerdestpath, 'sources')
+ if os.path.isdir(srcdir):
+ shutil.rmtree(srcdir)
+ # Drop all bbappends except the one for the image the SDK is being built for
+ # (because of externalsrc, the workspace bbappends will interfere with the
+ # locked signatures if present, and we don't need them anyway)
+ image_bbappend = os.path.splitext(os.path.basename(self.d.getVar('FILE', True)))[0] + '.bbappend'
+ appenddir = os.path.join(layerdestpath, 'appends')
+ if os.path.isdir(appenddir):
+ for fn in os.listdir(appenddir):
+ if fn == image_bbappend:
+ continue
+ else:
+ os.remove(os.path.join(appenddir, fn))
+ # Drop README
+ readme = os.path.join(layerdestpath, 'README')
+ if os.path.exists(readme):
+ os.remove(readme)
+ # Filter out comments in layer.conf and change layer name
+ layerconf = os.path.join(layerdestpath, 'conf', 'layer.conf')
+ with open(layerconf, 'r') as f:
+ origlines = f.readlines()
+ with open(layerconf, 'w') as f:
+ for line in origlines:
+ if line.startswith('#'):
+ continue
+ line = line.replace('workspacelayer', workspace_newname)
+ f.write(line)
+
return layers_copied
def generate_locked_sigs(sigfile, d):
@@ -123,7 +169,7 @@ def merge_lockedsigs(copy_tasks, lockedsigs_main, lockedsigs_extra, merged_outpu
if line.endswith('\\\n'):
if not line in merged[invalue]:
target, task = line.strip().split(':')[:2]
- if task in copy_tasks:
+ if not copy_tasks or task in copy_tasks:
tocopy[invalue].append(line)
merged[invalue].append(line)
else:
@@ -150,7 +196,8 @@ def merge_lockedsigs(copy_tasks, lockedsigs_main, lockedsigs_extra, merged_outpu
f.write('SIGGEN_LOCKEDSIGS_TYPES = "%s"\n' % ' '.join(fulltypes))
write_sigs_file(copy_output, tocopy.keys(), tocopy)
- write_sigs_file(merged_output, arch_order, merged)
+ if merged_output:
+ write_sigs_file(merged_output, arch_order, merged)
def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cache, d, fixedlsbstring=""):
bb.note('Generating sstate-cache...')