[elbe-devel] [PATCH 1/2] elbepack: updatepkg: inline call to version_compare()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Thu Aug 15 09:03:48 CEST 2024


There is no advantage to have the wrapper function on the rpcaptcache.

This also fixes gen_update_package() as compare_versions() gained a
spurious self-argument in a mismerge in 018bdf05bb8a ("rpcaptcache: fix compare_versions which has been broken")

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/rpcaptcache.py | 6 +-----
 elbepack/updatepkg.py   | 4 +++-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index c6fe489fc6f8..616be240f765 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -10,7 +10,7 @@ from multiprocessing.util import Finalize
 
 from apt import Cache
 
-from apt_pkg import config, version_compare
+from apt_pkg import config
 
 from elbepack.aptpkgutils import (
     APTPackage,
@@ -265,10 +265,6 @@ class RPCAPTCache(InChRootObject):
     def get_corresponding_source_packages(self, pkg_lst=None):
         return get_corresponding_source_packages(self.cache, pkg_lst)
 
-    @staticmethod
-    def compare_versions(self, ver1, ver2):
-        return version_compare(ver1, ver2)
-
     def download_binary(self, pkgname, path, version=None):
         p = self.cache[pkgname]
         if version is None:
diff --git a/elbepack/updatepkg.py b/elbepack/updatepkg.py
index 2ade83eeb723..6ecdad4ec3d0 100644
--- a/elbepack/updatepkg.py
+++ b/elbepack/updatepkg.py
@@ -6,6 +6,8 @@ import logging
 import os
 from shutil import copyfile, copytree, rmtree
 
+import apt_pkg
+
 from elbepack.dump import dump_fullpkgs
 from elbepack.elbexml import ElbeXML
 from elbepack.repomanager import UpdateRepo
@@ -68,7 +70,7 @@ def gen_update_pkg(project, xml_filename, upd_filename,
                 continue
 
             ipkg = instindex[name]
-            comp = cache.compare_versions(ipkg.installed_version, ver)
+            comp = apt_pkg.version_compare(ipkg.installed_version, ver)
 
             pfname = ipkg.installed_deb
 

-- 
2.46.0



More information about the elbe-devel mailing list