diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-12-13 16:46:56 +1300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-14 17:10:59 +0000 |
| commit | d2ba6dfab33ab401c2752eb7a2a738a4f7173373 (patch) | |
| tree | 6a85baaeb165a888faf3ee5d030f5874322d26fc /meta/lib | |
| parent | 66c263884444cf5c68447612562f6b6eb93a9711 (diff) | |
| download | poky-d2ba6dfab33ab401c2752eb7a2a738a4f7173373.tar.gz | |
oe-selftest: distrodata: change test_maintainers() to use tinfoil
Use tinfoil to enumerate recipes and get the value of RECIPE_MAINTAINER
to make it a bit more reliable in the face of do_checkpkg issues we are
currently seeing on the Yocto Project autobuilder. This also makes it a
little less painful to re-execute test_maintainers() since you don't
have to wait for bitbake -c checkpkg to complete every time.
Note that the new test has been written in such a way that it will still
function if RECIPE_MAINTAINER values are ever moved to the recipes.
Also, the test still currently fails as there are recipes that don't
have an assigned maintainer.
(From OE-Core rev: 47282a2f6f12acebf58961ea9410cfbc335d560b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/distrodata.py | 81 |
1 files changed, 34 insertions, 47 deletions
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py index e7b5e34956..a862d30b10 100644 --- a/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/meta/lib/oeqa/selftest/cases/distrodata.py | |||
| @@ -6,15 +6,6 @@ from oeqa.core.decorator.oeid import OETestID | |||
| 6 | 6 | ||
| 7 | class Distrodata(OESelftestTestCase): | 7 | class Distrodata(OESelftestTestCase): |
| 8 | 8 | ||
| 9 | @classmethod | ||
| 10 | def setUpClass(cls): | ||
| 11 | super(Distrodata, cls).setUpClass() | ||
| 12 | feature = 'INHERIT += "distrodata"\n' | ||
| 13 | feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n' | ||
| 14 | |||
| 15 | cls.write_config(cls, feature) | ||
| 16 | bitbake('-c checkpkg world') | ||
| 17 | |||
| 18 | @OETestID(1902) | 9 | @OETestID(1902) |
| 19 | def test_checkpkg(self): | 10 | def test_checkpkg(self): |
| 20 | """ | 11 | """ |
| @@ -23,6 +14,11 @@ class Distrodata(OESelftestTestCase): | |||
| 23 | Product: oe-core | 14 | Product: oe-core |
| 24 | Author: Alexander Kanavin <alex.kanavin@gmail.com> | 15 | Author: Alexander Kanavin <alex.kanavin@gmail.com> |
| 25 | """ | 16 | """ |
| 17 | feature = 'INHERIT += "distrodata"\n' | ||
| 18 | feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n' | ||
| 19 | self.write_config(feature) | ||
| 20 | bitbake('-c checkpkg world') | ||
| 21 | |||
| 26 | checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] | 22 | checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] |
| 27 | regressed_failures = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'UNKNOWN_BROKEN'] | 23 | regressed_failures = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'UNKNOWN_BROKEN'] |
| 28 | regressed_successes = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'KNOWN_BROKEN'] | 24 | regressed_successes = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'KNOWN_BROKEN'] |
| @@ -55,45 +51,36 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re | |||
| 55 | return True | 51 | return True |
| 56 | return False | 52 | return False |
| 57 | 53 | ||
| 58 | def is_in_oe_core(recipe, recipes): | 54 | feature = 'require conf/distro/include/maintainers.inc\n' |
| 59 | self.assertTrue(recipe in recipes.keys(), "Recipe %s was not in 'bitbake-layers show-recipes' output" %(recipe)) | 55 | self.write_config(feature) |
| 60 | self.assertTrue(len(recipes[recipe]) > 0, "'bitbake-layers show-recipes' could not determine what layer(s) a recipe %s is in" %(recipe)) | ||
| 61 | try: | ||
| 62 | recipes[recipe].index('meta') | ||
| 63 | return True | ||
| 64 | except ValueError: | ||
| 65 | return False | ||
| 66 | 56 | ||
| 67 | def get_recipe_layers(): | 57 | with bb.tinfoil.Tinfoil() as tinfoil: |
| 68 | import re | 58 | tinfoil.prepare(config_only=False) |
| 69 | 59 | ||
| 70 | recipes = {} | 60 | with_maintainer_list = [] |
| 71 | recipe_regex = re.compile('^(?P<name>.*):$') | 61 | no_maintainer_list = [] |
| 72 | layer_regex = re.compile('^ (?P<name>\S*) +') | 62 | # We could have used all_recipes() here, but this method will find |
| 73 | output = runCmd('bitbake-layers show-recipes').output | 63 | # every recipe if we ever move to setting RECIPE_MAINTAINER in recipe files |
| 74 | for line in output.split('\n'): | 64 | # instead of maintainers.inc |
| 75 | recipe_name_obj = recipe_regex.search(line) | 65 | for fn in tinfoil.all_recipe_files(variants=False): |
| 76 | if recipe_name_obj: | 66 | if not '/meta/recipes-' in fn: |
| 77 | recipe_name = recipe_name_obj.group('name') | 67 | # We are only interested in OE-Core |
| 78 | recipes[recipe_name] = [] | 68 | continue |
| 79 | recipe_layer_obj = layer_regex.search(line) | 69 | rd = tinfoil.parse_recipe_file(fn, appends=False) |
| 80 | if recipe_layer_obj: | 70 | pn = rd.getVar('PN') |
| 81 | layer_name = recipe_layer_obj.group('name') | 71 | if is_exception(pn): |
| 82 | recipes[recipe_name].append(layer_name) | 72 | continue |
| 83 | return recipes | 73 | if rd.getVar('RECIPE_MAINTAINER'): |
| 74 | with_maintainer_list.append((pn, fn)) | ||
| 75 | else: | ||
| 76 | no_maintainer_list.append((pn, fn)) | ||
| 84 | 77 | ||
| 85 | checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] | 78 | if no_maintainer_list: |
| 86 | recipes_layers = get_recipe_layers() | 79 | self.fail(""" |
| 87 | no_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \ | 80 | The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file. |
| 88 | if pkg_data[14] == '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])] | 81 | """ + "\n".join(['%s (%s)' % i for i in no_maintainer_list])) |
| 89 | msg = """ | ||
| 90 | The following packages do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file. | ||
| 91 | """ + "\n".join(no_maintainer_list) | ||
| 92 | self.assertTrue(len(no_maintainer_list) == 0, msg) | ||
| 93 | 82 | ||
| 94 | with_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \ | 83 | if not with_maintainer_list: |
| 95 | if pkg_data[14] != '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])] | 84 | self.fail(""" |
| 96 | msg = """ | 85 | The list of oe-core recipes with maintainers is empty. This may indicate that the test has regressed and needs fixing. |
| 97 | The list of oe-core packages with maintainers is empty. This may indicate that the test has regressed and needs fixing. | 86 | """) |
| 98 | """ | ||
| 99 | self.assertTrue(len(with_maintainer_list) > 0, msg) | ||
