[Libosinfo] [libosinfo PATCH] db: Add missing attributes to fill_media()

Fabiano Fidêncio fidencio at redhat.com
Thu Feb 28 21:17:31 UTC 2019


Some new attributes have been added to OsinfoMedia, as:
- the install-script list (during this cycle);
- installer-script (1.3.0);

However, none of those attributes have been filled in in the media
accordingly to matched media.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_db.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 5696279..f59c804 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -642,6 +642,9 @@ static void fill_media(OsinfoDb *db, OsinfoMedia *media,
     const gchar *initrd_path;
     const gchar *arch;
     const gchar *url;
+    gint i;
+    gboolean installer_script;
+    OsinfoInstallScriptList *install_script_list;
     GList *variants, *node;
 
     set_languages_for_media(db, media, matched_media);
@@ -685,6 +688,23 @@ static void fill_media(OsinfoDb *db, OsinfoMedia *media,
                      "eject-after-install", eject_after_install,
                      NULL);
     }
+    installer_script = osinfo_entity_get_param_value_boolean_with_default(OSINFO_ENTITY(matched_media),
+                                                                          OSINFO_MEDIA_PROP_INSTALLER_SCRIPT,
+                                                                          TRUE);
+    g_object_set(G_OBJECT(media),
+                 "installer-script", installer_script,
+                 NULL);
+    install_script_list = osinfo_media_get_install_script_list(matched_media);
+    if (install_script_list != NULL &&
+        osinfo_list_get_length(OSINFO_LIST(install_script_list)) > 0) {
+        for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(install_script_list)); i++) {
+            OsinfoInstallScript *script;
+
+            script = OSINFO_INSTALL_SCRIPT(osinfo_list_get_nth(OSINFO_LIST(install_script_list), i));
+            osinfo_media_add_install_script(media, script);
+        }
+    }
+
     if (os != NULL)
         osinfo_media_set_os(media, os);
 }
-- 
2.20.1




More information about the Libosinfo mailing list