[elbe-devel] [PATCH 2/2] elbepack: check-build: use apt_pkg.version_compare()
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Thu Aug 15 09:03:49 CEST 2024
Use a library function instead of shelling out.
The apt_pkg module is already a dependency of check-build through
elbepack.aptpkgutils.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/commands/check-build.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/elbepack/commands/check-build.py b/elbepack/commands/check-build.py
index ebf81a6dc4cd..825845e0aa41 100644
--- a/elbepack/commands/check-build.py
+++ b/elbepack/commands/check-build.py
@@ -12,6 +12,8 @@ import sys
import tempfile
import traceback
+import apt_pkg
+
import pexpect
from elbepack import qemu_firmware
@@ -136,12 +138,6 @@ class CheckCdroms(CheckBase):
f"Failed to get debian infos ({'|'.join(fmt)}) "
f'for {path}:\n{E}')
- @staticmethod
- def cmp_version(v1, v2):
- return subprocess.run([
- 'dpkg', '--compare-versions', v1, 'eq', v2,
- ]).returncode
-
def do_src(self, sources, src_total):
"""Check for sources in src-cdrom*"""
@@ -180,7 +176,7 @@ class CheckCdroms(CheckBase):
for version in sources[src_name]:
# Found a matching version; prune it
- if self.cmp_version(version, src_version) == 0:
+ if apt_pkg.version_compare(version, src_version) == 0:
logging.info('Validating source %s_%s',
src_name, version)
--
2.46.0
More information about the elbe-devel
mailing list