Extensible SDK improvements
cover Extensible SDK improvements
Add ability to build derivative extensible SDK and fix up an issue with the earlier patch introducing oe-workdir and oe-logs symlinks.
The following changes since commit 390bad905537820f49add855c95d726b5b55c8fa:
sanity: Fix int verses string reference (2016-02-28 22:54:06 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/extsdkfixes8-oe
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/extsdkfixes8-oe
Paul Eggleton (3):
classes/externalsrc: fix symlinking if symlink exists pointing to another path
devtool: build-image: rename module
devtool: add build-sdk subcommand
meta/classes/externalsrc.bbclass | 1 +
meta/classes/populate_sdk_ext.bbclass | 148 +++++++++++++--------
meta/lib/oe/copy_buildsystem.py | 59 +++++++-
.../lib/devtool/{build-image.py => build_image.py} | 79 ++++++++---
scripts/lib/devtool/build_sdk.py | 65 +++++++++
5 files changed, 265 insertions(+), 87 deletions(-)
rename scripts/lib/devtool/{build-image.py => build_image.py} (67%)
create mode 100644 scripts/lib/devtool/build_sdk.pySignature · 1 line
2.5.0
PATCH 1/3 classes/externalsrc: fix symlinking if symlink exists pointing to another path
If the oe-workdir / oe-logs symlink exists and points to a different path then the symlink needs to be removed before calling os.symlink() or it'll fail.
--- meta/classes/externalsrc.bbclass | 1 + 1 file changed, 1 insertion(+)
meta/classes/externalsrc.bbclass +1 -0
@@ -115,6 +115,7 @@ python externalsrc_configure_prefunc() { # Link already exists, leave it if it points to the right location already if os.readlink(lnkfile) == target: continue + os.unlink(lnkfile) elif os.path.exists(lnkfile): # File/dir exists with same name as link, just leave it alone continue
Signature · 1 line
2.5.0
PATCH 2/3 devtool: build-image: rename module
In reply to Paul EggletonHyphens aren't allowed in python identifiers, so you shouldn't use them in module names or they are more difficult to import.
---
scripts/lib/devtool/{build-image.py => build_image.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename scripts/lib/devtool/{build-image.py => build_image.py} (100%)scripts/lib/devtool/build_image.py renamed from scripts/lib/devtool/build-image.py +0 -0
Signature · 1 line
2.5.0
PATCH 3/3 devtool: add build-sdk subcommand
In reply to Paul EggletonAdd 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].
--- meta/classes/populate_sdk_ext.bbclass | 148 ++++++++++++++++++++-------------- meta/lib/oe/copy_buildsystem.py | 59 ++++++++++++-- scripts/lib/devtool/build_image.py | 79 +++++++++++++----- scripts/lib/devtool/build_sdk.py | 65 +++++++++++++++ 4 files changed, 264 insertions(+), 87 deletions(-) create mode 100644 scripts/lib/devtool/build_sdk.py
meta/classes/populate_sdk_ext.bbclass +89 -59
@@ -89,7 +89,14 @@ python copy_buildsystem () { # Copy in all metadata layers + bitbake (as repositories) buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d) baseoutpath = d.getVar('SDK_OUTPUT', True) + '/' + d.getVar('SDKPATH', True) - layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers') + + # Determine if we're building a derivative extensible SDK (from devtool build-sdk) + derivative = (d.getVar('SDK_DERIVATIVE', True) or '') == '1' + if derivative: + workspace_name = 'orig-workspace' + else: + workspace_name = None + layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name) sdkbblayers = [] corebase = os.path.basename(d.getVar('COREBASE', True))
@@ -153,75 +160,81 @@ python copy_buildsystem () { f.write(' "\n') # Create local.conf - local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST', True) or '').split() - local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST', True) or '').split() - def handle_var(varname, origvalue, op, newlines): - if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist): - newlines.append('# Removed original setting of %s\n' % varname) - return None, op, 0, True - else: - return origvalue, op, 0, True - varlist = ['[^#=+ ]*'] builddir = d.getVar('TOPDIR', True) - with open(builddir + '/conf/local.conf', 'r') as f: - oldlines = f.readlines() - (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) + if derivative: + shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf') + else: + local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST', True) or '').split() + local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST', True) or '').split() + def handle_var(varname, origvalue, op, newlines): + if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist): + newlines.append('# Removed original setting of %s\n' % varname) + return None, op, 0, True + else: + return origvalue, op, 0, True + varlist = ['[^#=+ ]*'] + with open(builddir + '/conf/local.conf', 'r') as f: + oldlines = f.readlines() + (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) - with open(baseoutpath + '/conf/local.conf', 'w') as f: - f.write('# WARNING: this configuration has been automatically generated and in\n') - f.write('# most cases should not be edited. If you need more flexibility than\n') - f.write('# this configuration provides, it is strongly suggested that you set\n') - f.write('# up a proper instance of the full build system and use that instead.\n\n') - for line in newlines: - if line.strip() and not line.startswith('#'): - f.write(line) - # Write a newline just in case there's none at the end of the original - f.write('\n') + with open(baseoutpath + '/conf/local.conf', 'w') as f: + f.write('# WARNING: this configuration has been automatically generated and in\n') + f.write('# most cases should not be edited. If you need more flexibility than\n') + f.write('# this configuration provides, it is strongly suggested that you set\n') + f.write('# up a proper instance of the full build system and use that instead.\n\n') + for line in newlines: + if line.strip() and not line.startswith('#'): + f.write(line) + # Write a newline just in case there's none at the end of the original + f.write('\n') - f.write('INHERIT += "%s"\n\n' % 'uninative') - f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False)) + f.write('INHERIT += "%s"\n\n' % 'uninative') + f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False)) - # Some classes are not suitable for SDK, remove them from INHERIT - f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False)) + # Some classes are not suitable for SDK, remove them from INHERIT + f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False)) - # Bypass the default connectivity check if any - f.write('CONNECTIVITY_CHECK_URIS = ""\n\n') + # Bypass the default connectivity check if any + f.write('CONNECTIVITY_CHECK_URIS = ""\n\n') - # Ensure locked sstate cache objects are re-used without error - f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "none"\n\n') + # Ensure locked sstate cache objects are re-used without error + f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "none"\n\n') - # Hide the config information from bitbake output (since it's fixed within the SDK) - f.write('BUILDCFG_HEADER = ""\n') + # Hide the config information from bitbake output (since it's fixed within the SDK) + f.write('BUILDCFG_HEADER = ""\n') - # Allow additional config through sdk-extra.conf - fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) - if fn: - with open(fn, 'r') as xf: - for line in xf: - f.write(line) + # Allow additional config through sdk-extra.conf + fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) + if fn: + with open(fn, 'r') as xf: + for line in xf: + f.write(line) - # If you define a sdk_extraconf() function then it can contain additional config - # (Though this is awkward; sdk-extra.conf should probably be used instead) - extraconf = (d.getVar('sdk_extraconf', True) or '').strip() - if extraconf: - # Strip off any leading / trailing spaces - for line in extraconf.splitlines(): - f.write(line.strip() + '\n') + # If you define a sdk_extraconf() function then it can contain additional config + # (Though this is awkward; sdk-extra.conf should probably be used instead) + extraconf = (d.getVar('sdk_extraconf', True) or '').strip() + if extraconf: + # Strip off any leading / trailing spaces + for line in extraconf.splitlines(): + f.write(line.strip() + '\n') - f.write('require conf/locked-sigs.inc\n') + f.write('require conf/locked-sigs.inc\n') if os.path.exists(builddir + '/conf/auto.conf'): - with open(builddir + '/conf/auto.conf', 'r') as f: - oldlines = f.readlines() - (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) - with open(baseoutpath + '/conf/auto.conf', 'w') as f: - f.write('# WARNING: this configuration has been automatically generated and in\n') - f.write('# most cases should not be edited. If you need more flexibility than\n') - f.write('# this configuration provides, it is strongly suggested that you set\n') - f.write('# up a proper instance of the full build system and use that instead.\n\n') - for line in newlines: - if line.strip() and not line.startswith('#'): - f.write(line) + if derivative: + shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf') + else: + with open(builddir + '/conf/auto.conf', 'r') as f: + oldlines = f.readlines() + (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) + with open(baseoutpath + '/conf/auto.conf', 'w') as f: + f.write('# WARNING: this configuration has been automatically generated and in\n') + f.write('# most cases should not be edited. If you need more flexibility than\n') + f.write('# this configuration provides, it is strongly suggested that you set\n') + f.write('# up a proper instance of the full build system and use that instead.\n\n') + for line in newlines: + if line.strip() and not line.startswith('#'): + f.write(line) # Filter the locked signatures file to just the sstate tasks we are interested in excluded_targets = d.getVar('SDK_TARGETS', True)
@@ -248,7 +261,24 @@ python copy_buildsystem () { lockedsigs_pruned, lockedsigs_copy) - if d.getVar('SDK_EXT_TYPE', True) != 'minimal': + if d.getVar('SDK_EXT_TYPE', True) == 'minimal': + if derivative: + # Assume the user is not going to set up an additional sstate + # mirror, thus we need to copy the additional artifacts (from + # workspace recipes) into the derivative SDK + lockedsigs_orig = d.getVar('TOPDIR', True) + '/conf/locked-sigs.inc' + if os.path.exists(lockedsigs_orig): + lockedsigs_extra = d.getVar('WORKDIR', True) + '/locked-sigs-extra.inc' + oe.copy_buildsystem.merge_lockedsigs(None, + lockedsigs_orig, + lockedsigs_pruned, + None, + lockedsigs_extra) + oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra, + d.getVar('SSTATE_DIR', True), + sstate_out, d, + fixedlsbstring) + else: oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned, d.getVar('SSTATE_DIR', True), sstate_out, d,
meta/lib/oe/copy_buildsystem.py +53 -6
104 lines not on this page · raw message
scripts/lib/devtool/build_image.py +57 -22
115 lines not on this page · raw message
scripts/lib/devtool/build_sdk.py new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.5.0