summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-11-10 14:20:50 +0100
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-11-10 14:30:23 +0100
commit74a19934f0ebeb875cdba74d88264b6242d0f3e5 (patch)
tree12a1f712ee80fb04bb9a41e5f2ba3c556c1d5577 /lib
parentebc05644d889a845260ad4299657bcab2fabe13e (diff)
Remove checks for apt_pkg.version_compare
The rename happened too long ago, and VersionCompare is long gone. We assume it exists in security_db anyway.
Diffstat (limited to 'lib')
-rw-r--r--lib/python/debian_support.py12
-rw-r--r--lib/python/sectracker/analyzers.py12
2 files changed, 7 insertions, 17 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py
index 73f6b0f80f..4c8cff5b38 100644
--- a/lib/python/debian_support.py
+++ b/lib/python/debian_support.py
@@ -113,10 +113,7 @@ class Version:
return 'Version(%r)' % self.__asString
def __cmp__(self, other):
- try:
- return apt_pkg.version_compare(self.__forCompare, other.__forCompare)
- except AttributeError:
- return apt_pkg.VersionCompare(self.__forCompare, other.__forCompare)
+ return apt_pkg.version_compare(self.__forCompare, other.__forCompare)
def __lt__(self, other):
return self.__cmp__(other) < 0
@@ -139,11 +136,8 @@ def version_compare(a, b):
~bpo and ~volatile suffixes are ignored."""
a = _version_normalize_regexp.sub("", a)
b = _version_normalize_regexp.sub("", b)
- try:
- vc = apt_pkg.version_compare
- except AttributeError:
- vc = apt_pkg.VersionCompare
- return vc(a, b)
+
+ return apt_pkg.version_compare(a, b)
class PackageFile:
"""A Debian package file.
diff --git a/lib/python/sectracker/analyzers.py b/lib/python/sectracker/analyzers.py
index 5b8eb28ee7..386af47974 100644
--- a/lib/python/sectracker/analyzers.py
+++ b/lib/python/sectracker/analyzers.py
@@ -20,12 +20,8 @@ import re as _re
from collections import namedtuple as _namedtuple
-# vercmp is the Debian version comparison algorithm
+# _apt_pkg.version_compare is the Debian version comparison algorithm
_apt_pkg.init()
-try:
- vercmp = _apt_pkg.version_compare
-except AttributeError:
- vercmp = _apt_pkg.VersionCompare
def mergelists(listfiles, diag):
"""Merge the (already parsed) list files in listfiles.
@@ -208,7 +204,7 @@ def fixedversions(bugdb, copysrc, versions, diag):
other_versions = set()
for rel, ver in getversions(pname):
if unstable_fixed is not None \
- and vercmp(ver, unstable_fixed) >= 0:
+ and _apt_pkg.version_compare(ver, unstable_fixed) >= 0:
# This version is already covered by the
# unstable fix.
continue
@@ -220,7 +216,7 @@ def fixedversions(bugdb, copysrc, versions, diag):
# Annotations like <not-affected>.
other_versions.add(ver)
continue
- if vercmp(ver, refver) >= 0:
+ if _apt_pkg.version_compare(ver, refver) >= 0:
other_versions.add(ver)
result.append(Vulnerability(bug.header.name, pname,
unstable_fixed, other_versions))
@@ -240,7 +236,7 @@ def bestversion(config, codename, pkg, requested_members=None):
if pkg in comp:
curpkg = comp[pkg]
curver = curpkg.version
- if bestver is None or vercmp(curver, bestver) > 0:
+ if bestver is None or _apt_pkg.version_compare(curver, bestver) > 0:
bestver = curver
bestpkg = curpkg
return bestpkg

© 2014-2024 Faster IT GmbH | imprint | privacy policy