summaryrefslogtreecommitdiffstats
path: root/meta/classes/populate_sdk_ext.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/populate_sdk_ext.bbclass')
-rw-r--r--meta/classes/populate_sdk_ext.bbclass78
1 files changed, 72 insertions, 6 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 211a02286e..ce8c8ff3c4 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -85,6 +85,60 @@ SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME', True) or d.getVar('DISTRO', True)} Extensible SDK"
+def clean_esdk_builddir(sdkbasepath):
+ """Clean up traces of the fake build for create_filtered_tasklist()"""
+ import shutil
+ cleanpaths = 'tmp cache conf/sanity_info conf/templateconf.cfg downloads'.split()
+ for pth in cleanpaths:
+ fullpth = os.path.join(sdkbasepath, pth)
+ if os.path.isdir(fullpth):
+ shutil.rmtree(fullpth)
+ elif os.path.isfile(fullpth):
+ os.remove(fullpth)
+
+def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
+ """
+ Create a filtered list of tasks. Also double-checks that the build system
+ within the SDK basically works and required sstate artifacts are available.
+ """
+ import tempfile
+ import shutil
+ import oe.copy_buildsystem
+
+ # Create a temporary build directory that we can pass to the env setup script
+ shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak')
+ try:
+ with open(sdkbasepath + '/conf/local.conf', 'a') as f:
+ f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR', True))
+ f.write('SSTATE_MIRRORS_forcevariable = ""\n')
+
+ # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
+ # will not allow in its COREBASE path, so we need to rename the directory temporarily
+ temp_sdkbasepath = d.getVar('SDK_OUTPUT', True) + '/tmp-renamed-sdk'
+ # Delete any existing temp dir
+ try:
+ shutil.rmtree(temp_sdkbasepath)
+ except FileNotFoundError:
+ pass
+ os.rename(sdkbasepath, temp_sdkbasepath)
+ try:
+ cmdprefix = '. %s .; ' % conf_initpath
+ logfile = d.getVar('WORKDIR', True) + '/tasklist_bb_log.txt'
+ try:
+ oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
+ except bb.process.ExecutionError as e:
+ msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip()
+ if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
+ msg += '\n----------\n\nNOTE: "attempted to execute unexpectedly and should have been setscened" errors indicate this may be caused by missing sstate artifacts that were likely produced in earlier builds, but have been subsequently deleted for some reason.\n'
+ bb.fatal(msg)
+ finally:
+ os.rename(temp_sdkbasepath, sdkbasepath)
+ # Clean out residue of running bitbake, which check_sstate_task_list()
+ # will effectively do
+ clean_esdk_builddir(sdkbasepath)
+ finally:
+ os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf')
+
python copy_buildsystem () {
import re
import shutil
@@ -301,6 +355,15 @@ python copy_buildsystem () {
# uninative.bbclass sets NATIVELSBSTRING to 'universal'
fixedlsbstring = 'universal'
+ sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1')
+ sdk_ext_type = d.getVar('SDK_EXT_TYPE', True)
+ if sdk_ext_type != 'minimal' or sdk_include_toolchain or derivative:
+ # Create the filtered task list used to generate the sstate cache shipped with the SDK
+ tasklistfn = d.getVar('WORKDIR', True) + '/tasklist.txt'
+ create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath)
+ else:
+ tasklistfn = None
+
# Add packagedata if enabled
if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1':
lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base.inc'
@@ -312,20 +375,21 @@ python copy_buildsystem () {
lockedsigs_pruned,
lockedsigs_copy)
- if d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1':
+ if sdk_include_toolchain:
lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base2.inc'
lockedsigs_toolchain = d.getVar('STAGING_DIR_HOST', True) + '/locked-sigs/locked-sigs-extsdk-toolchain.inc'
shutil.move(lockedsigs_pruned, lockedsigs_base)
- oe.copy_buildsystem.merge_lockedsigs(['do_populate_sysroot'],
+ oe.copy_buildsystem.merge_lockedsigs([],
lockedsigs_base,
lockedsigs_toolchain,
lockedsigs_pruned)
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain,
d.getVar('SSTATE_DIR', True),
sstate_out, d,
- fixedlsbstring)
+ fixedlsbstring,
+ filterfile=tasklistfn)
- if d.getVar('SDK_EXT_TYPE', True) == 'minimal':
+ if sdk_ext_type == '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
@@ -341,12 +405,14 @@ python copy_buildsystem () {
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
d.getVar('SSTATE_DIR', True),
sstate_out, d,
- fixedlsbstring)
+ fixedlsbstring,
+ filterfile=tasklistfn)
else:
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
d.getVar('SSTATE_DIR', True),
sstate_out, d,
- fixedlsbstring)
+ fixedlsbstring,
+ filterfile=tasklistfn)
# We don't need sstate do_package files
for root, dirs, files in os.walk(sstate_out):