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 8/9] devtool: deploy: make pseudo calls independent of bitbake.conf
Date: Sun,  6 Sep 2026 23:02:06 +0200	[thread overview]
Message-ID: <20260906210307.2793974-9-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20260906210307.2793974-1-adrian.freihofer@siemens.com>

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

Relying on bitbake.conf's global PSEUDO_INCLUDE_PATHS to cover the
stripped-copy directory is fragile, and will only get more fragile as
devtool deploy learns to deploy to more kinds of places. Add an
env_overrides parameter to exec_fakeroot_no_d() and use it to state
PSEUDO_INCLUDE_PATHS explicitly for each pseudo call in the --strip
path, so bitbake.conf no longer needs a devtool-specific entry.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/conf/bitbake.conf          |  2 +-
 scripts/lib/devtool/__init__.py | 11 ++++++++++-
 scripts/lib/devtool/deploy.py   | 11 +++++++----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 63d84cf37b..a21223e216 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -752,7 +752,7 @@ SRC_URI = ""
 PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/"
 PSEUDO_PASSWD ?= "${STAGING_DIR_TARGET}:${PSEUDO_SYSROOT}"
 PSEUDO_SYSROOT = "${COMPONENTS_DIR}/${BUILD_ARCH}/pseudo-native"
-PSEUDO_INCLUDE_PATHS = "/proc,${WORKDIR}/image,${WORKDIR}/package,${WORKDIR}/rootfs,${WORKDIR}/sstate-build-package/,${WORKDIR}/sstate-install-package/,${WORKDIR}/pkgdata,${WORKDIR}/minidebuginfo,${WORKDIR}/devtool-deploy-target-stripped"
+PSEUDO_INCLUDE_PATHS = "/proc,${WORKDIR}/image,${WORKDIR}/package,${WORKDIR}/rootfs,${WORKDIR}/sstate-build-package/,${WORKDIR}/sstate-install-package/,${WORKDIR}/pkgdata,${WORKDIR}/minidebuginfo"
 
 export PSEUDO_DISABLED = "1"
 #export PSEUDO_PREFIX = "${STAGING_DIR_NATIVE}${prefix_native}"
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 58b02eb460..32a7bc0098 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -77,7 +77,14 @@ def exec_watch(cmd, **options):
 
     return buf, None
 
-def exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, cmd, **kwargs):
+def exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, cmd, env_overrides=None, **kwargs):
+    """Run cmd under pseudo using a recipe's own FAKEROOTCMD/FAKEROOTENV.
+
+    env_overrides, if given, is applied after fakerootenv so callers can point
+    pseudo at a different database/allow-list, e.g. a target rootfs's own
+    PSEUDO_LOCALSTATEDIR/PSEUDO_INCLUDE_PATHS instead of the ambient ones from
+    FAKEROOTENV.
+    """
     if not os.path.exists(fakerootcmd):
         logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built')
         return 2
@@ -88,6 +95,8 @@ def exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, cmd, **kwargs):
         if '=' in varvalue:
             splitval = varvalue.split('=', 1)
             newenv[splitval[0]] = splitval[1]
+    if env_overrides:
+        newenv.update(env_overrides)
     return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs)
 
 def setup_tinfoil(config_only=False, basepath=None, tracking=False):
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index d11b04aea2..7a83d4a23a 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -277,8 +277,10 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce
         srcdir = recipe_outdir
         recipe_outdir = os.path.join(workdir, 'devtool-deploy-target-stripped')
         if os.path.isdir(recipe_outdir):
-            exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "rm -rf %s" % recipe_outdir, shell=True)
-        exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True)
+            exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "rm -rf %s" % recipe_outdir,
+                                env_overrides={'PSEUDO_INCLUDE_PATHS': recipe_outdir}, shell=True)
+        exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir),
+                            env_overrides={'PSEUDO_INCLUDE_PATHS': '%s,%s' % (srcdir, recipe_outdir)}, shell=True)
 
         # Strip under pseudo so that it records any inode replacements made by
         # the strip tool before the deployment tar reads this directory.
@@ -292,7 +294,7 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce
         ret = exec_fakeroot_no_d(
             fakerootcmd, fakerootenv, path,
             '%s -c %s' % (shlex.quote(sys.executable), shlex.quote(strip_script)),
-            shell=True)
+            env_overrides={'PSEUDO_INCLUDE_PATHS': recipe_outdir}, shell=True)
         if ret != 0:
             raise DevtoolError('Failed to strip files for deployment')
 
@@ -418,7 +420,8 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce
         remote_cmd = '%s | %s  %s %s %s \'sh %s %s %s %s\'' % (
             tar_cmd, ssh_sshexec, ssh_port, extraoptions, args.target,
             tmpscript, args.recipename, destdir, tmpfilelist)
-        ret = exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, remote_cmd, cwd=recipe_outdir, shell=True)
+        ret = exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, remote_cmd, cwd=recipe_outdir,
+                                env_overrides={'PSEUDO_INCLUDE_PATHS': recipe_outdir}, shell=True)
     finally:
         if tar_filelist_path:
             os.remove(tar_filelist_path)
-- 
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 ` [PATCH 5/9] devtool: ide-sdk: run do_install through BitBake AdrianF
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 ` AdrianF [this message]
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-9-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