[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] tests/vm: Introduce get_qemu_packages_from_lcitool_vars() he
|
From: |
Philippe Mathieu-Daudé |
|
Subject: |
[PATCH 2/3] tests/vm: Introduce get_qemu_packages_from_lcitool_vars() helper |
|
Date: |
Wed, 31 May 2023 22:09:05 +0200 |
The 'lcitool variables $OS qemu' command produces a file containing
consistent environment variables helpful to build QEMU on $OS.
In particular the $PKGS variable contains the packages required to
build QEMU.
Since some of these files are committed in the repository (see
0e103a65ba "gitlab: support for FreeBSD 12, 13 and macOS 11 via
cirrus-run"), we can parse these files to get the package list
required to build a VM.
Add the get_qemu_packages_from_lcitool_vars() helper which return
such package list from a lcitool env var file.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/vm/basevm.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 8ec021ddcf..2632c3d41a 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -522,6 +522,12 @@ def get_qemu_version(qemu_path):
version_num = re.split(' |\(', version_line)[3].split('.')[0]
return int(version_num)
+def get_qemu_packages_from_lcitool_vars(vars_path):
+ """Parse a lcitool variables file and return the PKGS list."""
+ with open(vars_path, 'r') as fd:
+ line = list(filter(lambda y: y.startswith('PKGS'), fd.readlines()))[0]
+ return line.split("'")[1].split()
+
def parse_config(config, args):
""" Parse yaml config and populate our config structure.
The yaml config allows the user to override the
--
2.38.1