From berrange at redhat.com Mon Dec 17 11:45:18 2012 From: berrange at redhat.com (Daniel P. Berrange) Date: Mon, 17 Dec 2012 11:45:18 +0000 Subject: [Libosinfo] Testing 123... Message-ID: <20121217114518.GK27825@redhat.com> ..456 Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| From cfergeau at redhat.com Mon Dec 17 21:07:43 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:43 +0100 Subject: [Libosinfo] [PATCHv4] datamap support Message-ID: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Hey, Here is another iteration of the datamap support patches. There are not many big changes before patch 07/11. I took a different approach from the previous series in that the values are only transformed when calling the appropriate getter. This has the side effect of making the code less complex, of making the implementation of the cloning function in patch 10/11 easier, ... This also makes it easier to support modifications of the OsinfoInstallConfig:config-params properties during the life time of the OsinfoInstallConfig objects. And in turn, this makes it easier to not force applications to use a new constructor, which would be an ABI break. Christophe From cfergeau at redhat.com Mon Dec 17 21:07:44 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:44 +0100 Subject: [Libosinfo] =?utf-8?q?=5BPATCHv4_01/11=5D_Add_OsinfoInstallConfig?= =?utf-8?q?Param=3A=3Avalue-map?= In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-2-git-send-email-cfergeau@redhat.com> If set, this OsinfoDatamap value will be used to map generic values to OS-specific values. --- osinfo/osinfo_install_config_param.c | 71 +++++++++++++++++++++++++++++++++++- osinfo/osinfo_install_config_param.h | 3 ++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 7876d20..68b80f6 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: + * Christophe Fergeau * Fabiano Fid?ncio */ @@ -41,11 +42,17 @@ G_DEFINE_TYPE (OsinfoInstallConfigParam, osinfo_install_config_param, OSINFO_TYP * generate an automated installation script */ +struct _OsinfoInstallConfigParamPrivate +{ + OsinfoDatamap *value_map; +}; + enum { PROP_0, PROP_NAME, PROP_POLICY, + PROP_VALUE_MAP }; static void @@ -63,6 +70,12 @@ osinfo_install_config_param_set_property(GObject *object, OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME, g_value_get_string(value)); break; + + case PROP_VALUE_MAP: + osinfo_install_config_param_set_value_map(config_param, + g_value_get_object(value)); + break; + default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -96,6 +109,9 @@ osinfo_install_config_param_get_property(GObject *object, g_value_set_enum(value, policy); break; } + case PROP_VALUE_MAP: + g_value_set_object(value, config_param->priv->value_map); + break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -103,6 +119,17 @@ osinfo_install_config_param_get_property(GObject *object, } } +static void +osinfo_install_config_param_finalize(GObject *object) +{ + OsinfoInstallConfigParam *config_param; + config_param = OSINFO_INSTALL_CONFIG_PARAM(object); + g_clear_object(&config_param->priv->value_map); + + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_param_parent_class)->finalize (object); +} + /* Init functions */ static void osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass) @@ -144,12 +171,30 @@ osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass) g_object_class_install_property(g_klass, PROP_POLICY, pspec); + /** + * OsinfoInstallConfigParam:value-map: + * + * The mapping between generic values and OS-specific values for this + * configuration parameter + **/ + pspec = g_param_spec_object("value-map", + "Value Mapping", + _("Parameter Value Mapping"), + OSINFO_TYPE_DATAMAP, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, + PROP_VALUE_MAP, + pspec); + + g_klass->finalize = osinfo_install_config_param_finalize; + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigParamPrivate)); } static void osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param) { - /* G_DEFINE_TYPE() needs an instance init function */ + config_param->priv = OSINFO_INSTALL_CONFIG_PARAM_GET_PRIVATE(config_param); } /** @@ -217,6 +262,30 @@ gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL); } +OsinfoDatamap *osinfo_install_config_param_get_value_map(const OsinfoInstallConfigParam *config_param) +{ + return config_param->priv->value_map; +} + +/** + * osinfo_install_config_param_set_value_map: + * @config_param: the configuration parameter + * @datamap: a #OsinfoDatamap to transform values this parameter is set to, + * or NULL to disable transformations for this parameter + * + * After a call to osinfo_install_config_param_set_value_map(), @datamap will + * be used to transform values set for this parameter to OS-specific + * values. A NULL @datamap will disable transformations. + */ +void osinfo_install_config_param_set_value_map(OsinfoInstallConfigParam *config_param, OsinfoDatamap *datamap) +{ + g_return_if_fail(OSINFO_IS_INSTALL_CONFIG_PARAM(config_param)); + + if (config_param->priv->value_map != NULL) + g_object_unref(G_OBJECT(config_param->priv->value_map)); + config_param->priv->value_map = g_object_ref(datamap); +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config_param.h b/osinfo/osinfo_install_config_param.h index 655c869..ba5a77c 100644 --- a/osinfo/osinfo_install_config_param.h +++ b/osinfo/osinfo_install_config_param.h @@ -88,6 +88,9 @@ gboolean osinfo_install_config_param_is_required(const OsinfoInstallConfigParam gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam *config_param); +void osinfo_install_config_param_set_value_map(OsinfoInstallConfigParam *config_param, OsinfoDatamap *datamap); +OsinfoDatamap *osinfo_install_config_param_get_value_map(const OsinfoInstallConfigParam *config_param); + #endif /* __OSINFO_INSTALL_CONFIG_PARAM_H__ */ /* -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:45 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:45 +0100 Subject: [Libosinfo] [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-3-git-send-email-cfergeau@redhat.com> --- 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 @@ + + + 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 From cfergeau at redhat.com Mon Dec 17 21:07:46 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:46 +0100 Subject: [Libosinfo] [PATCHv4 03/11] Add OsinfoInstallConfigParamList In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-4-git-send-email-cfergeau@redhat.com> --- osinfo/Makefile.am | 160 ++++++++++++++++--------------- osinfo/libosinfo.syms | 4 + osinfo/osinfo.h | 1 + osinfo/osinfo_install_config_paramlist.c | 94 ++++++++++++++++++ osinfo/osinfo_install_config_paramlist.h | 79 +++++++++++++++ 5 files changed, 259 insertions(+), 79 deletions(-) create mode 100644 osinfo/osinfo_install_config_paramlist.c create mode 100644 osinfo/osinfo_install_config_paramlist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 1c9c3ae..9d03a34 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -53,87 +53,89 @@ libosinfo_1_0_la_DEPENDENCIES = libosinfo.syms libosinfo_1_0_includedir = $(includedir)/libosinfo-1.0/osinfo -OSINFO_HEADER_FILES = \ - osinfo.h \ - osinfo_avatar_format.h \ - osinfo_db.h \ - osinfo_loader.h \ - osinfo_datamap.h \ - osinfo_datamaplist.h \ - osinfo_device.h \ - osinfo_device_driver.h \ - osinfo_device_driverlist.h \ - osinfo_devicelink.h \ - osinfo_devicelist.h \ - osinfo_devicelinklist.h \ - osinfo_devicelinkfilter.h \ - osinfo_entity.h \ - osinfo_filter.h \ - osinfo_install_config.h \ - osinfo_install_config_param.h \ - osinfo_install_script.h \ - osinfo_install_scriptlist.h \ - osinfo_product.h \ - osinfo_productfilter.h \ - osinfo_productlist.h \ - osinfo_platform.h \ - osinfo_platformlist.h \ - osinfo_list.h \ - osinfo_os.h \ - osinfo_oslist.h \ - osinfo_deployment.h \ - osinfo_deploymentlist.h \ - osinfo_media.h \ - osinfo_media_private.h \ - osinfo_medialist.h \ - osinfo_resources.h \ - osinfo_resourceslist.h \ - osinfo_tree.h \ - osinfo_treelist.h \ +OSINFO_HEADER_FILES = \ + osinfo.h \ + osinfo_avatar_format.h \ + osinfo_db.h \ + osinfo_loader.h \ + osinfo_datamap.h \ + osinfo_datamaplist.h \ + osinfo_device.h \ + osinfo_devicelink.h \ + osinfo_devicelist.h \ + osinfo_devicelinklist.h \ + osinfo_devicelinkfilter.h \ + osinfo_device_driver.h \ + osinfo_device_driverlist.h \ + osinfo_entity.h \ + osinfo_filter.h \ + osinfo_install_config.h \ + osinfo_install_config_param.h \ + osinfo_install_config_paramlist.h \ + osinfo_install_script.h \ + osinfo_install_scriptlist.h \ + osinfo_product.h \ + osinfo_productfilter.h \ + osinfo_productlist.h \ + osinfo_platform.h \ + osinfo_platformlist.h \ + osinfo_list.h \ + osinfo_os.h \ + osinfo_oslist.h \ + osinfo_deployment.h \ + osinfo_deploymentlist.h \ + osinfo_media.h \ + osinfo_media_private.h \ + osinfo_medialist.h \ + osinfo_resources.h \ + osinfo_resourceslist.h \ + osinfo_tree.h \ + osinfo_treelist.h \ $(NULL) -libosinfo_1_0_include_HEADERS = \ - $(OSINFO_HEADER_FILES) \ - osinfo_enum_types.h - -libosinfo_1_0_la_SOURCES = \ - osinfo_avatar_format.c \ - osinfo_datamap.c \ - osinfo_datamaplist.c \ - osinfo_entity.c \ - osinfo_enum_types.c \ - osinfo_filter.c \ - osinfo_list.c \ - osinfo_device.c \ - osinfo_device_driver.c \ - osinfo_device_driver_private.h \ - osinfo_device_driverlist.c \ - osinfo_devicelink.c \ - osinfo_devicelist.c \ - osinfo_devicelinklist.c \ - osinfo_devicelinkfilter.c \ - osinfo_install_config.c \ - osinfo_install_config_param.c \ - osinfo_install_script.c \ - osinfo_install_script_private.h \ - osinfo_install_scriptlist.c \ - osinfo_product.c \ - osinfo_productfilter.c \ - osinfo_productlist.c \ - osinfo_platform.c \ - osinfo_platformlist.c \ - osinfo_oslist.c \ - osinfo_os.c \ - osinfo_deployment.c \ - osinfo_deploymentlist.c \ - osinfo_media.c \ - osinfo_medialist.c \ - osinfo_resources.c \ - osinfo_resourceslist.c \ - osinfo_tree.c \ - osinfo_treelist.c \ - osinfo_db.c \ - osinfo_loader.c \ +libosinfo_1_0_include_HEADERS = \ + $(OSINFO_HEADER_FILES) \ + osinfo_enum_types.h \ + $(NULL) + +libosinfo_1_0_la_SOURCES = \ + osinfo_avatar_format.c \ + osinfo_datamap.c \ + osinfo_datamaplist.c \ + osinfo_entity.c \ + osinfo_enum_types.c \ + osinfo_filter.c \ + osinfo_list.c \ + osinfo_device.c \ + osinfo_devicelink.c \ + osinfo_devicelist.c \ + osinfo_devicelinklist.c \ + osinfo_devicelinkfilter.c \ + osinfo_device_driver.c \ + osinfo_device_driverlist.c \ + osinfo_install_config.c \ + osinfo_install_config_param.c \ + osinfo_install_config_paramlist.c \ + osinfo_install_script.c \ + osinfo_install_script_private.h \ + osinfo_install_scriptlist.c \ + osinfo_product.c \ + osinfo_productfilter.c \ + osinfo_productlist.c \ + osinfo_platform.c \ + osinfo_platformlist.c \ + osinfo_oslist.c \ + osinfo_os.c \ + osinfo_deployment.c \ + osinfo_deploymentlist.c \ + osinfo_media.c \ + osinfo_medialist.c \ + osinfo_resources.c \ + osinfo_resourceslist.c \ + osinfo_tree.c \ + osinfo_treelist.c \ + osinfo_db.c \ + osinfo_loader.c \ $(NULL) osinfo_enum_types.h: $(OSINFO_HEADER_FILES) osinfo_enum_types.h.template diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index ab04df7..7d295a2 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,8 +388,12 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + osinfo_install_config_paramlist_get_type; + osinfo_install_config_paramlist_new; + osinfo_media_get_languages; osinfo_media_get_os; + } LIBOSINFO_0.2.2; /* Symbols in next release... diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 13b5a0b..1012ede 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_install_config_paramlist.c b/osinfo/osinfo_install_config_paramlist.c new file mode 100644 index 0000000..d3eeffc --- /dev/null +++ b/osinfo/osinfo_install_config_paramlist.c @@ -0,0 +1,94 @@ +/* + * libosinfo: a list of installation configuration parameters + * + * Copyright (C) 2009-2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Arjun Roy + * Christophe Fergeau + * Daniel P. Berrange + */ + +#include + +#include +#include + +G_DEFINE_TYPE (OsinfoInstallConfigParamList, osinfo_install_config_paramlist, OSINFO_TYPE_LIST); + +#define OSINFO_INSTALL_CONFIG_PARAMLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListPrivate)) + +/** + * SECTION:osinfo_install_config_paramlist + * @short_description: A list of installation install_config_param + * @see_also: #OsinfoList, #OsinfoInstallConfigParam + * + * #OsinfoInstallConfigParamList is a list specialization that stores + * only #OsinfoInstallConfigParam objects. + */ + +struct _OsinfoInstallConfigParamListPrivate +{ + gboolean unused; +}; + +static void +osinfo_install_config_paramlist_finalize (GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_paramlist_parent_class)->finalize (object); +} + +/* Init functions */ +static void +osinfo_install_config_paramlist_class_init (OsinfoInstallConfigParamListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS (klass); + + g_klass->finalize = osinfo_install_config_paramlist_finalize; + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigParamListPrivate)); +} + +static void +osinfo_install_config_paramlist_init (OsinfoInstallConfigParamList *list) +{ + OsinfoInstallConfigParamListPrivate *priv; + list->priv = priv = OSINFO_INSTALL_CONFIG_PARAMLIST_GET_PRIVATE(list); + +} + +/** + * osinfo_install_config_paramlist_new: + * + * Construct a new install_config_param list that is initially empty. + * + * Returns: (transfer full): an empty install_config_param list + */ +OsinfoInstallConfigParamList *osinfo_install_config_paramlist_new(void) +{ + return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, + "element-type", OSINFO_TYPE_INSTALL_CONFIG_PARAM, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_install_config_paramlist.h b/osinfo/osinfo_install_config_paramlist.h new file mode 100644 index 0000000..81254c3 --- /dev/null +++ b/osinfo/osinfo_install_config_paramlist.h @@ -0,0 +1,79 @@ +/* + * libosinfo: a list of installation configuration parameters + * + * Copyright (C) 2009-2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Arjun Roy + * Christophe Fergeau + * Daniel P. Berrange + * Zeeshan Ali + */ + +#include +#include + +#ifndef __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ +#define __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST (osinfo_install_config_paramlist_get_type ()) +#define OSINFO_INSTALL_CONFIG_PARAMLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamList)) +#define OSINFO_IS_INSTALL_CONFIG_PARAMLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST)) +#define OSINFO_INSTALL_CONFIG_PARAMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListClass)) +#define OSINFO_IS_INSTALL_CONFIG_PARAMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST)) +#define OSINFO_INSTALL_CONFIG_PARAMLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListClass)) + +typedef struct _OsinfoInstallConfigParamList OsinfoInstallConfigParamList; + +typedef struct _OsinfoInstallConfigParamListClass OsinfoInstallConfigParamListClass; + +typedef struct _OsinfoInstallConfigParamListPrivate OsinfoInstallConfigParamListPrivate; + +/* object */ +struct _OsinfoInstallConfigParamList +{ + OsinfoList parent_instance; + + /* public */ + + /* private */ + OsinfoInstallConfigParamListPrivate *priv; +}; + +/* class */ +struct _OsinfoInstallConfigParamListClass +{ + OsinfoListClass parent_class; + + /* class members */ +}; + +GType osinfo_install_config_paramlist_get_type(void); + +OsinfoInstallConfigParamList *osinfo_install_config_paramlist_new(void); + +#endif /* __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:47 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:47 +0100 Subject: [Libosinfo] [PATCHv4 04/11] Set id in osinfo_install_config_param_new In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-5-git-send-email-cfergeau@redhat.com> OsinfoInstallConfigParam is an OsinfoEntity, but its _new method does not set an id when creating it. This is needed if we want to be able to use an OsinfoInstallConfigParamList. The "name" argument that is passed at creation time is expected to be unique, so we can use that as the entity id even though a full URI would have been nicer. --- osinfo/osinfo_install_config_param.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 68b80f6..d8502df 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -207,7 +207,10 @@ osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param) */ OsinfoInstallConfigParam *osinfo_install_config_param_new(const gchar *name) { - return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAM, "name", name, NULL); + return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAM, + "id", name, + "name", name, + NULL); } /** -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:48 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:48 +0100 Subject: [Libosinfo] [PATCHv4 05/11] OsinfoInstallScript: Use an OsinfoInstallConfigParamList In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-6-git-send-email-cfergeau@redhat.com> Currently the install script config parameters are stored in a raw GList. However, OsinfoInstallScript ends up reimplementing part of the OsinfoList API, and the raw GList also does not make it convenient to pass the list of config parameters around. Replace the internal GList with an OsinfoInstallConfigParamList, which has the side-effect of nicely simplifying the code. --- osinfo/libosinfo.syms | 2 ++ osinfo/osinfo_install_script.c | 74 ++++++++++++++++++++++-------------------- osinfo/osinfo_install_script.h | 1 + 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 7d295a2..a1c2d71 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -391,6 +391,8 @@ LIBOSINFO_0.2.3 { osinfo_install_config_paramlist_get_type; osinfo_install_config_paramlist_new; + osinfo_install_script_get_config_params; + osinfo_media_get_languages; osinfo_media_get_os; diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 2229843..d72c394 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -50,7 +50,7 @@ struct _OsinfoInstallScriptPrivate { gchar *output_prefix; gchar *output_filename; - GList *config_param_list; + OsinfoInstallConfigParamList *config_params; OsinfoAvatarFormat *avatar; }; @@ -164,8 +164,11 @@ osinfo_install_script_finalize (GObject *object) OsinfoInstallScript *script = OSINFO_INSTALL_SCRIPT (object); g_free(script->priv->output_prefix); g_free(script->priv->output_filename); - g_list_free_full(script->priv->config_param_list, g_object_unref); - if (script->priv->avatar != NULL) + + if (script->priv->config_params) + g_object_unref(script->priv->config_params); + + if (script->priv->avatar) g_object_unref(script->priv->avatar); /* Chain up to the parent class */ @@ -258,35 +261,23 @@ void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoI g_return_if_fail(OSINFO_IS_INSTALL_SCRIPT(script)); g_return_if_fail(OSINFO_IS_INSTALL_CONFIG_PARAM(param)); - script->priv->config_param_list = - g_list_prepend(script->priv->config_param_list, param); + osinfo_list_add(OSINFO_LIST(script->priv->config_params), + OSINFO_ENTITY(param)); } gboolean osinfo_install_script_has_config_param(const OsinfoInstallScript *script, const OsinfoInstallConfigParam *config_param) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), - osinfo_install_config_param_get_name(config_param)) == 0) - return TRUE; - } - return FALSE; + /* NB: this code assumes that the 'id' and 'name' entity properties + * are the same + */ + const char *name = osinfo_install_config_param_get_name(config_param); + return osinfo_install_script_has_config_param_name(script, name); } gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript *script, const gchar *name) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), name) == 0) - return TRUE; - } - return FALSE; + OsinfoList *l = OSINFO_LIST(script->priv->config_params); + return (osinfo_list_find_by_id(l, name) != NULL); } /** @@ -300,7 +291,20 @@ gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript * */ GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script) { - return g_list_copy(script->priv->config_param_list); + return osinfo_list_get_elements(OSINFO_LIST(script->priv->config_params)); +} + +/** + * osinfo_install_script_get_config_params: + * + * Get the list of valid config parameters for @script. + * + * Returns: (transfer none): the list of valid #OsinfoInstallConfigParam + * parameters. + */ +OsinfoInstallConfigParamList *osinfo_install_script_get_config_params(const OsinfoInstallScript *script) +{ + return script->priv->config_params; } /** @@ -317,16 +321,16 @@ OsinfoInstallConfigParam * osinfo_install_script_get_config_param(const OsinfoInstallScript *script, const gchar *name) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), name) == 0) - return g_object_ref(tmp); - } + /* NB: this code assumes that the 'id' and 'name' entity properties + * are the same + */ + OsinfoInstallConfigParam *param; + OsinfoList *l = OSINFO_LIST(script->priv->config_params); + param = OSINFO_INSTALL_CONFIG_PARAM(osinfo_list_find_by_id(l, name)); + if (param == NULL) + return NULL; - return NULL; + return g_object_ref(G_OBJECT(param)); } static void @@ -335,7 +339,7 @@ osinfo_install_script_init (OsinfoInstallScript *list) OsinfoInstallScriptPrivate *priv; list->priv = priv = OSINFO_INSTALL_SCRIPT_GET_PRIVATE(list); - list->priv->config_param_list = NULL; + list->priv->config_params = osinfo_install_config_paramlist_new(); } diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h index f610716..d91751e 100644 --- a/osinfo/osinfo_install_script.h +++ b/osinfo/osinfo_install_script.h @@ -157,6 +157,7 @@ OsinfoInstallConfigParam *osinfo_install_script_get_config_param(const OsinfoIns void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoInstallConfigParam *param); GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script); +OsinfoInstallConfigParamList *osinfo_install_script_get_config_params(const OsinfoInstallScript *script); OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *script); gboolean osinfo_install_script_get_can_pre_install_drivers(OsinfoInstallScript *script); -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:49 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:49 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-7-git-send-email-cfergeau@redhat.com> This property lists the parameters that can be set for a given OsinfoInstallConfig. This is not enforced, it's only there for informative purpose. This will also be used in later commits in order to automatically apply transformations on values for parameters which have an associated OsinfoDatamap. --- osinfo/libosinfo.syms | 3 ++ osinfo/osinfo_install_config.c | 95 +++++++++++++++++++++++++++++++++++++++++- osinfo/osinfo_install_config.h | 7 ++++ 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index a1c2d71..d0582ea 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,6 +388,9 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + 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 64e7ed5..8078f8c 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -42,14 +42,91 @@ G_DEFINE_TYPE (OsinfoInstallConfig, osinfo_install_config, OSINFO_TYPE_ENTITY); struct _OsinfoInstallConfigPrivate { - gboolean unused; + OsinfoInstallConfigParamList *config_params; }; +enum { + PROP_0, + + PROP_CONFIG_PARAMS, +}; + +static void +osinfo_install_config_set_property(GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG(object); + + switch (property_id) { + case PROP_CONFIG_PARAMS: + osinfo_install_config_set_config_params(config, g_value_get_object(value)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +osinfo_install_config_get_property(GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG(object); + + switch (property_id) { + case PROP_CONFIG_PARAMS: + g_value_set_object(value, osinfo_install_config_get_config_params(config)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void +osinfo_install_config_finalize (GObject *object) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG (object); + + if (config->priv->config_params) + g_object_unref(config->priv->config_params); + + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_parent_class)->finalize (object); +} + /* Init functions */ static void osinfo_install_config_class_init (OsinfoInstallConfigClass *klass) { + GObjectClass *g_klass = G_OBJECT_CLASS (klass); + GParamSpec *pspec; + + g_klass->get_property = osinfo_install_config_get_property; + g_klass->set_property = osinfo_install_config_set_property; + g_klass->finalize = osinfo_install_config_finalize; + + pspec = g_param_spec_object("config-params", + "Config Parameters", + _("Valid configuration parameters"), + OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, + PROP_CONFIG_PARAMS, + pspec); + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigPrivate)); } @@ -637,6 +714,22 @@ const gchar *osinfo_install_config_get_post_install_drivers_location(OsinfoInsta OSINFO_INSTALL_CONFIG_PROP_POST_INSTALL_DRIVERS_LOCATION); } +void osinfo_install_config_set_config_params(OsinfoInstallConfig *config, + OsinfoInstallConfigParamList *config_params) +{ + if (config->priv->config_params != NULL) + g_object_unref(config->priv->config_params); + if (config_params != NULL) + config->priv->config_params = g_object_ref(G_OBJECT(config_params)); + else + config->priv->config_params = NULL; +} + +OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInstallConfig *config) +{ + return config->priv->config_params; +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h index d650a0a..89215d1 100644 --- a/osinfo/osinfo_install_config.h +++ b/osinfo/osinfo_install_config.h @@ -22,6 +22,7 @@ */ #include +#include #ifndef __OSINFO_INSTALL_CONFIG_H__ #define __OSINFO_INSTALL_CONFIG_H__ @@ -182,6 +183,7 @@ const gchar *osinfo_install_config_get_avatar_disk(OsinfoInstallConfig *config); void osinfo_install_config_set_pre_install_drivers_disk(OsinfoInstallConfig *config, const gchar *disk); const gchar *osinfo_install_config_get_pre_install_drivers_disk(OsinfoInstallConfig *config); + void osinfo_install_config_set_pre_install_drivers_location(OsinfoInstallConfig *config, const gchar *location); const gchar *osinfo_install_config_get_pre_install_drivers_location(OsinfoInstallConfig *config); @@ -189,10 +191,15 @@ const gchar *osinfo_install_config_get_pre_install_drivers_location(OsinfoInstal void osinfo_install_config_set_post_install_drivers_disk(OsinfoInstallConfig *config, const gchar *disk); const gchar *osinfo_install_config_get_post_install_drivers_disk(OsinfoInstallConfig *config); + void osinfo_install_config_set_post_install_drivers_location(OsinfoInstallConfig *config, 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__ */ /* * Local variables: -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:50 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:50 +0100 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-8-git-send-email-cfergeau@redhat.com> Now that OsinfoInstallConfig has access to the OsinfoInstallConfigParamList for the OsinfoInstallScript that is being configured, we can use the OsinfoDatamap that is optionally set on a given parameter to automatically translate a value for this parameter from a generic libosinfo value to an OS-specific one. --- osinfo/Makefile.am | 1 + osinfo/osinfo_install_config.c | 85 ++++++++++++++++++++++++++++++++++ osinfo/osinfo_install_config_private.h | 38 +++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 osinfo/osinfo_install_config_private.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 9d03a34..9f3c20d 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -116,6 +116,7 @@ libosinfo_1_0_la_SOURCES = \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ + osinfo_install_config_private.h \ osinfo_install_script.c \ osinfo_install_script_private.h \ osinfo_install_scriptlist.c \ diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index 8078f8c..7f75841 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -24,6 +24,7 @@ #include #include +#include "osinfo/osinfo_install_config_private.h" #include G_DEFINE_TYPE (OsinfoInstallConfig, osinfo_install_config, OSINFO_TYPE_ENTITY); @@ -730,6 +731,90 @@ OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInst return config->priv->config_params; } + +static const gchar * +osinfo_install_config_transform_value(OsinfoInstallConfig *config, + const gchar *key, + const gchar *value) +{ + OsinfoDatamap *map; + OsinfoEntity *entity; + OsinfoInstallConfigParam *param; + const gchar *transformed_value; + + if (!config->priv->config_params) + return value; + + entity = osinfo_list_find_by_id(OSINFO_LIST(config->priv->config_params), + key); + if (entity == NULL) { + g_warning("%s is not a known parameter for this config", key); + return value; + } + + param = OSINFO_INSTALL_CONFIG_PARAM(entity);; + map = osinfo_install_config_param_get_value_map(param); + if (map == NULL) { + g_debug("no remapping to be done for %s", key); + return value; + } + transformed_value = osinfo_datamap_lookup(map, value); + if (transformed_value == NULL) { + g_warning("value not present in %s datamap: %s", key, value); + return value; + } + + return transformed_value; +} + +static GHashTable *get_remapped_keys_once(void) +{ + const char *remapped_properties[] = { + OSINFO_INSTALL_CONFIG_PROP_HARDWARE_ARCH, + OSINFO_INSTALL_CONFIG_PROP_L10N_KEYBOARD, + OSINFO_INSTALL_CONFIG_PROP_L10N_LANGUAGE, + OSINFO_INSTALL_CONFIG_PROP_L10N_TIMEZONE, + NULL + }; + const char **it; + GHashTable *remapped_keys; + + remapped_keys = g_hash_table_new(g_str_hash, g_str_equal); + for (it = remapped_properties; *it != NULL; it++) { + g_hash_table_add(remapped_keys, (gpointer)*it); + } + + return remapped_keys; +} + +GList * +osinfo_install_config_get_param_value_list(OsinfoInstallConfig *config, + const gchar *key) +{ + GList *values; + GList *it; + static GOnce remapped_keys_once = G_ONCE_INIT; + GHashTable *remapped_keys; + + values = osinfo_entity_get_param_value_list(OSINFO_ENTITY(config), key); + if (values == NULL) + return NULL; + + remapped_keys = g_once(&remapped_keys_once, + (GThreadFunc)get_remapped_keys_once, + NULL); + if (!g_hash_table_contains(remapped_keys, key)) + return values; + + for (it = values; it != NULL; it = it->next) { + it->data = (gpointer)osinfo_install_config_transform_value(config, + key, + it->data); + } + + return values; +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h new file mode 100644 index 0000000..e08f863 --- /dev/null +++ b/osinfo/osinfo_install_config_private.h @@ -0,0 +1,38 @@ +/* + * libosinfo: OS installation config + * + * Copyright (C) 2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Christophe Fergeau + */ + +#include + +#ifndef __OSINFO_INSTALL_CONFIG_PRIVATE_H__ +#define __OSINFO_INSTALL_CONFIG_PRIVATE_H__ + +GList *osinfo_install_config_get_param_value_list(OsinfoInstallConfig *config, const gchar *key); + +#endif /* __OSINFO_INSTALL_CONFIG_PRIVATE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:51 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:51 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-9-git-send-email-cfergeau@redhat.com> When generating the unattended installation script, we can now use osinfo_install_config_get_param_list() to get OS-specific values when available. This will only work when an OsinfoInstallConfigParamList is associated with the OsinfoInstallConfig being processed. --- osinfo/osinfo_install_script.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index d72c394..8dbef9e 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -30,6 +30,7 @@ #include #include #include +#include "osinfo_install_config_private.h" #include "osinfo_install_script_private.h" G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); @@ -604,6 +605,7 @@ 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) { @@ -635,9 +637,15 @@ static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConf tmp1 = keys = osinfo_entity_get_param_keys(entity); while (tmp1) { - GList *values = osinfo_entity_get_param_value_list(entity, tmp1->data); - GList *tmp2 = values; + GList *values; + GList *tmp2; + if (is_install_config) + 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); + + tmp2 = values; while (tmp2) { if (!(data = xmlNewDocNode(NULL, NULL, (const xmlChar*)tmp1->data, (const xmlChar*)tmp2->data))) { @@ -687,6 +695,7 @@ 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; @@ -698,6 +707,7 @@ 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; @@ -709,6 +719,7 @@ 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; -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:52 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:52 +0100 Subject: [Libosinfo] [PATCHv4 09/11] Add osinfo_install_config_new_for_script In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-10-git-send-email-cfergeau@redhat.com> 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 + /* 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 From cfergeau at redhat.com Mon Dec 17 21:07:53 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:53 +0100 Subject: [Libosinfo] [PATCHv4 10/11] Set OsinfoInstallConfig:config-params in osinfo_install_script_apply_template In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-11-git-send-email-cfergeau@redhat.com> This allows translation of generic config to OS-specific config if the install script XML specified some datamaps to transform these parameters. --- osinfo/osinfo_install_script.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 8dbef9e..e106eca 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -768,6 +768,33 @@ static gchar *osinfo_install_script_apply_xslt(xsltStylesheetPtr ss, } +static OsinfoInstallConfig *create_config_for_script(OsinfoInstallScript *script, OsinfoInstallConfig *config) +{ + OsinfoInstallConfig *os_config; + GList *params; + GList *param; + const gchar *id; + + id = osinfo_entity_get_id(OSINFO_ENTITY(config)); + os_config = osinfo_install_config_new_for_script(id, script); + params = osinfo_entity_get_param_keys(OSINFO_ENTITY(config)); + for (param = params; param != NULL; param = param->next) { + GList *values; + GList *value; + + osinfo_entity_clear_param(OSINFO_ENTITY(os_config), param->data); + values = osinfo_entity_get_param_value_list(OSINFO_ENTITY(config), param->data); + for (value = values; value != NULL; value = value->next) { + osinfo_entity_add_param(OSINFO_ENTITY(os_config), param->data, value->data); + } + g_list_free(values); + } + g_list_free(params); + + return os_config; +} + + static gboolean osinfo_install_script_apply_template(OsinfoInstallScript *script, OsinfoOs *os, const gchar *templateUri, @@ -777,8 +804,10 @@ static gboolean osinfo_install_script_apply_template(OsinfoInstallScript *script GError **error) { gboolean ret = FALSE; + OsinfoInstallConfig *os_config = create_config_for_script(script, config); xsltStylesheetPtr templateXsl = osinfo_install_script_load_template(templateUri, template, error); - xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, config, error); + xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, os_config, error); + g_object_unref(G_OBJECT(os_config)); if (!templateXsl || !configXml) goto cleanup; -- 1.8.0.2 From cfergeau at redhat.com Mon Dec 17 21:07:54 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 17 Dec 2012 22:07:54 +0100 Subject: [Libosinfo] [PATCHv4 11/11] test: Add test for param remapping in install scripts In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355778474-9513-12-git-send-email-cfergeau@redhat.com> --- test/dbdata/datamaps/test-datamap.xml | 20 ++++++ .../dbdata/install-scripts/test-install-script.xml | 26 +++++++ test/test-install-script.c | 84 ++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 test/dbdata/datamaps/test-datamap.xml create mode 100644 test/dbdata/install-scripts/test-install-script.xml diff --git a/test/dbdata/datamaps/test-datamap.xml b/test/dbdata/datamaps/test-datamap.xml new file mode 100644 index 0000000..16c5116 --- /dev/null +++ b/test/dbdata/datamaps/test-datamap.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/test/dbdata/install-scripts/test-install-script.xml b/test/dbdata/install-scripts/test-install-script.xml new file mode 100644 index 0000000..48469ef --- /dev/null +++ b/test/dbdata/install-scripts/test-install-script.xml @@ -0,0 +1,26 @@ + + + + jeos + test.ks + + + + + + + + diff --git a/test/test-install-script.c b/test/test-install-script.c index 6abeeb3..4a3f16a 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -56,6 +56,12 @@ static const gchar *expectData = \ "%end\n" \ " "; +static const gchar *expectData2 = \ + "\n" \ + "keyboard FOOBAR\n" \ + "lang French\n" \ + "timezone --utc Europe/Paris"; + static void test_generate_finish(GObject *src, GAsyncResult *res, gpointer user_data) @@ -172,6 +178,83 @@ START_TEST(test_script_data) } END_TEST +START_TEST(test_script_datamap) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + OsinfoOs *os; + OsinfoInstallScript *script; + OsinfoInstallConfig *config; + GMainLoop *loop; + + osinfo_loader_process_path(loader, SRCDIR "/test/dbdata", &error); + fail_unless(error == NULL, error ? error->message : "none"); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + fail_unless(osinfo_db_get_datamap(db, "http://example.com/libosinfo/test-datamap") != NULL, "Could not find OsinfoDatamap 'test-datamap'"); + fail_unless(osinfo_db_get_datamap(db, "http://example.com/libosinfo/test-datamap2") != NULL, "Could not find OsinfoDatamap 'test-datamap2'"); + script = osinfo_db_get_install_script(db, "http://example.com/libosinfo/test-install-script"); + fail_unless(script != NULL, "Could not find OsinfoInstallScript 'test-install-script'"); + + config = osinfo_install_config_new("http://example.com"); + + osinfo_install_config_set_l10n_keyboard(config, "unknown"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "unknown") == 0, + "Got %s instead of 'unknown'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val1"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val1") == 0, + "Got %s instead of 'val1'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val2"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val2") == 0, + "Got %s instead of 'val2'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val3"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val3") == 0, + "Got %s instead of 'val3'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "VAL1"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "VAL1") == 0, + "Got %s instead of 'VAL1", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_language(config, "en_EN"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_language(config), "en_EN") == 0, + "Got %s instead of 'en_EN'", osinfo_install_config_get_l10n_language(config)); + osinfo_install_config_set_l10n_language(config, "fr_FR"); + osinfo_install_config_set_l10n_timezone(config, "Europe/Paris"); + + + os = osinfo_os_new("http://fedoraproject.org/fedora/16"); + osinfo_entity_set_param(OSINFO_ENTITY(os), + OSINFO_PRODUCT_PROP_SHORT_ID, + "fedora16"); + + loop = g_main_loop_new (g_main_context_get_thread_default (), + TRUE); + + osinfo_install_script_generate_async(script, + os, + config, + NULL, + test_generate_finish, + loop); + + if (g_main_loop_is_running(loop)) + g_main_loop_run(loop); + + unlink(BUILDDIR "/test/install-script-actual.txt"); + fail_unless(error == NULL, error ? error->message : "none"); + + fail_unless(strcmp(actualData, expectData2) == 0, "Actual '%s' match expect '%s'", + actualData, expectData2); + + g_object_unref(db); + g_object_unref(os); + g_object_unref(config); +} +END_TEST static Suite * @@ -183,6 +266,7 @@ list_suite(void) tcase_add_test(tc, test_script_file); tcase_add_test(tc, test_script_data); + tcase_add_test(tc, test_script_datamap); suite_add_tcase(s, tc); return s; } -- 1.8.0.2 From zeeshanak at gnome.org Tue Dec 18 01:08:29 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:08:29 +0200 Subject: [Libosinfo] [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML In-Reply-To: <1355778474-9513-3-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-3-git-send-email-cfergeau@redhat.com> Message-ID: On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau wrote: > --- > 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 @@ > > > > + > + > + > > > > 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); Its probably just me being blind but I can't find this osinfo_loader_get_datamap() being defined in this or the only previous patch in this series. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:13:29 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:13:29 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <1355778474-9513-7-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> Message-ID: On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau wrote: > This property lists the parameters that can be set for a given > OsinfoInstallConfig. This is not enforced, it's only there for > informative purpose. This will also be used in later commits > in order to automatically apply transformations on values > for parameters which have an associated OsinfoDatamap. Since there is already a very similar property in OsinfoInstallScript, I'm afraid this will cause confusion for app developers. Is there no way we can achieve the same goals through the existing API? -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:31:51 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:31:51 +0200 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: <1355778474-9513-8-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> Message-ID: On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau wrote: > Now that OsinfoInstallConfig has access to the > OsinfoInstallConfigParamList for the OsinfoInstallScript that is > being configured, In the previous patch (06/11) you just added the setter/getter for config params to OsinfoInstallConfig but nothing yet sets the params. Either I'm totally confused or the ordering of these patches is somehow wrong. > we can use the OsinfoDatamap that is optionally > set on a given parameter to automatically translate a value for > this parameter from a generic libosinfo value to an OS-specific one. Assuming config params in OsinfoInstallScript has (or can has) access to datamaps, I wonder if there is any need to involve OsinfoInstallConfig at all here. The changes will be less intrusive that way AFAICT. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:35:55 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:35:55 +0200 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <1355778474-9513-9-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> Message-ID: On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau wrote: > When generating the unattended installation script, we can now > use osinfo_install_config_get_param_list() to get OS-specific > values when available. This will only work when an > OsinfoInstallConfigParamList is associated with the > OsinfoInstallConfig being processed. > --- > osinfo/osinfo_install_script.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > index d72c394..8dbef9e 100644 > --- a/osinfo/osinfo_install_script.c > +++ b/osinfo/osinfo_install_script.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include "osinfo_install_config_private.h" > #include "osinfo_install_script_private.h" > > G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); > @@ -604,6 +605,7 @@ 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) We don't need a boolean parameter for finding out the type of entity. :) There is OSINFO_IS_INSTALL_CONFIG() or you can check if name=="config". -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:42:17 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:42:17 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> Message-ID: On Tue, Dec 18, 2012 at 3:13 AM, Zeeshan Ali (Khattak) wrote: > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > wrote: >> This property lists the parameters that can be set for a given >> OsinfoInstallConfig. This is not enforced, it's only there for >> informative purpose. This will also be used in later commits >> in order to automatically apply transformations on values >> for parameters which have an associated OsinfoDatamap. > > Since there is already a very similar property in OsinfoInstallScript, > I'm afraid this will cause confusion for app developers. Is there no > way we can achieve the same goals through the existing API? Later commits clarifies things quite a bit so take that comment as: Perhaps this should be internal API? -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:45:51 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:45:51 +0200 Subject: [Libosinfo] [PATCHv4] datamap support In-Reply-To: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> Message-ID: On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau wrote: > Hey, > > Here is another iteration of the datamap support patches. There are not > many big changes before patch 07/11. I took a different approach from the > previous series in that the values are only transformed when calling > the appropriate getter. This has the side effect of making the code > less complex, of making the implementation of the cloning function in > patch 10/11 easier, ... This also makes it easier to support modifications > of the OsinfoInstallConfig:config-params properties during the life > time of the OsinfoInstallConfig objects. And in turn, this makes > it easier to not force applications to use a new constructor, which would > be an ABI break. Apart from the minor issues I pointed out, it looks pretty good already. Thanks for the hard work on this and taking my suggestions/criticism very seriously. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 01:43:30 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 03:43:30 +0200 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> Message-ID: On Tue, Dec 18, 2012 at 3:31 AM, Zeeshan Ali (Khattak) wrote: > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > wrote: >> Now that OsinfoInstallConfig has access to the >> OsinfoInstallConfigParamList for the OsinfoInstallScript that is >> being configured, > > In the previous patch (06/11) you just added the setter/getter for > config params to OsinfoInstallConfig but nothing yet sets the params. > Either I'm totally confused or the ordering of these patches is > somehow wrong. > >> we can use the OsinfoDatamap that is optionally >> set on a given parameter to automatically translate a value for >> this parameter from a generic libosinfo value to an OS-specific one. > > Assuming config params in OsinfoInstallScript has (or can has) access > to datamaps, I wonder if there is any need to involve > OsinfoInstallConfig at all here. The changes will be less intrusive > that way AFAICT. Ignore this comment completely please. I should have seen the whole series before commenting. :( -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Tue Dec 18 09:50:21 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 10:50:21 +0100 Subject: [Libosinfo] [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-3-git-send-email-cfergeau@redhat.com> Message-ID: <20121218095021.GF2054@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 03:08:29AM +0200, Zeeshan Ali (Khattak) wrote: > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > wrote: > > --- > > 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 @@ > > > > > > > > + > > + > > + > > > > > > > > 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); > > Its probably just me being blind but I can't find this > osinfo_loader_get_datamap() being defined in this or the only previous > patch in this series. It's already in git master as of c983335d82c: commit c983335d82cb3b9915be7bc28c784d9526679b77 Author: Christophe Fergeau Date: Fri Dec 7 13:01:26 2012 +0100 loader: Load datamaps Install scripts can add a 'datamap' attribute when they declare their config parameters. The value of this attribute is the ID of a datamap, which is an XML file containing key/value pairs: inval="generic-val2" outval="bar"/> This commit adds support for loading these datamaps. The next patches will then make use of these datamaps when the libosinfo user set a value for the corresponding config parameter. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 09:53:34 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 10:53:34 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> Message-ID: <20121218095334.GG2054@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 03:42:17AM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 3:13 AM, Zeeshan Ali (Khattak) > wrote: > > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > > wrote: > >> This property lists the parameters that can be set for a given > >> OsinfoInstallConfig. This is not enforced, it's only there for > >> informative purpose. This will also be used in later commits > >> in order to automatically apply transformations on values > >> for parameters which have an associated OsinfoDatamap. > > > > Since there is already a very similar property in OsinfoInstallScript, > > I'm afraid this will cause confusion for app developers. Is there no > > way we can achieve the same goals through the existing API? > > Later commits clarifies things quite a bit so take that comment as: > Perhaps this should be internal API? I assume you are talking about osinfo_install_config_get_config_params and osinfo_install_config_set_config_params as the GObject property can't really be made private? I _think_ this API could be useful as a public API, but I'm fine with making it private for now and exporting it when we see a real need for it. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 10:03:24 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 11:03:24 +0100 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> Message-ID: <20121218100324.GH2054@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 03:31:51AM +0200, Zeeshan Ali (Khattak) wrote: > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > wrote: > > Now that OsinfoInstallConfig has access to the > > OsinfoInstallConfigParamList for the OsinfoInstallScript that is > > being configured, > > In the previous patch (06/11) you just added the setter/getter for > config params to OsinfoInstallConfig but nothing yet sets the params. > Either I'm totally confused or the ordering of these patches is > somehow wrong. Let's blame the commit log here, what the series is doing is 1) add the OsinfoInstallConfig:config-parameters property 2) use it in OsinfoInstallConfig _if it is set_ 3) use OS specific values in OsinfoInstallScript 4) set OsinfoInstallConfig:config-parameters where needed This commit is doing 2) even though the commit log can be misleading. I can see 3) being misplaced, it could go last, but apart from this I think the ordering is not that bad. > > we can use the OsinfoDatamap that is optionally > > set on a given parameter to automatically translate a value for > > this parameter from a generic libosinfo value to an OS-specific one. > > Assuming config params in OsinfoInstallScript has (or can has) access > to datamaps, I wonder if there is any need to involve > OsinfoInstallConfig at all here. The changes will be less intrusive > that way AFAICT. I've seen your followup to this email saying to disregard this comment. For what it's worth, I've already detailed in https://www.redhat.com/archives/virt-tools-list/2012-December/msg00288.html why I think adding config params to OsinfoInstallConfig is a good move regardless of the datamaps stuff. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 10:05:06 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 11:05:06 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> Message-ID: <20121218100505.GI2054@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 03:35:55AM +0200, Zeeshan Ali (Khattak) wrote: > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > wrote: > > When generating the unattended installation script, we can now > > use osinfo_install_config_get_param_list() to get OS-specific > > values when available. This will only work when an > > OsinfoInstallConfigParamList is associated with the > > OsinfoInstallConfig being processed. > > --- > > osinfo/osinfo_install_script.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > > index d72c394..8dbef9e 100644 > > --- a/osinfo/osinfo_install_script.c > > +++ b/osinfo/osinfo_install_script.c > > @@ -30,6 +30,7 @@ > > #include > > #include > > #include > > +#include "osinfo_install_config_private.h" > > #include "osinfo_install_script_private.h" > > > > G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); > > @@ -604,6 +605,7 @@ 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) > > We don't need a boolean parameter for finding out the type of entity. > :) There is OSINFO_IS_INSTALL_CONFIG() or you can check if > name=="config". Yup, I've thought of both, we can also do if (config == entity) {}, but I preferred to go the explicit way since the caller knows what it wants us to do. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 10:29:06 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 11:29:06 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121218095334.GG2054@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> Message-ID: <20121218102905.GA5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 10:53:34AM +0100, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 03:42:17AM +0200, Zeeshan Ali (Khattak) wrote: > > On Tue, Dec 18, 2012 at 3:13 AM, Zeeshan Ali (Khattak) > > wrote: > > > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > > > wrote: > > >> This property lists the parameters that can be set for a given > > >> OsinfoInstallConfig. This is not enforced, it's only there for > > >> informative purpose. This will also be used in later commits > > >> in order to automatically apply transformations on values > > >> for parameters which have an associated OsinfoDatamap. > > > > > > Since there is already a very similar property in OsinfoInstallScript, > > > I'm afraid this will cause confusion for app developers. Is there no > > > way we can achieve the same goals through the existing API? > > > > Later commits clarifies things quite a bit so take that comment as: > > Perhaps this should be internal API? > > I assume you are talking about osinfo_install_config_get_config_params > and osinfo_install_config_set_config_params as the GObject property can't > really be made private? I _think_ this API could be useful as a public API, > but I'm fine with making it private for now and exporting it when we see a > real need for it. Thinking a bit more about this, if we make these private then it's better to make osinfo_install_config_new_for_script public and to advocate using it instead of osinfo_install_config_new, otherwise it's pretty weird to have this config-params property which will always be NULL as far as the library user can see. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 10:49:00 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 11:49:00 +0100 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: <20121218100324.GH2054@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> <20121218100324.GH2054@teriyaki.redhat.com> Message-ID: <20121218104900.GB5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 11:03:24AM +0100, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 03:31:51AM +0200, Zeeshan Ali (Khattak) wrote: > > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > > wrote: > > > Now that OsinfoInstallConfig has access to the > > > OsinfoInstallConfigParamList for the OsinfoInstallScript that is > > > being configured, > > > > In the previous patch (06/11) you just added the setter/getter for > > config params to OsinfoInstallConfig but nothing yet sets the params. > > Either I'm totally confused or the ordering of these patches is > > somehow wrong. > > Let's blame the commit log here With the log changed to: OsinfoInstallConfig: Use config-params if set Now that OsinfoInstallConfig has a 'config-params' property which describes the config parameters when it's set, we can use it when it's available. OsinfoInstallConfigParams can indeed contain a datamap to be used to translate generic libosinfo values to OS-specific values. This commit introduces an osinfo_install_config_get_param_value_list method that will be used in subsequent commits to get these OS-specific values when generating install scripts. does the patch looks better and in the right place? Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 11:01:16 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 12:01:16 +0100 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: <20121218100324.GH2054@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> <20121218100324.GH2054@teriyaki.redhat.com> Message-ID: <20121218110116.GC5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 11:03:24AM +0100, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 03:31:51AM +0200, Zeeshan Ali (Khattak) wrote: > > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau > > wrote: > > > Now that OsinfoInstallConfig has access to the > > > OsinfoInstallConfigParamList for the OsinfoInstallScript that is > > > being configured, > > > > In the previous patch (06/11) you just added the setter/getter for > > config params to OsinfoInstallConfig but nothing yet sets the params. > > Either I'm totally confused or the ordering of these patches is > > somehow wrong. > > Let's blame the commit log here, what the series is doing is > 1) add the OsinfoInstallConfig:config-parameters property > 2) use it in OsinfoInstallConfig _if it is set_ > 3) use OS specific values in OsinfoInstallScript > 4) set OsinfoInstallConfig:config-parameters where needed > > This commit is doing 2) even though the commit log can be misleading. > I can see 3) being misplaced, it could go last, but apart from this I think > the ordering is not that bad. After rewording the commit log, I've done a bit of reordering, it's now: commit bce1a8dd0ecf9dfdf3ed1c70da183da618dadb12 Author: Christophe Fergeau Date: Thu Dec 6 22:46:35 2012 +0100 Add OsinfoInstallConfig:config-params property This property lists the parameters that can be set for a given OsinfoInstallConfig. This is not enforced, it's only there for informative purpose. This will also be used in later commits in order to automatically apply transformations on values for parameters which have an associated OsinfoDatamap. commit 983f15d436e6fcc41c2db9749c1ebc43367463a7 Author: Christophe Fergeau Date: Fri Dec 7 12:31:39 2012 +0100 OsinfoInstallConfig: Use config-params if set Now that OsinfoInstallConfig has a 'config-params' property which describes the config parameters when it's set, we can use it when it's available. OsinfoInstallConfigParams can indeed contain a datamap to be used to translate generic libosinfo values to OS-specific values. This commit introduces an osinfo_install_config_get_param_value_list method that will be used in subsequent commits to get these OS-specific values when generating install scripts. commit bb5a22a02b606026bf97f6d89c4f088e76c70faa Author: Christophe Fergeau Date: Thu Dec 6 21:18:45 2012 +0100 Add osinfo_install_config_new_for_script 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. commit d663f67b7ece1d5823e2e2a11f886281d5c7cb2c Author: Christophe Fergeau Date: Fri Dec 14 19:03:31 2012 +0100 Set OsinfoInstallConfig:config-params in osinfo_install_script_apply_template This allows translation of generic config to OS-specific config if the install script XML specified some datamaps to transform these parameters. commit b9591db34db3eea540dc28b132fb8a53885e3e05 Author: Christophe Fergeau Date: Mon Dec 17 20:47:34 2012 +0100 Use OS-specific config in OsinfoInstallScript When generating the unattended installation script, we can now use osinfo_install_config_get_param_list() to get OS-specific values when available. This will only work when an OsinfoInstallConfigParamList is associated with the OsinfoInstallConfig being processed. (see http://cgit.freedesktop.org/~teuf/libosinfo/log/?h=datamap) Does it look better this way? Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 14:45:15 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 16:45:15 +0200 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <20121218100505.GI2054@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 03:35:55AM +0200, Zeeshan Ali (Khattak) wrote: >> On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau >> wrote: >> > When generating the unattended installation script, we can now >> > use osinfo_install_config_get_param_list() to get OS-specific >> > values when available. This will only work when an >> > OsinfoInstallConfigParamList is associated with the >> > OsinfoInstallConfig being processed. >> > --- >> > osinfo/osinfo_install_script.c | 15 +++++++++++++-- >> > 1 file changed, 13 insertions(+), 2 deletions(-) >> > >> > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c >> > index d72c394..8dbef9e 100644 >> > --- a/osinfo/osinfo_install_script.c >> > +++ b/osinfo/osinfo_install_script.c >> > @@ -30,6 +30,7 @@ >> > #include >> > #include >> > #include >> > +#include "osinfo_install_config_private.h" >> > #include "osinfo_install_script_private.h" >> > >> > G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); >> > @@ -604,6 +605,7 @@ 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) >> >> We don't need a boolean parameter for finding out the type of entity. >> :) There is OSINFO_IS_INSTALL_CONFIG() or you can check if >> name=="config". > > Yup, I've thought of both, we can also do if (config == entity) {}, but I > preferred to go the explicit way since the caller knows what it wants us to > do. Caller knows what it is passing and callee has easy ways to find out the type so why would you need this extra parameter? You are not making anything more explicit either in the caller or callee functions. Sorry but this just looks very clumsy. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 14:48:27 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 16:48:27 +0200 Subject: [Libosinfo] Fwd: [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> Message-ID: Hit 'reply' instead of 'reply-all'. :( ---------- Forwarded message ---------- From: Zeeshan Ali (Khattak) Date: Tue, Dec 18, 2012 at 4:47 PM Subject: Re: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property To: Christophe Fergeau On Tue, Dec 18, 2012 at 12:29 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 10:53:34AM +0100, Christophe Fergeau wrote: >> On Tue, Dec 18, 2012 at 03:42:17AM +0200, Zeeshan Ali (Khattak) wrote: >> > On Tue, Dec 18, 2012 at 3:13 AM, Zeeshan Ali (Khattak) >> > wrote: >> > > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau >> > > wrote: >> > >> This property lists the parameters that can be set for a given >> > >> OsinfoInstallConfig. This is not enforced, it's only there for >> > >> informative purpose. This will also be used in later commits >> > >> in order to automatically apply transformations on values >> > >> for parameters which have an associated OsinfoDatamap. >> > > >> > > Since there is already a very similar property in OsinfoInstallScript, >> > > I'm afraid this will cause confusion for app developers. Is there no >> > > way we can achieve the same goals through the existing API? >> > >> > Later commits clarifies things quite a bit so take that comment as: >> > Perhaps this should be internal API? >> >> I assume you are talking about osinfo_install_config_get_config_params >> and osinfo_install_config_set_config_params as the GObject property can't >> really be made private? I _think_ this API could be useful as a public API, >> but I'm fine with making it private for now and exporting it when we see a >> real need for it. > > Thinking a bit more about this, if we make these private then it's better > to make osinfo_install_config_new_for_script public and to advocate using > it instead of osinfo_install_config_new, otherwise it's pretty weird to > have this config-params property which will always be NULL as far as > the library user can see. Or we don't expose config-params as property? We can just have the getter/setter for now. Also, wasn't there a way to make properties private? -- Regards, Zeeshan Ali (Khattak) FSF member#5124 -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 14:57:09 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 16:57:09 +0200 Subject: [Libosinfo] [PATCHv4 07/11] Automatically remap OsinfoInstallConfig values if needed In-Reply-To: <20121218110116.GC5336@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-8-git-send-email-cfergeau@redhat.com> <20121218100324.GH2054@teriyaki.redhat.com> <20121218110116.GC5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 1:01 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 11:03:24AM +0100, Christophe Fergeau wrote: >> On Tue, Dec 18, 2012 at 03:31:51AM +0200, Zeeshan Ali (Khattak) wrote: >> > On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau >> > wrote: >> > > Now that OsinfoInstallConfig has access to the >> > > OsinfoInstallConfigParamList for the OsinfoInstallScript that is >> > > being configured, >> > >> > In the previous patch (06/11) you just added the setter/getter for >> > config params to OsinfoInstallConfig but nothing yet sets the params. >> > Either I'm totally confused or the ordering of these patches is >> > somehow wrong. >> >> Let's blame the commit log here, what the series is doing is >> 1) add the OsinfoInstallConfig:config-parameters property >> 2) use it in OsinfoInstallConfig _if it is set_ >> 3) use OS specific values in OsinfoInstallScript >> 4) set OsinfoInstallConfig:config-parameters where needed >> >> This commit is doing 2) even though the commit log can be misleading. >> I can see 3) being misplaced, it could go last, but apart from this I think >> the ordering is not that bad. > > After rewording the commit log, I've done a bit of reordering, it's now: > > > commit bce1a8dd0ecf9dfdf3ed1c70da183da618dadb12 > Author: Christophe Fergeau > Date: Thu Dec 6 22:46:35 2012 +0100 > > Add OsinfoInstallConfig:config-params property > > This property lists the parameters that can be set for a given > OsinfoInstallConfig. This is not enforced, it's only there for > informative purpose. This will also be used in later commits > in order to automatically apply transformations on values > for parameters which have an associated OsinfoDatamap. > > commit 983f15d436e6fcc41c2db9749c1ebc43367463a7 > Author: Christophe Fergeau > Date: Fri Dec 7 12:31:39 2012 +0100 > > OsinfoInstallConfig: Use config-params if set > > Now that OsinfoInstallConfig has a 'config-params' property > which describes the config parameters when it's set, we can > use it when it's available. OsinfoInstallConfigParams can indeed > contain a datamap to be used to translate generic libosinfo values > to OS-specific values. > This commit introduces an osinfo_install_config_get_param_value_list > method that will be used in subsequent commits to get these > OS-specific values when generating install scripts. > > commit bb5a22a02b606026bf97f6d89c4f088e76c70faa > Author: Christophe Fergeau > Date: Thu Dec 6 21:18:45 2012 +0100 > > Add osinfo_install_config_new_for_script > > 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. > > commit d663f67b7ece1d5823e2e2a11f886281d5c7cb2c > Author: Christophe Fergeau > Date: Fri Dec 14 19:03:31 2012 +0100 > > Set OsinfoInstallConfig:config-params in > osinfo_install_script_apply_template > > This allows translation of generic config to OS-specific config if > the install script XML specified some datamaps to transform these > parameters. > > commit b9591db34db3eea540dc28b132fb8a53885e3e05 > Author: Christophe Fergeau > Date: Mon Dec 17 20:47:34 2012 +0100 > > Use OS-specific config in OsinfoInstallScript > > When generating the unattended installation script, we can now > use osinfo_install_config_get_param_list() to get OS-specific > values when available. This will only work when an > OsinfoInstallConfigParamList is associated with the > OsinfoInstallConfig being processed. > > (see http://cgit.freedesktop.org/~teuf/libosinfo/log/?h=datamap) > > Does it look better this way? Yeah, it looks good. Not that it wasn't good already. Only the commit log needed some adjusting and I didn't know that one of the needed change is already in git master. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 15:17:11 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 17:17:11 +0200 Subject: [Libosinfo] [PATCH] win7,xp: Version driver location Message-ID: <1355843831-550-1-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" This is so that apps can differentiate between different versions of drivers. --- data/oses/windows.xml.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/oses/windows.xml.in b/data/oses/windows.xml.in index 310de62..4db2dea 100644 --- a/data/oses/windows.xml.in +++ b/data/oses/windows.xml.in @@ -383,7 +383,7 @@ - + viostor.cat viostor.inf viostor.sys @@ -392,7 +392,7 @@ - + viostor.cat viostor.inf viostor.sys @@ -754,14 +754,14 @@ - + viostor.cat viostor.inf viostor.sys - + viostor.cat viostor.inf viostor.sys -- 1.8.0.2 From cfergeau at redhat.com Tue Dec 18 16:19:31 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 17:19:31 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> Message-ID: <20121218161930.GH5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 04:45:15PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau > wrote: > > Yup, I've thought of both, we can also do if (config == entity) {}, but I > > preferred to go the explicit way since the caller knows what it wants us to > > do. > > Caller knows what it is passing and callee has easy ways to find out > the type so why would you need this extra parameter? You are not > making anything more explicit either in the caller or callee > functions. Sorry but this just looks very clumsy. Callee has an easy way to _guess_ how it was called by harcoding checks for something that is true the way the code is _now_, this assumption could easily break with some future changes. I'm fine with changing to a runtime type check, but I don't see this as an improvement, just clumsy in a different way. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 16:43:08 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 17:43:08 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> Message-ID: <20121218164226.GI5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 04:47:53PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 12:29 PM, Christophe Fergeau > wrote: > > Thinking a bit more about this, if we make these private then it's better > > to make osinfo_install_config_new_for_script public and to advocate using > > it instead of osinfo_install_config_new, otherwise it's pretty weird to > > have this config-params property which will always be NULL as far as > > the library user can see. > > Or we don't expose config-params as property? We can just have the > getter/setter for now. Also, wasn't there a way to make properties > private? As said that email I linked to, I think the config-params property is useful to have on an OsinfoInstallConfig object to be able to answer questions such as 'which properties should I set on this object?'. Currently in order to know that, you need to query the OsinfoInstallScript that you are going to use, which is weird and inconvenient imo. Basically there are 2 competing approaches: - OsinfoInstallConfig is just a simple wrapper on top of OsinfoEntity and has dedicated getters/setters for various properties that make sense for an OS installation script. However, only OsinfoInstallScript knows which parameters are needed, what their value is, ... and you have to use this for any validation/transformation/... you want to apply to these config values - the second approach is to make OsinfoInstallConfig something more sophisticated which knows more about the paramaters it's holding, what they should be, the restrictions on their values, how to transform them, ... In my opinion, the second approach is more convenient both for the library user and for us from a maintainance point of view, which explains my insistance on moving this way ;) Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 17:09:06 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 19:09:06 +0200 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <20121218161930.GH5336@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> <20121218161930.GH5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 6:19 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 04:45:15PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau >> wrote: >> > Yup, I've thought of both, we can also do if (config == entity) {}, but I >> > preferred to go the explicit way since the caller knows what it wants us to >> > do. >> >> Caller knows what it is passing and callee has easy ways to find out >> the type so why would you need this extra parameter? You are not >> making anything more explicit either in the caller or callee >> functions. Sorry but this just looks very clumsy. > > Callee has an easy way to _guess_ how it was called by harcoding checks for > something that is true the way the code is _now_, this assumption could > easily break with some future changes. I don't see how and where is the hardcoding? If in future Config instance is not passed, the passed param will never be TRUE. In the absence of that param, everything will work in the same way. > I'm fine with changing to a runtime > type check, but I don't see this as an improvement, just clumsy in a > different way. You need to check the type and you use a macro that is provided for exactly that purpose. There is nothing clumsy about that. Whereas what you are doing is something I haven't seen before. The ideal case would be to not have to check the type at all but rather have a specialized function for dealing with Config entities. You can do it that way too. I have suggestion for even better solution but that would mean more work that we can live without (for now). -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Tue Dec 18 17:17:24 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 18:17:24 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> <20121218161930.GH5336@teriyaki.redhat.com> Message-ID: <20121218171723.GJ5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 07:09:06PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 6:19 PM, Christophe Fergeau wrote: > > On Tue, Dec 18, 2012 at 04:45:15PM +0200, Zeeshan Ali (Khattak) wrote: > >> On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau > >> wrote: > >> > Yup, I've thought of both, we can also do if (config == entity) {}, but I > >> > preferred to go the explicit way since the caller knows what it wants us to > >> > do. > >> > >> Caller knows what it is passing and callee has easy ways to find out > >> the type so why would you need this extra parameter? You are not > >> making anything more explicit either in the caller or callee > >> functions. Sorry but this just looks very clumsy. > > > > Callee has an easy way to _guess_ how it was called by harcoding checks for > > something that is true the way the code is _now_, this assumption could > > easily break with some future changes. > > I don't see how and where is the hardcoding? If in future Config > instance is not passed, the passed param will never be TRUE. In the > absence of that param, everything will work in the same way. We are hardcoding the fact that we want to transform parameters values for all OsinfoInstallConfig instances that are passed to this function, which may or may not be true depending on how this code evolves. Anyway, changed already. > > I'm fine with changing to a runtime > > type check, but I don't see this as an improvement, just clumsy in a > > different way. > > You need to check the type and you use a macro that is provided for > exactly that purpose. There is nothing clumsy about that. Whereas what > you are doing is something I haven't seen before. I don't really want to check the type, I want to know if I should try to transform the values or not. Agreed, the variable was badly named for what I had in mind with this check. > I have suggestion for even better solution but that would mean more > work that we can live without (for now). Well, that's still interesting even if we don't do it.. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 17:18:04 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 19:18:04 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121218164226.GI5336@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 6:43 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 04:47:53PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 12:29 PM, Christophe Fergeau >> wrote: >> > Thinking a bit more about this, if we make these private then it's better >> > to make osinfo_install_config_new_for_script public and to advocate using >> > it instead of osinfo_install_config_new, otherwise it's pretty weird to >> > have this config-params property which will always be NULL as far as >> > the library user can see. >> >> Or we don't expose config-params as property? We can just have the >> getter/setter for now. Also, wasn't there a way to make properties >> private? > > As said that email I linked to, I think the config-params property is > useful to have on an OsinfoInstallConfig object to be able to answer > questions such as 'which properties should I set on this object?'. > Currently in order to know that, you need to query the OsinfoInstallScript > that you are going to use, which is weird and inconvenient imo. > Basically there are 2 competing approaches: > - OsinfoInstallConfig is just a simple wrapper on top of OsinfoEntity and > has dedicated getters/setters for various properties that make sense for > an OS installation script. However, only OsinfoInstallScript knows which > parameters are needed, what their value is, ... and you have to use this > for any validation/transformation/... you want to apply to these config > values > - the second approach is to make OsinfoInstallConfig something more > sophisticated which knows more about the paramaters it's holding, what > they should be, the restrictions on their values, how to transform them, > ... > > In my opinion, the second approach is more convenient both for the library > user and for us from a maintainance point of view, which explains my > insistance on moving this way ;) Thanks for the summary. Thing is that we have already moved a lot towards the first approach and to be able to move towards the second approach, we must deprecate the API that are designed for the first (existing) approach. Otherwise we'll just be confusing app developers with this contradiction. While I might agree with you that the 2nd approach is better, I don't think its worth it to change towards that now. Since we both disagree about the approach, I'd like to get input from Daniel about this too. Daniel? -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Tue Dec 18 17:21:30 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 19:21:30 +0200 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <20121218171723.GJ5336@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> <20121218161930.GH5336@teriyaki.redhat.com> <20121218171723.GJ5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 7:17 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 07:09:06PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 6:19 PM, Christophe Fergeau wrote: >> > On Tue, Dec 18, 2012 at 04:45:15PM +0200, Zeeshan Ali (Khattak) wrote: >> >> On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau >> >> wrote: >> >> > Yup, I've thought of both, we can also do if (config == entity) {}, but I >> >> > preferred to go the explicit way since the caller knows what it wants us to >> >> > do. >> >> >> >> Caller knows what it is passing and callee has easy ways to find out >> >> the type so why would you need this extra parameter? You are not >> >> making anything more explicit either in the caller or callee >> >> functions. Sorry but this just looks very clumsy. >> > >> > Callee has an easy way to _guess_ how it was called by harcoding checks for >> > something that is true the way the code is _now_, this assumption could >> > easily break with some future changes. >> >> I don't see how and where is the hardcoding? If in future Config >> instance is not passed, the passed param will never be TRUE. In the >> absence of that param, everything will work in the same way. > > We are hardcoding the fact that we want to transform parameters values > for all OsinfoInstallConfig instances that are passed to this function, > which may or may not be true depending on how this code evolves. Anyway, > changed already. > >> > I'm fine with changing to a runtime >> > type check, but I don't see this as an improvement, just clumsy in a >> > different way. >> >> You need to check the type and you use a macro that is provided for >> exactly that purpose. There is nothing clumsy about that. Whereas what >> you are doing is something I haven't seen before. > > I don't really want to check the type, I want to know if I should try to > transform the values or not. Agreed, the variable was badly named for what > I had in mind with this check. > > >> I have suggestion for even better solution but that would mean more >> work that we can live without (for now). > > Well, that's still interesting even if we don't do it.. OK but don't think of it as something I want you to implement. :) The idea was simply to move this function to Entity class as virtual (and internal) and then have Config override it.. but now that I said it, I just realized that would be impossible to implement without breaking ABI. :( -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Tue Dec 18 17:28:07 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 18:28:07 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-9-git-send-email-cfergeau@redhat.com> <20121218100505.GI2054@teriyaki.redhat.com> <20121218161930.GH5336@teriyaki.redhat.com> <20121218171723.GJ5336@teriyaki.redhat.com> Message-ID: <20121218172807.GK5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 07:21:30PM +0200, Zeeshan Ali (Khattak) wrote: > OK but don't think of it as something I want you to implement. :) The > idea was simply to move this function to Entity class as virtual (and > internal) and then have Config override it.. but now that I said it, I > just realized that would be impossible to implement without breaking > ABI. :( Well, been there (without breaking the ABI, thanks to Marc-Andr?), and went back to this approach. You need to be able to get both the transformed and untransformed value depending on the situation (transformed when generating the OsinfoInstallScript, untransformed for example when cloning the OsinfoInstallConfig object). Given that we need 2 methods anyway, it seemed better not be too smart, and to keep OsinfoEntity behaviour consistent (osinfo_entity_set(entity, "A", "B"); followed by osinfo_entity_get(entity, "A") will always return "B"). Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Tue Dec 18 17:38:24 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 18:38:24 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> Message-ID: <20121218173824.GL5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 07:18:04PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 6:43 PM, Christophe Fergeau wrote: > > In my opinion, the second approach is more convenient both for the library > > user and for us from a maintainance point of view, which explains my > > insistance on moving this way ;) > > Thanks for the summary. Thing is that we have already moved a lot > towards the first approach Are you saying the OsinfoInstallScript/OsinfoInstallConfig/ OsinfoInstallConfigParam relationship was intentionally designed this way? Ie OsinfoInstallConfigParam and OsinfoInstallConfig are separate on purpose? Until now my feeling was that this ended up being implemented this way, but that this was not a conscious decision, especially as this code didn't land very long ago. > and to be able to move towards the second > approach, we must deprecate the API that are designed for the first > (existing) approach. Otherwise we'll just be confusing app developers > with this contradiction. I'm not exactly sure what API you have in mind exactly. All I'm suggesting is gradual improvement and having a clear idea of what belongs where. I don't think we have things to deprecate to achieve that. > While I might agree with you that the 2nd approach is better, I don't > think its worth it to change towards that now. Once again, I'm a bit confused what there is to change here, nor where the big changes are. The only change I'm suggesting is having an (optional) OsinfoInstallConfigParamList be part of OsinfoInstallConfig, and use that if we later need parameter validation, ... This also means recommending the use of osinfo_install_config_new_for_script(), but even using that new method is not required, things will still work fine when using osinfo_install_config_new(). Please be more concrete as to why this is such an invasive unwanted change. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 17:57:00 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 19:57:00 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121218173824.GL5336@teriyaki.redhat.com> References: <1355778474-9513-1-git-send-email-cfergeau@redhat.com> <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 7:38 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 07:18:04PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 6:43 PM, Christophe Fergeau wrote: >> > In my opinion, the second approach is more convenient both for the library >> > user and for us from a maintainance point of view, which explains my >> > insistance on moving this way ;) >> >> Thanks for the summary. Thing is that we have already moved a lot >> towards the first approach > > Are you saying the OsinfoInstallScript/OsinfoInstallConfig/ > OsinfoInstallConfigParam relationship was intentionally designed this way? > Ie OsinfoInstallConfigParam and OsinfoInstallConfig are separate on > purpose? Yes. >Until now my feeling was that this ended up being implemented > this way, but that this was not a conscious decision, especially as this > code didn't land very long ago. AFAIK, the code in question has been in a separate branch/list for a while and was thoroughly reviewed. >> and to be able to move towards the second >> approach, we must deprecate the API that are designed for the first >> (existing) approach. Otherwise we'll just be confusing app developers >> with this contradiction. > > I'm not exactly sure what API you have in mind exactly. All I'm suggesting > is gradual improvement and having a clear idea of what belongs where. I > don't think we have things to deprecate to achieve that. I'm talking about having this config-params on both InstallScript and InstallConfig. As you pointed out already, currently app has to look at the params on the InstallScript to see which parameters the script will be able to use and which ones it must be provided. Exposing the same list on InstallConfig w/o deprecating it on the InstallScript, is the change I'm talking about. I hope I was more clear this time. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Tue Dec 18 18:15:47 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 19:15:47 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> Message-ID: <20121218181547.GM5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 07:57:00PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 7:38 PM, Christophe Fergeau wrote: > > On Tue, Dec 18, 2012 at 07:18:04PM +0200, Zeeshan Ali (Khattak) wrote: > >> On Tue, Dec 18, 2012 at 6:43 PM, Christophe Fergeau wrote: > >> > In my opinion, the second approach is more convenient both for the library > >> > user and for us from a maintainance point of view, which explains my > >> > insistance on moving this way ;) > >> > >> Thanks for the summary. Thing is that we have already moved a lot > >> towards the first approach > > > > Are you saying the OsinfoInstallScript/OsinfoInstallConfig/ > > OsinfoInstallConfigParam relationship was intentionally designed this way? > > Ie OsinfoInstallConfigParam and OsinfoInstallConfig are separate on > > purpose? > > Yes. Well, if that's the case and if that was obvious to you, I'm not very pleased that you mention that now after another patch iteration rather than in answer to https://www.redhat.com/archives/virt-tools-list/2012-December/msg00288.html > > >Until now my feeling was that this ended up being implemented > > this way, but that this was not a conscious decision, especially as this > > code didn't land very long ago. > > AFAIK, the code in question has been in a separate branch/list for a > while and was thoroughly reviewed. This was still a huge chunk of code, it's easy to miss some things during review. > > >> and to be able to move towards the second > >> approach, we must deprecate the API that are designed for the first > >> (existing) approach. Otherwise we'll just be confusing app developers > >> with this contradiction. > > > > I'm not exactly sure what API you have in mind exactly. All I'm suggesting > > is gradual improvement and having a clear idea of what belongs where. I > > don't think we have things to deprecate to achieve that. > > I'm talking about having this config-params on both InstallScript and > InstallConfig. As you pointed out already, currently app has to look > at the params on the InstallScript to see which parameters the script > will be able to use and which ones it must be provided. Actually, OsinfoInstallScript does not expose an OsinfoInstallConfigParamList as this class is introduced by this series. Not having this class in the first place is one of the reasons I assumed this part of the code may need some improvements... We have various methods on the OsinfoInstallScript class to handle OsinfoInstallConfigParam, but they look out of place to me, especially after the introduction of the OsinfoInstallConfigParamList class. I wouldn't mind deprecating these methods, they are probably not widely used anyway. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 18:30:16 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Tue, 18 Dec 2012 20:30:16 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121218181547.GM5336@teriyaki.redhat.com> References: <1355778474-9513-7-git-send-email-cfergeau@redhat.com> <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> Message-ID: On Tue, Dec 18, 2012 at 8:15 PM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 07:57:00PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 7:38 PM, Christophe Fergeau wrote: >> > On Tue, Dec 18, 2012 at 07:18:04PM +0200, Zeeshan Ali (Khattak) wrote: >> >> On Tue, Dec 18, 2012 at 6:43 PM, Christophe Fergeau wrote: >> >> > In my opinion, the second approach is more convenient both for the library >> >> > user and for us from a maintainance point of view, which explains my >> >> > insistance on moving this way ;) >> >> >> >> Thanks for the summary. Thing is that we have already moved a lot >> >> towards the first approach >> > >> > Are you saying the OsinfoInstallScript/OsinfoInstallConfig/ >> > OsinfoInstallConfigParam relationship was intentionally designed this way? >> > Ie OsinfoInstallConfigParam and OsinfoInstallConfig are separate on >> > purpose? >> >> Yes. > > Well, if that's the case and if that was obvious to you, I'm not very > pleased that you mention that now after another patch iteration rather than > in answer to > https://www.redhat.com/archives/virt-tools-list/2012-December/msg00288.html I'm sorry, I just got a bit lost in these changes. >> >Until now my feeling was that this ended up being implemented >> > this way, but that this was not a conscious decision, especially as this >> > code didn't land very long ago. >> >> AFAIK, the code in question has been in a separate branch/list for a >> while and was thoroughly reviewed. > > This was still a huge chunk of code, it's easy to miss some things during > review. I can understand and I didn't mean to blame you. There were some other problematic changes that I also missed during the reviews. >> >> and to be able to move towards the second >> >> approach, we must deprecate the API that are designed for the first >> >> (existing) approach. Otherwise we'll just be confusing app developers >> >> with this contradiction. >> > >> > I'm not exactly sure what API you have in mind exactly. All I'm suggesting >> > is gradual improvement and having a clear idea of what belongs where. I >> > don't think we have things to deprecate to achieve that. >> >> I'm talking about having this config-params on both InstallScript and >> InstallConfig. As you pointed out already, currently app has to look >> at the params on the InstallScript to see which parameters the script >> will be able to use and which ones it must be provided. > > Actually, OsinfoInstallScript does not expose an > OsinfoInstallConfigParamList as this class is introduced by this series. > Not having this class in the first place is one of the reasons I assumed > this part of the code may need some improvements... I did indeed forget that fact that the list itself is not being exposed as is but rather InstallScript only provides methods to access params in the list. > We have various methods on the OsinfoInstallScript class to handle > OsinfoInstallConfigParam, but they look out of place to me, especially > after the introduction of the OsinfoInstallConfigParamList class. I > wouldn't mind deprecating these methods, they are probably not widely used > anyway. None of the libosinfo API is yet widely used. The main app that uses libosinfo is Boxes and we are using the methods in question in there. As I said before, I don't think there is a compelling reason to deprecate APIs in this case. Hence the reason I wanted Daniel to make the decision here. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Tue Dec 18 22:33:34 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 18 Dec 2012 23:33:34 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> Message-ID: <20121218223333.GN5336@teriyaki.redhat.com> On Tue, Dec 18, 2012 at 08:30:16PM +0200, Zeeshan Ali (Khattak) wrote: > On Tue, Dec 18, 2012 at 8:15 PM, Christophe Fergeau wrote: > > Actually, OsinfoInstallScript does not expose an > > OsinfoInstallConfigParamList as this class is introduced by this series. > > Not having this class in the first place is one of the reasons I assumed > > this part of the code may need some improvements... > > I did indeed forget that fact that the list itself is not being > exposed as is but rather InstallScript only provides methods to access > params in the list. The list is exposed, but as a GList, not as an OsinfoInstallConfigParamList, which is what would be consistent with the rest of the libosinfo API. Part of this series fixes that by adding an OsinfoInstallConfigParamList class and making use of it. If something makes some code redundant in this series, and could cause some of the osinfo_install_script_*_config_param_* methods to become obsolete, it's this change ("OsinfoInstallScript: Use an OsinfoInstallConfigParamList"). And this one really is a worthwhile cleanup. > > > We have various methods on the OsinfoInstallScript class to handle > > OsinfoInstallConfigParam, but they look out of place to me, especially > > after the introduction of the OsinfoInstallConfigParamList class. I > > wouldn't mind deprecating these methods, they are probably not widely used > > anyway. > > None of the libosinfo API is yet widely used. The main app that uses > libosinfo is Boxes and we are using the methods in question in there. Fwiw, I could find one single use of osinfo_script_get_config_param, so whatever happens, it should not be too hard to adjust... > > As I said before, I don't think there is a compelling reason to > deprecate APIs in this case. Hence the reason I wanted Daniel to make > the decision here. You are the one saying we should deprecate some methods, and at the same time saying we should not be deprecating things. As far as I'm concerned, after applying the whole patch series, the old API is still working as always, I don't see reasons for it being broken any time soon, and as far as I'm concerned the old API can stay. After looking at what Boxes does, it seems to make sense to have the OsinfoInstallConfigParamList be available from both OsinfoInstallScript and OsinfoInstallConfig depending on what is more convenient for the user at a given time. I'd just like that we export osinfo_install_config_new_for_script and promote its use in our docs as imo this will be useful moving forward, but that's it. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Tue Dec 18 23:43:34 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Wed, 19 Dec 2012 01:43:34 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121218223333.GN5336@teriyaki.redhat.com> References: <20121218095334.GG2054@teriyaki.redhat.com> <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> Message-ID: On Wed, Dec 19, 2012 at 12:33 AM, Christophe Fergeau wrote: > On Tue, Dec 18, 2012 at 08:30:16PM +0200, Zeeshan Ali (Khattak) wrote: >> On Tue, Dec 18, 2012 at 8:15 PM, Christophe Fergeau wrote: >> > Actually, OsinfoInstallScript does not expose an >> > OsinfoInstallConfigParamList as this class is introduced by this series. >> > Not having this class in the first place is one of the reasons I assumed >> > this part of the code may need some improvements... >> >> I did indeed forget that fact that the list itself is not being >> exposed as is but rather InstallScript only provides methods to access >> params in the list. > > The list is exposed, but as a GList, not as an > OsinfoInstallConfigParamList, which is what would be consistent with the > rest of the libosinfo API. Part of this series fixes that by adding > an OsinfoInstallConfigParamList class and making use of it. > > If something makes some code redundant in this series, and could cause some > of the osinfo_install_script_*_config_param_* methods to become obsolete, > it's this change ("OsinfoInstallScript: Use an OsinfoInstallConfigParamList"). > > And this one really is a worthwhile cleanup. > >> >> > We have various methods on the OsinfoInstallScript class to handle >> > OsinfoInstallConfigParam, but they look out of place to me, especially >> > after the introduction of the OsinfoInstallConfigParamList class. I >> > wouldn't mind deprecating these methods, they are probably not widely used >> > anyway. >> >> None of the libosinfo API is yet widely used. The main app that uses >> libosinfo is Boxes and we are using the methods in question in there. > > Fwiw, I could find one single use of osinfo_script_get_config_param, so > whatever happens, it should not be too hard to adjust... > >> >> As I said before, I don't think there is a compelling reason to >> deprecate APIs in this case. Hence the reason I wanted Daniel to make >> the decision here. > > You are the one saying we should deprecate some methods, and at the same > time saying we should not be deprecating things. I've really had it with you generalizing my statements and taking them out of context. I don't think we should be deprecating APIs without a good reason. In this case, I don't see any. > As far as I'm concerned, after applying the whole patch series, the old API > is still working as always, I don't see reasons for it being broken any > time soon, and as far as I'm concerned the old API can stay. As I said twice already, that will mean confusing the app developer with two competing APIs. > After looking at what Boxes does, it seems to make sense to have the > OsinfoInstallConfigParamList be available from both > OsinfoInstallScript and OsinfoInstallConfig depending on what is more > convenient for the user at a given time. How would one be more convenient than the other? > I'd just like that we export osinfo_install_config_new_for_script and > promote its use in our docs as imo this will be useful moving forward, but > that's it. Not deprecating existing API (now) while adding a competing API to it and promoting that in the docs is no solution. Its like deprecating API silently. Once again, I'll propose that Daniel makes the decision here. I don't know why you keep ignoring that suggestion. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From fabiano at fidencio.org Wed Dec 19 00:08:19 2012 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 18 Dec 2012 22:08:19 -0200 Subject: [Libosinfo] [PATCHv4 1/4] docs: Add missing documentation Message-ID: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> Annotations for: - osinfo_install_script_generate_finish() - osinfo_install_script_generate_output_finish() --- osinfo/osinfo_install_script.c | 16 ++++++++++++++++ osinfo/osinfo_media.c | 15 +++++++++++++-- osinfo/osinfo_os.c | 8 +++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 2229843..da92850 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -889,6 +889,14 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript return g_simple_async_result_get_op_res_gpointer(simple); } +/** + * osinfo_install_script_generate_finish: + * @script: the install script + * @res: a #GAsyncResult + * @error: The location where to store any error, or NULL + * + * Returns: (transfer full): the generated script, or NULL on error + */ gchar *osinfo_install_script_generate_finish(OsinfoInstallScript *script, GAsyncResult *res, GError **error) @@ -898,6 +906,14 @@ gchar *osinfo_install_script_generate_finish(OsinfoInstallScript *script, error); } +/** + * osinfo_install_script_generate_output_finish: + * @script: the install script + * @res: a #GAsyncResult + * @error: The location where to store any error, or NULL + * + * Returns: (transfer full): a file containing the script, or NULL on error + */ GFile *osinfo_install_script_generate_output_finish(OsinfoInstallScript *script, GAsyncResult *res, GError **error) diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index 0bb29fa..2821e7f 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -1114,8 +1114,11 @@ gint osinfo_media_get_installer_reboots(OsinfoMedia *media) (OSINFO_ENTITY(media), OSINFO_MEDIA_PROP_INSTALLER_REBOOTS, 1); } -/* osinfo_media_get_os: - * Returns: (transfer full): +/** + * osinfo_media_get_os: + * @media: an #OsinfoMedia instance + * + * Returns: (transfer full): the operating system, or NULL */ OsinfoOs *osinfo_media_get_os(OsinfoMedia *media) { @@ -1156,6 +1159,14 @@ GList *osinfo_media_get_languages(OsinfoMedia *media) return osinfo_entity_get_param_value_list(OSINFO_ENTITY(media), OSINFO_MEDIA_PROP_LANG); } +/** + * osinfo_media_set_languages: + * @media: an #OsinfoMedia instance + * @languages: (element-type utf8): a #GList containing the list of the UI + * languages this media supports. + * + * Sets the #OSINFO_MEDIA_PROP_LANG parameter + */ void osinfo_media_set_languages(OsinfoMedia *media, GList *languages) { GList *it; diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 2be7f64..786e596 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -538,7 +538,13 @@ void osinfo_os_add_recommended_resources(OsinfoOs *os, OSINFO_ENTITY(resources)); } - +/** + * osinfo_os_find_install_script: + * @os: an operating system + * @profile: the install script profile + * + * Returns: (transfer full): A new #OsinfoInstallScript for the @os @profile + */ OsinfoInstallScript *osinfo_os_find_install_script(OsinfoOs *os, const gchar *profile) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); -- 1.8.0.2 From fabiano at fidencio.org Wed Dec 19 00:08:20 2012 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 18 Dec 2012 22:08:20 -0200 Subject: [Libosinfo] [PATCHv4 2/4] docs: Fix typos In-Reply-To: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> References: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> Message-ID: <1355875702-8271-2-git-send-email-fabiano@fidencio.org> - a -> an - to -> for - add a missing word (elements) - references: @param: an Osinfo* -> @param: an #Osinfo* --- osinfo/osinfo_avatar_format.c | 2 +- osinfo/osinfo_db.c | 10 +++++----- osinfo/osinfo_deployment.h | 2 +- osinfo/osinfo_device_driver.c | 10 +++++----- osinfo/osinfo_devicelink.c | 2 +- osinfo/osinfo_entity.c | 14 +++++++------- osinfo/osinfo_filter.c | 2 +- osinfo/osinfo_install_config_param.c | 2 +- osinfo/osinfo_install_script.c | 2 +- osinfo/osinfo_list.c | 4 ++-- osinfo/osinfo_media.c | 30 +++++++++++++++--------------- osinfo/osinfo_os.c | 4 ++-- osinfo/osinfo_resources.c | 18 +++++++++--------- osinfo/osinfo_tree.c | 18 +++++++++--------- 14 files changed, 60 insertions(+), 60 deletions(-) diff --git a/osinfo/osinfo_avatar_format.c b/osinfo/osinfo_avatar_format.c index 81436df..7928c41 100644 --- a/osinfo/osinfo_avatar_format.c +++ b/osinfo/osinfo_avatar_format.c @@ -171,7 +171,7 @@ osinfo_avatar_format_init (OsinfoAvatarFormat *avatar) /** * osinfo_avatar_format_new: * - * Construct a new user avatar file to a #OsinfoInstallScript. + * Construct a new user avatar file for an #OsinfoInstallScript. * * Returns: (transfer full): the necessary information to create an avatar for * an user diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c index 2015106..e3f6f45 100644 --- a/osinfo/osinfo_db.c +++ b/osinfo/osinfo_db.c @@ -493,7 +493,7 @@ void osinfo_db_add_deployment(OsinfoDb *db, OsinfoDeployment *deployment) /** * osinfo_db_add_datamap: * @db: the database - * @datamap: (transfer none): a install datamap + * @datamap: (transfer none): an install datamap * */ void osinfo_db_add_datamap(OsinfoDb *db, OsinfoDatamap *datamap) @@ -508,7 +508,7 @@ void osinfo_db_add_datamap(OsinfoDb *db, OsinfoDatamap *datamap) /** * osinfo_db_add_install_script: * @db: the database - * @script: (transfer none): a install script + * @script: (transfer none): an install script * */ void osinfo_db_add_install_script(OsinfoDb *db, OsinfoInstallScript *script) @@ -604,7 +604,7 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db, * @matched_media: (out) (transfer none) (allow-none): the matched operating * system media * - * Guess operating system given a #OsinfoMedia object. + * Guess operating system given an #OsinfoMedia object. * * Returns: (transfer none): the operating system, or NULL if guessing failed * Deprecated: 0.2.3: Use osinfo_db_identify_media() instead. @@ -664,7 +664,7 @@ static void fill_media (OsinfoDb *db, OsinfoMedia *media, /** * osinfo_db_identify_media: - * @db: a #OsinfoDb database + * @db: an #OsinfoDb database * @media: the installation media * data * @@ -703,7 +703,7 @@ gboolean osinfo_db_identify_media(OsinfoDb *db, OsinfoMedia *media) * @matched_tree: (out) (transfer none) (allow-none): the matched operating * system tree * - * Guess operating system given a #OsinfoTree object. + * Guess operating system given an #OsinfoTree object. * * Returns: (transfer none): the operating system, or NULL if guessing failed */ diff --git a/osinfo/osinfo_deployment.h b/osinfo/osinfo_deployment.h index 70c170e..45a9d14 100644 --- a/osinfo/osinfo_deployment.h +++ b/osinfo/osinfo_deployment.h @@ -1,5 +1,5 @@ /* - * libosinfo: a operating system deployment for a platform + * libosinfo: an operating system deployment for a platform * * Copyright (C) 2009-2012 Red Hat, Inc. * diff --git a/osinfo/osinfo_device_driver.c b/osinfo/osinfo_device_driver.c index 9a7e5e2..d402bc7 100644 --- a/osinfo/osinfo_device_driver.c +++ b/osinfo/osinfo_device_driver.c @@ -95,7 +95,7 @@ OsinfoDeviceDriver *osinfo_device_driver_new(const gchar *id) /** * osinfo_device_driver_get_architecture: - * @driver: a #OsinfoDeviceDriver instance + * @driver: an #OsinfoDeviceDriver instance * * Retrieves the target hardware architecture of @driver. * @@ -109,7 +109,7 @@ const gchar *osinfo_device_driver_get_architecture(OsinfoDeviceDriver *driver) /** * osinfo_device_driver_get_location: - * @driver: a #OsinfoDeviceDriver instance + * @driver: an #OsinfoDeviceDriver instance * * Retrieves the location of the @driver as a URL. * @@ -123,7 +123,7 @@ const gchar *osinfo_device_driver_get_location(OsinfoDeviceDriver *driver) /** * osinfo_device_driver_get_files: - * @driver: a #OsinfoDeviceDriver instance + * @driver: an #OsinfoDeviceDriver instance * * Retrieves the names of driver files under the location returned by * #osinfo_device_driver_get_location. @@ -138,7 +138,7 @@ GList *osinfo_device_driver_get_files(OsinfoDeviceDriver *driver) /** * osinfo_device_driver_get_pre_installable: - * @driver: a #OsinfoDeviceDriver instance + * @driver: an #OsinfoDeviceDriver instance * * Returns: TRUE if @driver is pre-installable, FALSE otherwise. */ @@ -151,7 +151,7 @@ gboolean osinfo_device_driver_get_pre_installable(OsinfoDeviceDriver *driver) /** * osinfo_device_driver_get_devices: - * @driver: a #OsinfoDeviceDriver instance + * @driver: an #OsinfoDeviceDriver instance * * Returns: (transfer none): The list of devices supported by this driver. */ diff --git a/osinfo/osinfo_devicelink.c b/osinfo/osinfo_devicelink.c index 383c7f2..52dea06 100644 --- a/osinfo/osinfo_devicelink.c +++ b/osinfo/osinfo_devicelink.c @@ -152,7 +152,7 @@ osinfo_devicelink_init (OsinfoDeviceLink *devlink) * osinfo_devicelink_new: * @target: the target device * - * Construct a new link to a #OsinfoDevice. The unique ID + * Construct a new link for an #OsinfoDevice. The unique ID * of the link is set to match the ID of the target device. * * Returns: (transfer full): the new device link diff --git a/osinfo/osinfo_entity.c b/osinfo/osinfo_entity.c index f108447..dc5a965 100644 --- a/osinfo/osinfo_entity.c +++ b/osinfo/osinfo_entity.c @@ -173,7 +173,7 @@ osinfo_entity_init (OsinfoEntity *entity) /** * osinfo_entity_set_param: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * @key: the name of the key * @value: the data to associated with that key * @@ -226,7 +226,7 @@ void osinfo_entity_set_param_enum(OsinfoEntity *entity, const gchar *key, gint v /** * osinfo_entity_add_param: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * @key: the name of the key * @value: the data to associated with that key * @@ -260,7 +260,7 @@ void osinfo_entity_add_param(OsinfoEntity *entity, const gchar *key, const gchar /** * osinfo_entity_clear_param: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * @key: the name of the key * * Remove all values associated with a key @@ -272,7 +272,7 @@ void osinfo_entity_clear_param(OsinfoEntity *entity, const gchar *key) /** * osinfo_entity_get_id: - * @entity: a OsinfoEntity + * @entity: an #OsinfoEntity * * Retrieves the unique key for the entity. The format of identifiers * is undefined, but the recommended practice is to use a URI. @@ -289,7 +289,7 @@ const gchar *osinfo_entity_get_id(OsinfoEntity *entity) /** * osinfo_entity_get_param_keys: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * * Retrieve all the known parameter keys associated with * the entity @@ -308,7 +308,7 @@ GList *osinfo_entity_get_param_keys(OsinfoEntity *entity) /** * osinfo_entity_get_param_value: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * @key: the name of the key * * Retrieve the parameter value associated with a named key. If @@ -406,7 +406,7 @@ gint osinfo_entity_get_param_value_enum(OsinfoEntity *entity, /** * osinfo_entity_get_param_value_list: - * @entity: OsinfoEntity containing the parameters + * @entity: an #OsinfoEntity containing the parameters * @key: the name of the key * * Retrieve all the parameter values associated with a named diff --git a/osinfo/osinfo_filter.c b/osinfo/osinfo_filter.c index 7f4dc56..6f19ec1 100644 --- a/osinfo/osinfo_filter.c +++ b/osinfo/osinfo_filter.c @@ -276,7 +276,7 @@ static gboolean osinfo_filter_matches_default(OsinfoFilter *filter, OsinfoEntity /** * osinfo_filter_matches: * @filter: a filter object - * @entity: a entity to query + * @entity: an entity to query * * Determine of an entity matches a filter * diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 7876d20..718f459 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -156,7 +156,7 @@ osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param) * osinfo_install_config_param_new: * @name: the configuration parameter name * - * Construct a new configuration parameter to a #OsinfoInstallScript. + * Construct a new configuration parameter for an #OsinfoInstallScript. * * Returns: (transfer full): the new configuration parameter */ diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index da92850..169f4d0 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -1097,7 +1097,7 @@ void osinfo_install_script_generate_output_async(OsinfoInstallScript *script, * @cancellable: (allow-none): a #GCancellable, or %NULL * @error: The location where to store any error, or %NULL * - * Creates a install script written in a file + * Creates an install script written in a file * * Returns: (transfer full): a file containing the script */ diff --git a/osinfo/osinfo_list.c b/osinfo/osinfo_list.c index 25716c9..c32a5ff 100644 --- a/osinfo/osinfo_list.c +++ b/osinfo/osinfo_list.c @@ -448,8 +448,8 @@ OsinfoList *osinfo_list_new_filtered(OsinfoList *source, OsinfoFilter *filter) * @sourceOne: the first list to copy * @sourceTwo: the second list to copy * - * Construct a new list that is filled with only the - * s that are present in both @sourceOne and @sourceTwo. + * Construct a new list that is filled with only the elements + * that are present in both @sourceOne and @sourceTwo. * * Returns: (transfer full): an intersection of the two lists */ diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index 2821e7f..8f03046 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -464,11 +464,11 @@ osinfo_media_class_init (OsinfoMediaClass *klass) /** * OsinfoMedia:installer: * - * Whether media provides a installer for an OS. + * Whether media provides an installer for an OS. */ pspec = g_param_spec_boolean ("installer", "Installer", - _("Media provides a installer"), + _("Media provides an installer"), TRUE /* default value */, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); @@ -926,7 +926,7 @@ OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, /** * osinfo_media_get_architecture: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * Retrieves the target hardware architecture of the OS @media provides. * @@ -940,7 +940,7 @@ const gchar *osinfo_media_get_architecture(OsinfoMedia *media) /** * osinfo_media_get_url: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * The URL to the @media * @@ -954,7 +954,7 @@ const gchar *osinfo_media_get_url(OsinfoMedia *media) /** * osinfo_media_get_volume_id: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If @media is an ISO9660 image/device, this function retrieves the expected * volume ID. @@ -973,7 +973,7 @@ const gchar *osinfo_media_get_volume_id(OsinfoMedia *media) /** * osinfo_media_get_system_id: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If @media is an ISO9660 image/device, this function retrieves the expected * system ID. @@ -992,7 +992,7 @@ const gchar *osinfo_media_get_system_id(OsinfoMedia *media) /** * osinfo_media_get_publisher_id: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If @media is an ISO9660 image/device, this function retrieves the expected * publisher ID. @@ -1011,7 +1011,7 @@ const gchar *osinfo_media_get_publisher_id(OsinfoMedia *media) /** * osinfo_media_get_application_id: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If @media is an ISO9660 image/device, this function retrieves the expected * application ID. @@ -1030,7 +1030,7 @@ const gchar *osinfo_media_get_application_id(OsinfoMedia *media) /** * osinfo_media_get_kernel_path: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * Retrieves the path to the kernel image in the install tree. * @@ -1046,7 +1046,7 @@ const gchar *osinfo_media_get_kernel_path(OsinfoMedia *media) /** * osinfo_media_get_initrd_path: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * Retrieves the path to the initrd image in the install tree. * @@ -1062,9 +1062,9 @@ const gchar *osinfo_media_get_initrd_path(OsinfoMedia *media) /** * osinfo_media_get_installer: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * - * Whether @media provides a installer for an OS. + * Whether @media provides an installer for an OS. * * Returns: #TRUE if media is installer, #FALSE otherwise */ @@ -1076,7 +1076,7 @@ gboolean osinfo_media_get_installer(OsinfoMedia *media) /** * osinfo_media_get_live: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * Whether @media can boot directly an OS without any installations. * @@ -1090,7 +1090,7 @@ gboolean osinfo_media_get_live(OsinfoMedia *media) /** * osinfo_media_get_installer_reboots: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If media is an installer, this method retrieves the number of reboots the * installer takes before installation is complete. @@ -1138,7 +1138,7 @@ void osinfo_media_set_os(OsinfoMedia *media, OsinfoOs *os) /** * osinfo_media_get_languages: - * @media: a #OsinfoMedia instance + * @media: an #OsinfoMedia instance * * If media is an installer, this property indicates the languages that * can be used during automatic installations. diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 786e596..97c33f7 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -368,7 +368,7 @@ OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev) /** * osinfo_os_get_family: - * @os: a OsinfoOs + * @os: an #OsinfoOs * * Retrieves the generic family the OS @os belongs to, based upon its kernel, * for example linux, winnt, solaris, freebsd etc. @@ -384,7 +384,7 @@ const gchar *osinfo_os_get_family(OsinfoOs *os) /** * osinfo_os_get_distro: - * @os: a OsinfoOs + * @os: an #OsinfoOs * * Retrieves the generic family the OS @os belongs to, for example fedora, * ubuntu, windows, solaris, freebsd etc. diff --git a/osinfo/osinfo_resources.c b/osinfo/osinfo_resources.c index 1cdc888..67d9952 100644 --- a/osinfo/osinfo_resources.c +++ b/osinfo/osinfo_resources.c @@ -267,7 +267,7 @@ OsinfoResources *osinfo_resources_new(const gchar *id, /** * osinfo_resources_get_architecture: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * * Retrieves the target hardware architecture to which @resources applies. Some * operating systems specify the same requirements and recommendations for all @@ -284,7 +284,7 @@ const gchar *osinfo_resources_get_architecture(OsinfoResources *resources) /** * osinfo_resources_get_n_cpus: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * * Retrieves the number of CPUs. * @@ -298,7 +298,7 @@ gint osinfo_resources_get_n_cpus(OsinfoResources *resources) /** * osinfo_resources_get_cpu: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * * Retrieves the CPU frequency in hertz (Hz). Divide the value by #OSINFO_MEGAHERTZ if * you need this value in megahertz (MHz). @@ -313,7 +313,7 @@ gint64 osinfo_resources_get_cpu(OsinfoResources *resources) /** * osinfo_resources_get_ram: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * * Retrieves the amount of Random Access Memory (RAM) in bytes. Divide the value * by #OSINFO_MEBIBYTES if you need this value in mebibytes. @@ -328,7 +328,7 @@ gint64 osinfo_resources_get_ram(OsinfoResources *resources) /** * osinfo_resources_get_storage: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * * Retrieves the amount of storage space in bytes. Divide the value by * #OSINFO_GIBIBYTES if you need this value in gibibytes. @@ -343,7 +343,7 @@ gint64 osinfo_resources_get_storage(OsinfoResources *resources) /** * osinfo_resources_set_n_cpus: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * @n_cpus: the number of CPUs * * Sets the number of CPUs. @@ -357,7 +357,7 @@ void osinfo_resources_set_n_cpus(OsinfoResources *resources, gint n_cpus) /** * osinfo_resources_set_cpu: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * @cpu: the CPU frequency in hertz (Hz) * * Sets the CPU frequency. @@ -371,7 +371,7 @@ void osinfo_resources_set_cpu(OsinfoResources *resources, gint64 cpu) /** * osinfo_resources_set_ram: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * @ram: the amount of ram in bytes * * Sets the amount of RAM in bytes. @@ -385,7 +385,7 @@ void osinfo_resources_set_ram(OsinfoResources *resources, gint64 ram) /** * osinfo_resources_set_storage: - * @resources: a #OsinfoResources instance + * @resources: an #OsinfoResources instance * @storage: the amount of storage in bytes * * Sets the amount of storage space. diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 3b964a1..fe8e659 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -698,7 +698,7 @@ OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, /** * osinfo_tree_get_architecture: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * Retrieves the target hardware architecture of the OS @tree provides. * @@ -712,7 +712,7 @@ const gchar *osinfo_tree_get_architecture(OsinfoTree *tree) /** * osinfo_tree_get_url: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * The URL to the @tree * @@ -726,7 +726,7 @@ const gchar *osinfo_tree_get_url(OsinfoTree *tree) /** * osinfo_tree_get_treeinfo_family: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * If @tree is an ISO9660 image/device, this function retrieves the expected * volume ID. @@ -745,7 +745,7 @@ const gchar *osinfo_tree_get_treeinfo_family(OsinfoTree *tree) /** * osinfo_tree_get_treeinfo_arch: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * If @tree is an ISO9660 image/device, this function retrieves the expected * system ID. @@ -764,7 +764,7 @@ const gchar *osinfo_tree_get_treeinfo_arch(OsinfoTree *tree) /** * osinfo_tree_get_treeinfo_variant: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * If @tree is an ISO9660 image/device, this function retrieves the expected * publisher ID. @@ -783,7 +783,7 @@ const gchar *osinfo_tree_get_treeinfo_variant(OsinfoTree *tree) /** * osinfo_tree_get_treeinfo_version: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * If @tree is an ISO9660 image/device, this function retrieves the expected * application ID. @@ -802,7 +802,7 @@ const gchar *osinfo_tree_get_treeinfo_version(OsinfoTree *tree) /** * osinfo_tree_get_boot_iso_path: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * Retrieves the path to the boot_iso image in the install tree. * @@ -816,7 +816,7 @@ const gchar *osinfo_tree_get_boot_iso_path(OsinfoTree *tree) /** * osinfo_tree_get_kernel_path: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * Retrieves the path to the kernel image in the install tree. * @@ -832,7 +832,7 @@ const gchar *osinfo_tree_get_kernel_path(OsinfoTree *tree) /** * osinfo_tree_get_initrd_path: - * @tree: a #OsinfoTree instance + * @tree: an #OsinfoTree instance * * Retrieves the path to the initrd image in the install tree. * -- 1.8.0.2 From fabiano at fidencio.org Wed Dec 19 00:08:21 2012 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 18 Dec 2012 22:08:21 -0200 Subject: [Libosinfo] [PATCHv4 3/4] syms: expose a forgotten method In-Reply-To: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> References: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> Message-ID: <1355875702-8271-3-git-send-email-fabiano@fidencio.org> --- osinfo/libosinfo.syms | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index ab04df7..c2edf90 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,6 +388,8 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + osinfo_install_script_generate_output_finish; + osinfo_media_get_languages; osinfo_media_get_os; } LIBOSINFO_0.2.2; -- 1.8.0.2 From fabiano at fidencio.org Wed Dec 19 00:08:22 2012 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 18 Dec 2012 22:08:22 -0200 Subject: [Libosinfo] [PATCHv4 4/4] docs: add missing ":" for proper introspection In-Reply-To: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> References: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> Message-ID: <1355875702-8271-4-git-send-email-fabiano@fidencio.org> --- osinfo/osinfo_install_script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 169f4d0..23e3c5a 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -507,7 +507,7 @@ osinfo_install_script_set_avatar_format(OsinfoInstallScript *script, } /** - * osinfo_install_script_get_avatar_format + * osinfo_install_script_get_avatar_format: * @script: the install script * * Some install scripts have restrictions on the format of the user avatar. Use -- 1.8.0.2 From zeeshanak at gnome.org Wed Dec 19 00:51:37 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Wed, 19 Dec 2012 02:51:37 +0200 Subject: [Libosinfo] [PATCHv4 1/4] docs: Add missing documentation In-Reply-To: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> References: <1355875702-8271-1-git-send-email-fabiano@fidencio.org> Message-ID: On Wed, Dec 19, 2012 at 2:08 AM, Fabiano Fid?ncio wrote: ACK to the whole series and pushed. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Wed Dec 19 09:16:26 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Wed, 19 Dec 2012 10:16:26 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> Message-ID: <20121219091626.GO5336@teriyaki.redhat.com> On Wed, Dec 19, 2012 at 01:43:34AM +0200, Zeeshan Ali (Khattak) wrote: > On Wed, Dec 19, 2012 at 12:33 AM, Christophe Fergeau > wrote: > > You are the one saying we should deprecate some methods, and at the same > > time saying we should not be deprecating things. > > I've really had it with you generalizing my statements and taking them > out of context. Well, this was a bit tongue in cheek, but what I meant is I'm not pushing to deprecate stuff. On the other hand, in this very mail, you are saying: ? I don't think we should be deprecating APIs without a good reason. ? and ? Its like deprecating API silently. ? > > > As far as I'm concerned, after applying the whole patch series, the old API > > is still working as always, I don't see reasons for it being broken any > > time soon, and as far as I'm concerned the old API can stay. > > As I said twice already, that will mean confusing the app developer > with two competing APIs. When I started working on these patches, I was very confused by OsinfoInstallConfig VS OsinfoInstallConfigParam. They have similar names, but they have no relationship whatsoever, you cannot get one from the other, you are not using them in the same API calls, ... so the API is confusing anyway. > > > After looking at what Boxes does, it seems to make sense to have the > > OsinfoInstallConfigParamList be available from both > > OsinfoInstallScript and OsinfoInstallConfig depending on what is more > > convenient for the user at a given time. > > How would one be more convenient than the other? If you have an OsinfoInstallScript object because you are setting up 'stuff' which you'll then use to create OsinfoInstallConfig(s), then it's more convenient to get the OsinfoInstallConfigParamList from the script as you haven't started creating your config. This is the way Boxes is using it. If you have already started your OsinfoInstallConfig and need to know which parameters are mandatory, which are supported, ... then it's more convenient to get the OsinfoInstallConfigParamList from the config as you may not have as script handy. > > I'd just like that we export osinfo_install_config_new_for_script and > > promote its use in our docs as imo this will be useful moving forward, but > > that's it. > > Not deprecating existing API (now) while adding a competing API to it > and promoting that in the docs is no solution. Its like deprecating > API silently. It's not a competing API, it's just convenience API that will ensure that OsinfoInstallConfig:config-params is set on your newly created OsinfoInstallConfig object. You can also set it by hand, or not set it at all if you don't need it. What I'm suggesting complements and improves the existing API, it does not really compete with it. > Once again, I'll propose that Daniel makes the decision here. I don't > know why you keep ignoring that suggestion. I'm not ignoring it. I'm still refining my thoughts on this subject, and slightly changing my point of view on the approach we should take in the course of this email thread, so I'm echoing this here. Daniel's input on that topic is obviously very welcome, but if we reach an agreement without him, that's good as well. 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). Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Wed Dec 19 10:14:28 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Wed, 19 Dec 2012 11:14:28 +0100 Subject: [Libosinfo] [libosinfo 1/2] Improve osinfo_install_config_new API doc Message-ID: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> It was inaccurately saying that the newly created OsinfoInstallConfig is empty while it has some default values set. --- osinfo/osinfo_install_config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index 64e7ed5..219a8e2 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -99,9 +99,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) { -- 1.8.0.2 From cfergeau at redhat.com Wed Dec 19 10:14:29 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Wed, 19 Dec 2012 11:14:29 +0100 Subject: [Libosinfo] [libosinfo 2/2] Small improvements to API doc In-Reply-To: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> References: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> Message-ID: <1355912069-32632-2-git-send-email-cfergeau@redhat.com> Improve the (short) description of the OsinfoInstallConfigParam and OsinfoInstallScript classes. --- osinfo/osinfo_install_config_param.c | 8 +++++--- osinfo/osinfo_install_script.c | 11 ++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 7876d20..98d0ab1 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -34,11 +34,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. */ enum { diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 2229843..df37957 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -38,12 +38,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 -- 1.8.0.2 From cfergeau at redhat.com Wed Dec 19 10:17:44 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Wed, 19 Dec 2012 11:17:44 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121219091626.GO5336@teriyaki.redhat.com> References: <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> Message-ID: <20121219101744.GP5336@teriyaki.redhat.com> 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From fabiano at fidencio.org Wed Dec 19 10:22:46 2012 From: fabiano at fidencio.org (=?ISO-8859-1?Q?Fabiano_Fid=EAncio?=) Date: Wed, 19 Dec 2012 08:22:46 -0200 Subject: [Libosinfo] [libosinfo 1/2] Improve osinfo_install_config_new API doc In-Reply-To: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> References: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> Message-ID: On Wed, Dec 19, 2012 at 8:14 AM, Christophe Fergeau wrote: > It was inaccurately saying that the newly created OsinfoInstallConfig > is empty while it has some default values set. ACK! > --- > osinfo/osinfo_install_config.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c > index 64e7ed5..219a8e2 100644 > --- a/osinfo/osinfo_install_config.c > +++ b/osinfo/osinfo_install_config.c > @@ -99,9 +99,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) > { > -- > 1.8.0.2 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Fabiano Fid?ncio From fabiano at fidencio.org Wed Dec 19 10:23:07 2012 From: fabiano at fidencio.org (=?ISO-8859-1?Q?Fabiano_Fid=EAncio?=) Date: Wed, 19 Dec 2012 08:23:07 -0200 Subject: [Libosinfo] [libosinfo 2/2] Small improvements to API doc In-Reply-To: <1355912069-32632-2-git-send-email-cfergeau@redhat.com> References: <1355912069-32632-1-git-send-email-cfergeau@redhat.com> <1355912069-32632-2-git-send-email-cfergeau@redhat.com> Message-ID: On Wed, Dec 19, 2012 at 8:14 AM, Christophe Fergeau wrote: > Improve the (short) description of the OsinfoInstallConfigParam and > OsinfoInstallScript classes. ACK! > --- > osinfo/osinfo_install_config_param.c | 8 +++++--- > osinfo/osinfo_install_script.c | 11 ++++++----- > 2 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c > index 7876d20..98d0ab1 100644 > --- a/osinfo/osinfo_install_config_param.c > +++ b/osinfo/osinfo_install_config_param.c > @@ -34,11 +34,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. > */ > > enum { > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > index 2229843..df37957 100644 > --- a/osinfo/osinfo_install_script.c > +++ b/osinfo/osinfo_install_script.c > @@ -38,12 +38,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 > -- > 1.8.0.2 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Fabiano Fid?ncio From zeeshanak at gnome.org Wed Dec 19 14:55:23 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Wed, 19 Dec 2012 16:55:23 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121219091626.GO5336@teriyaki.redhat.com> References: <20121218102905.GA5336@teriyaki.redhat.com> <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> Message-ID: On Wed, Dec 19, 2012 at 11:16 AM, Christophe Fergeau wrote: > On Wed, Dec 19, 2012 at 01:43:34AM +0200, Zeeshan Ali (Khattak) wrote: >> On Wed, Dec 19, 2012 at 12:33 AM, Christophe Fergeau >> wrote: >> > You are the one saying we should deprecate some methods, and at the same >> > time saying we should not be deprecating things. >> >> I've really had it with you generalizing my statements and taking them >> out of context. > > Well, this was a bit tongue in cheek, but what I meant is I'm not pushing > to deprecate stuff. On the other hand, in this very mail, you are saying: > ? I don't think we should be deprecating APIs without a good reason. ? > and ? Its like deprecating API silently. ? Yes, I *was* saying that what you are proposing really is nothing short of deprecating existing API. Stress on the word *was* cause I realized now that you have slightly changed your opinion here (see below). >> > As far as I'm concerned, after applying the whole patch series, the old API >> > is still working as always, I don't see reasons for it being broken any >> > time soon, and as far as I'm concerned the old API can stay. >> >> As I said twice already, that will mean confusing the app developer >> with two competing APIs. > > When I started working on these patches, I was very confused by > OsinfoInstallConfig VS OsinfoInstallConfigParam. They have similar names, > but they have no relationship whatsoever, you cannot get one from the > other, you are not using them in the same API calls, ... so the API is > confusing anyway. I understand and agree that this API is confusing but by keeping it and adding the same API on another class will cause a lot more confusion. That would be actually contrary to what you are trying to achieve here. >> > After looking at what Boxes does, it seems to make sense to have the >> > OsinfoInstallConfigParamList be available from both >> > OsinfoInstallScript and OsinfoInstallConfig depending on what is more >> > convenient for the user at a given time. >> >> How would one be more convenient than the other? > > If you have an OsinfoInstallScript object because you are setting up > 'stuff' which you'll then use to create OsinfoInstallConfig(s), then it's > more convenient to get the OsinfoInstallConfigParamList from the script as > you haven't started creating your config. This is the way Boxes is using > it. > > If you have already started your OsinfoInstallConfig and need to know which > parameters are mandatory, which are supported, ... That is dependent on the script and config alone can not tell you that. The only way config can tell you this is to get this information from a script. > then it's more > convenient to get the OsinfoInstallConfigParamList from the config as you > may not have as script handy. You can't have this information without a script instance at hand for the reason I mentioned above. So I'm sorry but I don't see any convenience being added. >> > I'd just like that we export osinfo_install_config_new_for_script and >> > promote its use in our docs as imo this will be useful moving forward, but >> > that's it. >> >> Not deprecating existing API (now) while adding a competing API to it >> and promoting that in the docs is no solution. Its like deprecating >> API silently. > > > It's not a competing API, it's just convenience API that will ensure that > OsinfoInstallConfig:config-params is set on your newly created > OsinfoInstallConfig object. You can also set it by hand, or not set it at > all if you don't need it. Why would we want an app to be doing that? > What I'm suggesting complements and improves the > existing API, it does not really compete with it. So I take it that you have changed your opinion slightly on this cause you were the first to call these two approaches "competing" in this thread? >> Once again, I'll propose that Daniel makes the decision here. I don't >> know why you keep ignoring that suggestion. > > I'm not ignoring it. I'm still refining my thoughts on this subject, and > slightly changing my point of view on the approach we should take in the > course of this email thread, so I'm echoing this here. Daniel's > input on that topic is obviously very welcome, but if we reach an agreement > without him, that's good as well. Good, sorry I misunderstood then. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Wed Dec 19 15:43:19 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Wed, 19 Dec 2012 16:43:19 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> Message-ID: <20121219154319.GA7062@teriyaki.ams2.redhat.com> On Wed, Dec 19, 2012 at 04:55:23PM +0200, Zeeshan Ali (Khattak) wrote: > On Wed, Dec 19, 2012 at 11:16 AM, Christophe Fergeau > wrote: > > When I started working on these patches, I was very confused by > > OsinfoInstallConfig VS OsinfoInstallConfigParam. They have similar names, > > but they have no relationship whatsoever, you cannot get one from the > > other, you are not using them in the same API calls, ... so the API is > > confusing anyway. > > I understand and agree that this API is confusing but by keeping it > and adding the same API on another class will cause a lot more > confusion. That would be actually contrary to what you are trying to > achieve here. I don't know what you are talking about here, use specific method and class names and make a detailed answer. We don't seem to be talking about the same thing. > > >> > After looking at what Boxes does, it seems to make sense to have the > >> > OsinfoInstallConfigParamList be available from both > >> > OsinfoInstallScript and OsinfoInstallConfig depending on what is more > >> > convenient for the user at a given time. > >> > >> How would one be more convenient than the other? > > > > If you have an OsinfoInstallScript object because you are setting up > > 'stuff' which you'll then use to create OsinfoInstallConfig(s), then it's > > more convenient to get the OsinfoInstallConfigParamList from the script as > > you haven't started creating your config. This is the way Boxes is using > > it. > > > > If you have already started your OsinfoInstallConfig and need to know which > > parameters are mandatory, which are supported, ... > > That is dependent on the script and config alone can not tell you > that. The only way config can tell you this is to get this information > from a script. > > > then it's more > > convenient to get the OsinfoInstallConfigParamList from the config as you > > may not have as script handy. > > You can't have this information without a script instance at hand for > the reason I mentioned above. So I'm sorry but I don't see any > convenience being added. This avoids having to carry around an OsinfoInstallScript instance when all you are doing is filling your OsinfoInstallConfig object, you don't have to pass it through every method calls, ... Had 'path-format' described as an OsinfoInstallConfigParam (which seems to make sense from a quick glance), Boxes would even have been able to benefit from that in UnattendedInstaller::configure_install_script, the OsinfoInstallScript argument would not have been needed. > > What I'm suggesting complements and improves the > > existing API, it does not really compete with it. > > So I take it that you have changed your opinion slightly on this cause > you were the first to call these two approaches "competing" in this > thread? Well, I don't know what I used to be saying, but yeah I've said several times in this email that my thinking on all of this was still evolving. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Thu Dec 20 15:07:23 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Thu, 20 Dec 2012 17:07:23 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121219154319.GA7062@teriyaki.ams2.redhat.com> References: <20121218164226.GI5336@teriyaki.redhat.com> <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> <20121219154319.GA7062@teriyaki.ams2.redhat.com> Message-ID: On Wed, Dec 19, 2012 at 5:43 PM, Christophe Fergeau wrote: > On Wed, Dec 19, 2012 at 04:55:23PM +0200, Zeeshan Ali (Khattak) wrote: >> On Wed, Dec 19, 2012 at 11:16 AM, Christophe Fergeau >> wrote: >> > When I started working on these patches, I was very confused by >> > OsinfoInstallConfig VS OsinfoInstallConfigParam. They have similar names, >> > but they have no relationship whatsoever, you cannot get one from the >> > other, you are not using them in the same API calls, ... so the API is >> > confusing anyway. >> >> I understand and agree that this API is confusing but by keeping it >> and adding the same API on another class will cause a lot more >> confusion. That would be actually contrary to what you are trying to >> achieve here. > > I don't know what you are talking about here, use specific method and class > names and make a detailed answer. We don't seem to be talking about the > same thing. > >> >> >> > After looking at what Boxes does, it seems to make sense to have the >> >> > OsinfoInstallConfigParamList be available from both >> >> > OsinfoInstallScript and OsinfoInstallConfig depending on what is more >> >> > convenient for the user at a given time. >> >> >> >> How would one be more convenient than the other? >> > >> > If you have an OsinfoInstallScript object because you are setting up >> > 'stuff' which you'll then use to create OsinfoInstallConfig(s), then it's >> > more convenient to get the OsinfoInstallConfigParamList from the script as >> > you haven't started creating your config. This is the way Boxes is using >> > it. >> > >> > If you have already started your OsinfoInstallConfig and need to know which >> > parameters are mandatory, which are supported, ... >> >> That is dependent on the script and config alone can not tell you >> that. The only way config can tell you this is to get this information >> from a script. >> >> > then it's more >> > convenient to get the OsinfoInstallConfigParamList from the config as you >> > may not have as script handy. >> >> You can't have this information without a script instance at hand for >> the reason I mentioned above. So I'm sorry but I don't see any >> convenience being added. > > This avoids having to carry around an OsinfoInstallScript instance when all > you are doing is filling your OsinfoInstallConfig object, you don't have to > pass it through every method calls, ... If I understood your current patch series correctly, OsinfoInstallConfig:config-params is not set before app generates the script so: 1. by the time OsinfoInstallConfig:config-params is set, OsinfoInstallConfig is unlikely to be useful to the app anymore. 2. it would be totally unintuitive for app to have access to OsinfoInstallConfig:config-params only after generating the script. Now if you want to revisit the decision to make osinfo_install_config_new_for_script() private, that is another thing. Otherwise, I really don't see what you want to achieve with exposing OsinfoInstallConfig:config-params in public API. > Had 'path-format' described as an OsinfoInstallConfigParam (which seems to > make sense from a quick glance), Boxes would even have been able to benefit > from that in UnattendedInstaller::configure_install_script, the > OsinfoInstallScript argument would not have been needed. Except that it wouldn't have worked with your current patches for the reason I mentioned above. >> > What I'm suggesting complements and improves the >> > existing API, it does not really compete with it. >> >> So I take it that you have changed your opinion slightly on this cause >> you were the first to call these two approaches "competing" in this >> thread? > > Well, I don't know what I used to be saying, but yeah I've said several > times in this email that my thinking on all of this was still evolving. Within this thread, I've seen your thinking evolving only in regards to justification of your patches. First you were of the opinion that InstallConfig:param-list is a 'competing approach' to config param API of OsinfoInstallScript and we should move towards the former approach. Then you changed the opinion to: These two are complementary to each other and app can choose which one to use depending on the scenerio. Thats what I gathered and I could be totally wrong so feel free to correct. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Thu Dec 20 15:13:01 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 16:13:01 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> <20121219154319.GA7062@teriyaki.ams2.redhat.com> Message-ID: <20121220151301.GE2047@teriyaki.redhat.com> On Thu, Dec 20, 2012 at 05:07:23PM +0200, Zeeshan Ali (Khattak) wrote: > On Wed, Dec 19, 2012 at 5:43 PM, Christophe Fergeau wrote: > If I understood your current patch series correctly, > OsinfoInstallConfig:config-params is not set before app generates the > script so: > > 1. by the time OsinfoInstallConfig:config-params is set, > OsinfoInstallConfig is unlikely to be useful to the app anymore. > 2. it would be totally unintuitive for app to have access to > OsinfoInstallConfig:config-params only after generating the script. > > Now if you want to revisit the decision to make > osinfo_install_config_new_for_script() private, that is another thing. > Otherwise, I really don't see what you want to achieve with exposing > OsinfoInstallConfig:config-params in public API. Please read again the last paragraph of https://www.redhat.com/archives/libosinfo/2012-December/msg00049.html as well as https://www.redhat.com/archives/libosinfo/2012-December/msg00052.html Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Thu Dec 20 15:29:34 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Thu, 20 Dec 2012 17:29:34 +0200 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <20121220151301.GE2047@teriyaki.redhat.com> References: <20121218173824.GL5336@teriyaki.redhat.com> <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> <20121219154319.GA7062@teriyaki.ams2.redhat.com> <20121220151301.GE2047@teriyaki.redhat.com> Message-ID: On Thu, Dec 20, 2012 at 5:13 PM, Christophe Fergeau wrote: > On Thu, Dec 20, 2012 at 05:07:23PM +0200, Zeeshan Ali (Khattak) wrote: >> On Wed, Dec 19, 2012 at 5:43 PM, Christophe Fergeau wrote: >> If I understood your current patch series correctly, >> OsinfoInstallConfig:config-params is not set before app generates the >> script so: >> >> 1. by the time OsinfoInstallConfig:config-params is set, >> OsinfoInstallConfig is unlikely to be useful to the app anymore. >> 2. it would be totally unintuitive for app to have access to >> OsinfoInstallConfig:config-params only after generating the script. >> >> Now if you want to revisit the decision to make >> osinfo_install_config_new_for_script() private, that is another thing. >> Otherwise, I really don't see what you want to achieve with exposing >> OsinfoInstallConfig:config-params in public API. > > Please read again the last paragraph of > https://www.redhat.com/archives/libosinfo/2012-December/msg00049.html > as well as > > https://www.redhat.com/archives/libosinfo/2012-December/msg00052.html Yikes, I had apparently missed those important bits somehow. My bad. As long as apps can choose between osinfo_install_config_new() or osinfo_install_config_new_for_script() without any issues/side-affects and we document (as you are doing in your patch) the difference clearly, I'm OK with these changes. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Thu Dec 20 16:17:26 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:17:26 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: References: <20121218181547.GM5336@teriyaki.redhat.com> <20121218223333.GN5336@teriyaki.redhat.com> <20121219091626.GO5336@teriyaki.redhat.com> <20121219154319.GA7062@teriyaki.ams2.redhat.com> <20121220151301.GE2047@teriyaki.redhat.com> Message-ID: <20121220161726.GF2047@teriyaki.redhat.com> On Thu, Dec 20, 2012 at 05:29:34PM +0200, Zeeshan Ali (Khattak) wrote: > As long as apps can choose between osinfo_install_config_new() or > osinfo_install_config_new_for_script() without any issues/side-affects > and we document (as you are doing in your patch) the difference > clearly, I'm OK with these changes. Great news, thanks! I'll resend the series with the latest changes mentioned in that thread integrated for a final review then. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Thu Dec 20 16:45:04 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:04 +0100 Subject: [Libosinfo] =?utf-8?q?=5BPATCHv4_01/11=5D_Add_OsinfoInstallConfig?= =?utf-8?q?Param=3A=3Avalue-map?= Message-ID: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> If set, this OsinfoDatamap value will be used to map generic values to OS-specific values. --- osinfo/osinfo_install_config_param.c | 71 +++++++++++++++++++++++++++++++++++- osinfo/osinfo_install_config_param.h | 3 ++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 8ba4e04..59a0048 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: + * Christophe Fergeau * Fabiano Fid?ncio */ @@ -43,11 +44,17 @@ G_DEFINE_TYPE (OsinfoInstallConfigParam, osinfo_install_config_param, OSINFO_TYP * object. */ +struct _OsinfoInstallConfigParamPrivate +{ + OsinfoDatamap *value_map; +}; + enum { PROP_0, PROP_NAME, PROP_POLICY, + PROP_VALUE_MAP }; static void @@ -65,6 +72,12 @@ osinfo_install_config_param_set_property(GObject *object, OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME, g_value_get_string(value)); break; + + case PROP_VALUE_MAP: + osinfo_install_config_param_set_value_map(config_param, + g_value_get_object(value)); + break; + default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -98,6 +111,9 @@ osinfo_install_config_param_get_property(GObject *object, g_value_set_enum(value, policy); break; } + case PROP_VALUE_MAP: + g_value_set_object(value, config_param->priv->value_map); + break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -105,6 +121,17 @@ osinfo_install_config_param_get_property(GObject *object, } } +static void +osinfo_install_config_param_finalize(GObject *object) +{ + OsinfoInstallConfigParam *config_param; + config_param = OSINFO_INSTALL_CONFIG_PARAM(object); + g_clear_object(&config_param->priv->value_map); + + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_param_parent_class)->finalize (object); +} + /* Init functions */ static void osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass) @@ -146,12 +173,30 @@ osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass) g_object_class_install_property(g_klass, PROP_POLICY, pspec); + /** + * OsinfoInstallConfigParam:value-map: + * + * The mapping between generic values and OS-specific values for this + * configuration parameter + **/ + pspec = g_param_spec_object("value-map", + "Value Mapping", + _("Parameter Value Mapping"), + OSINFO_TYPE_DATAMAP, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, + PROP_VALUE_MAP, + pspec); + + g_klass->finalize = osinfo_install_config_param_finalize; + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigParamPrivate)); } static void osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param) { - /* G_DEFINE_TYPE() needs an instance init function */ + config_param->priv = OSINFO_INSTALL_CONFIG_PARAM_GET_PRIVATE(config_param); } /** @@ -219,6 +264,30 @@ gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL); } +OsinfoDatamap *osinfo_install_config_param_get_value_map(const OsinfoInstallConfigParam *config_param) +{ + return config_param->priv->value_map; +} + +/** + * osinfo_install_config_param_set_value_map: + * @config_param: the configuration parameter + * @datamap: a #OsinfoDatamap to transform values this parameter is set to, + * or NULL to disable transformations for this parameter + * + * After a call to osinfo_install_config_param_set_value_map(), @datamap will + * be used to transform values set for this parameter to OS-specific + * values. A NULL @datamap will disable transformations. + */ +void osinfo_install_config_param_set_value_map(OsinfoInstallConfigParam *config_param, OsinfoDatamap *datamap) +{ + g_return_if_fail(OSINFO_IS_INSTALL_CONFIG_PARAM(config_param)); + + if (config_param->priv->value_map != NULL) + g_object_unref(G_OBJECT(config_param->priv->value_map)); + config_param->priv->value_map = g_object_ref(datamap); +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config_param.h b/osinfo/osinfo_install_config_param.h index 655c869..ba5a77c 100644 --- a/osinfo/osinfo_install_config_param.h +++ b/osinfo/osinfo_install_config_param.h @@ -88,6 +88,9 @@ gboolean osinfo_install_config_param_is_required(const OsinfoInstallConfigParam gboolean osinfo_install_config_param_is_optional(const OsinfoInstallConfigParam *config_param); +void osinfo_install_config_param_set_value_map(OsinfoInstallConfigParam *config_param, OsinfoDatamap *datamap); +OsinfoDatamap *osinfo_install_config_param_get_value_map(const OsinfoInstallConfigParam *config_param); + #endif /* __OSINFO_INSTALL_CONFIG_PARAM_H__ */ /* -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:05 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:05 +0100 Subject: [Libosinfo] [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-2-git-send-email-cfergeau@redhat.com> --- 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 @@ + + + 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 From cfergeau at redhat.com Thu Dec 20 16:45:06 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:06 +0100 Subject: [Libosinfo] [PATCHv4 03/11] Add OsinfoInstallConfigParamList In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-3-git-send-email-cfergeau@redhat.com> --- osinfo/Makefile.am | 160 ++++++++++++++++--------------- osinfo/libosinfo.syms | 4 + osinfo/osinfo.h | 1 + osinfo/osinfo_install_config_paramlist.c | 94 ++++++++++++++++++ osinfo/osinfo_install_config_paramlist.h | 79 +++++++++++++++ 5 files changed, 259 insertions(+), 79 deletions(-) create mode 100644 osinfo/osinfo_install_config_paramlist.c create mode 100644 osinfo/osinfo_install_config_paramlist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 1c9c3ae..9d03a34 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -53,87 +53,89 @@ libosinfo_1_0_la_DEPENDENCIES = libosinfo.syms libosinfo_1_0_includedir = $(includedir)/libosinfo-1.0/osinfo -OSINFO_HEADER_FILES = \ - osinfo.h \ - osinfo_avatar_format.h \ - osinfo_db.h \ - osinfo_loader.h \ - osinfo_datamap.h \ - osinfo_datamaplist.h \ - osinfo_device.h \ - osinfo_device_driver.h \ - osinfo_device_driverlist.h \ - osinfo_devicelink.h \ - osinfo_devicelist.h \ - osinfo_devicelinklist.h \ - osinfo_devicelinkfilter.h \ - osinfo_entity.h \ - osinfo_filter.h \ - osinfo_install_config.h \ - osinfo_install_config_param.h \ - osinfo_install_script.h \ - osinfo_install_scriptlist.h \ - osinfo_product.h \ - osinfo_productfilter.h \ - osinfo_productlist.h \ - osinfo_platform.h \ - osinfo_platformlist.h \ - osinfo_list.h \ - osinfo_os.h \ - osinfo_oslist.h \ - osinfo_deployment.h \ - osinfo_deploymentlist.h \ - osinfo_media.h \ - osinfo_media_private.h \ - osinfo_medialist.h \ - osinfo_resources.h \ - osinfo_resourceslist.h \ - osinfo_tree.h \ - osinfo_treelist.h \ +OSINFO_HEADER_FILES = \ + osinfo.h \ + osinfo_avatar_format.h \ + osinfo_db.h \ + osinfo_loader.h \ + osinfo_datamap.h \ + osinfo_datamaplist.h \ + osinfo_device.h \ + osinfo_devicelink.h \ + osinfo_devicelist.h \ + osinfo_devicelinklist.h \ + osinfo_devicelinkfilter.h \ + osinfo_device_driver.h \ + osinfo_device_driverlist.h \ + osinfo_entity.h \ + osinfo_filter.h \ + osinfo_install_config.h \ + osinfo_install_config_param.h \ + osinfo_install_config_paramlist.h \ + osinfo_install_script.h \ + osinfo_install_scriptlist.h \ + osinfo_product.h \ + osinfo_productfilter.h \ + osinfo_productlist.h \ + osinfo_platform.h \ + osinfo_platformlist.h \ + osinfo_list.h \ + osinfo_os.h \ + osinfo_oslist.h \ + osinfo_deployment.h \ + osinfo_deploymentlist.h \ + osinfo_media.h \ + osinfo_media_private.h \ + osinfo_medialist.h \ + osinfo_resources.h \ + osinfo_resourceslist.h \ + osinfo_tree.h \ + osinfo_treelist.h \ $(NULL) -libosinfo_1_0_include_HEADERS = \ - $(OSINFO_HEADER_FILES) \ - osinfo_enum_types.h - -libosinfo_1_0_la_SOURCES = \ - osinfo_avatar_format.c \ - osinfo_datamap.c \ - osinfo_datamaplist.c \ - osinfo_entity.c \ - osinfo_enum_types.c \ - osinfo_filter.c \ - osinfo_list.c \ - osinfo_device.c \ - osinfo_device_driver.c \ - osinfo_device_driver_private.h \ - osinfo_device_driverlist.c \ - osinfo_devicelink.c \ - osinfo_devicelist.c \ - osinfo_devicelinklist.c \ - osinfo_devicelinkfilter.c \ - osinfo_install_config.c \ - osinfo_install_config_param.c \ - osinfo_install_script.c \ - osinfo_install_script_private.h \ - osinfo_install_scriptlist.c \ - osinfo_product.c \ - osinfo_productfilter.c \ - osinfo_productlist.c \ - osinfo_platform.c \ - osinfo_platformlist.c \ - osinfo_oslist.c \ - osinfo_os.c \ - osinfo_deployment.c \ - osinfo_deploymentlist.c \ - osinfo_media.c \ - osinfo_medialist.c \ - osinfo_resources.c \ - osinfo_resourceslist.c \ - osinfo_tree.c \ - osinfo_treelist.c \ - osinfo_db.c \ - osinfo_loader.c \ +libosinfo_1_0_include_HEADERS = \ + $(OSINFO_HEADER_FILES) \ + osinfo_enum_types.h \ + $(NULL) + +libosinfo_1_0_la_SOURCES = \ + osinfo_avatar_format.c \ + osinfo_datamap.c \ + osinfo_datamaplist.c \ + osinfo_entity.c \ + osinfo_enum_types.c \ + osinfo_filter.c \ + osinfo_list.c \ + osinfo_device.c \ + osinfo_devicelink.c \ + osinfo_devicelist.c \ + osinfo_devicelinklist.c \ + osinfo_devicelinkfilter.c \ + osinfo_device_driver.c \ + osinfo_device_driverlist.c \ + osinfo_install_config.c \ + osinfo_install_config_param.c \ + osinfo_install_config_paramlist.c \ + osinfo_install_script.c \ + osinfo_install_script_private.h \ + osinfo_install_scriptlist.c \ + osinfo_product.c \ + osinfo_productfilter.c \ + osinfo_productlist.c \ + osinfo_platform.c \ + osinfo_platformlist.c \ + osinfo_oslist.c \ + osinfo_os.c \ + osinfo_deployment.c \ + osinfo_deploymentlist.c \ + osinfo_media.c \ + osinfo_medialist.c \ + osinfo_resources.c \ + osinfo_resourceslist.c \ + osinfo_tree.c \ + osinfo_treelist.c \ + osinfo_db.c \ + osinfo_loader.c \ $(NULL) osinfo_enum_types.h: $(OSINFO_HEADER_FILES) osinfo_enum_types.h.template diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index c2edf90..67d6d07 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,10 +388,14 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + osinfo_install_config_paramlist_get_type; + osinfo_install_config_paramlist_new; + osinfo_install_script_generate_output_finish; osinfo_media_get_languages; osinfo_media_get_os; + } LIBOSINFO_0.2.2; /* Symbols in next release... diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 13b5a0b..1012ede 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_install_config_paramlist.c b/osinfo/osinfo_install_config_paramlist.c new file mode 100644 index 0000000..d3eeffc --- /dev/null +++ b/osinfo/osinfo_install_config_paramlist.c @@ -0,0 +1,94 @@ +/* + * libosinfo: a list of installation configuration parameters + * + * Copyright (C) 2009-2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Arjun Roy + * Christophe Fergeau + * Daniel P. Berrange + */ + +#include + +#include +#include + +G_DEFINE_TYPE (OsinfoInstallConfigParamList, osinfo_install_config_paramlist, OSINFO_TYPE_LIST); + +#define OSINFO_INSTALL_CONFIG_PARAMLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListPrivate)) + +/** + * SECTION:osinfo_install_config_paramlist + * @short_description: A list of installation install_config_param + * @see_also: #OsinfoList, #OsinfoInstallConfigParam + * + * #OsinfoInstallConfigParamList is a list specialization that stores + * only #OsinfoInstallConfigParam objects. + */ + +struct _OsinfoInstallConfigParamListPrivate +{ + gboolean unused; +}; + +static void +osinfo_install_config_paramlist_finalize (GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_paramlist_parent_class)->finalize (object); +} + +/* Init functions */ +static void +osinfo_install_config_paramlist_class_init (OsinfoInstallConfigParamListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS (klass); + + g_klass->finalize = osinfo_install_config_paramlist_finalize; + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigParamListPrivate)); +} + +static void +osinfo_install_config_paramlist_init (OsinfoInstallConfigParamList *list) +{ + OsinfoInstallConfigParamListPrivate *priv; + list->priv = priv = OSINFO_INSTALL_CONFIG_PARAMLIST_GET_PRIVATE(list); + +} + +/** + * osinfo_install_config_paramlist_new: + * + * Construct a new install_config_param list that is initially empty. + * + * Returns: (transfer full): an empty install_config_param list + */ +OsinfoInstallConfigParamList *osinfo_install_config_paramlist_new(void) +{ + return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, + "element-type", OSINFO_TYPE_INSTALL_CONFIG_PARAM, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_install_config_paramlist.h b/osinfo/osinfo_install_config_paramlist.h new file mode 100644 index 0000000..81254c3 --- /dev/null +++ b/osinfo/osinfo_install_config_paramlist.h @@ -0,0 +1,79 @@ +/* + * libosinfo: a list of installation configuration parameters + * + * Copyright (C) 2009-2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Arjun Roy + * Christophe Fergeau + * Daniel P. Berrange + * Zeeshan Ali + */ + +#include +#include + +#ifndef __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ +#define __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST (osinfo_install_config_paramlist_get_type ()) +#define OSINFO_INSTALL_CONFIG_PARAMLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamList)) +#define OSINFO_IS_INSTALL_CONFIG_PARAMLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST)) +#define OSINFO_INSTALL_CONFIG_PARAMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListClass)) +#define OSINFO_IS_INSTALL_CONFIG_PARAMLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST)) +#define OSINFO_INSTALL_CONFIG_PARAMLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, OsinfoInstallConfigParamListClass)) + +typedef struct _OsinfoInstallConfigParamList OsinfoInstallConfigParamList; + +typedef struct _OsinfoInstallConfigParamListClass OsinfoInstallConfigParamListClass; + +typedef struct _OsinfoInstallConfigParamListPrivate OsinfoInstallConfigParamListPrivate; + +/* object */ +struct _OsinfoInstallConfigParamList +{ + OsinfoList parent_instance; + + /* public */ + + /* private */ + OsinfoInstallConfigParamListPrivate *priv; +}; + +/* class */ +struct _OsinfoInstallConfigParamListClass +{ + OsinfoListClass parent_class; + + /* class members */ +}; + +GType osinfo_install_config_paramlist_get_type(void); + +OsinfoInstallConfigParamList *osinfo_install_config_paramlist_new(void); + +#endif /* __OSINFO_INSTALL_CONFIG_PARAMLIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:07 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:07 +0100 Subject: [Libosinfo] [PATCHv4 04/11] Set id in osinfo_install_config_param_new In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-4-git-send-email-cfergeau@redhat.com> OsinfoInstallConfigParam is an OsinfoEntity, but its _new method does not set an id when creating it. This is needed if we want to be able to use an OsinfoInstallConfigParamList. The "name" argument that is passed at creation time is expected to be unique, so we can use that as the entity id even though a full URI would have been nicer. --- osinfo/osinfo_install_config_param.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c index 59a0048..541f066 100644 --- a/osinfo/osinfo_install_config_param.c +++ b/osinfo/osinfo_install_config_param.c @@ -209,7 +209,10 @@ osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param) */ OsinfoInstallConfigParam *osinfo_install_config_param_new(const gchar *name) { - return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAM, "name", name, NULL); + return g_object_new(OSINFO_TYPE_INSTALL_CONFIG_PARAM, + "id", name, + "name", name, + NULL); } /** -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:08 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:08 +0100 Subject: [Libosinfo] [PATCHv4 05/11] OsinfoInstallScript: Use an OsinfoInstallConfigParamList In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-5-git-send-email-cfergeau@redhat.com> Currently the install script config parameters are stored in a raw GList. However, OsinfoInstallScript ends up reimplementing part of the OsinfoList API, and the raw GList also does not make it convenient to pass the list of config parameters around. Replace the internal GList with an OsinfoInstallConfigParamList, which has the side-effect of nicely simplifying the code. --- osinfo/libosinfo.syms | 1 + osinfo/osinfo_install_script.c | 74 ++++++++++++++++++++++-------------------- osinfo/osinfo_install_script.h | 1 + 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 67d6d07..4615829 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -392,6 +392,7 @@ LIBOSINFO_0.2.3 { osinfo_install_config_paramlist_new; osinfo_install_script_generate_output_finish; + osinfo_install_script_get_config_params; osinfo_media_get_languages; osinfo_media_get_os; diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 0ade99f..b82c0f9 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -51,7 +51,7 @@ struct _OsinfoInstallScriptPrivate { gchar *output_prefix; gchar *output_filename; - GList *config_param_list; + OsinfoInstallConfigParamList *config_params; OsinfoAvatarFormat *avatar; }; @@ -165,8 +165,11 @@ osinfo_install_script_finalize (GObject *object) OsinfoInstallScript *script = OSINFO_INSTALL_SCRIPT (object); g_free(script->priv->output_prefix); g_free(script->priv->output_filename); - g_list_free_full(script->priv->config_param_list, g_object_unref); - if (script->priv->avatar != NULL) + + if (script->priv->config_params) + g_object_unref(script->priv->config_params); + + if (script->priv->avatar) g_object_unref(script->priv->avatar); /* Chain up to the parent class */ @@ -259,35 +262,23 @@ void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoI g_return_if_fail(OSINFO_IS_INSTALL_SCRIPT(script)); g_return_if_fail(OSINFO_IS_INSTALL_CONFIG_PARAM(param)); - script->priv->config_param_list = - g_list_prepend(script->priv->config_param_list, param); + osinfo_list_add(OSINFO_LIST(script->priv->config_params), + OSINFO_ENTITY(param)); } gboolean osinfo_install_script_has_config_param(const OsinfoInstallScript *script, const OsinfoInstallConfigParam *config_param) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), - osinfo_install_config_param_get_name(config_param)) == 0) - return TRUE; - } - return FALSE; + /* NB: this code assumes that the 'id' and 'name' entity properties + * are the same + */ + const char *name = osinfo_install_config_param_get_name(config_param); + return osinfo_install_script_has_config_param_name(script, name); } gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript *script, const gchar *name) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), name) == 0) - return TRUE; - } - return FALSE; + OsinfoList *l = OSINFO_LIST(script->priv->config_params); + return (osinfo_list_find_by_id(l, name) != NULL); } /** @@ -301,7 +292,20 @@ gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript * */ GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script) { - return g_list_copy(script->priv->config_param_list); + return osinfo_list_get_elements(OSINFO_LIST(script->priv->config_params)); +} + +/** + * osinfo_install_script_get_config_params: + * + * Get the list of valid config parameters for @script. + * + * Returns: (transfer none): the list of valid #OsinfoInstallConfigParam + * parameters. + */ +OsinfoInstallConfigParamList *osinfo_install_script_get_config_params(const OsinfoInstallScript *script) +{ + return script->priv->config_params; } /** @@ -318,16 +322,16 @@ OsinfoInstallConfigParam * osinfo_install_script_get_config_param(const OsinfoInstallScript *script, const gchar *name) { - GList *l; - - for (l = script->priv->config_param_list; l != NULL; l = l->next) { - OsinfoInstallConfigParam *tmp = l->data; - - if (g_strcmp0(osinfo_install_config_param_get_name(tmp), name) == 0) - return g_object_ref(tmp); - } + /* NB: this code assumes that the 'id' and 'name' entity properties + * are the same + */ + OsinfoInstallConfigParam *param; + OsinfoList *l = OSINFO_LIST(script->priv->config_params); + param = OSINFO_INSTALL_CONFIG_PARAM(osinfo_list_find_by_id(l, name)); + if (param == NULL) + return NULL; - return NULL; + return g_object_ref(G_OBJECT(param)); } static void @@ -336,7 +340,7 @@ osinfo_install_script_init (OsinfoInstallScript *list) OsinfoInstallScriptPrivate *priv; list->priv = priv = OSINFO_INSTALL_SCRIPT_GET_PRIVATE(list); - list->priv->config_param_list = NULL; + list->priv->config_params = osinfo_install_config_paramlist_new(); } diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h index f610716..d91751e 100644 --- a/osinfo/osinfo_install_script.h +++ b/osinfo/osinfo_install_script.h @@ -157,6 +157,7 @@ OsinfoInstallConfigParam *osinfo_install_script_get_config_param(const OsinfoIns void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoInstallConfigParam *param); GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script); +OsinfoInstallConfigParamList *osinfo_install_script_get_config_params(const OsinfoInstallScript *script); OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *script); gboolean osinfo_install_script_get_can_pre_install_drivers(OsinfoInstallScript *script); -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:09 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:09 +0100 Subject: [Libosinfo] [PATCHv4 06/11] Add OsinfoInstallConfig:config-params property In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-6-git-send-email-cfergeau@redhat.com> This property lists the parameters that can be set for a given OsinfoInstallConfig. This is not enforced, it's only there for informative purpose. This will also be used in later commits in order to automatically apply transformations on values for parameters which have an associated OsinfoDatamap. --- osinfo/Makefile.am | 1 + osinfo/libosinfo.syms | 2 + osinfo/osinfo_install_config.c | 96 +++++++++++++++++++++++++++++++++- osinfo/osinfo_install_config.h | 5 ++ osinfo/osinfo_install_config_private.h | 39 ++++++++++++++ 5 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 osinfo/osinfo_install_config_private.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 9d03a34..9f3c20d 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -116,6 +116,7 @@ libosinfo_1_0_la_SOURCES = \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ + osinfo_install_config_private.h \ osinfo_install_script.c \ osinfo_install_script_private.h \ osinfo_install_scriptlist.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 4615829..a32a8b7 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,6 +388,8 @@ LIBOSINFO_0.2.3 { osinfo_db_get_datamap_list; osinfo_db_identify_media; + osinfo_install_config_get_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 219a8e2..a77317b 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -24,6 +24,7 @@ #include #include +#include "osinfo/osinfo_install_config_private.h" #include G_DEFINE_TYPE (OsinfoInstallConfig, osinfo_install_config, OSINFO_TYPE_ENTITY); @@ -42,14 +43,91 @@ G_DEFINE_TYPE (OsinfoInstallConfig, osinfo_install_config, OSINFO_TYPE_ENTITY); struct _OsinfoInstallConfigPrivate { - gboolean unused; + OsinfoInstallConfigParamList *config_params; }; +enum { + PROP_0, + + PROP_CONFIG_PARAMS, +}; + +static void +osinfo_install_config_set_property(GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG(object); + + switch (property_id) { + case PROP_CONFIG_PARAMS: + osinfo_install_config_set_config_params(config, g_value_get_object(value)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +osinfo_install_config_get_property(GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG(object); + + switch (property_id) { + case PROP_CONFIG_PARAMS: + g_value_set_object(value, osinfo_install_config_get_config_params(config)); + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void +osinfo_install_config_finalize (GObject *object) +{ + OsinfoInstallConfig *config = OSINFO_INSTALL_CONFIG (object); + + if (config->priv->config_params) + g_object_unref(config->priv->config_params); + + /* Chain up to the parent class */ + G_OBJECT_CLASS (osinfo_install_config_parent_class)->finalize (object); +} + /* Init functions */ static void osinfo_install_config_class_init (OsinfoInstallConfigClass *klass) { + GObjectClass *g_klass = G_OBJECT_CLASS (klass); + GParamSpec *pspec; + + g_klass->get_property = osinfo_install_config_get_property; + g_klass->set_property = osinfo_install_config_set_property; + g_klass->finalize = osinfo_install_config_finalize; + + pspec = g_param_spec_object("config-params", + "Config Parameters", + _("Valid configuration parameters"), + OSINFO_TYPE_INSTALL_CONFIG_PARAMLIST, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, + PROP_CONFIG_PARAMS, + pspec); + g_type_class_add_private (klass, sizeof (OsinfoInstallConfigPrivate)); } @@ -643,6 +721,22 @@ const gchar *osinfo_install_config_get_post_install_drivers_location(OsinfoInsta OSINFO_INSTALL_CONFIG_PROP_POST_INSTALL_DRIVERS_LOCATION); } +void osinfo_install_config_set_config_params(OsinfoInstallConfig *config, + OsinfoInstallConfigParamList *config_params) +{ + if (config->priv->config_params != NULL) + g_object_unref(config->priv->config_params); + if (config_params != NULL) + config->priv->config_params = g_object_ref(G_OBJECT(config_params)); + else + config->priv->config_params = NULL; +} + +OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInstallConfig *config) +{ + return config->priv->config_params; +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h index d650a0a..caf5518 100644 --- a/osinfo/osinfo_install_config.h +++ b/osinfo/osinfo_install_config.h @@ -22,6 +22,7 @@ */ #include +#include #ifndef __OSINFO_INSTALL_CONFIG_H__ #define __OSINFO_INSTALL_CONFIG_H__ @@ -182,6 +183,7 @@ const gchar *osinfo_install_config_get_avatar_disk(OsinfoInstallConfig *config); void osinfo_install_config_set_pre_install_drivers_disk(OsinfoInstallConfig *config, const gchar *disk); const gchar *osinfo_install_config_get_pre_install_drivers_disk(OsinfoInstallConfig *config); + void osinfo_install_config_set_pre_install_drivers_location(OsinfoInstallConfig *config, const gchar *location); const gchar *osinfo_install_config_get_pre_install_drivers_location(OsinfoInstallConfig *config); @@ -189,10 +191,13 @@ const gchar *osinfo_install_config_get_pre_install_drivers_location(OsinfoInstal void osinfo_install_config_set_post_install_drivers_disk(OsinfoInstallConfig *config, const gchar *disk); const gchar *osinfo_install_config_get_post_install_drivers_disk(OsinfoInstallConfig *config); + void osinfo_install_config_set_post_install_drivers_location(OsinfoInstallConfig *config, const gchar *location); const gchar *osinfo_install_config_get_post_install_drivers_location(OsinfoInstallConfig *config); +OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInstallConfig *config); + #endif /* __OSINFO_INSTALL_CONFIG_H__ */ /* * Local variables: diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h new file mode 100644 index 0000000..5a1edd3 --- /dev/null +++ b/osinfo/osinfo_install_config_private.h @@ -0,0 +1,39 @@ +/* + * libosinfo: OS installation config + * + * Copyright (C) 2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Christophe Fergeau + */ + +#include + +#ifndef __OSINFO_INSTALL_CONFIG_PRIVATE_H__ +#define __OSINFO_INSTALL_CONFIG_PRIVATE_H__ + +void osinfo_install_config_set_config_params(OsinfoInstallConfig *config, + OsinfoInstallConfigParamList *config_params); + +#endif /* __OSINFO_INSTALL_CONFIG_PRIVATE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:10 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:10 +0100 Subject: [Libosinfo] [PATCHv4 07/11] OsinfoInstallConfig: Use config-params if set In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-7-git-send-email-cfergeau@redhat.com> Now that OsinfoInstallConfig has a 'config-params' property which describes the config parameters when it's set, we can use it when it's available. OsinfoInstallConfigParams can indeed contain a datamap to be used to translate generic libosinfo values to OS-specific values. This commit introduces an osinfo_install_config_get_param_value_list method that will be used in subsequent commits to get these OS-specific values when generating install scripts. --- osinfo/osinfo_install_config.c | 84 ++++++++++++++++++++++++++++++++++ osinfo/osinfo_install_config_private.h | 1 + 2 files changed, 85 insertions(+) diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index a77317b..4c42746 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -737,6 +737,90 @@ OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInst return config->priv->config_params; } + +static const gchar * +osinfo_install_config_transform_value(OsinfoInstallConfig *config, + const gchar *key, + const gchar *value) +{ + OsinfoDatamap *map; + OsinfoEntity *entity; + OsinfoInstallConfigParam *param; + const gchar *transformed_value; + + if (!config->priv->config_params) + return value; + + entity = osinfo_list_find_by_id(OSINFO_LIST(config->priv->config_params), + key); + if (entity == NULL) { + g_warning("%s is not a known parameter for this config", key); + return value; + } + + param = OSINFO_INSTALL_CONFIG_PARAM(entity);; + map = osinfo_install_config_param_get_value_map(param); + if (map == NULL) { + g_debug("no remapping to be done for %s", key); + return value; + } + transformed_value = osinfo_datamap_lookup(map, value); + if (transformed_value == NULL) { + g_warning("value not present in %s datamap: %s", key, value); + return value; + } + + return transformed_value; +} + +static GHashTable *get_remapped_keys_once(void) +{ + const char *remapped_properties[] = { + OSINFO_INSTALL_CONFIG_PROP_HARDWARE_ARCH, + OSINFO_INSTALL_CONFIG_PROP_L10N_KEYBOARD, + OSINFO_INSTALL_CONFIG_PROP_L10N_LANGUAGE, + OSINFO_INSTALL_CONFIG_PROP_L10N_TIMEZONE, + NULL + }; + const char **it; + GHashTable *remapped_keys; + + remapped_keys = g_hash_table_new(g_str_hash, g_str_equal); + for (it = remapped_properties; *it != NULL; it++) { + g_hash_table_add(remapped_keys, (gpointer)*it); + } + + return remapped_keys; +} + +GList * +osinfo_install_config_get_param_value_list(OsinfoInstallConfig *config, + const gchar *key) +{ + GList *values; + GList *it; + static GOnce remapped_keys_once = G_ONCE_INIT; + GHashTable *remapped_keys; + + values = osinfo_entity_get_param_value_list(OSINFO_ENTITY(config), key); + if (values == NULL) + return NULL; + + remapped_keys = g_once(&remapped_keys_once, + (GThreadFunc)get_remapped_keys_once, + NULL); + if (!g_hash_table_contains(remapped_keys, key)) + return values; + + for (it = values; it != NULL; it = it->next) { + it->data = (gpointer)osinfo_install_config_transform_value(config, + key, + it->data); + } + + return values; +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h index 5a1edd3..5ad2162 100644 --- a/osinfo/osinfo_install_config_private.h +++ b/osinfo/osinfo_install_config_private.h @@ -28,6 +28,7 @@ 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); #endif /* __OSINFO_INSTALL_CONFIG_PRIVATE_H__ */ /* -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:11 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:11 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Add osinfo_install_config_new_for_script In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-8-git-send-email-cfergeau@redhat.com> 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/libosinfo.syms | 1 + osinfo/osinfo_install_config.c | 36 +++++++++++++++++++++++++++++++++--- osinfo/osinfo_install_config.h | 4 ++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index a32a8b7..efea371 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -388,6 +388,7 @@ 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_paramlist_get_type; diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index 4c42746..e61bfb6 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -189,9 +189,39 @@ 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); +} + + +/** + * 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) +{ + 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 caf5518..112860b 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 + /* object */ struct _OsinfoInstallConfig { @@ -95,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); -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:12 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:12 +0100 Subject: [Libosinfo] [PATCHv4 09/11] Set OsinfoInstallConfig:config-params in osinfo_install_script_apply_template In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-9-git-send-email-cfergeau@redhat.com> This allows translation of generic config to OS-specific config if the install script XML specified some datamaps to transform these parameters. --- osinfo/osinfo_install_script.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index b82c0f9..0591708 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -30,6 +30,7 @@ #include #include #include +#include "osinfo_install_config_private.h" #include "osinfo_install_script_private.h" G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY); @@ -758,6 +759,33 @@ static gchar *osinfo_install_script_apply_xslt(xsltStylesheetPtr ss, } +static OsinfoInstallConfig *create_config_for_script(OsinfoInstallScript *script, OsinfoInstallConfig *config) +{ + OsinfoInstallConfig *os_config; + GList *params; + GList *param; + const gchar *id; + + id = osinfo_entity_get_id(OSINFO_ENTITY(config)); + os_config = osinfo_install_config_new_for_script(id, script); + params = osinfo_entity_get_param_keys(OSINFO_ENTITY(config)); + for (param = params; param != NULL; param = param->next) { + GList *values; + GList *value; + + osinfo_entity_clear_param(OSINFO_ENTITY(os_config), param->data); + values = osinfo_entity_get_param_value_list(OSINFO_ENTITY(config), param->data); + for (value = values; value != NULL; value = value->next) { + osinfo_entity_add_param(OSINFO_ENTITY(os_config), param->data, value->data); + } + g_list_free(values); + } + g_list_free(params); + + return os_config; +} + + static gboolean osinfo_install_script_apply_template(OsinfoInstallScript *script, OsinfoOs *os, const gchar *templateUri, @@ -767,8 +795,10 @@ static gboolean osinfo_install_script_apply_template(OsinfoInstallScript *script GError **error) { gboolean ret = FALSE; + OsinfoInstallConfig *os_config = create_config_for_script(script, config); xsltStylesheetPtr templateXsl = osinfo_install_script_load_template(templateUri, template, error); - xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, config, error); + xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, os_config, error); + g_object_unref(G_OBJECT(os_config)); if (!templateXsl || !configXml) goto cleanup; -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:13 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:13 +0100 Subject: [Libosinfo] [PATCHv4 10/11] Use OS-specific config in OsinfoInstallScript In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-10-git-send-email-cfergeau@redhat.com> When generating the unattended installation script, we can now use osinfo_install_config_get_param_list() to get OS-specific values when available. This will only work when an OsinfoInstallConfigParamList is associated with the OsinfoInstallConfig being processed. --- osinfo/osinfo_install_script.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 0591708..70d6b1d 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -637,9 +637,15 @@ static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConf tmp1 = keys = osinfo_entity_get_param_keys(entity); while (tmp1) { - GList *values = osinfo_entity_get_param_value_list(entity, tmp1->data); - GList *tmp2 = values; + GList *values; + GList *tmp2; + + 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); + tmp2 = values; while (tmp2) { if (!(data = xmlNewDocNode(NULL, NULL, (const xmlChar*)tmp1->data, (const xmlChar*)tmp2->data))) { -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 16:45:14 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 17:45:14 +0100 Subject: [Libosinfo] [PATCHv4 11/11] test: Add test for param remapping in install scripts In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <1356021914-16369-11-git-send-email-cfergeau@redhat.com> --- test/dbdata/datamaps/test-datamap.xml | 20 ++++++ .../dbdata/install-scripts/test-install-script.xml | 26 +++++++ test/test-install-script.c | 84 ++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 test/dbdata/datamaps/test-datamap.xml create mode 100644 test/dbdata/install-scripts/test-install-script.xml diff --git a/test/dbdata/datamaps/test-datamap.xml b/test/dbdata/datamaps/test-datamap.xml new file mode 100644 index 0000000..16c5116 --- /dev/null +++ b/test/dbdata/datamaps/test-datamap.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/test/dbdata/install-scripts/test-install-script.xml b/test/dbdata/install-scripts/test-install-script.xml new file mode 100644 index 0000000..48469ef --- /dev/null +++ b/test/dbdata/install-scripts/test-install-script.xml @@ -0,0 +1,26 @@ + + + + jeos + test.ks + + + + + + + + diff --git a/test/test-install-script.c b/test/test-install-script.c index 6abeeb3..4a3f16a 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -56,6 +56,12 @@ static const gchar *expectData = \ "%end\n" \ " "; +static const gchar *expectData2 = \ + "\n" \ + "keyboard FOOBAR\n" \ + "lang French\n" \ + "timezone --utc Europe/Paris"; + static void test_generate_finish(GObject *src, GAsyncResult *res, gpointer user_data) @@ -172,6 +178,83 @@ START_TEST(test_script_data) } END_TEST +START_TEST(test_script_datamap) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + OsinfoOs *os; + OsinfoInstallScript *script; + OsinfoInstallConfig *config; + GMainLoop *loop; + + osinfo_loader_process_path(loader, SRCDIR "/test/dbdata", &error); + fail_unless(error == NULL, error ? error->message : "none"); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + fail_unless(osinfo_db_get_datamap(db, "http://example.com/libosinfo/test-datamap") != NULL, "Could not find OsinfoDatamap 'test-datamap'"); + fail_unless(osinfo_db_get_datamap(db, "http://example.com/libosinfo/test-datamap2") != NULL, "Could not find OsinfoDatamap 'test-datamap2'"); + script = osinfo_db_get_install_script(db, "http://example.com/libosinfo/test-install-script"); + fail_unless(script != NULL, "Could not find OsinfoInstallScript 'test-install-script'"); + + config = osinfo_install_config_new("http://example.com"); + + osinfo_install_config_set_l10n_keyboard(config, "unknown"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "unknown") == 0, + "Got %s instead of 'unknown'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val1"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val1") == 0, + "Got %s instead of 'val1'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val2"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val2") == 0, + "Got %s instead of 'val2'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "val3"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "val3") == 0, + "Got %s instead of 'val3'", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_keyboard(config, "VAL1"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_keyboard(config), "VAL1") == 0, + "Got %s instead of 'VAL1", osinfo_install_config_get_l10n_keyboard(config)); + + osinfo_install_config_set_l10n_language(config, "en_EN"); + fail_unless(g_strcmp0(osinfo_install_config_get_l10n_language(config), "en_EN") == 0, + "Got %s instead of 'en_EN'", osinfo_install_config_get_l10n_language(config)); + osinfo_install_config_set_l10n_language(config, "fr_FR"); + osinfo_install_config_set_l10n_timezone(config, "Europe/Paris"); + + + os = osinfo_os_new("http://fedoraproject.org/fedora/16"); + osinfo_entity_set_param(OSINFO_ENTITY(os), + OSINFO_PRODUCT_PROP_SHORT_ID, + "fedora16"); + + loop = g_main_loop_new (g_main_context_get_thread_default (), + TRUE); + + osinfo_install_script_generate_async(script, + os, + config, + NULL, + test_generate_finish, + loop); + + if (g_main_loop_is_running(loop)) + g_main_loop_run(loop); + + unlink(BUILDDIR "/test/install-script-actual.txt"); + fail_unless(error == NULL, error ? error->message : "none"); + + fail_unless(strcmp(actualData, expectData2) == 0, "Actual '%s' match expect '%s'", + actualData, expectData2); + + g_object_unref(db); + g_object_unref(os); + g_object_unref(config); +} +END_TEST static Suite * @@ -183,6 +266,7 @@ list_suite(void) tcase_add_test(tc, test_script_file); tcase_add_test(tc, test_script_data); + tcase_add_test(tc, test_script_datamap); suite_add_tcase(s, tc); return s; } -- 1.8.0.2 From cfergeau at redhat.com Thu Dec 20 17:03:22 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 20 Dec 2012 18:03:22 +0100 Subject: [Libosinfo] [PATCHv4 01/11] Add OsinfoInstallConfigParam::value-map In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <20121220170321.GG2047@teriyaki.redhat.com> Hmm, this was meant to be v5, sorry about that. Changes since previous series is that osinfo_install_config_new_for_script is exported, and osinfo_install_config_set_config_params is private now. I've also addressed some of Zeeshan's comments from the previous posting. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Fri Dec 21 00:17:16 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 02:17:16 +0200 Subject: [Libosinfo] [PATCHv4 07/11] OsinfoInstallConfig: Use config-params if set In-Reply-To: <1356021914-16369-7-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> <1356021914-16369-7-git-send-email-cfergeau@redhat.com> Message-ID: On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau wrote: > Now that OsinfoInstallConfig has a 'config-params' property > which describes the config parameters when it's set, we can > use it when it's available. OsinfoInstallConfigParams can indeed > contain a datamap to be used to translate generic libosinfo values > to OS-specific values. > This commit introduces an osinfo_install_config_get_param_value_list > method that will be used in subsequent commits to get these > OS-specific values when generating install scripts. > --- > osinfo/osinfo_install_config.c | 84 ++++++++++++++++++++++++++++++++++ > osinfo/osinfo_install_config_private.h | 1 + > 2 files changed, 85 insertions(+) > > diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c > index a77317b..4c42746 100644 > --- a/osinfo/osinfo_install_config.c > +++ b/osinfo/osinfo_install_config.c > @@ -737,6 +737,90 @@ OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInst > return config->priv->config_params; > } > > + > +static const gchar * > +osinfo_install_config_transform_value(OsinfoInstallConfig *config, > + const gchar *key, > + const gchar *value) > +{ > + OsinfoDatamap *map; > + OsinfoEntity *entity; > + OsinfoInstallConfigParam *param; > + const gchar *transformed_value; > + > + if (!config->priv->config_params) > + return value; > + > + entity = osinfo_list_find_by_id(OSINFO_LIST(config->priv->config_params), > + key); > + if (entity == NULL) { > + g_warning("%s is not a known parameter for this config", key); > + return value; > + } > + > + param = OSINFO_INSTALL_CONFIG_PARAM(entity);; > + map = osinfo_install_config_param_get_value_map(param); > + if (map == NULL) { > + g_debug("no remapping to be done for %s", key); > + return value; > + } > + transformed_value = osinfo_datamap_lookup(map, value); > + if (transformed_value == NULL) { > + g_warning("value not present in %s datamap: %s", key, value); > + return value; > + } > + > + return transformed_value; > +} > + > +static GHashTable *get_remapped_keys_once(void) Two questions: 1. Do we really need this hashtable here and hardcode the params that will be transformed? It seems to me that osinfo_install_config_transform_value() can work just fine without it, depending on whether or not the config param in question has a datamap associated or not. 2. Wouldn't the code be more simpler with this hashtable initialization in class_init (so you dont have to to use GOnce API)? Both these apply to internal code only so answer to these questions shouldn't block these patches to be pushed already. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Fri Dec 21 00:21:57 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 02:21:57 +0200 Subject: [Libosinfo] [PATCHv4 08/11] Add osinfo_install_config_new_for_script In-Reply-To: <1356021914-16369-8-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> <1356021914-16369-8-git-send-email-cfergeau@redhat.com> Message-ID: On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau wrote: > 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/libosinfo.syms | 1 + > osinfo/osinfo_install_config.c | 36 +++++++++++++++++++++++++++++++++--- > osinfo/osinfo_install_config.h | 4 ++++ > 3 files changed, 38 insertions(+), 3 deletions(-) > > diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms > index a32a8b7..efea371 100644 > --- a/osinfo/libosinfo.syms > +++ b/osinfo/libosinfo.syms > @@ -388,6 +388,7 @@ 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_paramlist_get_type; > diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c > index 4c42746..e61bfb6 100644 > --- a/osinfo/osinfo_install_config.c > +++ b/osinfo/osinfo_install_config.c > @@ -189,9 +189,39 @@ 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); > +} > + > + > +/** > + * 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) > +{ > + OsinfoInstallConfigParamList *params = NULL; > + OsinfoInstallConfig *config; > + > + if (script != NULL) > + params = osinfo_install_script_get_config_params(script); > + I don't think it makes sense to have script argument nullable here but no strong feelings. If you disagree, you want to add gir annotation in the doc comment. Either way, you can just change it before pushing. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From zeeshanak at gnome.org Fri Dec 21 00:30:08 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 02:30:08 +0200 Subject: [Libosinfo] [PATCHv4 01/11] Add OsinfoInstallConfigParam::value-map In-Reply-To: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau wrote: > If set, this OsinfoDatamap value will be used to map generic > values to OS-specific values. > --- ACK to the series. We can discuss the questions/issues I pointed out still and change things if needed but you can push these changes already. -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Fri Dec 21 09:53:06 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 21 Dec 2012 10:53:06 +0100 Subject: [Libosinfo] [PATCHv4 08/11] Add osinfo_install_config_new_for_script In-Reply-To: References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> <1356021914-16369-8-git-send-email-cfergeau@redhat.com> Message-ID: <20121221095305.GC2323@teriyaki.redhat.com> On Fri, Dec 21, 2012 at 02:21:57AM +0200, Zeeshan Ali (Khattak) wrote: > > diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c > > index 4c42746..e61bfb6 100644 > > --- a/osinfo/osinfo_install_config.c > > +++ b/osinfo/osinfo_install_config.c > > @@ -189,9 +189,39 @@ 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); > > +} > > + > > + > > +/** > > + * 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) > > +{ > > + OsinfoInstallConfigParamList *params = NULL; > > + OsinfoInstallConfig *config; > > + > > + if (script != NULL) > > + params = osinfo_install_script_get_config_params(script); > > + > > I don't think it makes sense to have script argument nullable here but > no strong feelings. If you disagree, you want to add gir annotation in > the doc comment. Either way, you can just change it before pushing. osinfo_install_config_new is calling it with a NULL script. Given that without that call, it's a one-liner, I'll change the code to forbid NULL scripts. Christophe > > -- > Regards, > > Zeeshan Ali (Khattak) > FSF member#5124 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Fri Dec 21 09:59:40 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 21 Dec 2012 10:59:40 +0100 Subject: [Libosinfo] [PATCHv4 07/11] OsinfoInstallConfig: Use config-params if set In-Reply-To: References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> <1356021914-16369-7-git-send-email-cfergeau@redhat.com> Message-ID: <20121221095940.GD2323@teriyaki.redhat.com> On Fri, Dec 21, 2012 at 02:17:16AM +0200, Zeeshan Ali (Khattak) wrote: > On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau wrote: > > Now that OsinfoInstallConfig has a 'config-params' property > > which describes the config parameters when it's set, we can > > use it when it's available. OsinfoInstallConfigParams can indeed > > contain a datamap to be used to translate generic libosinfo values > > to OS-specific values. > > This commit introduces an osinfo_install_config_get_param_value_list > > method that will be used in subsequent commits to get these > > OS-specific values when generating install scripts. > > --- > > osinfo/osinfo_install_config.c | 84 ++++++++++++++++++++++++++++++++++ > > osinfo/osinfo_install_config_private.h | 1 + > > 2 files changed, 85 insertions(+) > > > > diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c > > index a77317b..4c42746 100644 > > --- a/osinfo/osinfo_install_config.c > > +++ b/osinfo/osinfo_install_config.c > > @@ -737,6 +737,90 @@ OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInst > > return config->priv->config_params; > > } > > > > + > > +static const gchar * > > +osinfo_install_config_transform_value(OsinfoInstallConfig *config, > > + const gchar *key, > > + const gchar *value) > > +{ > > + OsinfoDatamap *map; > > + OsinfoEntity *entity; > > + OsinfoInstallConfigParam *param; > > + const gchar *transformed_value; > > + > > + if (!config->priv->config_params) > > + return value; > > + > > + entity = osinfo_list_find_by_id(OSINFO_LIST(config->priv->config_params), > > + key); > > + if (entity == NULL) { > > + g_warning("%s is not a known parameter for this config", key); > > + return value; > > + } > > + > > + param = OSINFO_INSTALL_CONFIG_PARAM(entity);; > > + map = osinfo_install_config_param_get_value_map(param); > > + if (map == NULL) { > > + g_debug("no remapping to be done for %s", key); > > + return value; > > + } > > + transformed_value = osinfo_datamap_lookup(map, value); > > + if (transformed_value == NULL) { > > + g_warning("value not present in %s datamap: %s", key, value); > > + return value; > > + } > > + > > + return transformed_value; > > +} > > + > > +static GHashTable *get_remapped_keys_once(void) > > Two questions: > > 1. Do we really need this hashtable here and hardcode the params that > will be transformed? Indeed, it seems pretty useless, good catch! I'll get rid of it. Thanks, Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From cfergeau at redhat.com Fri Dec 21 10:46:41 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 21 Dec 2012 11:46:41 +0100 Subject: [Libosinfo] [libosinfo] OsinfoInstallConfig: Use config-params if set In-Reply-To: <20121221095940.GD2323@teriyaki.redhat.com> References: <20121221095940.GD2323@teriyaki.redhat.com> Message-ID: <1356086801-10605-1-git-send-email-cfergeau@redhat.com> Now that OsinfoInstallConfig has a 'config-params' property which describes the config parameters when it's set, we can use it when it's available. OsinfoInstallConfigParams can indeed contain a datamap to be used to translate generic libosinfo values to OS-specific values. This commit introduces an osinfo_install_config_get_param_value_list method that will be used in subsequent commits to get these OS-specific values when generating install scripts. --- I've now removed the GOnce hash, this makes the code simpler, but quite different from what was reviewed, resending just this patch for a quick review. Christophe osinfo/osinfo_install_config.c | 50 ++++++++++++++++++++++++++++++++++ osinfo/osinfo_install_config_private.h | 1 + 2 files changed, 51 insertions(+) diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c index a77317b..e912441 100644 --- a/osinfo/osinfo_install_config.c +++ b/osinfo/osinfo_install_config.c @@ -737,6 +737,56 @@ OsinfoInstallConfigParamList *osinfo_install_config_get_config_params(OsinfoInst return config->priv->config_params; } + +static OsinfoDatamap * +osinfo_install_config_get_param_datamap(OsinfoInstallConfig *config, + const gchar *param_name) +{ + OsinfoEntity *entity; + OsinfoInstallConfigParam *param; + + if (!config->priv->config_params) + return NULL; + + entity = osinfo_list_find_by_id(OSINFO_LIST(config->priv->config_params), + param_name); + if (entity == NULL) { + g_debug("%s is not a known parameter for this config", param_name); + return NULL; + } + + param = OSINFO_INSTALL_CONFIG_PARAM(entity);; + return osinfo_install_config_param_get_value_map(param); +} + + +GList * +osinfo_install_config_get_param_value_list(OsinfoInstallConfig *config, + const gchar *key) +{ + GList *values; + GList *it; + OsinfoDatamap *map; + + values = osinfo_entity_get_param_value_list(OSINFO_ENTITY(config), key); + if (values == NULL) + return NULL; + + map = osinfo_install_config_get_param_datamap(config, key); + if (map != NULL) { + for (it = values; it != NULL; it = it->next) { + const char *transformed_value; + transformed_value = osinfo_datamap_lookup(map, it->data); + if (transformed_value == NULL) { + continue; + } + it->data = (gpointer)transformed_value; + } + } + + return values; +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_config_private.h b/osinfo/osinfo_install_config_private.h index 5a1edd3..5ad2162 100644 --- a/osinfo/osinfo_install_config_private.h +++ b/osinfo/osinfo_install_config_private.h @@ -28,6 +28,7 @@ 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); #endif /* __OSINFO_INSTALL_CONFIG_PRIVATE_H__ */ /* -- 1.8.0.2 From zeeshanak at gnome.org Fri Dec 21 13:54:10 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 15:54:10 +0200 Subject: [Libosinfo] [libosinfo] OsinfoInstallConfig: Use config-params if set In-Reply-To: <1356086801-10605-1-git-send-email-cfergeau@redhat.com> References: <20121221095940.GD2323@teriyaki.redhat.com> <1356086801-10605-1-git-send-email-cfergeau@redhat.com> Message-ID: On Fri, Dec 21, 2012 at 12:46 PM, Christophe Fergeau wrote: > Now that OsinfoInstallConfig has a 'config-params' property > which describes the config parameters when it's set, we can > use it when it's available. OsinfoInstallConfigParams can indeed > contain a datamap to be used to translate generic libosinfo values > to OS-specific values. > This commit introduces an osinfo_install_config_get_param_value_list > method that will be used in subsequent commits to get these > OS-specific values when generating install scripts. > --- > I've now removed the GOnce hash, this makes the code simpler, but quite > different from what was reviewed, resending just this patch for a quick review. Looks good. ACK -- Regards, Zeeshan Ali (Khattak) FSF member#5124 From cfergeau at redhat.com Fri Dec 21 16:41:23 2012 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 21 Dec 2012 17:41:23 +0100 Subject: [Libosinfo] [PATCHv4 01/11] Add OsinfoInstallConfigParam::value-map In-Reply-To: References: <1356021914-16369-1-git-send-email-cfergeau@redhat.com> Message-ID: <20121221164122.GE2327@teriyaki.redhat.com> On Fri, Dec 21, 2012 at 02:30:08AM +0200, Zeeshan Ali (Khattak) wrote: > On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau wrote: > > If set, this OsinfoDatamap value will be used to map generic > > values to OS-specific values. > > --- > > ACK to the series. We can discuss the questions/issues I pointed out > still and change things if needed but you can push these changes > already. I've now pushed the series, and all the remarks you should have have been addressed. Thanks! Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From zeeshanak at gnome.org Fri Dec 21 17:14:59 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 19:14:59 +0200 Subject: [Libosinfo] [PATCH] rhel: Fix a typo causing infinit loops/recursion Message-ID: <1356110100-10572-1-git-send-email-zeeshanak@gnome.org> Pushed under trivial rule. From zeeshanak at gnome.org Fri Dec 21 17:15:00 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 21 Dec 2012 19:15:00 +0200 Subject: [Libosinfo] [PATCH] rhel: Fix a typo causing infinit loops/recursion In-Reply-To: <1356110100-10572-1-git-send-email-zeeshanak@gnome.org> References: <1356110100-10572-1-git-send-email-zeeshanak@gnome.org> Message-ID: <1356110100-10572-2-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" RHEL 6.3 derives from 6.2, not 6.3 itself. --- data/oses/rhel.xml.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in index 8a4f8de..12d4a02 100644 --- a/data/oses/rhel.xml.in +++ b/data/oses/rhel.xml.in @@ -757,8 +757,8 @@ linux rhel Santiago - - + + 2012-06-21 2023-11-30 -- 1.8.0.2 From zeeshanak at gnome.org Sat Dec 22 04:20:53 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Sat, 22 Dec 2012 06:20:53 +0200 Subject: [Libosinfo] RHEL 6.3 installer & few improvements Message-ID: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> With these patches, users are now able do a smooth unattended installation of RHEL 6.3 on Boxes (at least). From zeeshanak at gnome.org Sat Dec 22 04:20:54 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Sat, 22 Dec 2012 06:20:54 +0200 Subject: [Libosinfo] [PATCH 1/4] rhel: No need for full version in name In-Reply-To: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> References: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> Message-ID: <1356150057-24165-2-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" The proper full name 'Red Hat Enterprise Linux X' is pretty long enough already, there is really no need to make it longer by specifying full versions (e.g 6.3 instead of just 6) in it. The full version string is available separately for interested apps. --- data/oses/rhel.xml.in | 80 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in index 12d4a02..92ccbbc 100644 --- a/data/oses/rhel.xml.in +++ b/data/oses/rhel.xml.in @@ -4,7 +4,7 @@ rhel2.1 - <_name>Red Hat Enterprise Linux 2.1 + <_name>Red Hat Enterprise Linux 2 2.1 <_vendor>Red Hat, Inc linux @@ -17,7 +17,7 @@ rhel2.1.1 - <_name>Red Hat Enterprise Linux 2.1 Update 1 + <_name>Red Hat Enterprise Linux 2 2.1.1 <_vendor>Red Hat, Inc linux @@ -32,7 +32,7 @@ rhel2.1.2 - <_name>Red Hat Enterprise Linux 2.1 Update 2 + <_name>Red Hat Enterprise Linux 2 2.1.2 <_vendor>Red Hat, Inc linux @@ -47,7 +47,7 @@ rhel2.1.3 - <_name>Red Hat Enterprise Linux 2.1 Update 3 + <_name>Red Hat Enterprise Linux 2 2.1.3 <_vendor>Red Hat, Inc linux @@ -62,7 +62,7 @@ rhel2.1.4 - <_name>Red Hat Enterprise Linux 2.1 Update 4 + <_name>Red Hat Enterprise Linux 2 2.1.4 <_vendor>Red Hat, Inc linux @@ -77,7 +77,7 @@ rhel2.1.5 - <_name>Red Hat Enterprise Linux 2.1 Update 5 + <_name>Red Hat Enterprise Linux 2 2.1.5 <_vendor>Red Hat, Inc linux @@ -92,7 +92,7 @@ rhel2.1.6 - <_name>Red Hat Enterprise Linux 2.1 Update 6 + <_name>Red Hat Enterprise Linux 2 2.1.6 <_vendor>Red Hat, Inc linux @@ -107,7 +107,7 @@ rhel2.1.7 - <_name>Red Hat Enterprise Linux 2.1 Update 7 + <_name>Red Hat Enterprise Linux 2 2.1.7 <_vendor>Red Hat, Inc linux @@ -139,7 +139,7 @@ rhel3.1 - <_name>Red Hat Enterprise Linux 3 Update 1 + <_name>Red Hat Enterprise Linux 3 3.1 <_vendor>Red Hat, Inc linux @@ -154,7 +154,7 @@ rhel3.2 - <_name>Red Hat Enterprise Linux 3 Update 2 + <_name>Red Hat Enterprise Linux 3 3.2 <_vendor>Red Hat, Inc linux @@ -169,7 +169,7 @@ rhel3.3 - <_name>Red Hat Enterprise Linux 3 Update 3 + <_name>Red Hat Enterprise Linux 3 3.3 <_vendor>Red Hat, Inc linux @@ -184,7 +184,7 @@ rhel3.4 - <_name>Red Hat Enterprise Linux 3 Update 4 + <_name>Red Hat Enterprise Linux 3 3.4 <_vendor>Red Hat, Inc linux @@ -199,7 +199,7 @@ rhel3.5 - <_name>Red Hat Enterprise Linux 3 Update 5 + <_name>Red Hat Enterprise Linux 3 3.5 <_vendor>Red Hat, Inc linux @@ -214,7 +214,7 @@ rhel3.6 - <_name>Red Hat Enterprise Linux 3 Update 6 + <_name>Red Hat Enterprise Linux 3 3.6 <_vendor>Red Hat, Inc linux @@ -229,7 +229,7 @@ rhel3.7 - <_name>Red Hat Enterprise Linux 3 Update 7 + <_name>Red Hat Enterprise Linux 3 3.7 <_vendor>Red Hat, Inc linux @@ -244,7 +244,7 @@ rhel3.8 - <_name>Red Hat Enterprise Linux 3 Update 8 + <_name>Red Hat Enterprise Linux 3 3.8 <_vendor>Red Hat, Inc linux @@ -259,7 +259,7 @@ rhel3.9 - <_name>Red Hat Enterprise Linux 3 Update 9 + <_name>Red Hat Enterprise Linux 3 3.9 <_vendor>Red Hat, Inc linux @@ -278,7 +278,7 @@ rhel4.0 - <_name>Red Hat Enterprise Linux 4.0 + <_name>Red Hat Enterprise Linux 4 4.0 <_vendor>Red Hat, Inc linux @@ -291,7 +291,7 @@ rhel4.1 - <_name>Red Hat Enterprise Linux 4.1 + <_name>Red Hat Enterprise Linux 4 4.1 <_vendor>Red Hat, Inc linux @@ -306,7 +306,7 @@ rhel4.2 - <_name>Red Hat Enterprise Linux 4.2 + <_name>Red Hat Enterprise Linux 4 4.2 <_vendor>Red Hat, Inc linux @@ -321,7 +321,7 @@ rhel4.3 - <_name>Red Hat Enterprise Linux 4.3 + <_name>Red Hat Enterprise Linux 4 4.3 <_vendor>Red Hat, Inc linux @@ -336,7 +336,7 @@ rhel4.4 - <_name>Red Hat Enterprise Linux 4.4 + <_name>Red Hat Enterprise Linux 4 4.4 <_vendor>Red Hat, Inc linux @@ -351,7 +351,7 @@ rhel4.5 - <_name>Red Hat Enterprise Linux 4.5 + <_name>Red Hat Enterprise Linux 4 4.5 <_vendor>Red Hat, Inc linux @@ -366,7 +366,7 @@ rhel4.6 - <_name>Red Hat Enterprise Linux 4.6 + <_name>Red Hat Enterprise Linux 4 4.6 <_vendor>Red Hat, Inc linux @@ -381,7 +381,7 @@ rhel4.7 - <_name>Red Hat Enterprise Linux 4.7 + <_name>Red Hat Enterprise Linux 4 4.7 <_vendor>Red Hat, Inc linux @@ -396,7 +396,7 @@ rhel4.8 - <_name>Red Hat Enterprise Linux 4.8 + <_name>Red Hat Enterprise Linux 4 4.8 <_vendor>Red Hat, Inc linux @@ -424,7 +424,7 @@ rhel4.9 - <_name>Red Hat Enterprise Linux 4.9 + <_name>Red Hat Enterprise Linux 4 4.9 <_vendor>Red Hat, Inc linux @@ -456,7 +456,7 @@ rhel5.0 - <_name>Red Hat Enterprise Linux 5.0 + <_name>Red Hat Enterprise Linux 5 5.0 <_vendor>Red Hat, Inc linux @@ -470,7 +470,7 @@ rhel5.1 - <_name>Red Hat Enterprise Linux 5.1 + <_name>Red Hat Enterprise Linux 5 5.1 <_vendor>Red Hat, Inc linux @@ -485,7 +485,7 @@ rhel5.2 - <_name>Red Hat Enterprise Linux 5.2 + <_name>Red Hat Enterprise Linux 5 5.2 <_vendor>Red Hat, Inc linux @@ -500,7 +500,7 @@ rhel5.3 - <_name>Red Hat Enterprise Linux 5.3 + <_name>Red Hat Enterprise Linux 5 5.3 <_vendor>Red Hat, Inc linux @@ -515,7 +515,7 @@ rhel5.4 - <_name>Red Hat Enterprise Linux 5.4 + <_name>Red Hat Enterprise Linux 5 5.4 <_vendor>Red Hat, Inc linux @@ -543,7 +543,7 @@ rhel5.5 - <_name>Red Hat Enterprise Linux 5.5 + <_name>Red Hat Enterprise Linux 5 5.5 <_vendor>Red Hat, Inc linux @@ -571,7 +571,7 @@ rhel5.6 - <_name>Red Hat Enterprise Linux 5.6 + <_name>Red Hat Enterprise Linux 5 5.6 <_vendor>Red Hat, Inc linux @@ -604,7 +604,7 @@ rhel5.7 - <_name>Red Hat Enterprise Linux 5.7 + <_name>Red Hat Enterprise Linux 5 5.7 <_vendor>Red Hat, Inc linux @@ -632,7 +632,7 @@ rhel5.8 - <_name>Red Hat Enterprise Linux 5.8 + <_name>Red Hat Enterprise Linux 5 5.8 <_vendor>Red Hat, Inc linux @@ -663,7 +663,7 @@ rhel6.0 - <_name>Red Hat Enterprise Linux 6.0 + <_name>Red Hat Enterprise Linux 6 6.0 <_vendor>Red Hat, Inc linux @@ -695,7 +695,7 @@ rhel6.1 - <_name>Red Hat Enterprise Linux 6.1 + <_name>Red Hat Enterprise Linux 6 6.1 <_vendor>Red Hat, Inc linux @@ -723,7 +723,7 @@ rhel6.2 - <_name>Red Hat Enterprise Linux 6.2 + <_name>Red Hat Enterprise Linux 6 6.2 <_vendor>Red Hat, Inc linux @@ -751,7 +751,7 @@ rhel6.3 - <_name>Red Hat Enterprise Linux 6.3 + <_name>Red Hat Enterprise Linux 6 6.3 <_vendor>Red Hat, Inc linux -- 1.8.0.2 From zeeshanak at gnome.org Sat Dec 22 04:20:55 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Sat, 22 Dec 2012 06:20:55 +0200 Subject: [Libosinfo] [PATCH 2/4] rhel: Specify kernel/initrd paths in 6.3 media In-Reply-To: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> References: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> Message-ID: <1356150057-24165-3-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" --- data/oses/rhel.xml.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in index 92ccbbc..12cff96 100644 --- a/data/oses/rhel.xml.in +++ b/data/oses/rhel.xml.in @@ -768,12 +768,16 @@ LINUX .*RHEL_6.3 i386.* + isolinux/vmlinuz + isolinux/initrd.img LINUX .*RHEL_6.3 x86_64.* + isolinux/vmlinuz + isolinux/initrd.img -- 1.8.0.2 From zeeshanak at gnome.org Sat Dec 22 04:20:56 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Sat, 22 Dec 2012 06:20:56 +0200 Subject: [Libosinfo] [PATCH 3/4] rhel: Specify min/recommended resources for 6.3 In-Reply-To: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> References: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> Message-ID: <1356150057-24165-4-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" Its just a C&P from F18 and seems to work nicely in practice. --- data/oses/rhel.xml.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in index 12cff96..877f4bf 100644 --- a/data/oses/rhel.xml.in +++ b/data/oses/rhel.xml.in @@ -779,5 +779,18 @@ isolinux/vmlinuz isolinux/initrd.img + + + + 1 + 805306368 + + + + 400000000 + 1207959552 + 9663676416 + + -- 1.8.0.2 From zeeshanak at gnome.org Sat Dec 22 04:20:57 2012 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Sat, 22 Dec 2012 06:20:57 +0200 Subject: [Libosinfo] [PATCH 4/4] Add install script for RHEL 6.3 In-Reply-To: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> References: <1356150057-24165-1-git-send-email-zeeshanak@gnome.org> Message-ID: <1356150057-24165-5-git-send-email-zeeshanak@gnome.org> From: "Zeeshan Ali (Khattak)" The same script might work for other versions too but I have only made it work against RHEL 6.3 for now. Still some issues though: 1. For some reason user's avatar is ignored although according to the docs I could find*, copying the avatar to /home/${USER}/.face should be enough. 2. We don't set the keyboard layout properly yet and just hardcode it to 'us'. This will require the same kind of mapping as Fedora 17 and older. * http://projects.gnome.org/gdm/docs/2.14/configuration.html --- data/install-scripts/Makefile.am | 1 + data/install-scripts/rhel.xml | 204 +++++++++++++++++++++++++++++++++++++++ data/oses/rhel.xml.in | 5 + 3 files changed, 210 insertions(+) create mode 100644 data/install-scripts/rhel.xml diff --git a/data/install-scripts/Makefile.am b/data/install-scripts/Makefile.am index cb24e09..c310468 100644 --- a/data/install-scripts/Makefile.am +++ b/data/install-scripts/Makefile.am @@ -2,6 +2,7 @@ databasedir = $(pkgdatadir)/db/install-scripts/ database_DATA = \ fedora.xml \ + rhel.xml \ windows-sif.xml \ windows-cmd.xml \ windows-reg.xml \ diff --git a/data/install-scripts/rhel.xml b/data/install-scripts/rhel.xml new file mode 100644 index 0000000..ce2edf0 --- /dev/null +++ b/data/install-scripts/rhel.xml @@ -0,0 +1,204 @@ + + + + jeos + fedora.ks + + + + + + + + + + + + + desktop + fedora.ks + + + + + + + + + + + + + + image/png + + + + + diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in index 877f4bf..d464976 100644 --- a/data/oses/rhel.xml.in +++ b/data/oses/rhel.xml.in @@ -792,5 +792,10 @@ 9663676416 + + +