按菜品分类:"The metadata is not deterministic and this needs to be fixed"

Bitbake: "The metadata is not deterministic and this needs to be fixed"

我正在构建 Bitbake 配方并收到以下错误消息:

ERROR: When reparsing virtual:native:/path/to/poky/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb.do_populate_cve_db, the basehash value changed from 0b637979bcb5db4263f9ed97497a6330 to bcd28a5efe646ed4d327fefa349f889c. The metadata is not deterministic and this needs to be fixed.

这会在干净的版本中重现(在 bitbake -c cleanall -c cleansstate <recipe> 之后)。

出现这个错误的原因是什么?配方未从上游版本修改。

当配方包含更改数据并且您尝试重建它时会发生这种情况,避免这种情况的一种方法是删除 tmp/ 目录[不是一个好的解决方案]但这是最​​不可能的解决方案。

以下是添加此诊断信息的yocto补丁 https://patchwork.openembedded.org/patch/133517/

这是提交消息,解释了它的原因以及获取问题的更多详细信息的可能方法:

Bitbake can parse metadata in the cooker and in the worker during builds. If the metadata isn't deterministic, it can change between these two parses and this confuses things a lot. It turns out to be hard to debug these issues currently.

This patch ensures the basehashes from the original parsing are passed into the workers and that these are checked when reparsing for consistency. The user is shown an error message if inconsistencies are found.

There is debug code in siggen.py (see the "Slow but can be useful for debugging mismatched basehashes" commented code), we don't enable this by default due to performance issues. If you run into this message, enable this code and you will find "sigbasedata" files in tmp/stamps which should correspond to the hashes shown in this error message. bitbake-diffsigs on the files should show which variables are changing.

Signed-off-by: Richard Purdie

它有助于我删除食谱的共享缓存:

bitbake recipename -c cleansstate

然后,一切都很顺利。

我使用的修复方法是转到那个食谱并在最后添加一个空行,这将有助于 bitbake 重新识别食谱

我偶然发现了类似的错误。对我来说,它发生在 do_install 例程中。我的目标是存储一个文件的副本,其名称附加了 ${DATETIME},指的是特定位置的构建时间。

显然,配方在构建过程中被解析了多次,并且由于时间在第二次解析时发生了变化,因此插入了不同的 ${DATETIME} 值,因此元数据被识别为已更改。

不管它的价值如何,这样做对我来说已经很清楚了:

devtool modify <recipe>
devtool reset <recipe>

如果您在构建过程中修改配方,也会发生这种情况...

这意味着如果您在构建过程中编辑配方文件,您所说的错误就会消失。如果这是您的情况,只需完成您的编辑并重新启动构建,它应该可以工作。我遇到了,就这样解决了。

最简单的解决方案:touch <recipename>。然后 运行 cleansstate 在你的食谱上。然后从这里照常进行。

我已经解决了这个问题如下:

My temporary solution is changing old_basehash to new_basehash logged in the error log (the basehash value changed from old_basehash to new_basehash.) at cache file in folder ./tmp/cache/

请参考:https://neotran.info/2022/05/yocto-error-the-metadata-is-not-deterministic-and-this-needs-to-be-fixed/