diff mbox series

[RFC,3/4] lcitool: allow overriding package mappings and target facts

Message ID 20230117091638.50523-4-pbonzini@redhat.com
State New
Headers show
Series Update CentOS and OpenSUSE CI to Python >=3.7 | expand

Commit Message

Paolo Bonzini Jan. 17, 2023, 9:16 a.m. UTC
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(-)

Comments

Daniel P. Berrangé Feb. 8, 2023, 5:31 p.m. UTC | #1
On Tue, Jan 17, 2023 at 10:16:37AM +0100, Paolo Bonzini wrote:
> 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.

I'd like to just push ahead with getting that merged so we
use the lcitool --data-dir arg to do what QEMU needs, and
stay away from the internal python code.

With regards,
Daniel
diff mbox series

Patch

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