[Libosinfo] [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML

Christophe Fergeau cfergeau at redhat.com
Mon Dec 17 21:07:45 UTC 2012


---
 data/schemas/libosinfo.rng           | 3 +++
 osinfo/osinfo_install_config_param.h | 5 +++--
 osinfo/osinfo_loader.c               | 7 +++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 62be37d..90b0dfb 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -557,6 +557,9 @@
                 <attribute name="policy">
                   <ref name='policies'/>
                 </attribute>
+                <optional>
+                  <attribute name="value-map"/>
+                </optional>
               </element>
             </oneOrMore>
           </element>
diff --git a/osinfo/osinfo_install_config_param.h b/osinfo/osinfo_install_config_param.h
index ba5a77c..b0f2217 100644
--- a/osinfo/osinfo_install_config_param.h
+++ b/osinfo/osinfo_install_config_param.h
@@ -37,8 +37,9 @@
 #define OSINFO_IS_INSTALL_CONFIG_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAM))
 #define OSINFO_INSTALL_CONFIG_PARAM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAM, OsinfoInstallConfigParamClass))
 
-#define OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME   "name"
-#define OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY "policy"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_DATAMAP "value-map"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME    "name"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY  "policy"
 
 typedef struct _OsinfoInstallConfigParam        OsinfoInstallConfigParam;
 typedef struct _OsinfoInstallConfigParamClass   OsinfoInstallConfigParamClass;
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index a097039..efbbc97 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -642,12 +642,19 @@ static void osinfo_loader_install_config_params(OsinfoLoader *loader,
     for (i = 0 ; i < nnodes ; i++) {
         gchar *name = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME);
         gchar *policy = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY);
+        gchar *mapid = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_DATAMAP);
         OsinfoInstallConfigParam *param = osinfo_install_config_param_new(name);
         osinfo_entity_set_param(OSINFO_ENTITY(param),
                                 OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY,
                                 policy);
         osinfo_install_script_add_config_param(OSINFO_INSTALL_SCRIPT(entity),
                                                param);
+        if (mapid != NULL) {
+            OsinfoDatamap *map;
+            map = osinfo_loader_get_datamap(loader, mapid);
+            if (map != NULL)
+                osinfo_install_config_param_set_value_map(param, map);
+        }
 
         xmlFree(name);
         xmlFree(policy);
-- 
1.8.0.2




More information about the Libosinfo mailing list