summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/distrodata.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-02-12 13:05:21 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-24 10:31:45 +0000
commit3bbf10c364e75380aebf655b22e77a2473362a71 (patch)
tree08c8111ee922897e0f70df8abf2455b3bd918dc1 /meta/lib/oeqa/selftest/cases/distrodata.py
parent6bb3595ec58db98f94b95b332adb7582f9c34929 (diff)
downloadpoky-3bbf10c364e75380aebf655b22e77a2473362a71.tar.gz
oe-selftest: add a test for recipes without maintainers
'bitbake -c checkpkg world' is moved to class initializer to avoid it being run twice in a row. The no-maintainers test checks only oe-core recipes, as other layers may be be configured, and assigning maintainership to specific people via maintainers.inc is known to be used only in oe-core. (From OE-Core rev: ac6a72aab19e04adb2fa2b9932a9427d1b6fbb46) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/distrodata.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/distrodata.py67
1 files changed, 62 insertions, 5 deletions
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py
index 12540adc7d..7b2800464c 100644
--- a/meta/lib/oeqa/selftest/cases/distrodata.py
+++ b/meta/lib/oeqa/selftest/cases/distrodata.py
@@ -9,6 +9,11 @@ class Distrodata(OESelftestTestCase):
9 @classmethod 9 @classmethod
10 def setUpClass(cls): 10 def setUpClass(cls):
11 super(Distrodata, cls).setUpClass() 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')
12 17
13 @OETestID(1902) 18 @OETestID(1902)
14 def test_checkpkg(self): 19 def test_checkpkg(self):
@@ -18,11 +23,6 @@ class Distrodata(OESelftestTestCase):
18 Product: oe-core 23 Product: oe-core
19 Author: Alexander Kanavin <alexander.kanavin@intel.com> 24 Author: Alexander Kanavin <alexander.kanavin@intel.com>
20 """ 25 """
21 feature = 'INHERIT += "distrodata"\n'
22 feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n'
23
24 self.write_config(feature)
25 bitbake('-c checkpkg world')
26 checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] 26 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'] 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']
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'] 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']
@@ -40,3 +40,60 @@ The following packages have been checked successfully for upstream versions,
40but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please remove that line from the recipes. 40but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please remove that line from the recipes.
41""" + "\n".join(regressed_successes) 41""" + "\n".join(regressed_successes)
42 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg) 42 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg)
43
44 def test_maintainers(self):
45 """
46 Summary: Test that oe-core recipes have a maintainer
47 Expected: All oe-core recipes (except a few special static/testing ones) should have a maintainer listed in maintainers.inc file.
48 Product: oe-core
49 Author: Alexander Kanavin <alexander.kanavin@intel.com>
50 """
51 def is_exception(pkg):
52 exceptions = ["packagegroup-", "initramfs-", "systemd-machine-units", "target-sdk-provides-dummy"]
53 for i in exceptions:
54 if i in pkg:
55 return True
56 return False
57
58 def is_in_oe_core(recipe, recipes):
59 self.assertTrue(recipe in recipes.keys(), "Recipe %s was not in 'bitbake-layers show-recipes' output" %(recipe))
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
67 def get_recipe_layers():
68 import re
69
70 recipes = {}
71 recipe_regex = re.compile('^(?P<name>.*):$')
72 layer_regex = re.compile('^ (?P<name>\S*) +')
73 output = runCmd('bitbake-layers show-recipes').output
74 for line in output.split('\n'):
75 recipe_name_obj = recipe_regex.search(line)
76 if recipe_name_obj:
77 recipe_name = recipe_name_obj.group('name')
78 recipes[recipe_name] = []
79 recipe_layer_obj = layer_regex.search(line)
80 if recipe_layer_obj:
81 layer_name = recipe_layer_obj.group('name')
82 recipes[recipe_name].append(layer_name)
83 return recipes
84
85 checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:]
86 recipes_layers = get_recipe_layers()
87 no_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \
88 if pkg_data[14] == '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])]
89 msg = """
90The 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
94 with_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \
95 if pkg_data[14] != '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])]
96 msg = """
97The list of oe-core packages with maintainers is empty. This may indicate that the test has regressed and needs fixing.
98"""
99 self.assertTrue(len(with_maintainer_list) > 0, msg)