summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/distrodata.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/distrodata.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/distrodata.py129
1 files changed, 0 insertions, 129 deletions
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py
deleted file mode 100644
index 1e88ea82e6..0000000000
--- a/meta/lib/oeqa/selftest/cases/distrodata.py
+++ /dev/null
@@ -1,129 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7from oeqa.selftest.case import OESelftestTestCase
8
9import oe.recipeutils
10
11class Distrodata(OESelftestTestCase):
12
13 def test_checkpkg(self):
14 """
15 Summary: Test that upstream version checks do not regress
16 Expected: Upstream version checks should succeed except for the recipes listed in the exception list.
17 Product: oe-core
18 Author: Alexander Kanavin <alex.kanavin@gmail.com>
19 """
20 feature = 'LICENSE_FLAGS_ACCEPTED += " commercial"\n'
21 self.write_config(feature)
22
23 pkggroups = oe.recipeutils.get_recipe_upgrade_status()
24
25 regressed_failures = [pkg['pn'] for pkgs in pkggroups for pkg in pkgs if pkg['status'] == 'UNKNOWN_BROKEN']
26 regressed_successes = [pkg['pn'] for pkgs in pkggroups for pkg in pkgs if pkg['status'] == 'KNOWN_BROKEN']
27 msg = ""
28 if len(regressed_failures) > 0:
29 msg = msg + """
30The following packages failed upstream version checks. Please fix them using UPSTREAM_CHECK_URI/UPSTREAM_CHECK_REGEX
31(when using tarballs) or UPSTREAM_CHECK_GITTAGREGEX (when using git). If an upstream version check cannot be performed
32(for example, if upstream does not use git tags), you can set UPSTREAM_VERSION_UNKNOWN to '1' in the recipe to acknowledge
33that the check cannot be performed.
34""" + "\n".join(regressed_failures)
35 if len(regressed_successes) > 0:
36 msg = msg + """
37The following packages have been checked successfully for upstream versions,
38but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please remove that line from the recipes.
39""" + "\n".join(regressed_successes)
40 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg)
41
42 def test_maintainers(self):
43 """
44 Summary: Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe
45 Expected: All oe-core recipes (except a few special static/testing ones) should have a maintainer listed in maintainers.inc file.
46 Expected: All entries in maintainers list should have a recipe file that matches them
47 Product: oe-core
48 Author: Alexander Kanavin <alex.kanavin@gmail.com>
49 """
50 def is_exception(pkg):
51 exceptions = ["packagegroup-",]
52 for i in exceptions:
53 if i in pkg:
54 return True
55 return False
56
57 def is_maintainer_exception(entry):
58 exceptions = ["musl", "newlib", "picolibc", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", "libx11-compose-data",
59 "cve-update-nvd2-native", "barebox"]
60 for i in exceptions:
61 if i in entry:
62 return True
63 return False
64
65 feature = 'require conf/distro/include/maintainers.inc\nLICENSE_FLAGS_ACCEPTED += " commercial"\nPARSE_ALL_RECIPES = "1"\nPACKAGE_CLASSES = "package_ipk package_deb package_rpm"\n'
66 self.write_config(feature)
67
68 with bb.tinfoil.Tinfoil() as tinfoil:
69 tinfoil.prepare(config_only=False)
70
71 with_maintainer_list = []
72 no_maintainer_list = []
73
74 missing_recipes = []
75 recipes = []
76 prefix = "RECIPE_MAINTAINER:pn-"
77
78 # We could have used all_recipes() here, but this method will find
79 # every recipe if we ever move to setting RECIPE_MAINTAINER in recipe files
80 # instead of maintainers.inc
81 for fn in tinfoil.all_recipe_files(variants=False):
82 if not '/meta/recipes-' in fn:
83 # We are only interested in OE-Core
84 continue
85 rd = tinfoil.parse_recipe_file(fn, appends=False)
86 pn = rd.getVar('PN')
87 recipes.append(pn)
88 if is_exception(pn):
89 continue
90 if rd.getVar('RECIPE_MAINTAINER'):
91 with_maintainer_list.append((pn, fn))
92 else:
93 no_maintainer_list.append((pn, fn))
94
95 maintainers = tinfoil.config_data.keys()
96 for key in maintainers:
97 if key.startswith(prefix):
98 recipe = tinfoil.config_data.expand(key[len(prefix):])
99 if is_maintainer_exception(recipe):
100 continue
101 if recipe not in recipes:
102 missing_recipes.append(recipe)
103
104 if no_maintainer_list:
105 self.fail("""
106The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file.
107""" + "\n".join(['%s (%s)' % i for i in no_maintainer_list]))
108
109 if not with_maintainer_list:
110 self.fail("""
111The list of oe-core recipes with maintainers is empty. This may indicate that the test has regressed and needs fixing.
112""")
113
114 if missing_recipes:
115 self.fail("""
116Unable to find recipes for the following entries in maintainers.inc:
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)