[libvirt PATCH 07/11] ci: helper: Improve output for list-images action

Andrea Bolognani abologna at redhat.com
Fri Apr 23 15:03:04 UTC 2021


This makes the output more compact by grouping together all
images that are built on the same base OS.

Later on, when we change the actions that operate on
container images to accept an lcitool-style --cross-arch
argument instead of expecting the name of the image to have
the cross-building architecture baked in, this will allow
users to quickly copy-and-paste the necessary information.

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

diff --git a/ci/helper b/ci/helper
index c1e1a53d51..6543a47131 100755
--- a/ci/helper
+++ b/ci/helper
@@ -311,25 +311,12 @@ class Application:
                                              self._args.gitlab_uri)
         images = util.get_registry_images(registry_uri)
 
-        native = []
-        cross = []
-        for image_distro in images.keys():
-            if images[image_distro]:
-                for image_cross in images[image_distro]:
-                    cross.append(image_distro + "-cross-" + image_cross)
+        for distro in sorted(images.keys()):
+            if images[distro]:
+                cross = " ".join(sorted(images[distro]))
+                print(f"{distro} (cross: {cross})")
             else:
-                native.append(image_distro)
-        native.sort()
-        cross.sort()
-
-        spacing = 4 * " "
-        print("Available x86 container images:\n")
-        print(spacing + ("\n" + spacing).join(native))
-
-        if cross:
-            print()
-            print("Available cross-compiler container images:\n")
-            print(spacing + ("\n" + spacing).join(cross))
+                print(distro)
 
     def _action_refresh(self):
         self._refresh_containers()
-- 
2.26.3




More information about the libvir-list mailing list