更新 Yocto 导致异常“bb.data”没有属性“getVar”

Eng*_*999 1 linux bitbake yocto

我正在尝试将使用 Yocto 1.6 Fido 的项目升级到 Yocto 2.6 Thud。

我在构建过程中收到以下异常。元 eca 层的问题

ERROR: ExpansionError during parsing /home/poky-thud/build- 
bbgw/../meta-eca/meta-iot/recipes-web/the-thing-system/steward_git.bb                                                                                         
| ETA:  0:01:02

Traceback (most recent call last):

bb.data_smart.ExpansionError: Failure expanding variable TTS_ARCH[:=], 
expression was ${@get_arch(bb, d)} which triggered exception AttributeError:

module 'bb.data' has no attribute 'getVar'
Run Code Online (Sandbox Code Playgroud)

我猜“getVar”不知何故已被弃用。

解决这个问题的最佳方法是什么?

dan*_*lor 5

这不是不getVar推荐使用的内容,而是使用/访问它的方式。您只需要 BitBake\xc2\xb4s 数据字典结构 ( d) 即可访问其环境变量。您应该按如下方式修改配方:

\n\n
def get_arch(d):\n    val = (d.getVar("MACHINEOVERRIDES", True) or "")\n    if val.find("genericx86") > 0:\n        return "--arch=i686"\n    elif val.find("x86") > 0:\n        return "--arch=i686"\n    elif val.find("arm") > 0:\n        return "--arch=arm"\n    else:\n        return ""\n\n# Always compile 32-bit in npm because many modules that npm\n# compiles do not support 64 bit in x86.\nTTS_ARCH := "${@get_arch(d)}"\n
Run Code Online (Sandbox Code Playgroud)\n\n

有关更多信息,请参阅BitBake 用户手册

\n