qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 3/4] lcitool: allow overriding package mappings and target fa


From: Paolo Bonzini
Subject: [RFC PATCH 3/4] lcitool: allow overriding package mappings and target facts
Date: Tue, 17 Jan 2023 10:16:37 +0100

lcitool has generally catered to the Libvirt's needs in terms of
package versions, which are pretty conservative. For example, lcitool
is hardcoding a version of Meson equal to 0.56. QEMU on the other hand
has different needs since some features were added to Meson for the
project's benefit in versions as recent as 0.63.

Until now, QEMU has managed to avoid the problem by shipping its own
version of Meson. However, the next release of QEMU will face a breaking
point in that Meson 0.63 does not work with the 3.6 version of Python
that is provided by CentOS Stream 8 and OpenSUSE LEAP 15.3.

Implement locally the functionality provided by
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/341, so that
QEMU can override the mappings and target paths that are used for its CI.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/lcitool/refresh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 31a34dce7a33..ca36f3536f53 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -15,7 +15,9 @@
 from contextlib import contextmanager
 from pathlib import Path
 
+import logging
 import sys
+import yaml
 
 if len(sys.argv) != 1:
     print("syntax: %s" % sys.argv[0], file=sys.stderr)
@@ -33,14 +35,25 @@ from lcitool.packages import Packages
 from lcitool.projects import Projects
 from lcitool.targets import BuildTarget, Targets
 from lcitool.formatters import DockerfileFormatter, ShellVariablesFormatter
-from lcitool.util import DataDir
+from lcitool.util import DataDir, merge_dict
+
+
+class MergeLocalFilesDataDir(DataDir):
+    def load_facts(self, resource_path, name):
+        result = {}
+        for file in self.search(resource_path, name + ".yml"):
+            logging.getLogger().debug(f"Loading facts from '{file}'")
+            with open(file, "r") as infile:
+                merge_dict(yaml.safe_load(infile), result)
+        return result
+
 
 PREFIX = ''
 
-DATA_DIR = DataDir(script_dir)
+DATA_DIR = MergeLocalFilesDataDir(script_dir)
 PROJECTS = Projects(DATA_DIR)
-PACKAGES = Packages()
-TARGETS = Targets()
+PACKAGES = Packages(DATA_DIR)
+TARGETS = Targets(DATA_DIR)
 
 
 @contextmanager
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]