From dkliban at redhat.com Mon Apr 1 22:39:34 2013 From: dkliban at redhat.com (Dennis Kliban) Date: Mon, 1 Apr 2013 18:39:34 -0400 (EDT) Subject: [Libosinfo] how do i add an extra config parameter to InstallScript? In-Reply-To: <407850802.922915.1364854668709.JavaMail.root@redhat.com> Message-ID: <7350056.928178.1364855974273.JavaMail.root@redhat.com> I have installed libosinfo 0.2.6 from koji. The documentation that was installed with the libosinfo-devel package did not seem to be up to date. After some googling I found the following pages: http://www.valadoc.org/#!wiki=libosinfo-1.0/index The documentation above seems to go well with the codebase in 0.2.6. Is this documentation ok to use with 0.2.6? Also wondering why the above site has the version listed as 1.0? I am attempting to use libosinfo to generate kickstart files for an image building service for OpenStack. I need to be able to add extra parameters to the InstallScript. According to the documentation, InstallScript object can have InstallConfigParam added to it. My understanding is that the InstallConfigParam consists of a name and a policy. What does a policy for a InstallConfigParam look like? I'd like to add the following line to the kickstart file. It is not found in the default kickstart file for Fedorav 18. How do I do this? url --url=http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/os/ Thanks, Dennis From cfergeau at redhat.com Tue Apr 2 09:03:09 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:03:09 +0200 Subject: [Libosinfo] how do i add an extra config parameter to InstallScript? In-Reply-To: <7350056.928178.1364855974273.JavaMail.root@redhat.com> References: <407850802.922915.1364854668709.JavaMail.root@redhat.com> <7350056.928178.1364855974273.JavaMail.root@redhat.com> Message-ID: <20130402090309.GI2401@teriyaki.redhat.com> Hey Dennis, On Mon, Apr 01, 2013 at 06:39:34PM -0400, Dennis Kliban wrote: > I have installed libosinfo 0.2.6 from koji. The documentation that was > installed with the libosinfo-devel package did not seem to be up to date. Looking at the documentation at /usr/share/gtk-doc/html/Libosinfo/index.html , I see that the various install-related classes do not appear in the generated HTML, is that what you mean when you say it's not up to date? > After some googling I found the following pages: > > http://www.valadoc.org/#!wiki=libosinfo-1.0/index > The documentation above seems to go well with the codebase in 0.2.6. Is > this documentation ok to use with 0.2.6? Also wondering why the above > site has the version listed as 1.0? Yes this documentation should be fine to use with 0.2.6. The -1.0 is the same as the suffix -1.0 used the .pc and .gir files libosinfo generates. For now this is a bit weird, but when 1.0 is released, if we decide to make ABI incompatible changes, then this allows 1.0 and 2.0 to be installed in parallel thanks to the -1.0 / -2.0 suffix on files/dirs that would otherwise conflicts. > I am attempting to use libosinfo to generate kickstart files for an image > building service for OpenStack. I need to be able to add extra > parameters to the InstallScript. According to the documentation, > InstallScript object can have InstallConfigParam added to it. My > understanding is that the InstallConfigParam consists of a name and a > policy. What does a policy for a InstallConfigParam look like? Looking into /usr/include/libosinfo-1.0/osinfo/osinfo_install_config_param.h you can find this: /** * OsinfoInstallConfigParamPolicy: * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_NONE: no policy defined * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_REQUIRED: config parameter is * required * @OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL: config parameter may be * omitted * * Policy for configuration parameter presence */ For the XML equivalent, you can have a look at the RNG schema at /usr/share/libosinfo/schemas/libosinfo.rng which has required|optional This means the XML 'config' element has a mandatory 'param' element, which in turn has a 'policy' attribute, which valid values are 'required' or 'optional': or (I've omitted the other unrelated attributes/elements). You can also have a look at existing install scripts when in doubt ;) > I'd like to add the following line to the kickstart file. It is not > found in the default kickstart file for Fedorav 18. How do I do this? > > url --url=http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/os/ Hmm I'd have to look more into this, but at this point I'm afraid you have to - either patch libosinfo to optionally support this (imo this would be a useful addition) - or duplicate the fedora install script under a different ID, with just this argument added, and make sure you load it at the same time you load the libosinfo database. Hope that helps, Christophe > > Thanks, > Dennis > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- 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 Apr 2 09:17:01 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:17:01 +0200 Subject: [Libosinfo] [libosinfo 0/3] Add osinfo_platform_get_all_devices() Message-ID: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> This patch series adds a osinfo_platform_get_all_devices() method similar to what osinfo_os_get_all_devices() does. To avoid duplicating most of osinfo_os_get_all_devices(), the series starts by adding a helper that will be used by both methods. Christophe From cfergeau at redhat.com Tue Apr 2 09:17:02 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:17:02 +0200 Subject: [Libosinfo] [libosinfo 1/3] Add osinfo_product_foreach_related() In-Reply-To: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> References: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> Message-ID: <1364894224-25916-2-git-send-email-cfergeau@redhat.com> This method iterates over all products that are related to a given product. This will be useful to implement osinfo_platform_get_all_devices(). --- osinfo/Makefile.am | 1 + osinfo/osinfo_product.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 5e9a761..496ee34 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -75,6 +75,7 @@ OSINFO_HEADER_FILES = \ osinfo_install_script.h \ osinfo_install_scriptlist.h \ osinfo_product.h \ + osinfo_product_private.h \ osinfo_productfilter.h \ osinfo_productlist.h \ osinfo_platform.h \ diff --git a/osinfo/osinfo_product.c b/osinfo/osinfo_product.c index d4d9ec9..561da63 100644 --- a/osinfo/osinfo_product.c +++ b/osinfo/osinfo_product.c @@ -30,6 +30,8 @@ #include #include +#include "osinfo/osinfo_product_private.h" + G_DEFINE_ABSTRACT_TYPE (OsinfoProduct, osinfo_product, OSINFO_TYPE_ENTITY); #define OSINFO_PRODUCT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_PRODUCT, OsinfoProductPrivate)) @@ -367,6 +369,64 @@ const gchar *osinfo_product_get_logo(OsinfoProduct *prod) return osinfo_entity_get_param_value(OSINFO_ENTITY(prod), OSINFO_PRODUCT_PROP_LOGO); } +static OsinfoList *osinfo_list_append(OsinfoList *appendee, + OsinfoList *appended) +{ + OsinfoList *result; + result = osinfo_list_new_union(appendee, appended); + g_object_unref(G_OBJECT(appendee)); + + return result; +} + +void osinfo_product_foreach_related(OsinfoProduct *product, + OsinfoProductForeachFlag flags, + OsinfoProductForeach foreach_func, + gpointer user_data) +{ + OsinfoList *related_list; + OsinfoProductList *tmp_related; + guint i; + + foreach_func(product, user_data); + + related_list = OSINFO_LIST(osinfo_productlist_new()); + if (flags & OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM) { + tmp_related = osinfo_product_get_related + (product, OSINFO_PRODUCT_RELATIONSHIP_DERIVES_FROM); + related_list = osinfo_list_append(related_list, + OSINFO_LIST(tmp_related)); + g_object_unref(G_OBJECT(tmp_related)); + } + + if (flags & OSINFO_PRODUCT_FOREACH_FLAG_UPGRADES) { + tmp_related = osinfo_product_get_related + (product, OSINFO_PRODUCT_RELATIONSHIP_UPGRADES); + related_list = osinfo_list_append(related_list, + OSINFO_LIST(tmp_related)); + g_object_unref(G_OBJECT(tmp_related)); + } + + if (flags & OSINFO_PRODUCT_FOREACH_FLAG_CLONES) { + tmp_related = osinfo_product_get_related + (product, OSINFO_PRODUCT_RELATIONSHIP_CLONES); + related_list = osinfo_list_append(related_list, + OSINFO_LIST(tmp_related)); + g_object_unref(G_OBJECT(tmp_related)); + } + + for (i = 0; i < osinfo_list_get_length(related_list); i++) { + OsinfoEntity *related; + + related = osinfo_list_get_nth(related_list, i); + osinfo_product_foreach_related(OSINFO_PRODUCT(related), + flags, + foreach_func, + user_data); + } + g_object_unref (related_list); +} + /* * Local variables: * indent-tabs-mode: nil -- 1.8.1.4 From cfergeau at redhat.com Tue Apr 2 09:17:03 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:17:03 +0200 Subject: [Libosinfo] [libosinfo 2/3] Implement osinfo_os_get_all_devices() with osinfo_product_foreach_related() In-Reply-To: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> References: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> Message-ID: <1364894224-25916-3-git-send-email-cfergeau@redhat.com> --- osinfo/osinfo_os.c | 68 +++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 97ced24..638d9c1 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -26,6 +26,7 @@ #include #include "osinfo_media_private.h" +#include "osinfo/osinfo_product_private.h" #include G_DEFINE_TYPE (OsinfoOs, osinfo_os, OSINFO_TYPE_PRODUCT); @@ -229,6 +230,29 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter) return newList; } +struct GetAllDevicesData { + OsinfoFilter *filter; + OsinfoDeviceList *devices; +}; + +static void get_all_devices_cb(OsinfoProduct *product, gpointer user_data) +{ + OsinfoDeviceList *devices; + OsinfoList *tmp_list; + struct GetAllDevicesData *foreach_data = (struct GetAllDevicesData *)user_data; + + g_return_if_fail(OSINFO_IS_OS(product)); + + devices = osinfo_os_get_devices(OSINFO_OS(product), + foreach_data->filter); + tmp_list = osinfo_list_new_union(OSINFO_LIST(foreach_data->devices), + OSINFO_LIST(devices)); + g_object_unref(foreach_data->devices); + g_object_unref(devices); + foreach_data->devices = OSINFO_DEVICELIST(tmp_list); +} + + /** * osinfo_os_get_all_devices: * @os: an operating system @@ -242,38 +266,18 @@ OsinfoDeviceList *osinfo_os_get_devices(OsinfoOs *os, OsinfoFilter *filter) */ OsinfoDeviceList *osinfo_os_get_all_devices(OsinfoOs *os, OsinfoFilter *filter) { - OsinfoProductList *derived, *cloned, *related_list; - OsinfoDeviceList *devices; - guint i; - - devices = osinfo_os_get_devices(os, filter); - - derived = osinfo_product_get_related - (OSINFO_PRODUCT(os), OSINFO_PRODUCT_RELATIONSHIP_DERIVES_FROM); - cloned = osinfo_product_get_related(OSINFO_PRODUCT(os), - OSINFO_PRODUCT_RELATIONSHIP_CLONES); - related_list = OSINFO_PRODUCTLIST(osinfo_list_new_union(OSINFO_LIST(derived), - OSINFO_LIST(cloned))); - g_object_unref(derived); - g_object_unref(cloned); - - for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(related_list)); i++) { - OsinfoEntity *related; - OsinfoDeviceList *related_devices; - - related = osinfo_list_get_nth(OSINFO_LIST(related_list), i); - related_devices = osinfo_os_get_all_devices(OSINFO_OS(related), filter); - if (osinfo_list_get_length(OSINFO_LIST(related_devices)) > 0) { - OsinfoDeviceList *tmp_list = devices; - devices = OSINFO_DEVICELIST(osinfo_list_new_union(OSINFO_LIST(devices), - OSINFO_LIST(related_devices))); - g_object_unref(tmp_list); - } - } - - g_object_unref (related_list); - - return devices; + struct GetAllDevicesData foreach_data = { + .filter = filter, + .devices = osinfo_devicelist_new() + }; + + osinfo_product_foreach_related(OSINFO_PRODUCT(os), + OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM | + OSINFO_PRODUCT_FOREACH_FLAG_CLONES, + get_all_devices_cb, + &foreach_data); + + return foreach_data.devices; } /** -- 1.8.1.4 From cfergeau at redhat.com Tue Apr 2 09:17:04 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:17:04 +0200 Subject: [Libosinfo] [libosinfo 3/3] Implement osinfo_platform_get_all_devices() In-Reply-To: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> References: <1364894224-25916-1-git-send-email-cfergeau@redhat.com> Message-ID: <1364894224-25916-4-git-send-email-cfergeau@redhat.com> --- osinfo/libosinfo.syms | 4 ++++ osinfo/osinfo_platform.c | 38 ++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_platform.h | 1 + 3 files changed, 43 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 45689a2..8fcf327 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -413,6 +413,10 @@ LIBOSINFO_0.2.6 { osinfo_install_script_get_post_install_drivers_signing_req; } LIBOSINFO_0.2.3; +LIBOSINFO_0.2.7 { + osinfo_platform_get_all_devices; +} LIBOSINFO_0.2.6; + /* Symbols in next release... LIBOSINFO_0.0.2 { diff --git a/osinfo/osinfo_platform.c b/osinfo/osinfo_platform.c index 222eb93..1bb3ecf 100644 --- a/osinfo/osinfo_platform.c +++ b/osinfo/osinfo_platform.c @@ -25,6 +25,7 @@ #include #include +#include "osinfo/osinfo_product_private.h" #include G_DEFINE_TYPE (OsinfoPlatform, osinfo_platform, OSINFO_TYPE_PRODUCT); @@ -101,6 +102,43 @@ OsinfoPlatform *osinfo_platform_new(const gchar *id) NULL); } +struct GetAllDevicesData { + OsinfoFilter *filter; + OsinfoDeviceList *devices; +}; + +static void get_all_devices_cb(OsinfoProduct *product, gpointer user_data) +{ + OsinfoDeviceList *devices; + OsinfoList *tmp_list; + struct GetAllDevicesData *foreach_data = (struct GetAllDevicesData *)user_data; + + g_return_if_fail(OSINFO_IS_PLATFORM(product)); + + devices = osinfo_platform_get_devices(OSINFO_PLATFORM(product), + foreach_data->filter); + tmp_list = osinfo_list_new_union(OSINFO_LIST(foreach_data->devices), + OSINFO_LIST(devices)); + g_object_unref(foreach_data->devices); + g_object_unref(devices); + foreach_data->devices = OSINFO_DEVICELIST(tmp_list); +} + +OsinfoDeviceList *osinfo_platform_get_all_devices(OsinfoPlatform *platform, + OsinfoFilter *filter) +{ + struct GetAllDevicesData foreach_data = { + .filter = filter, + .devices = osinfo_devicelist_new() + }; + + osinfo_product_foreach_related(OSINFO_PRODUCT(platform), + OSINFO_PRODUCT_FOREACH_FLAG_UPGRADES, + get_all_devices_cb, + &foreach_data); + + return foreach_data.devices; +} /** * osinfo_platform_get_devices: diff --git a/osinfo/osinfo_platform.h b/osinfo/osinfo_platform.h index 8455a32..d5df225 100644 --- a/osinfo/osinfo_platform.h +++ b/osinfo/osinfo_platform.h @@ -71,6 +71,7 @@ GType osinfo_platform_get_type(void); OsinfoPlatform *osinfo_platform_new(const gchar *id); OsinfoDeviceList *osinfo_platform_get_devices(OsinfoPlatform *platform, OsinfoFilter *filter); +OsinfoDeviceList *osinfo_platform_get_all_devices(OsinfoPlatform *platform, OsinfoFilter *filter); OsinfoDeviceLinkList *osinfo_platform_get_device_links(OsinfoPlatform *platform, OsinfoFilter *filter); OsinfoDeviceLink *osinfo_platform_add_device(OsinfoPlatform *platform, OsinfoDevice *dev); -- 1.8.1.4 From cfergeau at redhat.com Tue Apr 2 09:20:05 2013 From: cfergeau at redhat.com (Christophe Fergeau) Date: Tue, 2 Apr 2013 11:20:05 +0200 Subject: [Libosinfo] [PATCH 03/11] centos, test: Add OS info/testcase for CentOS 6.0 In-Reply-To: References: <1364047774-28914-1-git-send-email-fidencio@redhat.com> <1364047774-28914-3-git-send-email-fidencio@redhat.com> <20130325085000.GC3330@teriyaki.redhat.com> Message-ID: <20130402092005.GJ2401@teriyaki.redhat.com> On Sat, Mar 30, 2013 at 11:30:19PM +0100, Fabiano Fid?ncio wrote: > On Mon, Mar 25, 2013 at 9:50 AM, Christophe Fergeau wrote: > > > On Sat, Mar 23, 2013 at 03:09:26PM +0100, Fabiano Fid?ncio wrote: > > > --- > > > data/oses/centos.xml.in | 22 > > ++++++++++++++++ > > > .../centos6.0/CentOS-6.0-i386-bin-DVD.iso.txt | 29 > > ++++++++++++++++++++++ > > > .../centos6.0/CentOS-6.0-x86_64-bin-DVD1.iso.txt | 29 > > ++++++++++++++++++++++ > > > test/test-isodetect.c | 6 +++++ > > > 4 files changed, 86 insertions(+) > > > create mode 100644 > > test/isodata/centos/centos6.0/CentOS-6.0-i386-bin-DVD.iso.txt > > > create mode 100644 > > test/isodata/centos/centos6.0/CentOS-6.0-x86_64-bin-DVD1.iso.txt > > > > > > diff --git a/data/oses/centos.xml.in b/data/oses/centos.xml.in > > > index 3f09dea..bb8e570 100644 > > > --- a/data/oses/centos.xml.in > > > +++ b/data/oses/centos.xml.in > > > @@ -16,13 +16,35 @@ > > > LINUX > > > CentOS_6.0_Final > > > > > > + isolinux/vmlinuz > > > + isolinux/initrd.img > > > > > > > > > > > > LINUX > > > CentOS_6.0_Final > > > > > > + isolinux/vmlinuz > > > + isolinux/initrd.img > > > > > > + > > > + > > > + > > > + 1 > > > + 536870912 > > > + > > > + > > > + > > > + 400000000 > > > + 1073741824 > > > + 9663676416 > > > + > > > + > > > + > > > + > > > +