在 Linux 内核的 Yocto 配方中,我需要在远程 Linux 内核 git 存储库中获取最近提交的标签。该标签被附加到 Linux 版本。我遇到的问题是basehash值(保留标签的变量)在构建过程中发生了变化,我得到了bitbake错误:
(...) the basehash value changed from 24896f703509afcd913bc2d97fcff392 to 2d43ec8fdf53988554b77bef20c6fd88. The metadata is not deterministic and this needs to be fixed.
这是我在食谱中使用的代码:
def get_git_tag(git_repo):
import subprocess
print(git_repo)
try:
subprocess.call("git fetch --tags", cwd=p, shell=True)
tag = subprocess.Popen("git describe --exact-match 2>/dev/null", cwd=p, shell=True, stdout=subprocess.PIPE, universal_newlines=True).communicate()[0].rstrip()
return tag
except OSError:
return ""
KERNEL_LOCALVERSION = "-${@get_git_tag('${S}')}"
KERNEL_LOCALVERSION[vardepvalue] = "${KERNEL_LOCALVERSION}"
do_configure[vardeps] += "KERNEL_LOCALVERSION"
代码在新提交后首次构建时失败。第二次编译没问题。失败是因为 basehash 值首先在不再存在的旧本地克隆(S 变量)上计算,然后在新克隆上计算,并且在构建期间更改了 basehash 值。
有没有办法告诉 bitbucket 在 do_fetch 任务之后计算 basehash 值?
当设置为 AUTOINC 时,SRCREV 是如何完成的?