[bitbake-devel] [PATCH] gitsm: catch SRCPV expansion errors

Alexander Kanavin alex.kanavin at gmail.com
Fri Feb 8 18:29:42 UTC 2019


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.

Signed-off-by: Alexander Kanavin <alex.kanavin at gmail.com>
---
 bitbake/lib/bb/fetch2/gitsm.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index b21fed26690..bcd1ca7dd22 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -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)
-- 
2.17.1



More information about the bitbake-devel mailing list