Re: [wic][PATCH] Fix bb and oe module confliction

Trevor Woerner <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
Hi,

Thanks for this patch, I will apply it after fixing up some wording.

On Tue 2026-04-28 @ 05:06:02 AM, Hongxu Jia wrote:
> While adding nativesdk-wic to buildtools-extended-tarball and using
> it for bitbake build, it triggered failure
> [snip]
> $ which wic
> path-to/buildtools.buildtools-extended-standalone-10.26.17.0/sysroots/x86_64-wrlinuxsdk-linux/usr/bin/wic
> 
> $ bitbake core-image-minimal
> ERROR: Unable to parse Var <METADATA_BRANCH[:=]>
> Traceback (most recent call last):
>   File "oe-core/bitbake/lib/bb/data_smart.py", line 465, in expandWithRefs
>     s = __expand_python_regexp__.sub(varparse.python_sub, s)
>   File "oe-core/bitbake/lib/bb/data_smart.py", line 154, in python_sub
>     value = utils.better_eval(codeobj, DataContext(self.d), {'d' : self.d})
>   File "oe-core/bitbake/lib/bb/utils.py", line 489, in better_eval
>     return eval(source, ctx, locals)
>   File "Var <METADATA_BRANCH[:=]>", line 1, in <module>
> AttributeError: module 'oe' has no attribute 'buildcfg'
> [snip]
> 
> In order to avoid confliction with oe module in oe-core and
> bb module in bitbake, move src/bb -> src/wic/bb, src/oe -> src/wic/oe,
> rename oe to wic.oe, bb to wic.bb
> 
> After apply the patch to wic recipe locally, run oe-selftest wic case
> $ oe-selftest -r wic
> ...
> 2026-04-28 20:00:03,230 - oe-selftest - INFO - SUMMARY:
> 2026-04-28 20:00:03,230 - oe-selftest - INFO - oe-selftest () - Ran 95 tests in 7853.682s
> 2026-04-28 20:00:03,230 - oe-selftest - INFO - oe-selftest - FAIL - Required tests failed (successes=87, skipped=1, failures=0, errors=7)
> 
> PS: the FAIL cases are about qemu related about `Permission denied on tap'
> 
> Signed-off-by: Hongxu Jia <[email protected]>
> ---
>  pyproject.toml                              | 4 ++--
>  src/{ => wic}/bb/__init__.py                | 0
>  src/{ => wic}/bb/utils.py                   | 0
>  src/{ => wic}/oe/__init__.py                | 0
>  src/{ => wic}/oe/bootfiles.py               | 0
>  src/{ => wic}/oe/path.py                    | 2 +-
>  src/wic/plugins/imager/direct.py            | 2 +-
>  src/wic/plugins/source/bootimg_partition.py | 2 +-
>  src/wic/plugins/source/rootfs.py            | 2 +-
>  9 files changed, 6 insertions(+), 6 deletions(-)
>  rename src/{ => wic}/bb/__init__.py (100%)
>  rename src/{ => wic}/bb/utils.py (100%)
>  rename src/{ => wic}/oe/__init__.py (100%)
>  rename src/{ => wic}/oe/bootfiles.py (100%)
>  rename src/{ => wic}/oe/path.py (99%)
> 
> diff --git a/pyproject.toml b/pyproject.toml
> index 6ef2946..fdc1ce0 100644
> --- a/pyproject.toml
> +++ b/pyproject.toml
> @@ -25,10 +25,10 @@ Repository = "https://git.yoctoproject.org/wic"
>  wic = "wic.cli:main"
>  
>  [tool.hatch.build]
> -packages = ["src/wic", "src/oe", "src/bb"]
> +packages = ["src/wic"]
>  
>  [tool.hatch.build.targets.wheel]
> -packages = ["src/wic", "src/oe", "src/bb"]
> +packages = ["src/wic"]
>  
>  [build-system]
>  requires = ["hatchling>=1.21"]
> diff --git a/src/bb/__init__.py b/src/wic/bb/__init__.py
> similarity index 100%
> rename from src/bb/__init__.py
> rename to src/wic/bb/__init__.py
> diff --git a/src/bb/utils.py b/src/wic/bb/utils.py
> similarity index 100%
> rename from src/bb/utils.py
> rename to src/wic/bb/utils.py
> diff --git a/src/oe/__init__.py b/src/wic/oe/__init__.py
> similarity index 100%
> rename from src/oe/__init__.py
> rename to src/wic/oe/__init__.py
> diff --git a/src/oe/bootfiles.py b/src/wic/oe/bootfiles.py
> similarity index 100%
> rename from src/oe/bootfiles.py
> rename to src/wic/oe/bootfiles.py
> diff --git a/src/oe/path.py b/src/wic/oe/path.py
> similarity index 99%
> rename from src/oe/path.py
> rename to src/wic/oe/path.py
> index 47b0c13..3e95ea0 100644
> --- a/src/oe/path.py
> +++ b/src/wic/oe/path.py
> @@ -10,7 +10,7 @@ import shutil
>  import subprocess
>  import os.path
>  
> -import bb
> +import wic.bb as bb
>  
>  def join(*paths):
>      """Like os.path.join but doesn't treat absolute RHS specially"""
> diff --git a/src/wic/plugins/imager/direct.py b/src/wic/plugins/imager/direct.py
> index 832d0e6..3a4f067 100644
> --- a/src/wic/plugins/imager/direct.py
> +++ b/src/wic/plugins/imager/direct.py
> @@ -19,13 +19,13 @@ import uuid
>  
>  from time import strftime
>  
> -from oe.path import copyhardlinktree
>  
>  from wic import WicError
>  from wic.filemap import sparse_copy
>  from wic.ksparser import KickStart, KickStartError
>  from wic.pluginbase import PluginMgr, ImagerPlugin
>  from wic.misc import get_bitbake_var, exec_cmd, exec_native_cmd
> +from wic.oe.path import copyhardlinktree
>  
>  logger = logging.getLogger('wic')
>  
> diff --git a/src/wic/plugins/source/bootimg_partition.py b/src/wic/plugins/source/bootimg_partition.py
> index cc121a7..96f5e14 100644
> --- a/src/wic/plugins/source/bootimg_partition.py
> +++ b/src/wic/plugins/source/bootimg_partition.py
> @@ -16,12 +16,12 @@ import logging
>  import os
>  import re
>  
> -from oe.bootfiles import get_boot_files
>  
>  from wic import WicError
>  from wic.engine import get_custom_config
>  from wic.pluginbase import SourcePlugin
>  from wic.misc import exec_cmd, get_bitbake_var
> +from wic.oe.bootfiles import get_boot_files
>  
>  logger = logging.getLogger('wic')
>  
> diff --git a/src/wic/plugins/source/rootfs.py b/src/wic/plugins/source/rootfs.py
> index 06fce06..dca4106 100644
> --- a/src/wic/plugins/source/rootfs.py
> +++ b/src/wic/plugins/source/rootfs.py
> @@ -16,12 +16,12 @@ import os
>  import shutil
>  import sys
>  
> -from oe.path import copyhardlinktree
>  from pathlib import Path
>  
>  from wic import WicError
>  from wic.pluginbase import SourcePlugin
>  from wic.misc import get_bitbake_var, exec_native_cmd
> +from wic.oe.path import copyhardlinktree
>  
>  logger = logging.getLogger('wic')
>  
> -- 
> 2.49.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.