Re: Custom DISTRO_VERSION with git describe


Mikko Rapeli
 

On Thu, Apr 28, 2022 at 01:25:03PM +0200, Ayoub Zaki wrote:
Hi,

thanks for the quick reply I tried your suggestion but I get:

ERROR: Unable to parse Var <DISTRO_VERSION[:=]>
Traceback (most recent call last):
File "Var <DISTRO_VERSION[:=]>", line 1, in <module>
bb.data_smart.ExpansionError: Failure expanding variable
DISTRO_VERSION[:=], expression was ${@my_distro_version(d)} which triggered
exception NameError: name 'my_distro_version' is not defined
Did you include the bbclass?

I think in this case the INHERIT doesn't work !
Well I have in distro config:

require classes/distroversion.bbclass

which has a single python function

def get_distro_version(d, dirty=True, abbrev=None):

which basically calls "git describe --always --dirty --abbrev=8",
the last one was added when git versions started behaving differently
and breaking reproducibility.

And then distro config also has:

DISTRO_VERSION := "${@get_distro_version(d)}"

This works for me up to yocto 3.1 dunfell at least.

Cheers,

-Mikko

Join yocto@lists.yoctoproject.org to automatically receive all group messages.