Skip to contentSkip to conversation

gitsm: catch SRCPV expansion errors

PATCH New Alexander Kanavin 1 participant 1 message Feb 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitsm: catch SRCPV expansion errors

SRCPV may fail to expand, for instance like this:

Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: The SRCREV_FORMAT variable must be set when multiple SCMs are used.

---
 bitbake/lib/bb/fetch2/gitsm.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/gitsm.py +4 -1
index b21fed26690..bcd1ca7dd22 100644
@@ -140,7 +140,10 @@ class GitSM(Git):
             # Workaround for issues with SRCPV/SRCREV_FORMAT errors
             # error refer to 'multiple' repositories.  Only the repository
             # in the original SRC_URI actually matters...
-            ld.setVar('SRCPV', d.getVar('SRCPV'))
+            try:
+                ld.setVar('SRCPV', d.getVar('SRCPV'))
+            except Exception as e:
+                raise bb.fetch2.UnpackError(e, url)
             ld.setVar('SRCREV_FORMAT', module)
 
             function(ud, url, module, paths[module], ld)
Signature · 1 line
2.17.1