blob: 12540adc7d8456d1afbea58fd567e25223b4c769 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001from oeqa.selftest.case import OESelftestTestCase
2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
3from oeqa.utils.decorators import testcase
4from oeqa.utils.ftools import write_file
5from oeqa.core.decorator.oeid import OETestID
6
7class Distrodata(OESelftestTestCase):
8
9 @classmethod
10 def setUpClass(cls):
11 super(Distrodata, cls).setUpClass()
12
13 @OETestID(1902)
14 def test_checkpkg(self):
15 """
16 Summary: Test that upstream version checks do not regress
17 Expected: Upstream version checks should succeed except for the recipes listed in the exception list.
18 Product: oe-core
19 Author: Alexander Kanavin <alexander.kanavin@intel.com>
20 """
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:]
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']
29 msg = ""
30 if len(regressed_failures) > 0:
31 msg = msg + """
32The following packages failed upstream version checks. Please fix them using UPSTREAM_CHECK_URI/UPSTREAM_CHECK_REGEX
33(when using tarballs) or UPSTREAM_CHECK_GITTAGREGEX (when using git). If an upstream version check cannot be performed
34(for example, if upstream does not use git tags), you can set UPSTREAM_VERSION_UNKNOWN to '1' in the recipe to acknowledge
35that the check cannot be performed.
36""" + "\n".join(regressed_failures)
37 if len(regressed_successes) > 0:
38 msg = msg + """
39The 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.
41""" + "\n".join(regressed_successes)
42 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg)