buildmetadatayoctobitbakenon-deterministic

yocto programmatically asigned SRCREV trigger metadata not deterministic


in my .bb i use this expression for determine the value of SRCREV based on the existence of the environment variable GW_TAG, which may contains a git tag:

SRCREV = "${@ d.getVar('AUTOREV') if d.getVar("BB_ORIGENV", True).getVar("GW_TAG") is None else d.getVar("BB_ORIGENV", True).getVar("GW_TAG") }"

it works fine but trigger this error:

ERROR: When reparsing /home/mt/GW/yocto/work/src/meta-mytest/recipes-mytest/libmytest/libmytest.bb.do_fetch, the basehash value changed from 165dfeff250af9bbfa23c9371b729c7b to b524c301b8d3835a3ba74ed812d2b16b. The metadata is not deterministic and this needs to be fixed.

if i just use

SRCREV = @{AUTOREV}

everything is fine. I don't understand why there's the error since the expression is always evaluated the same, GW_TAG if assigned is assigned before the build.


Solution

  • Modifying the line to

    SRCREV := "${@ d.getVar('AUTOREV') if d.getVar("BB_ORIGENV", True).getVar("GW_TAG") is None else d.getVar("BB_ORIGENV", True).getVar("GW_TAG") }"

    Solved the issue