diff options
author | Lee Chee Yang <chee.yang.lee@intel.com> | 2021-01-29 11:51:15 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-10 23:55:53 +0000 |
commit | 2b526d90791da501c9870dd6d3993fcfa7d15249 (patch) | |
tree | b6c0848703b8b94d8ab95d68ca09808a4f58e218 /meta/lib/oeqa | |
parent | f829419105c8a85dd403ab61d70ce730f5bf9103 (diff) | |
download | poky-2b526d90791da501c9870dd6d3993fcfa7d15249.tar.gz |
cve_check: add CVE_VERSION_SUFFIX to indicate suffix in versioning
add CVE_VERSION_SUFFIX to indicate the version suffix type, currently
works in two value, "alphabetical" if the version string uses single
alphabetical character suffix as incremental release, blank to not
consider the unidentified suffixes. This can be expand when more suffix
pattern identified.
refactor cve_check.Version class to use functools and add parameter to
handle suffix condition.
Also update testcases to cover new changes.
(From OE-Core rev: 37a40c30709bf80c74948f47361b2be2c646c9d8)
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 5dfd5ad5144708b474ef31eaa89a846c57be8ac0)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/cve_check.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/cve_check.py b/meta/lib/oeqa/selftest/cases/cve_check.py index 35e2b29a9a..3f343a2841 100644 --- a/meta/lib/oeqa/selftest/cases/cve_check.py +++ b/meta/lib/oeqa/selftest/cases/cve_check.py | |||
@@ -23,5 +23,14 @@ class CVECheck(OESelftestTestCase): | |||
23 | self.assertTrue( result, msg="Failed to compare version '1.0_dev' <= '1.0'") | 23 | self.assertTrue( result, msg="Failed to compare version '1.0_dev' <= '1.0'") |
24 | 24 | ||
25 | # ignore "p1" and "p2", so these should be equal | 25 | # ignore "p1" and "p2", so these should be equal |
26 | result = Version("1.0p2") <= Version("1.0p1") and Version("1.0p2") >= Version("1.0p1") | 26 | result = Version("1.0p2") == Version("1.0p1") |
27 | self.assertTrue( result ,msg="Failed to compare version '1.0p2' to '1.0p1'") | 27 | self.assertTrue( result ,msg="Failed to compare version '1.0p2' to '1.0p1'") |
28 | # ignore the "b" and "r" | ||
29 | result = Version("1.0b") == Version("1.0r") | ||
30 | self.assertTrue( result ,msg="Failed to compare version '1.0b' to '1.0r'") | ||
31 | |||
32 | # consider the trailing alphabet as patched level when comparing | ||
33 | result = Version("1.0b","alphabetical") < Version("1.0r","alphabetical") | ||
34 | self.assertTrue( result ,msg="Failed to compare version with suffix '1.0b' < '1.0r'") | ||
35 | result = Version("1.0b","alphabetical") > Version("1.0","alphabetical") | ||
36 | self.assertTrue( result ,msg="Failed to compare version with suffix '1.0b' > '1.0'") | ||