From b78d9de8e585f5071f62bab7362c8e69affe4102 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 12 Oct 2021 14:21:42 +0200 Subject: updatesrcrev.py: work around python crash Since commit c9c9679 ("buildconf/local.conf: don't set any machine by default") calling scripts/uprev-srcrev creates a python crash unless one makes sure a MACHINE is set. Just reading PV from the datastore before continuing with doing the uprev fixes the issue. Fixes: | Traceback (most recent call last): | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 1585, in latest_revision | return revs[key] | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/persist_data.py", line 50, in wrap_func | return f(self, *args, **kwargs) | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/persist_data.py", line 79, in wrap_func | return f(self, cursor, *args, **kwargs) | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/persist_data.py", line 167, in __getitem__ | raise KeyError(key) | KeyError: 'git:git.toradex.com.u-boot-toradex.gittoradex_2020.07' | | During handling of the above exception, another exception occurred: | | ... | | The above exception was the direct cause of the following exception: | | Traceback (most recent call last): | ... | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/fetch2/__init__.py", line 1587, in latest_revision | revs[key] = rev = self._latest_revision(ud, d, name) | File "/home/krm/bla/dunfell/layers/openembedded-core/bitbake/lib/bb/fetch2/git.py", line 689, in _latest_revision | sha1, ref = l.split() | bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception ValueError: not enough values to unpack (expected 2, got 0) Signed-off-by: Max Krummenacher --- lib/recipetool/updatesrcrev.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/recipetool/updatesrcrev.py b/lib/recipetool/updatesrcrev.py index 411e428..0c6fb19 100644 --- a/lib/recipetool/updatesrcrev.py +++ b/lib/recipetool/updatesrcrev.py @@ -37,6 +37,12 @@ def updatesrcrev(args): if not rd: return 1 + # The line `PV = "2020.07+git${SRCPV}"` in the U-Boot 2020.07 recipe + # makes the uprev of that recipe fail if no MACHINE is defined. + # (Because then UBOOT_MACHINE or UBOOT_CONFIG is not defined.) + # Just reading PV of the datastore fixes the issue + pv = rd.getVar('PV') + src_uris = rd.getVar('SRC_URI').split() revision = {} for src_uri in src_uris: -- cgit v1.2.3