[1/6] CI: Add API for checking package version in rootfs

Message ID 20250221154843.515037-2-amikan@ilbers.de
State New
Headers show
Series Fix essentials rebuild and cover with CI | expand

Commit Message

Anton Mikanovich Feb. 21, 2025, 3:48 p.m. UTC
It will output the version installed in the rootfs.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/cibuilder.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index b5b6a093..e671a4ae 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -1,7 +1,7 @@ 
 #!/usr/bin/env python3
 #
 # This software is a part of ISAR.
-# Copyright (C) 2022-2024 ilbers GmbH
+# Copyright (C) 2022-2025 ilbers GmbH
 # Copyright (C) 2022-2024 Siemens AG
 #
 # SPDX-License-Identifier: MIT
@@ -335,6 +335,10 @@  class CIBuilder(Test):
         bb.utils.edit_bblayers_conf(bblayersconf_file, None, tmp_layer_dir)
         bb.utils.prunedir(tmp_layer_dir)
 
+    def get_pkg_ver(self, rootfs, package):
+        cmd = f"dpkg-query --root={rootfs} -f='${{Version}}' -W {package}"
+        return process.getoutput(cmd)
+
     def get_ssh_cmd_prefix(self, user, host, port, priv_key):
         cmd_prefix = (
             f"ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no -p {port} "