mirror of
https://git.yoctoproject.org/poky
synced 2026-07-16 15:57:04 +00:00
cve-check: CVE_VERSION_SUFFIX to work with patched release
CVE_VERSION_SUFFIX in "patch" to treat version string with suffix "pX" or "patchX" as patched release. also update testcases to cover this changes and set CVE_VERSION_SUFFIX for sudo. (From OE-Core rev: d75f95a09e5e85eb759e748f9e0fee1c5fa1b318) Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8076815fc2ffc8f632e73527ce2b7d158a29e9ea) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
daf52f58e3
commit
b9739ad63a
@@ -11,8 +11,13 @@ _Version = collections.namedtuple(
|
||||
class Version():
|
||||
|
||||
def __init__(self, version, suffix=None):
|
||||
|
||||
suffixes = ["alphabetical", "patch"]
|
||||
|
||||
if str(suffix) == "alphabetical":
|
||||
version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<patch>[-_\.]?(?P<patch_l>[a-z]))?(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
|
||||
elif str(suffix) == "patch":
|
||||
version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<patch>[-_\.]?(p|patch)(?P<patch_l>[0-9]+))?(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
|
||||
else:
|
||||
version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
|
||||
regex = re.compile(r"^\s*" + version_pattern + r"\s*$", re.VERBOSE | re.IGNORECASE)
|
||||
@@ -23,7 +28,7 @@ class Version():
|
||||
|
||||
self._version = _Version(
|
||||
release=tuple(int(i) for i in match.group("release").replace("-",".").split(".")),
|
||||
patch_l=match.group("patch_l") if str(suffix) == "alphabetical" and match.group("patch_l") else "",
|
||||
patch_l=match.group("patch_l") if str(suffix) in suffixes and match.group("patch_l") else "",
|
||||
pre_l=match.group("pre_l"),
|
||||
pre_v=match.group("pre_v")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user