summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorAlexander Kanavin <alex@linutronix.de>2024-07-17 20:22:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-22 16:53:06 +0100
commitbd18497110796c5d86cef202dc37798478c84cd2 (patch)
treed5c6250ee8efd07c798cde3c9f4e771c0687c49c /meta/lib/oe
parent597b87a46855a792d0d78209db1a85b96a50ac8e (diff)
downloadpoky-bd18497110796c5d86cef202dc37798478c84cd2.tar.gz
lib/recipeutils: add a function to determine recipes with shared include files
This functionality is needed for 'lockstep version upgrades' where several recipes need to be upgraded at the same time to produce a buildable outcome. The function itself obtains BBINCLUDED for each recipe and then massages the data until it takes the form of a list of sets: [{'cmake','cmake-native'}, {'qemu','qemu-native','qemu-system-native'}, ... ] There's also a selftest that checks for the above. Unfortunately this won't detect mutually exclusive recipes like mesa and mesa-gl as they're chosen with PREFERRED_PROVIDER and can't be enabled in the same build at the same time. ('devtool upgrade' will also accept just one of them but not the other) (From OE-Core rev: 2400920f8b84cca9d6c1f6a2e850630554fe00fa) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/recipeutils.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index f9d7dfe253..7586332fe0 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -1183,3 +1183,40 @@ def get_recipe_upgrade_status(recipes=None):
1183 pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list) 1183 pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list)
1184 1184
1185 return pkgs_list 1185 return pkgs_list
1186
1187def get_common_include_recipes():
1188 with bb.tinfoil.Tinfoil() as tinfoil:
1189 tinfoil.prepare(config_only=False)
1190
1191 recipes = tinfoil.all_recipe_files(variants=False)
1192
1193 recipeincludes = {}
1194 for fn in recipes:
1195 data = tinfoil.parse_recipe_file(fn)
1196 recipeincludes[fn] = {'bbincluded':data.getVar('BBINCLUDED').split(),'pn':data.getVar('PN')}
1197 return _get_common_include_recipes(recipeincludes)
1198
1199def _get_common_include_recipes(recipeincludes_all):
1200 recipeincludes = {}
1201 for fn,data in recipeincludes_all.items():
1202 bbincluded_filtered = [i for i in data['bbincluded'] if os.path.dirname(i) == os.path.dirname(fn) and i != fn]
1203 if bbincluded_filtered:
1204 recipeincludes[data['pn']] = bbincluded_filtered
1205
1206 recipeincludes_inverted = {}
1207 for k,v in recipeincludes.items():
1208 for i in v:
1209 recipeincludes_inverted.setdefault(i,set()).add(k)
1210
1211 recipeincludes_inverted_filtered = {k:v for k,v in recipeincludes_inverted.items() if len(v) > 1}
1212
1213 recipes_with_shared_includes = list()
1214 for v in recipeincludes_inverted_filtered.values():
1215 recipeset = v
1216 for v1 in recipeincludes_inverted_filtered.values():
1217 if recipeset.intersection(v1):
1218 recipeset.update(v1)
1219 if recipeset not in recipes_with_shared_includes:
1220 recipes_with_shared_includes.append(recipeset)
1221
1222 return recipes_with_shared_includes