[elbe-devel] [PATCH 2/5] elbepack: aptpkgutils: remove cache convenience from APTPackage

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Nov 13 13:18:32 CET 2024


Only one caller makes use of it and it is shorted to just have the logic
in this one caller.

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

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 7bd2eea18867fa7eca893e65334f14050f1de190..448906c3c88ff7ee0b9656582ea8a45b37a7c089 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -243,10 +243,7 @@ class PackageBase:
 
 
 class APTPackage(PackageBase):
-    def __init__(self, pkg, cache=None):
-        if isinstance(pkg, str):
-            pkg = cache[pkg]
-
+    def __init__(self, pkg):
         iver = pkg.installed and pkg.installed.version
         cver = pkg.candidate and pkg.candidate.version
         ihashes = pkg.installed and _apt_pkg_hashes(pkg.installed)
diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index b89b4b6deee6fcf71c4a1f28f46553d4d7c54e24..315f0c6c6746c4045d96b385bd1906c1220cd869 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -221,7 +221,7 @@ class RPCAPTCache(InChRootObject):
 
     def get_dependencies(self, pkgname):
         deps = getalldeps(self.cache, pkgname)
-        return [APTPackage(p, cache=self.cache) for p in deps]
+        return [APTPackage(self.cache[p]) for p in deps]
 
     def get_installed_pkgs(self, section='all'):
         if section == 'all':

-- 
2.47.0



More information about the elbe-devel mailing list