On Wed, Dec 19, 2012 at 10:16:26AM +0100, Christophe Fergeau wrote: > To summarize my current take on this, both OsinfoInstallConfig:config-params > and OsinfoInstallScript:config-params are good to have. Depending on > the use case, both can be useful, so we should keep both. > We add two new methods osinfo_install_config_new_for_script() and > osinfo_install_config_get_config_params(). We don't deprecate anything. > osinfo_install_script_get_config_params() and osinfo_install_config_new() > will still be there as they are useful in different context. > And I don't see any huge confusion arising from that that cannot be fixed > by some basic documentation (I said 'basic', there is no complicated > confusing magic to understand there). To make things even more clear, this means this patch on top of the series (with the various hunks squashed into the right commits) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index d0582ea..8e07177 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,8 +388,8 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + osinfo_install_config_new_for_script; osinfo_install_config_get_config_params; - osinfo_install_config_set_config_params; osinfo_install_config_paramlist_get_type; osinfo_install_config_paramlist_new; diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index c928227..e61bfb6 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -177,9 +177,15 @@ osinfo_install_config_init (OsinfoInstallConfig *config) * osinfo_install_config_new: * @id: the unique identifier * - * Construct a new install configuration that is initially empty. + * Construct a new install configuration with default values for + * language, keyboard, timezone and admin password. The default values + * are to use an 'us' keyboard, an 'en_US.UTF-8' language and an + * 'America/New_York' timezone. The admin password is set to a random + * 8 character password. + * + * Returns: (transfer full): an install configuration with default + * values * - * Returns: (transfer full): an empty install configuration */ OsinfoInstallConfig *osinfo_install_config_new(const gchar *id) { @@ -187,6 +193,20 @@ OsinfoInstallConfig *osinfo_install_config_new(const gchar *id) } +/** + * osinfo_install_config_new_for_script: + * @id: the unique identifier + * @script: the #OsinfoInstallScript we are creating the configuration for + * + * Construct a new install configuration associated with @script. + * OsinfoInstallConfig:config-params will contain the + * #OsinfoInstallConfigParamList describing the parameters that can be set + * on the config object when creating a configuration for @script. See + * osinfo_install_config_new() for a description of the default values that + * will be set on the newly created #OsinfoInstallConfig. + * + * Returns: (transfer full): an install configuration + */ OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id, OsinfoInstallScript *script) { diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h index 94575c3..112860b 100644 --- a/osinfo/osinfo_install_config.h +++ b/osinfo/osinfo_install_config.h @@ -97,6 +97,8 @@ struct _OsinfoInstallConfigClass GType osinfo_install_config_get_type(void); OsinfoInstallConfig *osinfo_install_config_new(const gchar *id); +OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id, + OsinfoInstallScript *script); void osinfo_install_config_set_hardware_arch(OsinfoInstallConfig *config, const gchar *arch); @@ -198,8 +200,6 @@ void osinfo_install_config_set_post_install_drivers_location(OsinfoInstallConfig const gchar *location); const gchar *osinfo_install_config_get_post_install_drivers_location(OsinfoInstallConfig *config); -void osinfo_install_config_set_config_params(OsinfoInstallConfig *config, - OsinfoInstallConfigParamList *config_params); OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInstallConfig *config); #endif /* __OSINFO_INSTALL_CONFIG_H__ */ diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index d8502df..2fe19a2 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -35,11 +35,13 @@ G_DEFINE_TYPE (OsinfoInstallConfigParam, osinfo_install_config_param, OSINFO_TYP /** * SECTION:osinfo_install_config_param * @short_description: OS install configuration parameters (and its policies) - * @see_also: #OsinfoInstallScript, #OsinfoInstallSciptConfig + * @see_also: #OsinfoInstallScript, #OsinfoInstallConfig * - * #OsinfoInstallConfigParam is an entity for representing all parameters that + * #OsinfoInstallConfigParam is an entity for describing all parameters that * can be set in an automated installation. It is used to help applications to - * generate an automated installation script + * generate an automated installation script. The actual parameter values + * for an #OsinfoInstallScript must be set using an #OsinfoInstallConfig + * object. */ struct _OsinfoInstallConfigParamPrivate diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h index 5a67576..5ad2162 100644 --- a/osinfo/osinfo_install_config_private.h +++ b/osinfo/osinfo_install_config_private.h @@ -26,9 +26,9 @@ #ifndef __OSINFO_INSTALL_CONFIG_PRIVATE_H__ #define __OSINFO_INSTALL_CONFIG_PRIVATE_H__ +void osinfo_install_config_set_config_params(OsinfoInstallConfig *config, + OsinfoInstallConfigParamList *config_params); 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__ */ /* diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index e106eca..a121d15 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -39,12 +39,13 @@ G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); /** * SECTION:osinfo_install_script - * @short_description: OS install scripturation - * @see_also: #OsinfoInstallScript + * @short_description: OS install script generation + * @see_also: #OsinfoInstallConfig * - * #OsinfoInstallScript is an object for representing OS - * install scripturation data. It is used to generate an - * automated installation script + * #OsinfoInstallScript is an object used to generate an + * automated installation script for an OS. The OS + * configuration data (language, keyboard, timezone, ...) + * comes from an #OsinfoInstallConfig object. */ struct _OsinfoInstallScriptPrivate @@ -605,7 +606,6 @@ static xsltStylesheetPtr osinfo_install_script_load_template(const gchar *uri, static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConfig *config, OsinfoEntity *entity, - gboolean is_install_config, const gchar *name, GError **error) { @@ -640,7 +640,7 @@ static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConf GList *values; GList *tmp2; - if (is_install_config) + if (OSINFO_IS_INSTALL_CONFIG(entity)) values = osinfo_install_config_get_param_value_list(OSINFO_INSTALL_CONFIG(entity), tmp1->data); else values = osinfo_entity_get_param_value_list(entity, tmp1->data); @@ -695,7 +695,6 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript * if (!(node = osinfo_install_script_generate_entity_config(config, OSINFO_ENTITY(script), - FALSE, "script", error))) goto error; @@ -707,7 +706,6 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript * if (!(node = osinfo_install_script_generate_entity_config(config, OSINFO_ENTITY(os), - FALSE, "os", error))) goto error; @@ -719,7 +717,6 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript * if (!(node = osinfo_install_script_generate_entity_config(config, OSINFO_ENTITY(config), - TRUE, "config", error))) goto error; Christophe
Attachment:
pgpztRaAiRGUu.pgp
Description: PGP signature
_______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo