summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-11-06 13:52:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-08 11:00:09 +0000
commite946b17cf17bed7b19abd0ed4acaaa57e41e65d0 (patch)
tree9fe115b90310f6d79cf4a5c0ec41a39a271e4aa6 /meta/classes-recipe
parentdbded89a7f483c505a98646fcea94101b8d3353a (diff)
downloadpoky-e946b17cf17bed7b19abd0ed4acaaa57e41e65d0.tar.gz
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>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r--meta/classes-recipe/populate_sdk_ext.bbclass59
1 files changed, 47 insertions, 12 deletions
diff --git a/meta/classes-recipe/populate_sdk_ext.bbclass b/meta/classes-recipe/populate_sdk_ext.bbclass
index 53adc868d4..f209becae1 100644
--- a/meta/classes-recipe/populate_sdk_ext.bbclass
+++ b/meta/classes-recipe/populate_sdk_ext.bbclass
@@ -186,12 +186,7 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
186 if os.path.exists(localconf + '.bak'): 186 if os.path.exists(localconf + '.bak'):
187 os.replace(localconf + '.bak', localconf) 187 os.replace(localconf + '.bak', localconf)
188 188
189python copy_buildsystem () { 189def copy_bitbake_and_layers(d, baseoutpath, derivative):
190 import re
191 import shutil
192 import glob
193 import oe.copy_buildsystem
194
195 oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT') 190 oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT')
196 191
197 conf_bbpath = '' 192 conf_bbpath = ''
@@ -200,13 +195,7 @@ python copy_buildsystem () {
200 195
201 # Copy in all metadata layers + bitbake (as repositories) 196 # Copy in all metadata layers + bitbake (as repositories)
202 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d) 197 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
203 baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
204 198
205 #check if custome templateconf path is set
206 use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
207
208 # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
209 derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
210 if derivative: 199 if derivative:
211 workspace_name = 'orig-workspace' 200 workspace_name = 'orig-workspace'
212 else: 201 else:
@@ -231,6 +220,9 @@ python copy_buildsystem () {
231 d.setVar('oe_init_build_env_path', conf_initpath) 220 d.setVar('oe_init_build_env_path', conf_initpath)
232 d.setVar('esdk_tools_path', esdk_tools_path) 221 d.setVar('esdk_tools_path', esdk_tools_path)
233 222
223 return (conf_initpath, conf_bbpath, core_meta_subdir, sdkbblayers)
224
225def write_devtool_config(d, baseoutpath, conf_bbpath, conf_initpath, core_meta_subdir):
234 # Write out config file for devtool 226 # Write out config file for devtool
235 import configparser 227 import configparser
236 config = configparser.ConfigParser() 228 config = configparser.ConfigParser()
@@ -247,10 +239,12 @@ python copy_buildsystem () {
247 with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f: 239 with open(os.path.join(baseoutpath, 'conf', 'devtool.conf'), 'w') as f:
248 config.write(f) 240 config.write(f)
249 241
242def write_unlocked_sigs(d, baseoutpath):
250 unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc') 243 unlockedsigs = os.path.join(baseoutpath, 'conf', 'unlocked-sigs.inc')
251 with open(unlockedsigs, 'w') as f: 244 with open(unlockedsigs, 'w') as f:
252 pass 245 pass
253 246
247def write_bblayers_conf(d, baseoutpath, sdkbblayers):
254 # Create a layer for new recipes / appends 248 # Create a layer for new recipes / appends
255 bbpath = d.getVar('BBPATH') 249 bbpath = d.getVar('BBPATH')
256 env = os.environ.copy() 250 env = os.environ.copy()
@@ -279,6 +273,9 @@ python copy_buildsystem () {
279 f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n') 273 f.write(' $' + '{SDKBASEMETAPATH}/workspace \\\n')
280 f.write(' "\n') 274 f.write(' "\n')
281 275
276def copy_uninative(d, baseoutpath):
277 import shutil
278
282 # Copy uninative tarball 279 # Copy uninative tarball
283 # For now this is where uninative.bbclass expects the tarball 280 # For now this is where uninative.bbclass expects the tarball
284 if bb.data.inherits_class('uninative', d): 281 if bb.data.inherits_class('uninative', d):
@@ -288,6 +285,12 @@ python copy_buildsystem () {
288 bb.utils.mkdirhier(uninative_outdir) 285 bb.utils.mkdirhier(uninative_outdir)
289 shutil.copy(uninative_file, uninative_outdir) 286 shutil.copy(uninative_file, uninative_outdir)
290 287
288 return uninative_checksum
289
290def write_local_conf(d, baseoutpath, derivative, core_meta_subdir, uninative_checksum):
291 #check if custome templateconf path is set
292 use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
293
291 env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split() 294 env_passthrough = (d.getVar('BB_ENV_PASSTHROUGH_ADDITIONS') or '').split()
292 env_passthrough_values = {} 295 env_passthrough_values = {}
293 296
@@ -457,6 +460,9 @@ python copy_buildsystem () {
457 f.write(line) 460 f.write(line)
458 f.write('\n') 461 f.write('\n')
459 462
463def prepare_locked_cache(d, baseoutpath, derivative, conf_initpath):
464 import shutil
465
460 # Filter the locked signatures file to just the sstate tasks we are interested in 466 # Filter the locked signatures file to just the sstate tasks we are interested in
461 excluded_targets = get_sdk_install_targets(d, images_only=True) 467 excluded_targets = get_sdk_install_targets(d, images_only=True)
462 sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc' 468 sigfile = d.getVar('WORKDIR') + '/locked-sigs.inc'
@@ -560,6 +566,9 @@ python copy_buildsystem () {
560 f = os.path.join(root, name) 566 f = os.path.join(root, name)
561 os.remove(f) 567 os.remove(f)
562 568
569def write_manifest(d, baseoutpath):
570 import glob
571
563 # Write manifest file 572 # Write manifest file
564 # Note: at the moment we cannot include the env setup script here to keep 573 # Note: at the moment we cannot include the env setup script here to keep
565 # it updated, since it gets modified during SDK installation (see 574 # it updated, since it gets modified during SDK installation (see
@@ -583,6 +592,32 @@ python copy_buildsystem () {
583 continue 592 continue
584 chksum = bb.utils.sha256_file(fn) 593 chksum = bb.utils.sha256_file(fn)
585 f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath))) 594 f.write('%s\t%s\n' % (chksum, os.path.relpath(fn, baseoutpath)))
595
596
597python copy_buildsystem () {
598 import oe.copy_buildsystem
599
600 baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
601
602 # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
603 derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
604
605 conf_initpath, conf_bbpath, core_meta_subdir, sdkbblayers = copy_bitbake_and_layers(d, baseoutpath, derivative)
606
607 write_devtool_config(d, baseoutpath, conf_bbpath, conf_initpath, core_meta_subdir)
608
609 write_unlocked_sigs(d, baseoutpath)
610
611 write_bblayers_conf(d, baseoutpath, sdkbblayers)
612
613 uninative_checksum = copy_uninative(d, baseoutpath)
614
615 write_local_conf(d, baseoutpath, derivative, core_meta_subdir, uninative_checksum)
616
617 prepare_locked_cache(d, baseoutpath, derivative, conf_initpath)
618
619 write_manifest(d, baseoutpath)
620
586} 621}
587 622
588def get_current_buildtools(d): 623def get_current_buildtools(d):