From: Michael Tremer Date: Tue, 1 Aug 2023 16:58:59 +0000 (+0000) Subject: release monitoring: Use new version compare function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1879770d6afe47be984373b2a6c502004fadb460;p=pbs.git release monitoring: Use new version compare function Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/releasemonitoring.py b/src/buildservice/releasemonitoring.py index 5036b0d5..ce8dafde 100644 --- a/src/buildservice/releasemonitoring.py +++ b/src/buildservice/releasemonitoring.py @@ -23,6 +23,7 @@ import difflib import json import logging import os +import pakfire import re import shutil import urllib.parse @@ -398,22 +399,21 @@ class Monitoring(base.DataObject): # Find all versions that are interesting for us and store them with # how many parts are matching against the current version - with self.backend.pakfire() as p: - for version in available_versions: - # Only consider later versions - if p.version_compare(current_version, version) >= 0: - continue + for version in available_versions: + # Only consider later versions + if pakfire.version_compare(current_version, version) >= 0: + continue - # Split the version into parts - parts = self._split_version(version) + # Split the version into parts + parts = self._split_version(version) - # Count the number of parts that match at the beginning - for i, (a, b) in enumerate(zip(current_version_parts, parts)): - if not a == b: - break + # Count the number of parts that match at the beginning + for i, (a, b) in enumerate(zip(current_version_parts, parts)): + if not a == b: + break - # Store the number of matching parts - versions[version] = i + 1 + # Store the number of matching parts + versions[version] = i + 1 # Fetch all versions with the highest number of matches versions = [v for v in versions if versions[v] == max(versions.values())] @@ -537,11 +537,9 @@ class Monitoring(base.DataObject): if not self.latest_build: return False - # Check if the version is larger than the build - with self.backend.pakfire() as p: - # Compare the versions - if p.version_compare(self.latest_build.pkg.evr, version) > 0: - return True + # Compare the versions + if pakfire.version_compare(self.latest_build.pkg.evr, version) > 0: + return True return False