[libvirt PATCH v3 07/10] ci: Implement 'build' helper action

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

 



This simply calls the underlying Makefile target, but allows
additional arguments to be specified in a more convenient and
discoverable way.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 ci/helper | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/ci/helper b/ci/helper
index 8eb521ae40..4a552595df 100755
--- a/ci/helper
+++ b/ci/helper
@@ -55,6 +55,20 @@ class Parser:
             help="use container images with non-default tags",
         )
 
+        # Options that are common to all actions that call the
+        # project's build system
+        mesonparser = argparse.ArgumentParser(add_help=False)
+        mesonparser.add_argument(
+            "--meson-args",
+            default="",
+            help="additional arguments passed to meson",
+        )
+        mesonparser.add_argument(
+            "--ninja-args",
+            default="",
+            help="additional arguments passed to ninja",
+        )
+
         # Options that are common to all actions that use lcitool
         lcitoolparser = argparse.ArgumentParser(add_help=False)
         lcitoolparser.add_argument(
@@ -72,6 +86,14 @@ class Parser:
         )
         subparsers.required = True
 
+        # build action
+        buildparser = subparsers.add_parser(
+            "build",
+            help="run a build in a container",
+            parents=[containerparser, mesonparser],
+        )
+        buildparser.set_defaults(func=Application.action_build)
+
         # shell action
         shellparser = subparsers.add_parser(
             "shell",
@@ -115,7 +137,7 @@ class Application:
             target,
         ]
 
-        if self.args.action == "shell":
+        if self.args.action in ["build", "shell"]:
             args.extend([
                 f"CI_ENGINE={self.args.engine}",
                 f"CI_USER_LOGIN={self.args.login}",
@@ -123,6 +145,12 @@ class Application:
                 f"CI_IMAGE_TAG={self.args.image_tag}",
             ])
 
+        if self.args.action == "build":
+            args.extend([
+                f"CI_MESON_ARGS={self.args.meson_args}",
+                f"CI_NINJA_ARGS={self.args.ninja_args}",
+            ])
+
         if pty.spawn(["make"] + args) != 0:
             sys.exit("error: 'make' failed")
 
@@ -200,6 +228,9 @@ class Application:
             print(f"cirrus/{host}")
             self.generate_vars(host)
 
+    def action_build(self):
+        self.make_run(f"ci-build@{self.args.target}")
+
     def action_shell(self):
         self.make_run(f"ci-shell@{self.args.target}")
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux