[bitbake-devel] gitsm: catch SRCPV expansion errors

Submitted by Alexander Kanavin on Feb. 8, 2019, 6:29 p.m. | Patch ID: 158623

Details

Message ID 20190208182942.88036-1-alex.kanavin@gmail.com
State New
Headers show

Commit Message

Alexander Kanavin Feb. 8, 2019, 6:29 p.m.
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@gmail.com>
---
 bitbake/lib/bb/fetch2/gitsm.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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)