[libvirt PATCH v3 05/10] ci: Implement 'list-images' helper action

Andrea Bolognani abologna at redhat.com
Fri Mar 12 17:28:17 UTC 2021


This simply calls the underlying Makefile target.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 ci/helper | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/ci/helper b/ci/helper
index 05ecdcb426..420e9b73c2 100755
--- a/ci/helper
+++ b/ci/helper
@@ -18,6 +18,7 @@
 
 import argparse
 import pathlib
+import pty
 import shutil
 import subprocess
 import sys
@@ -42,6 +43,13 @@ class Parser:
         )
         subparsers.required = True
 
+        # list-images action
+        listimagesparser = subparsers.add_parser(
+            "list-images",
+            help="list known container images",
+        )
+        listimagesparser.set_defaults(func=Application.action_list_images)
+
         # refresh action
         refreshparser = subparsers.add_parser(
             "refresh",
@@ -63,6 +71,16 @@ class Application:
             if not shutil.which(self.args.lcitool):
                 sys.exit("error: 'lcitool' not installed")
 
+    def make_run(self, target):
+        args = [
+            "-C",
+            self.basedir,
+            target,
+        ]
+
+        if pty.spawn(["make"] + args) != 0:
+            sys.exit("error: 'make' failed")
+
     def lcitool_run(self, args):
         output = subprocess.check_output([self.args.lcitool] + args)
         return output.decode("utf-8")
@@ -137,6 +155,9 @@ class Application:
             print(f"cirrus/{host}")
             self.generate_vars(host)
 
+    def action_list_images(self):
+        self.make_run(f"ci-list-images")
+
     def action_refresh(self):
         self.refresh_containers()
         self.refresh_cirrus()
-- 
2.26.2




More information about the libvir-list mailing list