]> git.ipfire.org Git - pbs.git/commitdiff
release monitoring: Use new version compare function
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Aug 2023 16:58:59 +0000 (16:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Aug 2023 17:01:46 +0000 (17:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/releasemonitoring.py

index 5036b0d57802e0fa83a44545763edbc452f99238..ce8dafdeff61688b0e1b006f3e8c9cdf6ae3fb77 100644 (file)
@@ -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