mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
populate_sdk_ext: split copy_buildsystem() into logical steps defined as functions
copy_buildsystem() has become far too large and needs to be split into shorter and more understandable pieces; some of those pieces will be reused for the purpose of providing esdk mode directly from a plain yocto build. (From OE-Core rev: a163b8f339f32bc9e3865736af321190bc89c61b) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
dbded89a7f
commit
e946b17cf1
@@ -186,12 +186,7 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
|
|||||||
if os.path.exists(localconf + '.bak'):
|
if os.path.exists(localconf + '.bak'):
|
||||||
os.replace(localconf + '.bak', localconf)
|
os.replace(localconf + '.bak', localconf)
|
||||||
|
|
||||||
python copy_buildsystem () {
|
def copy_bitbake_and_layers(d, baseoutpath, derivative):
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import glob
|
|
||||||
import oe.copy_buildsystem
|
|
||||||
|
|
||||||
oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
|
oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
|
||||||
|
|
||||||
conf_bbpath = ''
|
conf_bbpath = ''
|
||||||
@@ -200,13 +195,7 @@ python copy_buildsystem () {
|
|||||||
|
|
||||||
# Copy in all metadata layers + bitbake (as repositories)
|
# Copy in all metadata layers + bitbake (as repositories)
|
||||||
buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
|
buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
|
||||||
baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
|
|
||||||
|
|
||||||
#check if custome templateconf path is set
|
|
||||||
use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
|
|
||||||
|
|
||||||
# Determine if we're building a derivative extensible SDK (from devtool build-sdk)
|
|
||||||
derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
|
|
||||||
if derivative:
|
if derivative:
|
||||||
workspace_name = 'orig-workspace'
|
workspace_name = 'orig-workspace'
|
||||||
else:
|
else:
|
||||||
@@ -231,6 +220,9 @@ python copy_buildsystem () {
|
|||||||
d.setVar('oe_init_build_env_path', conf_initpath)
|
d.setVar('oe_init_build_env_path', conf_initpath)
|
||||||
d.setVar('esdk_tools_path', esdk_tools_path)
|
d.setVar('esdk_tools_path', esdk_tools_path)
|
||||||
|
|
||||||
|
return (conf_initpath, conf_bbpath, core_meta_subdir, sdkbblayers)
|
||||||
|
|
||||||
|
def write_devtool_config(d, baseoutpath, conf_bbpath, conf_initpath, core_meta_subdir):
|
||||||
# Write out config file for devtool
|
# Write out config file for devtool
|
||||||
import configparser
|
import configparser
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@@ -247,10 +239,12 @@ python copy_buildsystem () {
|
|||||||
with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
|
with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
|
||||||
config.write(f)
|
config.write(f)
|
||||||
|
|
||||||
|
def write_unlocked_sigs(d, baseoutpath):
|
||||||
unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
|
unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
|
||||||
with open(unlockedsigs, 'w') as f:
|
with open(unlockedsigs, 'w') as f:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def write_bblayers_conf(d, baseoutpath, sdkbblayers):
|
||||||
# Create a layer for new recipes / appends
|
# Create a layer for new recipes / appends
|
||||||
bbpath = d.getVar('BBPATH')
|
bbpath = d.getVar('BBPATH')
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@@ -279,6 +273,9 @@ python copy_buildsystem () {
|
|||||||
f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
|
f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
|
||||||
f.write(' "\n')
|
f.write(' "\n')
|
||||||
|
|
||||||
|
def copy_uninative(d, baseoutpath):
|
||||||
|
import shutil
|
||||||
|
|
||||||
# Copy uninative tarball
|
# Copy uninative tarball
|
||||||
# For now this is where uninative.bbclass expects the tarball
|
# For now this is where uninative.bbclass expects the tarball
|
||||||
if bb.data.inherits_class('uninative', d):
|
if bb.data.inherits_class('uninative', d):
|
||||||
@@ -288,6 +285,12 @@ python copy_buildsystem () {
|
|||||||
bb.utils.mkdirhier(uninative_outdir)
|
bb.utils.mkdirhier(uninative_outdir)
|
||||||
shutil.copy(uninative_file, uninative_outdir)
|
shutil.copy(uninative_file, uninative_outdir)
|
||||||
|
|
||||||
|
return uninative_checksum
|
||||||
|
|
||||||
|
def write_local_conf(d, baseoutpath, derivative, core_meta_subdir, uninative_checksum):
|
||||||
|
#check if custome templateconf path is set
|
||||||
|
use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
|
||||||
|
|
||||||
env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split()
|
env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split()
|
||||||
env_passthrough_values = {}
|
env_passthrough_values = {}
|
||||||
|
|
||||||
@@ -457,6 +460,9 @@ python copy_buildsystem () {
|
|||||||
f.write(line)
|
f.write(line)
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
|
def prepare_locked_cache(d, baseoutpath, derivative, conf_initpath):
|
||||||
|
import shutil
|
||||||
|
|
||||||
# Filter the locked signatures file to just the sstate tasks we are interested in
|
# Filter the locked signatures file to just the sstate tasks we are interested in
|
||||||
excluded_targets = get_sdk_install_targets(d, images_only=True)
|
excluded_targets = get_sdk_install_targets(d, images_only=True)
|
||||||
sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
|
sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
|
||||||
@@ -560,6 +566,9 @@ python copy_buildsystem () {
|
|||||||
f = os.path.join(root, name)
|
f = os.path.join(root, name)
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
|
|
||||||
|
def write_manifest(d, baseoutpath):
|
||||||
|
import glob
|
||||||
|
|
||||||
# Write manifest file
|
# Write manifest file
|
||||||
# Note: at the moment we cannot include the env setup script here to keep
|
# Note: at the moment we cannot include the env setup script here to keep
|
||||||
# it updated, since it gets modified during SDK installation (see
|
# it updated, since it gets modified during SDK installation (see
|
||||||
@@ -583,6 +592,32 @@ python copy_buildsystem () {
|
|||||||
continue
|
continue
|
||||||
chksum = bb.utils.sha256_file(fn)
|
chksum = bb.utils.sha256_file(fn)
|
||||||
f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
|
f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
|
||||||
|
|
||||||
|
|
||||||
|
python copy_buildsystem () {
|
||||||
|
import oe.copy_buildsystem
|
||||||
|
|
||||||
|
baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
|
||||||
|
|
||||||
|
# Determine if we're building a derivative extensible SDK (from devtool build-sdk)
|
||||||
|
derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
|
||||||
|
|
||||||
|
conf_initpath, conf_bbpath, core_meta_subdir, sdkbblayers = copy_bitbake_and_layers(d, baseoutpath, derivative)
|
||||||
|
|
||||||
|
write_devtool_config(d, baseoutpath, conf_bbpath, conf_initpath, core_meta_subdir)
|
||||||
|
|
||||||
|
write_unlocked_sigs(d, baseoutpath)
|
||||||
|
|
||||||
|
write_bblayers_conf(d, baseoutpath, sdkbblayers)
|
||||||
|
|
||||||
|
uninative_checksum = copy_uninative(d, baseoutpath)
|
||||||
|
|
||||||
|
write_local_conf(d, baseoutpath, derivative, core_meta_subdir, uninative_checksum)
|
||||||
|
|
||||||
|
prepare_locked_cache(d, baseoutpath, derivative, conf_initpath)
|
||||||
|
|
||||||
|
write_manifest(d, baseoutpath)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_current_buildtools(d):
|
def get_current_buildtools(d):
|
||||||
|
|||||||
Reference in New Issue
Block a user