summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2022-04-15 06:34:56 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-19 14:15:09 +0100
commit57b11d17247c626e97c5eabc4343dd89b0765c87 (patch)
tree453c9532fcb4c0f516ecc1d5c6cf8bc992604a2d
parent20e64650d6e8b9e0c6c3c4784885c54fa2a4ff92 (diff)
downloadpoky-57b11d17247c626e97c5eabc4343dd89b0765c87.tar.gz
bitbake: providers: use local variable for packages_dynamic pattern
During parsing, Python raises RuntimeError: dictionary changed size during iteration in getRuntimeProviders, if you happen to have a recipe with an explicit RDEPENDS on a dynamic package containing a '+' character, such as 'gtk+3-locale-en'. This is because we're using the modified pattern as the key into the packages_dynamic dict to append to rproviders, and since that key doesn't exist, the dict is getting modified to add a new, empty, entry for it. So even without the runtime error, we'd be generating an incorrect result. Fix this by using a local variable for modifying the pattern and using the original key to retrieve the value on a match. (Bitbake rev: 07de375c3e57f17ab7b47569186f24ecd9896825) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/providers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index 8c1c31a5c5..e11a4637d1 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -396,8 +396,8 @@ def getRuntimeProviders(dataCache, rdepend):
396 return rproviders 396 return rproviders
397 397
398 # Only search dynamic packages if we can't find anything in other variables 398 # Only search dynamic packages if we can't find anything in other variables
399 for pattern in dataCache.packages_dynamic: 399 for pat_key in dataCache.packages_dynamic:
400 pattern = pattern.replace(r'+', r"\+") 400 pattern = pat_key.replace(r'+', r"\+")
401 if pattern in regexp_cache: 401 if pattern in regexp_cache:
402 regexp = regexp_cache[pattern] 402 regexp = regexp_cache[pattern]
403 else: 403 else:
@@ -408,7 +408,7 @@ def getRuntimeProviders(dataCache, rdepend):
408 raise 408 raise
409 regexp_cache[pattern] = regexp 409 regexp_cache[pattern] = regexp
410 if regexp.match(rdepend): 410 if regexp.match(rdepend):
411 rproviders += dataCache.packages_dynamic[pattern] 411 rproviders += dataCache.packages_dynamic[pat_key]
412 logger.debug("Assuming %s is a dynamic package, but it may not exist" % rdepend) 412 logger.debug("Assuming %s is a dynamic package, but it may not exist" % rdepend)
413 413
414 return rproviders 414 return rproviders