diff options
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/recipeutils.py | 37 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/distrodata.py | 12 |
2 files changed, 49 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 | |||
| 1187 | def 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 | |||
| 1199 | def _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 | ||
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py index b60913dbca..bc56160522 100644 --- a/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/meta/lib/oeqa/selftest/cases/distrodata.py | |||
| @@ -115,3 +115,15 @@ The list of oe-core recipes with maintainers is empty. This may indicate that th | |||
| 115 | self.fail(""" | 115 | self.fail(""" |
| 116 | Unable to find recipes for the following entries in maintainers.inc: | 116 | Unable to find recipes for the following entries in maintainers.inc: |
| 117 | """ + "\n".join(['%s' % i for i in missing_recipes])) | 117 | """ + "\n".join(['%s' % i for i in missing_recipes])) |
| 118 | |||
| 119 | def test_common_include_recipes(self): | ||
| 120 | """ | ||
| 121 | Summary: Test that obtaining recipes that share includes between them returns a sane result | ||
| 122 | Expected: At least cmake and qemu entries are present in the output | ||
| 123 | Product: oe-core | ||
| 124 | Author: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 125 | """ | ||
| 126 | recipes = oe.recipeutils.get_common_include_recipes() | ||
| 127 | |||
| 128 | self.assertIn({'qemu-system-native', 'qemu', 'qemu-native'}, recipes) | ||
| 129 | self.assertIn({'cmake-native', 'cmake'}, recipes) | ||
