On Wed, 7 Jan 2026 at 00:36, Tom Geelen <[email protected]> wrote:
>      def launch(self, launch_cmd, get_ip = True, qemuparams = None, 
> extra_bootparams = None, env = None):
> -        # use logfile to determine the recipe-sysroot-native path and
> -        # then add in the site-packages path components and add that
> -        # to the python sys.path so the qmp module can be found.
> -        python_path = os.path.dirname(os.path.dirname(self.logfile))
> -        python_path += "/recipe-sysroot-native/usr/lib/qemu-python"
> -        sys.path.append(python_path)
> +        # Discover qmp module location robustly.
> +        # 1) Try path derived from logfile (historical behavior)
> +        # 2) Fallback: search TMPDIR/work/*/<rootfs>/recipe-sysroot-4native 
> for qemu-python or site-packages
> +        candidates = []
> +        base_from_log = os.path.dirname(os.path.dirname(self.logfile))
> +        candidates.append(os.path.join(base_from_log, 
> "recipe-sysroot-native", "usr", "lib", "qemu-python"))
> +
> +        # We can deduce the location for qmp also from the image which is 
> being called as we know:
> +        # - this will have qmp in recipe-sysroot-native
> +        # - this will need to be called as this will derive TESTIMAGE
> +        for p in glob.glob(os.path.join(self.tmpdir, "work", "*", 
> os.path.basename(self.rootfs).split('.')[0], "*", "recipe-sysroot-native", 
> "usr", "lib", "qemu-python")):
> +            candidates.append(p)
> +        # Print all candidates to the debugger
> +        for candidate in candidates:
> +            self.logger.debug("qmp candidates : %s", candidate)

Apologies, but I can't agree to this. It's a lot of guessing against
hardcoded path elements, which can go wrong in various ways. The
correct fix is to pass in the correct native sysroot path explicitly
from further up, how to start with doing that was previously
discussed:

https://lists.yoctoproject.org/g/yocto-patches/message/2762

This bit:

"I'd say in this situation AUH is right, and the code in point 1 is
wrong. It needs to figure out the path to qmp module directly from
WORKDIR, but I don't know yet which of the many parameters to
QemuRunner's constructor and launch() method can be used. Can you look
into it? You can tweak the code to print them all, and see if
something suitable is in there."

Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#228989): 
https://lists.openembedded.org/g/openembedded-core/message/228989
Mute This Topic: https://lists.openembedded.org/mt/117125913/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to