[virt-tools-list] [PATCH 1/4] differ expected and output name for a script
Fabiano Fidêncio
fabiano at fidencio.org
Sun Aug 26 08:50:14 UTC 2012
We need to differ the expected name (name used for the installers, set
in the XML representing each script) and the output-file name (name used
to generate the script, may be the same than expected name; may be not,
once we can set the prefix_output for a script)
---
osinfo/libosinfo.syms | 1 +
osinfo/osinfo_install_script.c | 19 +++++++++++++++++--
osinfo/osinfo_install_script.h | 4 +++-
osinfo/osinfo_loader.c | 2 +-
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 6060b1d..c60f726 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -281,6 +281,7 @@ LIBOSINFO_0.2.0 {
osinfo_install_script_get_template_uri;
osinfo_install_script_get_template_data;
osinfo_install_script_get_output_filename;
+ osinfo_install_script_get_filename;
osinfo_install_script_has_config_param;
osinfo_install_script_has_config_param_name;
osinfo_install_script_get_config_param_list;
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index bb2c2eb..bb4e0f3 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -47,6 +47,7 @@ G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY);
struct _OsinfoInstallScriptPrivate
{
gchar *output_prefix;
+ gchar *output_filename;
GList *config_param_list;
};
@@ -353,10 +354,24 @@ const gchar *osinfo_install_script_get_output_prefix(OsinfoInstallScript *script
return script->priv->output_prefix;
}
-const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script)
+const gchar *osinfo_install_script_get_filename(OsinfoInstallScript *script)
{
return osinfo_entity_get_param_value(OSINFO_ENTITY(script),
- OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME);
+ OSINFO_INSTALL_SCRIPT_PROP_FILENAME);
+}
+
+const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script)
+{
+ if (script->priv->output_prefix) {
+ g_free(script->priv->output_filename);
+ script->priv->output_filename =
+ g_strdup_printf("%s-%s",
+ script->priv->output_prefix,
+ osinfo_install_script_get_filename(script));
+ return script->priv->output_filename;
+ }
+
+ return osinfo_install_script_get_filename(script);
}
struct _OsinfoInstallScriptGenerateData {
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index cbfc517..a360098 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -50,7 +50,7 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA "template-data"
#define OSINFO_INSTALL_SCRIPT_PROP_PROFILE "profile"
#define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format"
-#define OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME "output-filename"
+#define OSINFO_INSTALL_SCRIPT_PROP_FILENAME "filename"
#define OSINFO_INSTALL_SCRIPT_PROP_CONFIG_REQUIRED "required"
#define OSINFO_INSTALL_SCRIPT_PROP_CONFIG_OPTIONAL "optional"
@@ -95,6 +95,8 @@ const gchar *osinfo_install_script_get_output_prefix(OsinfoInstallScript *script
const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script);
+const gchar *osinfo_install_script_get_filename(OsinfoInstallScript *script);
+
void osinfo_install_script_generate_async(OsinfoInstallScript *script,
OsinfoOs *os,
OsinfoInstallConfig *config,
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index c080fc4..404e5b9 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -619,7 +619,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
goto error;
if (value)
osinfo_entity_set_param(OSINFO_ENTITY(installScript),
- OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME,
+ OSINFO_INSTALL_SCRIPT_PROP_FILENAME,
value);
g_free(value);
--
1.7.11.4
More information about the virt-tools-list
mailing list