summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-10 15:04:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-11 22:39:19 +0100
commit433cff7297cc60528f003add2b495e218b2d392c (patch)
tree15c11b1938bfde56b349506fa81e20cb83fd3215 /bitbake
parentd0389d202c9f14a21d83ec322a42448fcd663087 (diff)
downloadpoky-433cff7297cc60528f003add2b495e218b2d392c.tar.gz
bitbake: fetch2: Add recursion guard
Users sometimes put ${S} references in ${SRC_URI} without realising this can be problematic. Improve the error messages if they accidentally do. [YOCTO #11593] (Bitbake rev: 89e0b19ec0b245a6cd414088904c91808e8814ab) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 47a4943369..d9e1599a05 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -754,6 +754,11 @@ def get_srcrev(d, method_name='sortable_revision'):
754 that fetcher provides a method with the given name and the same signature as sortable_revision. 754 that fetcher provides a method with the given name and the same signature as sortable_revision.
755 """ 755 """
756 756
757 recursion = d.getVar("__BBINSRCREV")
758 if recursion:
759 raise FetchError("There are recursive references in fetcher variables, likely through SRC_URI")
760 d.setVar("__BBINSRCREV", True)
761
757 scms = [] 762 scms = []
758 fetcher = Fetch(d.getVar('SRC_URI').split(), d) 763 fetcher = Fetch(d.getVar('SRC_URI').split(), d)
759 urldata = fetcher.ud 764 urldata = fetcher.ud
@@ -768,6 +773,7 @@ def get_srcrev(d, method_name='sortable_revision'):
768 autoinc, rev = getattr(urldata[scms[0]].method, method_name)(urldata[scms[0]], d, urldata[scms[0]].names[0]) 773 autoinc, rev = getattr(urldata[scms[0]].method, method_name)(urldata[scms[0]], d, urldata[scms[0]].names[0])
769 if len(rev) > 10: 774 if len(rev) > 10:
770 rev = rev[:10] 775 rev = rev[:10]
776 d.delVar("__BBINSRCREV")
771 if autoinc: 777 if autoinc:
772 return "AUTOINC+" + rev 778 return "AUTOINC+" + rev
773 return rev 779 return rev
@@ -802,6 +808,7 @@ def get_srcrev(d, method_name='sortable_revision'):
802 if seenautoinc: 808 if seenautoinc:
803 format = "AUTOINC+" + format 809 format = "AUTOINC+" + format
804 810
811 d.delVar("__BBINSRCREV")
805 return format 812 return format
806 813
807def localpath(url, d): 814def localpath(url, d):