[libosinfo PATCH] Revert "osinfo-detect: print os variants info for env format"

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

 



This reverts commit 44cab89243220223b0ac6312237c08a514055664, as the
commit was mistakenly pushed.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tools/osinfo-detect.c | 47 +++++++++----------------------------------
 1 file changed, 10 insertions(+), 37 deletions(-)

diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c
index 626df7d..c21e694 100644
--- a/tools/osinfo-detect.c
+++ b/tools/osinfo-detect.c
@@ -120,16 +120,11 @@ static void print_bootable(gboolean bootable)
 static void print_media(OsinfoMedia *media)
 {
     OsinfoOs *os;
-    OsinfoOsVariantList *variants;
-    gsize num_variants;
 
     g_object_get(G_OBJECT(media), "os", &os, NULL);
     if (os == NULL)
         return;
 
-    variants = osinfo_media_get_os_variants(media);
-    num_variants = osinfo_list_get_length(OSINFO_LIST(variants));
-
     if (format == OUTPUT_FORMAT_ENV) {
         const gchar *id = osinfo_entity_get_id(OSINFO_ENTITY(os));
 
@@ -139,22 +134,13 @@ static void print_media(OsinfoMedia *media)
             g_print("OSINFO_LIVE=%s\n", id);
         g_print("OSINFO_MEDIA=%s\n",
                 osinfo_entity_get_id(OSINFO_ENTITY(media)));
-        if (num_variants > 0) {
-            gsize i;
-
-            g_print("OSINFO_MEDIA_VARIANTS=");
-            for (i = 0; i < num_variants; i++) {
-                OsinfoEntity *variant;
-
-                variant = osinfo_list_get_nth(OSINFO_LIST(variants), i);
-                g_print("%s", osinfo_os_variant_get_name(OSINFO_OS_VARIANT(variant)));
-                g_print("%s", i < num_variants - 1 ? ", " : "\n");
-            }
-        }
-
     } else {
+        OsinfoOsVariantList *variants;
         const gchar *name;
+        guint num_variants;
 
+        variants = osinfo_media_get_os_variants(media);
+        num_variants = osinfo_list_get_length(OSINFO_LIST(variants));
         if (num_variants == 1) {
             OsinfoEntity *variant;
 
@@ -170,7 +156,7 @@ static void print_media(OsinfoMedia *media)
             g_print(_("Media is live media for OS '%s'\n"), name);
 
         if (num_variants > 1) {
-            gsize i;
+            guint i;
 
             g_print(_("Available OS variants on media:\n"));
             for (i = 0; i < num_variants; i++) {
@@ -189,17 +175,10 @@ static void print_media(OsinfoMedia *media)
 
 static void print_os_tree(OsinfoOs *os, OsinfoTree *tree, OsinfoTree *matched_tree)
 {
-    OsinfoOsVariantList *variants;
-    gsize num_variants;
-
     if (os == NULL)
         return;
 
-    variants = osinfo_tree_get_os_variants(matched_tree);
-    num_variants = osinfo_list_get_length(OSINFO_LIST(variants));
-
     if (format == OUTPUT_FORMAT_ENV) {
-        gsize i;
         const gchar *id = osinfo_entity_get_id(OSINFO_ENTITY(os));
         const gchar *kernel = osinfo_tree_get_kernel_path(tree);
         const gchar *initrd = osinfo_tree_get_initrd_path(tree);
@@ -221,19 +200,13 @@ static void print_os_tree(OsinfoOs *os, OsinfoTree *tree, OsinfoTree *matched_tr
             g_print("OSINFO_TREE_INITRD=%s\n", initrd);
         if (bootiso)
             g_print("OSINFO_TREE_BOOT_ISO=%s\n", bootiso);
-        if (num_variants > 0) {
-            g_print("OSINFO_TREE_VARIANTS=");
-            for (i = 0; i < num_variants; i++) {
-                OsinfoEntity *variant;
-
-                variant = osinfo_list_get_nth(OSINFO_LIST(variants), i);
-                g_print("%s", osinfo_os_variant_get_name(OSINFO_OS_VARIANT(variant)));
-                g_print("%s", i < num_variants - 1 ? ", " : "\n");
-            }
-        }
     } else {
+        OsinfoOsVariantList *variants;
         const gchar *name;
+        guint num_variants;
 
+        variants = osinfo_tree_get_os_variants(matched_tree);
+        num_variants = osinfo_list_get_length(OSINFO_LIST(variants));
         if (num_variants == 1) {
             OsinfoEntity *variant;
 
@@ -246,7 +219,7 @@ static void print_os_tree(OsinfoOs *os, OsinfoTree *tree, OsinfoTree *matched_tr
         g_print(_("Tree is an installer for OS '%s'\n"), name);
 
         if (num_variants > 1) {
-            gsize i;
+            guint i;
 
             g_print(_("Available OS variants on tree:\n"));
             for (i = 0; i < num_variants; i++) {
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




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

  Powered by Linux