]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ci: Implement 'list-images' helper action
authorAndrea Bolognani <abologna@redhat.com>
Fri, 12 Mar 2021 16:52:50 +0000 (17:52 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 15 Mar 2021 17:49:03 +0000 (18:49 +0100)
This simply calls the underlying Makefile target.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
ci/helper

index 20b10eb3e8d494ef7f3340cd6f150d70d53406a8..578920c380a86a85c17e6da8c224afae4f4c9942 100755 (executable)
--- a/ci/helper
+++ b/ci/helper
@@ -5,6 +5,7 @@
 
 import argparse
 import pathlib
+import pty
 import shutil
 import subprocess
 import sys
@@ -29,6 +30,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",
@@ -50,6 +58,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")
@@ -126,6 +144,9 @@ class Application:
 
             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()