[PATCHv4 09/11] Add osinfo_install_config_new_for_script

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

 



In order to be able to automatically transform configuration parameters set
on OsinfoInstallConfig instances (ie translate from generic value to
OS-specific value), we need to have access to the
OsinfoInstallConfigParamList for the current OsinfoInstallScript as
this is where the OsinfoDatamaps needed to do the remapping are stored.

After the previous commits we can now associate an
OsinfoInstallConfigParamList with an OsinfoInstallConfig instance,
and we can get the OsinfoInstallConfigParamList corresponding to
an OsinfoInstallScript instance, so this commit just adds a new
osinfo_install_config_new_for_script which will create a new
OsinfoInstallConfig instance associated with the
OsinfoInstallConfigParamList for a given installation script.
---
 osinfo/osinfo_install_config.c         | 22 +++++++++++++++++++---
 osinfo/osinfo_install_config.h         |  2 ++
 osinfo/osinfo_install_config_private.h |  2 ++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c
index 7f75841..c928227 100644
--- a/osinfo/osinfo_install_config.c
+++ b/osinfo/osinfo_install_config.c
@@ -183,9 +183,25 @@ osinfo_install_config_init (OsinfoInstallConfig *config)
  */
 OsinfoInstallConfig *osinfo_install_config_new(const gchar *id)
 {
-    return g_object_new(OSINFO_TYPE_INSTALL_CONFIG,
-                        "id", id,
-                        NULL);
+    return osinfo_install_config_new_for_script(id, NULL);
+}
+
+
+OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id,
+                                                          OsinfoInstallScript *script)
+{
+    OsinfoInstallConfigParamList *params = NULL;
+    OsinfoInstallConfig *config;
+
+    if (script != NULL)
+        params = osinfo_install_script_get_config_params(script);
+
+    config = g_object_new(OSINFO_TYPE_INSTALL_CONFIG,
+                          "id", id,
+                          "config-params", params,
+                          NULL);
+
+    return config;
 }
 
 void osinfo_install_config_set_hardware_arch(OsinfoInstallConfig *config,
diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h
index 89215d1..94575c3 100644
--- a/osinfo/osinfo_install_config.h
+++ b/osinfo/osinfo_install_config.h
@@ -72,6 +72,8 @@ typedef struct _OsinfoInstallConfig        OsinfoInstallConfig;
 typedef struct _OsinfoInstallConfigClass   OsinfoInstallConfigClass;
 typedef struct _OsinfoInstallConfigPrivate OsinfoInstallConfigPrivate;
 
+#include <osinfo/osinfo_install_script.h>
+
 /* object */
 struct _OsinfoInstallConfig
 {
diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h
index e08f863..5a67576 100644
--- a/osinfo/osinfo_install_config_private.h
+++ b/osinfo/osinfo_install_config_private.h
@@ -27,6 +27,8 @@
 #define __OSINFO_INSTALL_CONFIG_PRIVATE_H__
 
 GList *osinfo_install_config_get_param_value_list(OsinfoInstallConfig *config, const gchar *key);
+OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id,
+                                                          OsinfoInstallScript *script);
 
 #endif /* __OSINFO_INSTALL_CONFIG_PRIVATE_H__ */
 /*
-- 
1.8.0.2


[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