From 63e53fb8b60d38315015844bd3357fa1649cd639 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Thu, 7 Sep 2023 12:51:01 +0200 Subject: build-sysroots: target or native sysroot population need to be selected explicitly Running them in parallel is prone to races as postinsts from target sysroots rely on executables from native sysroots which may or may not be fully prepared yet. This was observed for example here: https://autobuilder.yoctoproject.org/typhoon/#/builders/146/builds/468/steps/12/logs/stdio https://autobuilder.yoctoproject.org/typhoon/#/builders/147/builds/467/steps/12/logs/stdio (From OE-Core rev: 38d7a2e45b883cf999a86af05bcc0eaa875bb47c) Signed-off-by: Alexander Kanavin Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/files/ext-sdk-prepare.py | 2 +- meta/lib/oeqa/selftest/cases/meta_ide.py | 5 +++-- meta/recipes-core/meta/build-sysroots.bb | 12 ++++++++++-- scripts/lib/devtool/sdk.py | 3 ++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/meta/files/ext-sdk-prepare.py b/meta/files/ext-sdk-prepare.py index d191e5e19c..89b0403089 100644 --- a/meta/files/ext-sdk-prepare.py +++ b/meta/files/ext-sdk-prepare.py @@ -71,7 +71,7 @@ def main(): ret = run_command_interruptible('BB_SETSCENE_ENFORCE=1 bitbake --quiet %s' % ' '.join(sdk_targets)) if not ret: - ret = run_command_interruptible('bitbake --quiet build-sysroots') + ret = run_command_interruptible('bitbake --quiet build-sysroots -c build_native_sysroot && bitbake --quiet build-sysroots -c build_target_sysroot') lastlog = get_last_consolelog() if lastlog: with open(lastlog, 'r') as f: diff --git a/meta/lib/oeqa/selftest/cases/meta_ide.py b/meta/lib/oeqa/selftest/cases/meta_ide.py index bae98359e5..59270fb3e0 100644 --- a/meta/lib/oeqa/selftest/cases/meta_ide.py +++ b/meta/lib/oeqa/selftest/cases/meta_ide.py @@ -18,7 +18,8 @@ class MetaIDE(OESelftestTestCase): def setUpClass(cls): super(MetaIDE, cls).setUpClass() bitbake('meta-ide-support') - bitbake('build-sysroots') + bitbake('build-sysroots -c build_native_sysroot') + bitbake('build-sysroots -c build_target_sysroot') bb_vars = get_bb_vars(['MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE']) cls.environment_script = 'environment-setup-%s' % bb_vars['MULTIMACH_TARGET_SYS'] cls.deploydir = bb_vars['DEPLOY_DIR_IMAGE'] @@ -55,5 +56,5 @@ class MetaIDE(OESelftestTestCase): def test_meta_ide_can_run_sdk_tests(self): bitbake('-c populate_sysroot gtk+3') - bitbake('build-sysroots') + bitbake('build-sysroots -c build_target_sysroot') bitbake('-c testsdk meta-ide-support') diff --git a/meta/recipes-core/meta/build-sysroots.bb b/meta/recipes-core/meta/build-sysroots.bb index 1a3b692a1b..db05c111ab 100644 --- a/meta/recipes-core/meta/build-sysroots.bb +++ b/meta/recipes-core/meta/build-sysroots.bb @@ -22,6 +22,14 @@ deltask collect_spdx_deps deltask create_runtime_spdx deltask recipe_qa +do_build_warn () { + bbwarn "Native or target sysroot population needs to be explicitly selected; please use +bitbake -c build_native_sysroot build-sysroots +bitbake -c build_target_sysroot build-sysroots +or both." +} +addtask do_build_warn before do_build + python do_build_native_sysroot () { targetsysroot = d.getVar("STANDALONE_SYSROOT") nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE") @@ -31,7 +39,7 @@ python do_build_native_sysroot () { } do_build_native_sysroot[cleandirs] = "${STANDALONE_SYSROOT_NATIVE}" do_build_native_sysroot[nostamp] = "1" -addtask do_build_native_sysroot before do_build +addtask do_build_native_sysroot python do_build_target_sysroot () { targetsysroot = d.getVar("STANDALONE_SYSROOT") @@ -42,6 +50,6 @@ python do_build_target_sysroot () { } do_build_target_sysroot[cleandirs] = "${STANDALONE_SYSROOT}" do_build_target_sysroot[nostamp] = "1" -addtask do_build_target_sysroot before do_build +addtask do_build_target_sysroot do_clean[cleandirs] += "${STANDALONE_SYSROOT} ${STANDALONE_SYSROOT_NATIVE}" diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py index d717b6c2b8..9aefd7e354 100644 --- a/scripts/lib/devtool/sdk.py +++ b/scripts/lib/devtool/sdk.py @@ -300,7 +300,8 @@ def sdk_install(args, config, basepath, workspace): return 2 try: - exec_build_env_command(config.init_path, basepath, 'bitbake build-sysroots', watch=True) + exec_build_env_command(config.init_path, basepath, 'bitbake build-sysroots -c build_native_sysroot', watch=True) + exec_build_env_command(config.init_path, basepath, 'bitbake build-sysroots -c build_target_sysroot', watch=True) except bb.process.ExecutionError as e: raise DevtoolError('Failed to bitbake build-sysroots:\n%s' % (str(e))) -- cgit v1.2.3-54-g00ecf