2015-02-23 17:00:43 +00:00
# Extensible SDK
inherit populate_sdk_base
# NOTE: normally you cannot use task overrides for this kind of thing - this
# only works because of get_sdk_ext_rdepends()
TOOLCHAIN_HOST_TASK_task-populate-sdk-ext = " \
meta-environment-extsdk-${MACHINE} \
"
TOOLCHAIN_TARGET_TASK_task-populate-sdk-ext = ""
SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0"
2015-12-20 20:55:39 +00:00
SDK_EXT = ""
SDK_EXT_task-populate-sdk-ext = "-ext"
2016-02-04 20:31:44 +00:00
# Options are full or minimal
SDK_EXT_TYPE ?= "full"
2016-07-22 12:38:07 +00:00
SDK_INCLUDE_PKGDATA ?= "0"
2016-12-14 21:13:04 +00:00
SDK_INCLUDE_TOOLCHAIN ?= "${@'1' if d.getVar('SDK_EXT_TYPE') == 'full' else '0'}"
2016-02-04 20:31:44 +00:00
2016-02-19 04:42:03 +00:00
SDK_RECRDEP_TASKS ?= ""
2015-09-07 12:42:23 +00:00
SDK_LOCAL_CONF_WHITELIST ?= ""
2016-02-01 23:51:51 +00:00
SDK_LOCAL_CONF_BLACKLIST ?= "CONF_VERSION \
BB_NUMBER_THREADS \
2016-05-10 03:06:43 +00:00
BB_NUMBER_PARSE_THREADS \
2016-02-01 23:51:51 +00:00
PARALLEL_MAKE \
PRSERV_HOST \
SSTATE_MIRRORS \
2016-05-10 03:06:43 +00:00
DL_DIR \
SSTATE_DIR \
TMPDIR \
2016-02-01 23:51:51 +00:00
"
2015-09-07 12:42:23 +00:00
SDK_INHERIT_BLACKLIST ?= "buildhistory icecc"
2015-09-07 12:42:27 +00:00
SDK_UPDATE_URL ?= ""
2015-02-23 17:00:43 +00:00
SDK_TARGETS ?= "${PN}"
2016-02-18 17:17:53 +00:00
2016-06-29 03:13:52 +00:00
def get_sdk_install_targets(d, images_only=False):
2016-02-18 17:17:53 +00:00
sdk_install_targets = ''
2016-12-14 21:13:04 +00:00
if images_only or d.getVar('SDK_EXT_TYPE') != 'minimal':
sdk_install_targets = d.getVar('SDK_TARGETS')
2016-02-18 17:17:53 +00:00
2016-02-24 23:27:42 +00:00
depd = d.getVar('BB_TASKDEPDATA', False)
2017-02-06 20:30:50 +00:00
tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
tasklist.remove('do_build')
2016-05-20 10:49:34 +00:00
for v in depd.values():
2017-02-06 20:30:50 +00:00
if v[1] in tasklist:
2016-02-24 23:27:42 +00:00
if v[0] not in sdk_install_targets:
sdk_install_targets += ' {}'.format(v[0])
2016-06-29 03:13:52 +00:00
if not images_only:
2016-12-14 21:13:04 +00:00
if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
2016-06-29 03:13:52 +00:00
sdk_install_targets += ' meta-world-pkgdata:do_allpackagedata'
2016-12-14 21:13:04 +00:00
if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1':
2016-07-22 12:38:09 +00:00
sdk_install_targets += ' meta-extsdk-toolchain:do_populate_sysroot'
2016-02-18 17:17:53 +00:00
return sdk_install_targets
2016-04-03 09:09:49 +00:00
get_sdk_install_targets[vardepsexclude] = "BB_TASKDEPDATA"
2015-02-23 17:00:43 +00:00
OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
# The files from COREBASE that you want preserved in the COREBASE copied
# into the sdk. This allows someone to have their own setup scripts in
# COREBASE be preserved as well as untracked files.
COREBASE_FILES ?= " \
oe-init-build-env \
oe-init-build-env-memres \
scripts \
LICENSE \
.templateconf \
"
SDK_DIR_task-populate-sdk-ext = "${WORKDIR}/sdk-ext"
B_task-populate-sdk-ext = "${SDK_DIR}"
2016-11-14 14:34:03 +00:00
TOOLCHAINEXT_OUTPUTNAME ?= "${SDK_NAME}-toolchain-ext-${SDK_VERSION}"
2016-01-28 21:18:20 +00:00
TOOLCHAIN_OUTPUTNAME_task-populate-sdk-ext = "${TOOLCHAINEXT_OUTPUTNAME}"
2015-02-23 17:00:43 +00:00
2016-01-31 15:21:14 +00:00
SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
2016-12-14 21:13:04 +00:00
SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK"
2015-04-20 16:47:08 +00:00
2016-08-11 04:45:01 +00:00
def clean_esdk_builddir(d, sdkbasepath):
2016-07-25 08:41:39 +00:00
"""Clean up traces of the fake build for create_filtered_tasklist()"""
import shutil
2016-11-02 02:31:05 +00:00
cleanpaths = 'cache conf/sanity_info tmp'.split()
2016-07-25 08:41:39 +00:00
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:
2016-09-14 05:09:51 +00:00
# Force the use of sstate from the build system
2016-12-14 21:13:04 +00:00
f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR'))
2016-07-25 08:41:39 +00:00
f.write('SSTATE_MIRRORS_forcevariable = ""\n')
2016-09-14 05:09:51 +00:00
# Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
f.write('TMPDIR_forcevariable = "${TOPDIR}/tmp"\n')
2017-04-13 10:09:07 +00:00
f.write('TCLIBCAPPEND_forcevariable = ""\n')
2016-11-22 15:57:54 +00:00
# Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
# be different and we won't be able to find our native sstate)
if not bb.data.inherits_class('uninative', d):
f.write('INHERIT_remove = "uninative"\n')
2016-07-25 08:41:39 +00:00
# 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
2016-12-14 21:13:04 +00:00
temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk'
2016-07-25 08:41:39 +00:00
# Delete any existing temp dir
try:
shutil.rmtree(temp_sdkbasepath)
except FileNotFoundError:
pass
os.rename(sdkbasepath, temp_sdkbasepath)
try:
cmdprefix = '. %s .; ' % conf_initpath
2016-12-14 21:13:04 +00:00
logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
2016-07-25 08:41:39 +00:00
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
2016-08-11 04:45:01 +00:00
clean_esdk_builddir(d, sdkbasepath)
2016-07-25 08:41:39 +00:00
finally:
os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf')
2015-02-23 17:00:43 +00:00
python copy_buildsystem () {
import re
2016-01-22 11:59:48 +00:00
import shutil
2016-01-22 11:59:51 +00:00
import glob
2015-02-23 17:00:43 +00:00
import oe.copy_buildsystem
2016-12-14 21:13:04 +00:00
oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
2015-02-23 17:00:43 +00:00
conf_bbpath = ''
conf_initpath = ''
core_meta_subdir = ''
# Copy in all metadata layers + bitbake (as repositories)
2015-11-12 15:24:29 +00:00
buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
2016-12-14 21:13:04 +00:00
baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
2016-03-02 10:44:21 +00:00
# Determine if we're building a derivative extensible SDK (from devtool build-sdk)
2016-12-14 21:13:04 +00:00
derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
2016-03-02 10:44:21 +00:00
if derivative:
workspace_name = 'orig-workspace'
else:
workspace_name = None
layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name)
2015-02-23 17:00:43 +00:00
sdkbblayers = []
2016-12-14 21:13:04 +00:00
corebase = os.path.basename(d.getVar('COREBASE'))
2015-02-23 17:00:43 +00:00
for layer in layers_copied:
if corebase == os.path.basename(layer):
conf_bbpath = os.path.join('layers', layer, 'bitbake')
else:
sdkbblayers.append(layer)
for path in os.listdir(baseoutpath + '/layers'):
relpath = os.path.join('layers', path, oe_init_env_script)
if os.path.exists(os.path.join(baseoutpath, relpath)):
conf_initpath = relpath
relpath = os.path.join('layers', path, 'scripts', 'devtool')
if os.path.exists(os.path.join(baseoutpath, relpath)):
scriptrelpath = os.path.dirname(relpath)
relpath = os.path.join('layers', path, 'meta')
if os.path.exists(os.path.join(baseoutpath, relpath, 'lib', 'oe')):
core_meta_subdir = relpath
d.setVar('oe_init_build_env_path', conf_initpath)
d.setVar('scriptrelpath', scriptrelpath)
# Write out config file for devtool
2016-05-20 10:57:44 +00:00
import configparser
config = configparser.SafeConfigParser()
2015-02-23 17:00:43 +00:00
config.add_section('General')
config.set('General', 'bitbake_subdir', conf_bbpath)
config.set('General', 'init_path', conf_initpath)
config.set('General', 'core_meta_subdir', core_meta_subdir)
2015-09-07 12:42:27 +00:00
config.add_section('SDK')
2016-12-14 21:13:04 +00:00
config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS'))
updateurl = d.getVar('SDK_UPDATE_URL')
2015-09-07 12:42:27 +00:00
if updateurl:
config.set('SDK', 'updateserver', updateurl)
2015-02-23 17:00:43 +00:00
bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf'))
with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
config.write(f)
2016-04-07 23:34:53 +00:00
unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
with open(unlockedsigs, 'w') as f:
pass
2015-02-23 17:00:43 +00:00
# Create a layer for new recipes / appends
2016-12-14 21:13:04 +00:00
bbpath = d.getVar('BBPATH')
2015-07-31 15:19:14 +00:00
bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')])
2015-02-23 17:00:43 +00:00
# Create bblayers.conf
bb.utils.mkdirhier(baseoutpath + '/conf')
with open(baseoutpath + '/conf/bblayers.conf', 'w') as f:
2015-04-20 16:47:07 +00:00
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')
2016-02-29 22:22:36 +00:00
# LCONF_VERSION may not be set, for example when using meta-poky
# so don't error if it isn't found
lconf_version = d.getVar('LCONF_VERSION', False)
if lconf_version is not None:
f.write('LCONF_VERSION = "%s"\n\n' % lconf_version)
2015-02-23 17:00:43 +00:00
f.write('BBPATH = "$' + '{TOPDIR}"\n')
f.write('SDKBASEMETAPATH = "$' + '{TOPDIR}"\n')
f.write('BBLAYERS := " \\\n')
for layerrelpath in sdkbblayers:
f.write(' $' + '{SDKBASEMETAPATH}/layers/%s \\\n' % layerrelpath)
f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
f.write(' "\n')
2016-08-11 04:44:59 +00:00
# Copy uninative tarball
# For now this is where uninative.bbclass expects the tarball
2017-12-09 11:06:47 +00:00
if bb.data.inherits_class('uninative', d):
uninative_file = d.expand('${UNINATIVE_DLDIR}/' + d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH")) + '/${UNINATIVE_TARBALL}')
uninative_checksum = bb.utils.sha256_file(uninative_file)
uninative_outdir = '%s/downloads/uninative/%s' % (baseoutpath, uninative_checksum)
bb.utils.mkdirhier(uninative_outdir)
shutil.copy(uninative_file, uninative_outdir)
2016-08-11 04:44:59 +00:00
2016-12-14 21:13:04 +00:00
env_whitelist = (d.getVar('BB_ENV_EXTRAWHITE') or '').split()
2016-03-31 08:53:31 +00:00
env_whitelist_values = {}
2015-02-23 17:00:43 +00:00
# Create local.conf
2016-12-14 21:13:04 +00:00
builddir = d.getVar('TOPDIR')
2017-03-03 11:13:00 +00:00
if derivative and os.path.exists(builddir + '/conf/auto.conf'):
shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf')
2016-03-02 10:44:21 +00:00
if derivative:
shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf')
else:
2016-12-14 21:13:04 +00:00
local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST') or '').split()
local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST') or '').split()
2016-03-02 10:44:21 +00:00
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:
2016-03-31 08:53:31 +00:00
if varname in env_whitelist:
env_whitelist_values[varname] = origvalue
2016-03-02 10:44:21 +00:00
return origvalue, op, 0, True
varlist = ['[^#=+ ]*']
2017-03-03 11:13:00 +00:00
oldlines = []
if os.path.exists(builddir + '/conf/auto.conf'):
with open(builddir + '/conf/auto.conf', 'r') as f:
oldlines += f.readlines()
2016-03-02 10:44:21 +00:00
with open(builddir + '/conf/local.conf', 'r') as f:
2017-03-03 11:13:00 +00:00
oldlines += f.readlines()
2016-03-02 10:44:21 +00:00
(updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
2015-09-07 12:42:23 +00:00
2016-03-02 10:44:21 +00:00
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')
2015-04-20 16:47:07 +00:00
2017-01-19 18:29:16 +00:00
f.write('TMPDIR = "${TOPDIR}/tmp"\n')
2017-04-13 10:09:07 +00:00
f.write('TCLIBCAPPEND = ""\n')
2016-10-14 12:57:51 +00:00
f.write('DL_DIR = "${TOPDIR}/downloads"\n')
2016-08-11 04:44:59 +00:00
f.write('INHERIT += "%s"\n' % 'uninative')
2016-12-14 21:13:04 +00:00
f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum))
2016-03-02 10:44:21 +00:00
f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
2015-02-23 17:00:43 +00:00
2016-03-02 10:44:21 +00:00
# Some classes are not suitable for SDK, remove them from INHERIT
f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False))
2015-09-07 12:42:23 +00:00
2016-03-02 10:44:21 +00:00
# Bypass the default connectivity check if any
f.write('CONNECTIVITY_CHECK_URIS = ""\n\n')
2015-04-20 16:47:06 +00:00
2016-04-07 23:34:51 +00:00
# This warning will come out if reverse dependencies for a task
# don't have sstate as well as the task itself. We already know
# this will be the case for the extensible sdk, so turn off the
# warning.
f.write('SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK = "none"\n\n')
2016-06-23 12:07:03 +00:00
# Warn if the sigs in the locked-signature file don't match
2016-04-07 23:34:51 +00:00
# the sig computed from the metadata.
2016-05-02 00:13:02 +00:00
f.write('SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n\n')
2015-02-23 17:00:43 +00:00
2016-06-23 12:07:03 +00:00
# Set up whitelist for run on install
2017-04-14 08:41:29 +00:00
f.write('BB_SETSCENE_ENFORCE_WHITELIST = "%:* *:do_shared_workdir *:do_rm_work wic-tools:* *:do_addto_recipe_sysroot"\n\n')
2016-06-23 12:07:03 +00:00
2016-03-02 10:44:21 +00:00
# Hide the config information from bitbake output (since it's fixed within the SDK)
2017-01-04 18:48:17 +00:00
f.write('BUILDCFG_HEADER = ""\n\n')
# Map gcc-dependent uninative sstate cache for installer usage
2017-03-03 11:12:09 +00:00
f.write('SSTATE_MIRRORS += " file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n\n')
2015-12-22 03:19:16 +00:00
2016-03-02 10:44:21 +00:00
# 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)
2016-02-19 09:41:58 +00:00
2016-03-02 10:44:21 +00:00
# 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)
2016-12-14 21:13:04 +00:00
extraconf = (d.getVar('sdk_extraconf') or '').strip()
2016-03-02 10:44:21 +00:00
if extraconf:
# Strip off any leading / trailing spaces
for line in extraconf.splitlines():
f.write(line.strip() + '\n')
2015-09-22 16:21:17 +00:00
2016-03-02 10:44:21 +00:00
f.write('require conf/locked-sigs.inc\n')
2016-04-07 23:34:53 +00:00
f.write('require conf/unlocked-sigs.inc\n')
2015-02-23 17:00:43 +00:00
2016-11-02 02:31:05 +00:00
# Write a templateconf.cfg
with open(baseoutpath + '/conf/templateconf.cfg', 'w') as f:
f.write('meta/conf\n')
2016-03-31 08:53:31 +00:00
# Ensure any variables set from the external environment (by way of
# BB_ENV_EXTRAWHITE) are set in the SDK's configuration
extralines = []
2016-05-20 10:49:34 +00:00
for name, value in env_whitelist_values.items():
2016-12-14 21:13:04 +00:00
actualvalue = d.getVar(name) or ''
2016-03-31 08:53:31 +00:00
if value != actualvalue:
extralines.append('%s = "%s"\n' % (name, actualvalue))
if extralines:
with open(baseoutpath + '/conf/local.conf', 'a') as f:
f.write('\n')
f.write('# Extra settings from environment:\n')
for line in extralines:
f.write(line)
f.write('\n')
2015-02-23 17:00:43 +00:00
# Filter the locked signatures file to just the sstate tasks we are interested in
2016-06-29 03:13:52 +00:00
excluded_targets = get_sdk_install_targets(d, images_only=True)
2016-12-14 21:13:04 +00:00
sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
2015-02-23 17:00:43 +00:00
lockedsigs_pruned = baseoutpath + '/conf/locked-sigs.inc'
2016-01-08 17:36:46 +00:00
oe.copy_buildsystem.prune_lockedsigs([],
2016-01-07 19:24:25 +00:00
excluded_targets.split(),
2015-02-23 17:00:43 +00:00
sigfile,
lockedsigs_pruned)
sstate_out = baseoutpath + '/sstate-cache'
bb.utils.remove(sstate_out, True)
2016-12-13 23:55:04 +00:00
# uninative.bbclass sets NATIVELSBSTRING to 'universal%s' % oe.utils.host_gcc_version(d)
fixedlsbstring = "universal%s" % oe.utils.host_gcc_version(d)
2016-01-22 11:59:48 +00:00
2016-12-14 21:13:04 +00:00
sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1')
sdk_ext_type = d.getVar('SDK_EXT_TYPE')
2016-07-25 08:41:39 +00:00
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
2016-12-14 21:13:04 +00:00
tasklistfn = d.getVar('WORKDIR') + '/tasklist.txt'
2016-07-25 08:41:39 +00:00
create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath)
else:
tasklistfn = None
2016-01-22 11:59:48 +00:00
# Add packagedata if enabled
2016-12-14 21:13:04 +00:00
if d.getVar('SDK_INCLUDE_PKGDATA') == '1':
lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base.inc'
lockedsigs_copy = d.getVar('WORKDIR') + '/locked-sigs-copy.inc'
2016-01-22 11:59:48 +00:00
shutil.move(lockedsigs_pruned, lockedsigs_base)
oe.copy_buildsystem.merge_lockedsigs(['do_packagedata'],
lockedsigs_base,
2016-12-14 21:13:04 +00:00
d.getVar('STAGING_DIR_HOST') + '/world-pkgdata/locked-sigs-pkgdata.inc',
2016-01-22 11:59:48 +00:00
lockedsigs_pruned,
lockedsigs_copy)
2016-02-04 20:31:44 +00:00
2016-07-25 08:41:39 +00:00
if sdk_include_toolchain:
2016-12-14 21:13:04 +00:00
lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc'
Switch to Recipe Specific Sysroots
This patch is comparatively large and invasive. It does only do one thing, switching the
system to build using recipe specific sysroots and where changes could be isolated from it,
that has been done.
With the current single sysroot approach, its possible for software to find things which
aren't in their dependencies. This leads to a determinism problem and is a growing issue in
several of the market segments where OE makes sense. The way to solve this problem for OE is
to have seperate sysroots for each recipe and these will only contain the dependencies for
that recipe.
Its worth noting that this is not task specific sysroots and that OE's dependencies do vary
enormously by task. This did result in some implementation challenges. There is nothing stopping
the implementation of task specific sysroots at some later point based on this work but
that as deemed a bridge too far right now.
Implementation details:
* Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in
TMPDIR/sysroot-components/PACKAGE_ARCH/PN.
* WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files
from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and
RECIPE_SYSROOT_NATIVE.
* This construction is primarily done by a new do_prepare_recipe_sysroot task which runs
before do_configure and consists of a call to the extend_recipe_sysroot function.
* Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native
and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies
for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot
dependencies.
* We have to do a search/replace 'fixme' operation on the files installed into the sysroot to
change hardcoded paths into the correct ones. We create a fixmepath file in the component
directory which lists the files which need this operation.
* Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each
time a new loader is added. These are handled by adding files in bindir with the name
prefixed by "postinst-" and are run in each sysroot as its created if they're present.
This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them.
* Since a recipe can have multiple tasks and these tasks can run against each other at the same
time we have to have a lock when we perform write operations against the sysroot. We also have
to maintain manifests of what we install against a task checksum of the dependency. If the
checksum changes, we remove its files and then add the new ones.
* The autotools logic for filtering the view of m4 files is no longer needed (and was the model
for the way extend_recipe_sysroot works).
* For autotools, we used to build a combined m4 macros directory which had both the native and
target m4 files. We can no longer do this so we use the target sysroot as the default and add
the native sysroot as an extra backup include path. If we don't do this, we'd have to build
target pkg-config before we could built anything using pkg-config for example (ditto gettext).
Such dependencies would be painful so we haven't required that.
* PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy
for each machine. The paths therefore changed, the behaviour did not.
* The ccache class had to be reworked to function with rss.
* The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data
does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal
recipe name therefore remains a bad idea.
* The logic in insane needed tweaks to deal with the new path layout, as did the debug source
file extraction code in package.bbclass.
* The logic in sstate.bbclass had to be rewritten since it previously only performed search and
replace on extracted sstate and we now need this to happen even if the compiled path was
"correct". This in theory could cause a mild performance issue but since the sysroot data
was the main data that needed this and we'd have to do it there regardless with rss, I've opted
just to change the way the class for everything. The built output used to build the sstate output
is now retained and installed rather than deleted.
* The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold
up against testing. This has been rewritten too. There are some assumptions made about paths, we
save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is
here works but is a little hardcoded and an area for future improvement.
* In order to work with eSDK we need a way to build something that looks like the old style sysroot.
"bitbake build-sysroots" will construct such a sysroot based on everything in the components
directory that matches the current MACHINE. It will allow transition of external tools and can
built target or native variants or both. It also supports a clean task. I'd suggest not relying on
this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have
to have built that in a previous bitbake invocation.
* pseudo is run out of its components directory. This is fine as its statically linked.
* The hacks for wayland to see allarch dependencies in the multilib case are no longer needed
and can be dropped.
* wic needed more extensive changes to work with rss and the fixes are in a separate commit series
* Various oe-selftest tweaks were needed since tests did assume the location to binaries and the
combined sysroot in several cases.
* Most missing dependencies this work found have been sent out as separate patches as they were found
but a few tweaks are still included here.
* A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib
sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my
hand. That implementation can probably be neater but this is on the list of things to cleanup later
at this point.
In summary, the impact people will likely see after this change:
* Recipes may fail with missing dependencies, particularly native tools like gettext-native,
glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors
* Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst
* There was a separate patch series dealing with roots postinst native dependency issues. Any postinst
which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS.
There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest
and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean
we've found all the issues.
Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the
task logfiles, not the console so I've intentionally left this like that for now. We can turn it down
easily enough in due course.
(From OE-Core rev: 809746f56df4b91af014bf6a3f28997d6698ac78)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 13:54:35 +00:00
lockedsigs_toolchain = d.expand("${STAGING_DIR}/${TUNE_PKGARCH}/meta-extsdk-toolchain/locked-sigs/locked-sigs-extsdk-toolchain.inc")
2016-07-22 12:38:09 +00:00
shutil.move(lockedsigs_pruned, lockedsigs_base)
2016-07-25 08:41:39 +00:00
oe.copy_buildsystem.merge_lockedsigs([],
2016-07-22 12:38:09 +00:00
lockedsigs_base,
lockedsigs_toolchain,
lockedsigs_pruned)
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain,
2016-12-14 21:13:04 +00:00
d.getVar('SSTATE_DIR'),
2016-07-22 12:38:09 +00:00
sstate_out, d,
2016-07-25 08:41:39 +00:00
fixedlsbstring,
filterfile=tasklistfn)
2016-07-22 12:38:09 +00:00
2016-07-25 08:41:39 +00:00
if sdk_ext_type == 'minimal':
2016-03-02 10:44:21 +00:00
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
2016-12-14 21:13:04 +00:00
lockedsigs_orig = d.getVar('TOPDIR') + '/conf/locked-sigs.inc'
2016-03-02 10:44:21 +00:00
if os.path.exists(lockedsigs_orig):
2016-12-14 21:13:04 +00:00
lockedsigs_extra = d.getVar('WORKDIR') + '/locked-sigs-extra.inc'
2016-03-02 10:44:21 +00:00
oe.copy_buildsystem.merge_lockedsigs(None,
lockedsigs_orig,
lockedsigs_pruned,
None,
lockedsigs_extra)
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
2016-12-14 21:13:04 +00:00
d.getVar('SSTATE_DIR'),
2016-03-02 10:44:21 +00:00
sstate_out, d,
2016-07-25 08:41:39 +00:00
fixedlsbstring,
filterfile=tasklistfn)
2016-03-02 10:44:21 +00:00
else:
2016-02-04 20:31:44 +00:00
oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
2016-12-14 21:13:04 +00:00
d.getVar('SSTATE_DIR'),
2016-01-22 11:59:48 +00:00
sstate_out, d,
2016-07-25 08:41:39 +00:00
fixedlsbstring,
filterfile=tasklistfn)
2016-01-22 11:59:48 +00:00
2016-01-08 17:36:46 +00:00
# We don't need sstate do_package files
for root, dirs, files in os.walk(sstate_out):
for name in files:
if name.endswith("_package.tgz"):
f = os.path.join(root, name)
os.remove(f)
2016-01-22 11:59:51 +00:00
# Write manifest file
# Note: at the moment we cannot include the env setup script here to keep
# it updated, since it gets modified during SDK installation (see
# sdk_ext_postinst() below) thus the checksum we take here would always
# be different.
manifest_file_list = ['conf/*']
manifest_file = os.path.join(baseoutpath, 'conf', 'sdk-conf-manifest')
with open(manifest_file, 'w') as f:
for item in manifest_file_list:
for fn in glob.glob(os.path.join(baseoutpath, item)):
if fn == manifest_file:
continue
chksum = bb.utils.sha256_file(fn)
f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
2015-02-23 17:00:43 +00:00
}
2016-08-11 04:45:04 +00:00
def get_current_buildtools(d):
"""Get the file name of the current buildtools installer"""
import glob
2016-12-14 21:13:04 +00:00
btfiles = glob.glob(os.path.join(d.getVar('SDK_DEPLOY'), '*-buildtools-nativesdk-standalone-*.sh'))
2016-08-11 04:45:04 +00:00
btfiles.sort(key=os.path.getctime)
return os.path.basename(btfiles[-1])
2015-09-07 12:42:21 +00:00
2016-08-11 04:45:06 +00:00
def get_sdk_required_utilities(buildtools_fn, d):
"""Find required utilities that aren't provided by the buildtools"""
2016-12-14 21:13:04 +00:00
sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES') or '').split()
2016-08-11 04:45:06 +00:00
sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc'))
sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++'))
2016-12-14 21:13:04 +00:00
buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY'), buildtools_fn)
2016-08-11 04:45:06 +00:00
filelist, _ = bb.process.run('%s -l' % buildtools_installer)
localdata = bb.data.createCopy(d)
localdata.setVar('SDKPATH', '.')
2016-12-14 21:13:04 +00:00
sdkpathnative = localdata.getVar('SDKPATHNATIVE')
sdkbindirs = [localdata.getVar('bindir_nativesdk'),
localdata.getVar('sbindir_nativesdk'),
localdata.getVar('base_bindir_nativesdk'),
localdata.getVar('base_sbindir_nativesdk')]
2016-08-11 04:45:06 +00:00
for line in filelist.splitlines():
splitline = line.split()
if len(splitline) > 5:
fn = splitline[5]
if not fn.startswith('./'):
fn = './%s' % fn
if fn.startswith(sdkpathnative):
relpth = '/' + os.path.relpath(fn, sdkpathnative)
for bindir in sdkbindirs:
if relpth.startswith(bindir):
relpth = os.path.relpath(relpth, bindir)
if relpth in sanity_required_utilities:
sanity_required_utilities.remove(relpth)
break
return ' '.join(sanity_required_utilities)
2015-02-23 17:00:43 +00:00
install_tools() {
install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}
2016-10-06 21:43:04 +00:00
scripts="devtool recipetool oe-find-native-sysroot runqemu*"
for script in $scripts; do
for scriptfn in `find ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath} -maxdepth 1 -executable -name "$script"`; do
lnr ${scriptfn} ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/`basename $scriptfn`
done
done
# We can't use the same method as above because files in the sysroot won't exist at this point
# (they get populated from sstate on installation)
2016-11-07 08:03:22 +00:00
unfsd_path="${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/unfsd"
2017-01-31 12:50:32 +00:00
if [ "${SDK_INCLUDE_TOOLCHAIN}" = "1" -a ! -e $unfsd_path ] ; then
2017-01-19 18:29:16 +00:00
binrelpath=${@os.path.relpath(d.getVar('STAGING_BINDIR_NATIVE'), d.getVar('TMPDIR'))}
lnr ${SDK_OUTPUT}/${SDKPATH}/tmp/$binrelpath/unfsd $unfsd_path
2016-10-06 21:43:04 +00:00
fi
2015-02-23 17:00:43 +00:00
touch ${SDK_OUTPUT}/${SDKPATH}/.devtoolbase
2015-09-07 12:42:21 +00:00
# find latest buildtools-tarball and install it
2016-08-11 04:45:04 +00:00
install ${SDK_DEPLOY}/${SDK_BUILDTOOLS_INSTALLER} ${SDK_OUTPUT}/${SDKPATH}
2015-02-23 17:00:43 +00:00
2016-01-12 18:47:47 +00:00
install -m 0644 ${COREBASE}/meta/files/ext-sdk-prepare.py ${SDK_OUTPUT}/${SDKPATH}
2015-02-23 17:00:43 +00:00
}
2016-01-22 11:59:54 +00:00
do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True"
2015-02-23 17:00:43 +00:00
2015-07-16 20:34:21 +00:00
sdk_ext_preinst() {
2016-08-11 04:45:06 +00:00
# Since bitbake won't run as root it doesn't make sense to try and install
# the extensible sdk as root.
2015-07-16 20:34:21 +00:00
if [ "`id -u`" = "0" ]; then
echo "ERROR: The extensible sdk cannot be installed as root."
exit 1
fi
2016-08-11 04:45:06 +00:00
if ! command -v locale > /dev/null; then
echo "ERROR: The installer requires the locale command, please install it first"
exit 1
fi
# Check setting of LC_ALL set above
canonicalised_locale=`echo $LC_ALL | sed 's/UTF-8/utf8/'`
if ! locale -a | grep -q $canonicalised_locale ; then
echo "ERROR: the installer requires the $LC_ALL locale to be installed (but not selected), please install it first"
exit 1
fi
# The relocation script used by buildtools installer requires python
if ! command -v python > /dev/null; then
echo "ERROR: The installer requires python, please install it first"
exit 1
fi
missing_utils=""
for util in ${SDK_REQUIRED_UTILITIES}; do
if ! command -v $util > /dev/null; then
missing_utils="$missing_utils $util"
fi
done
if [ -n "$missing_utils" ] ; then
echo "ERROR: the SDK requires the following missing utilities, please install them: $missing_utils"
exit 1
fi
2015-07-16 20:34:21 +00:00
SDK_EXTENSIBLE="1"
2016-03-31 08:53:33 +00:00
if [ "$publish" = "1" ] ; then
EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=ext-sdk-prepare.py"
if [ "${SDK_EXT_TYPE}" = "minimal" ] ; then
EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=sstate-cache"
fi
fi
2015-07-16 20:34:21 +00:00
}
SDK_PRE_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_preinst}"
2015-02-23 17:00:43 +00:00
# FIXME this preparation should be done as part of the SDK construction
sdk_ext_postinst() {
printf "\nExtracting buildtools...\n"
cd $target_sdk_dir
2016-08-11 04:45:03 +00:00
env_setup_script="$target_sdk_dir/environment-setup-${REAL_MULTIMACH_TARGET_SYS}"
2016-08-11 04:45:04 +00:00
printf "buildtools\ny" | ./${SDK_BUILDTOOLS_INSTALLER} > buildtools.log || { printf 'ERROR: buildtools installation failed:\n' ; cat buildtools.log ; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; }
2016-02-29 16:50:28 +00:00
# Delete the buildtools tar file since it won't be used again
2016-08-11 04:45:04 +00:00
rm -f ./${SDK_BUILDTOOLS_INSTALLER}
2016-08-11 04:45:03 +00:00
# We don't need the log either since it succeeded
rm -f buildtools.log
2015-02-23 17:00:43 +00:00
# Make sure when the user sets up the environment, they also get
# the buildtools-tarball tools in their path.
2015-09-22 16:21:16 +00:00
echo ". $target_sdk_dir/buildtools/environment-setup*" >> $env_setup_script
2015-02-23 17:00:43 +00:00
# Allow bitbake environment setup to be ran as part of this sdk.
2015-09-22 16:21:16 +00:00
echo "export OE_SKIP_SDK_CHECK=1" >> $env_setup_script
2017-04-19 08:57:28 +00:00
# Work around runqemu not knowing how to get this information within the eSDK
echo "export DEPLOY_DIR_IMAGE=$target_sdk_dir/tmp/${@os.path.relpath(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('TMPDIR'))}" >> $env_setup_script
2015-02-23 17:00:43 +00:00
# A bit of another hack, but we need this in the path only for devtool
# so put it at the end of $PATH.
2016-02-29 11:50:53 +00:00
echo "export PATH=$target_sdk_dir/sysroots/${SDK_SYS}${bindir_nativesdk}:\$PATH" >> $env_setup_script
2015-02-23 17:00:43 +00:00
2015-10-19 16:33:10 +00:00
echo "printf 'SDK environment now set up; additionally you may now run devtool to perform development tasks.\nRun devtool --help for further details.\n'" >> $env_setup_script
2015-10-19 16:33:11 +00:00
# Warn if trying to use external bitbake and the ext SDK together
echo "(which bitbake > /dev/null 2>&1 && echo 'WARNING: attempting to use the extensible SDK in an environment set up to run bitbake - this may lead to unexpected results. Please source this script in a new shell session instead.') || true" >> $env_setup_script
2016-03-21 05:14:01 +00:00
if [ "$prepare_buildsystem" != "no" ]; then
2015-10-19 16:33:08 +00:00
printf "Preparing build system...\n"
# dash which is /bin/sh on Ubuntu will not preserve the
# current working directory when first ran, nor will it set $1 when
# sourcing a script. That is why this has to look so ugly.
2015-11-12 15:00:47 +00:00
LOGFILE="$target_sdk_dir/preparing_build_system.log"
2016-08-11 04:45:07 +00:00
sh -c ". buildtools/environment-setup* > $LOGFILE && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE && python $target_sdk_dir/ext-sdk-prepare.py $LOGFILE '${SDK_INSTALL_TARGETS}'" || { echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; }
2016-01-22 11:59:53 +00:00
rm $target_sdk_dir/ext-sdk-prepare.py
2015-09-07 12:42:25 +00:00
fi
2015-02-23 17:00:43 +00:00
echo done
}
SDK_POST_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_postinst}"
SDK_POSTPROCESS_COMMAND_prepend_task-populate-sdk-ext = "copy_buildsystem; install_tools; "
2016-02-24 23:27:42 +00:00
SDK_INSTALL_TARGETS = ""
2015-02-23 17:00:43 +00:00
fakeroot python do_populate_sdk_ext() {
2015-11-18 20:59:36 +00:00
# FIXME hopefully we can remove this restriction at some point, but uninative
# currently forces this upon us
2016-12-14 21:13:04 +00:00
if d.getVar('SDK_ARCH') != d.getVar('BUILD_ARCH'):
bb.fatal('The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is set to %s (likely via setting SDKMACHINE) which is different from the architecture of the build machine (%s). Unable to continue.' % (d.getVar('SDK_ARCH'), d.getVar('BUILD_ARCH')))
2015-11-18 20:59:36 +00:00
2016-02-24 23:27:42 +00:00
d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d))
2016-08-11 04:45:04 +00:00
buildtools_fn = get_current_buildtools(d)
2016-08-11 04:45:06 +00:00
d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d))
2016-08-11 04:45:04 +00:00
d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn)
2016-09-02 10:22:41 +00:00
d.setVar('SDKDEPLOYDIR', '${SDKEXTDEPLOYDIR}')
2016-02-24 23:27:42 +00:00
2016-09-01 08:56:02 +00:00
populate_sdk_common(d)
2015-02-23 17:00:43 +00:00
}
2016-01-12 21:39:03 +00:00
def get_ext_sdk_depends(d):
2016-06-29 03:13:51 +00:00
# Note: the deps varflag is a list not a string, so we need to specify expand=False
deps = d.getVarFlag('do_image_complete', 'deps', False)
2016-12-14 21:13:04 +00:00
pn = d.getVar('PN')
2016-06-29 03:13:51 +00:00
deplist = ['%s:%s' % (pn, dep) for dep in deps]
2017-02-06 20:30:50 +00:00
tasklist = bb.build.tasksbetween('do_image_complete', 'do_build', d)
tasklist.append('do_rootfs')
for task in tasklist:
2016-12-14 21:13:06 +00:00
deplist.extend((d.getVarFlag(task, 'depends') or '').split())
2016-06-29 03:13:51 +00:00
return ' '.join(deplist)
2016-01-12 21:39:03 +00:00
python do_sdk_depends() {
# We have to do this separately in its own task so we avoid recursing into
# dependencies we don't need to (e.g. buildtools-tarball) and bringing those
# into the SDK's sstate-cache
import oe.copy_buildsystem
2016-12-14 21:13:04 +00:00
sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
2016-01-12 21:39:03 +00:00
oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
}
addtask sdk_depends
do_sdk_depends[dirs] = "${WORKDIR}"
2017-03-01 14:47:50 +00:00
do_sdk_depends[depends] = "${@get_ext_sdk_depends(d)} meta-extsdk-toolchain:do_populate_sysroot"
2016-01-12 21:39:03 +00:00
do_sdk_depends[recrdeptask] = "${@d.getVarFlag('do_populate_sdk', 'recrdeptask', False)}"
2016-02-19 04:42:03 +00:00
do_sdk_depends[recrdeptask] += "do_populate_lic do_package_qa do_populate_sysroot do_deploy ${SDK_RECRDEP_TASKS}"
2016-01-17 23:26:33 +00:00
do_sdk_depends[rdepends] = "${@get_sdk_ext_rdepends(d)}"
2016-01-12 21:39:03 +00:00
2015-02-23 17:00:43 +00:00
def get_sdk_ext_rdepends(d):
localdata = d.createCopy()
localdata.appendVar('OVERRIDES', ':task-populate-sdk-ext')
2016-12-14 21:13:06 +00:00
return localdata.getVarFlag('do_populate_sdk', 'rdepends')
2015-02-23 17:00:43 +00:00
do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}"
2016-01-17 23:26:33 +00:00
do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \
2017-12-09 11:06:47 +00:00
buildtools-tarball:do_populate_sdk \
2016-12-14 21:13:04 +00:00
${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA') == '1' else ''} \
${@'meta-extsdk-toolchain:do_locked_sigs' if d.getVar('SDK_INCLUDE_TOOLCHAIN') == '1' else ''}"
2015-02-23 17:00:43 +00:00
2017-03-29 11:29:50 +00:00
# We must avoid depending on do_build here if rm_work.bbclass is active,
# because otherwise do_rm_work may run before do_populate_sdk_ext itself.
# We can't mark do_populate_sdk_ext and do_sdk_depends as having to
# run before do_rm_work, because then they would also run as part
# of normal builds.
do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':' + (d.getVar('RM_WORK_BUILD_WITHOUT') or 'do_build') for x in d.getVar('SDK_TARGETS').split()])}"
2015-02-23 17:00:43 +00:00
2016-02-04 20:31:45 +00:00
# Make sure code changes can result in rebuild
do_populate_sdk_ext[vardeps] += "copy_buildsystem \
sdk_ext_postinst"
2015-02-23 17:00:43 +00:00
2016-03-01 18:08:21 +00:00
# Since any change in the metadata of any layer should cause a rebuild of the
# sdk(since the layers are put in the sdk) set the task to nostamp so it
# always runs.
do_populate_sdk_ext[nostamp] = "1"
2016-01-22 11:59:54 +00:00
2016-09-02 10:22:41 +00:00
SDKEXTDEPLOYDIR = "${WORKDIR}/deploy-${PN}-populate-sdk-ext"
SSTATETASKS += "do_populate_sdk_ext"
SSTATE_SKIP_CREATION_task-populate-sdk-ext = '1'
2018-01-21 09:44:07 +00:00
do_populate_sdk_ext[cleandirs] = "${SDKEXTDEPLOYDIR}"
2016-09-02 10:22:41 +00:00
do_populate_sdk_ext[sstate-inputdirs] = "${SDKEXTDEPLOYDIR}"
do_populate_sdk_ext[sstate-outputdirs] = "${SDK_DEPLOY}"
do_populate_sdk_ext[stamp-extra-info] = "${MACHINE}"
2016-01-12 21:39:03 +00:00
addtask populate_sdk_ext after do_sdk_depends