[OE-core] Using timestamps (DATETIME) in PV

Stefan Agner stefan at agner.ch
Mon Nov 25 20:43:17 UTC 2019


Hi,

tl;dr: Afaict, using DATETIME in PV is currently impossible due to
commit 9ca2fad2 ("image: Expand PV to avoid AUTOREV parsing failures").
Do not use DATETIME in PV.


In an effort to use timestamps for development builds we tried to use
DATETIME in the PV variable of an image recipe (basically PV =
"${DATETIME}", although my real use case is a bit more involved, but
this is the part which matters). Unfortunately this lead to basehash
value changed errors:

ERROR: When reparsing
/build/ags/torizon-master/build-colibri-imx7/conf/../../layers/meta-toradex-torizon/recipes-images/images/torizon-core-docker.bb:do_patch,
the basehash value changed from
9d65be87aee58d81c6310c5d4a09e1ab94115074c2076766e5bb87267b6257ed to
3b069c8e23e86f778350cd91f17edd00ac71be5fb95a512b1fd567c31dcab46d. The
metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake torizon-core-docker -cdo_patch -Snone
ERROR: Then:
ERROR: $ bitbake torizon-core-docker -cdo_patch -Sprintdiff

Normally this can be fixed by excluding the variable from the
dependencies like this:

PV[vardepsexclude] += "DATETIME"

However, it did not help in this case. I then did what Richard suggests
in [1] and fired up bitbake-diffsigs using the two hashes from the error
showed. This revealed that it is still PV which is an issue:

NOTE: Starting bitbake server...
basehash changed from
4bf60537ad6dbcf8d54972bd81d51ea49d968600cebb6b198c25f4766ae2d31c to
4897cf911d1a75dcdd7f5cbead00d15fd8e419e9e647d49be4585640c67dd0a4
Variable PV value changed from '20191125160227' to '20191125160240'

I found three issues here.

1. sstate.bbclass sets PV[vardepvalue] = "${PV}" to explicitly evaluate
PV (see [2]). This can be easily fixed by clearing vardepvalue, e.g.
PV[vardepvalue] = "".

However, with this fixed we still see issue in custom image tasks.

2. image.bbclass uses localdata.setVar('PV', d.getVar('PV')) to
basically do the same (see [3]). Unfortunately I found no way to easily
alter this behavior from my layer. Since we make use of custom image
tasks we use IMAGE_CMD_x.

3. I also get "The postinstall intercept hook 'update_udev_hwdb' failed,
details in ...temp/log.do_rootfs", it says "chown: invalid user:
‘root:root’". It seems like a pseudo issue, however PSEUDO_LOCALSTATEDIR
seems to be setup correctly. It seems that PSEUDO_LOCALSTATEDIR has a
slight different timestamp then where the rootfs is located but I am not
sure if that is an issue. Anyways, this problem remains unsolved at this
point.

Maybe 2 could be solved differently such that the behavior can be
controlled from an image?

Especially since PV is part of the WORKDIR (which also seems to cause
the third issue) I am not sure how many more problems along those lines
waiting to be found. I plan to move to a different/custom variable to
accomplish my goal. However, since I did all the research so far I
wanted to post this anyway.

--
Stefan


[1]
https://git.openembedded.org/bitbake/commit/?id=857829048c14338132784326ba98a71f12192db8&h=master
[2]
https://git.openembedded.org/openembedded-core/commit/?id=918646ca803d56004fb0ab7c21e86cc9cb14513d&h=master
[3]
https://git.openembedded.org/openembedded-core/commit/?id=9ca2fad2e569597f460e6bcbbd96077c8b8cfce9&h=master


More information about the Openembedded-core mailing list