Openembedded Core Discussions
 help / color / mirror / Atom feed
From: AdrianF <adrian.freihofer@siemens.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH 5/9] devtool: ide-sdk: run do_install through BitBake
Date: Sun,  6 Sep 2026 23:02:03 +0200	[thread overview]
Message-ID: <20260906210307.2793974-6-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20260906210307.2793974-1-adrian.freihofer@siemens.com>

From: Adrian Freihofer <adrian.freihofer@siemens.com>

Generate a Python install-task runner for the IDE SDK environment. It
prepares Tinfoil normally, then invokes run_prepared_task() to rerun
do_install through BitBake's worker path before deploying the result.

The IDE owns configure, compile, and unit-test steps in the modified source
tree. At deployment time, resolving task dependencies could rerun those
steps, discard the IDE's build results, and add unnecessary delay. The
prepared-task runner therefore executes only do_install after BitBake has
prepared its prerequisites.

This supports shell and Python task bodies and lets BitBake establish the
fakeroot environment when the task requires pseudo.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/lib/devtool/ide_sdk.py | 42 +++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index 6558137134..0b76aa448b 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -1421,26 +1421,32 @@ class RecipeModified:
                           self.fakerootcmd, self.fakerootenv))
         return self.write_script(cmd_lines, 'deploy_target')
 
+    def gen_install_task_script(self):
+        """Generate a script which runs do_install through BitBake."""
+        cmd_lines = ['#!%s' % sys.executable]
+        if self.cmd_compile:
+            cmd_lines += ['import subprocess',
+                          'subprocess.run(%s, cwd=%r, shell=True, check=True)' %
+                          (repr(self.cmd_compile), self.real_srctree)]
+        cmd_lines += ['import os',
+                      'import sys',
+                      'sys.path.insert(0, %r)' % os.path.realpath(
+                          os.path.join(self.bitbakepath, '..', 'lib')),
+                      'import bb.tinfoil',
+                      'os.chdir(%r)' % self.topdir,
+                      'tinfoil = bb.tinfoil.Tinfoil()',
+                      'try:',
+                      '    tinfoil.prepare(config_only=False, quiet=2)',
+                      '    tinfoil.run_prepared_task(%r, "do_install")' % self.pn,
+                      'finally:',
+                      '    tinfoil.shutdown()']
+        return self.write_script(cmd_lines, 'bb_run_do_install')
+
     def gen_install_deploy_script(self, args):
         """Generate a script which does install and deploy"""
-        cmd_lines = ['#!/bin/sh']
-
-        # Save the original command-line args before 'set' overwrites $@
-        cmd_lines.append('_args="$@"')
-        # . oe-init-build-env $BUILDDIR $BITBAKEDIR
-        # Using 'set' to pass the build directory to oe-init-build-env in sh syntax
-        cmd_lines.append('cd "%s" || { echo "cd %s failed"; exit 1; }' % (
-            self.oe_init_dir, self.oe_init_dir))
-        cmd_lines.append('set %s %s' % (self.topdir, self.bitbakepath.rstrip('/bin')))
-        cmd_lines.append('. "%s" || { echo ". %s %s failed"; exit 1; }' % (
-            self.oe_init_build_env, self.oe_init_build_env, self.topdir))
-
-        # bitbake -c install
-        cmd_lines.append(
-            'bitbake %s -c install --force || { echo "bitbake %s -c install --force failed"; exit 1; }' % (self.bpn, self.bpn))
-
-        # Self contained devtool deploy-target - use saved args, not $@ (overwritten by 'set')
-        cmd_lines.append(self.gen_deploy_target_script(args) + ' $_args')
+        cmd_lines = ['#!/bin/sh -e']
+        cmd_lines.append(self.gen_install_task_script())
+        cmd_lines.append(self.gen_deploy_target_script(args) + ' "$@"')
 
         return self.write_script(cmd_lines, 'install_and_deploy')
 
-- 
2.55.0



  parent reply	other threads:[~2026-09-06 21:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 21:01 [PATCH 0/9] devtool: ide-sdk: bug fixes, do_install-through-bitbake, NFS deploy prep AdrianF
2026-09-06 21:01 ` [PATCH 1/9] devtool: ide-sdk: fix GDB loading stale libs instead of recipe's own build AdrianF
2026-09-06 21:02 ` [PATCH 2/9] oe-selftest: devtool ide-sdk: do not guess the slirp SSH port AdrianF
2026-09-06 21:19   ` Patchtest results for " patchtest
2026-09-06 21:02 ` [PATCH 3/9] devtool: ide-sdk: pre-select attach process with processFilter AdrianF
2026-09-06 21:02 ` [PATCH 4/9] oe-selftest: tinfoil: test prepared task runner AdrianF
2026-09-06 21:02 ` AdrianF [this message]
2026-09-06 21:02 ` [PATCH 6/9] oe-selftest: devtool ide-sdk: test install task AdrianF
2026-09-06 21:02 ` [PATCH 7/9] runqemu-export-rootfs: set PSEUDO_INCLUDE_PATHS for unfsd AdrianF
2026-09-06 21:02 ` [PATCH 8/9] devtool: deploy: make pseudo calls independent of bitbake.conf AdrianF
2026-09-06 21:02 ` [PATCH 9/9] devtool: deploy: remove dead files_list computation AdrianF

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260906210307.2793974-6-adrian.freihofer@siemens.com \
    --to=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox