[elbe-devel] [PATCH 2/2] elbepack: aptpkgutils: use sha256 accessor

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jun 17 12:42:47 CEST 2024


Nowadays apt.package.Package already provides a nice accessor for the
sha256sum of the package.

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

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 8d9ca062a2b6..2b7f1967c11f 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -27,15 +27,6 @@ statestring = {
 }
 
 
-def apt_pkg_sha256(pkg):
-    hashes = pkg._records.hashes
-    for i in range(len(hashes)):
-        h = str(hashes[i])
-        if h.startswith('SHA256'):
-            return h.split(':')[1]
-    return ''
-
-
 def getdeps(pkg):
     for dd in pkg.dependencies:
         for d in dd:
@@ -222,8 +213,8 @@ class APTPackage(PackageBase):
 
         iver = pkg.installed and pkg.installed.version
         cver = pkg.candidate and pkg.candidate.version
-        isha256 = pkg.installed and apt_pkg_sha256(pkg.installed)
-        csha256 = pkg.candidate and apt_pkg_sha256(pkg.candidate)
+        isha256 = pkg.installed and pkg.installed.sha256
+        csha256 = pkg.candidate and pkg.candidate.sha256
         iprio = pkg.installed and pkg.installed.priority
         cprio = pkg.candidate and pkg.candidate.priority
 

-- 
2.45.2



More information about the elbe-devel mailing list