On Thu, Oct 04, 2012 at 08:22:56PM +0300, Zeeshan Ali (Khattak) wrote: > From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> > > If media is an installer, this specifies the number of reboots the > installer takes before installation is complete. Default value is '1'. > > This is mainly needed for applications like GNOME Boxes and virt-install > to be able to tell when OS installation from a given media is complete so > that they can take whatever post installation steps they may need to. > --- > osinfo/libosinfo.syms | 1 + > osinfo/osinfo_loader.c | 9 +++++++ > osinfo/osinfo_media.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ > osinfo/osinfo_media.h | 20 +++++++++------- > 4 files changed, 86 insertions(+), 9 deletions(-) > > diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms > index 6676588..f96ca99 100644 > --- a/osinfo/libosinfo.syms > +++ b/osinfo/libosinfo.syms > @@ -308,6 +308,7 @@ LIBOSINFO_0.2.1 { > osinfo_entity_get_param_value_int64; > osinfo_entity_get_param_value_int64_with_default; > osinfo_entity_set_param_int64; > + osinfo_media_get_installer_reboots; > } LIBOSINFO_0.2.0; This no longer applies on master. > > /* Symbols in next release... > diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c > index ab507da..da0ef45 100644 > --- a/osinfo/osinfo_loader.c > +++ b/osinfo/osinfo_loader.c > @@ -652,6 +652,8 @@ static OsinfoMedia *osinfo_loader_media (OsinfoLoader *loader, > gchar *arch = (gchar *)xmlGetProp(root, BAD_CAST "arch"); > xmlChar *live = xmlGetProp(root, BAD_CAST OSINFO_MEDIA_PROP_LIVE); > xmlChar *installer = xmlGetProp(root, BAD_CAST OSINFO_MEDIA_PROP_INSTALLER); > + xmlChar *installer_reboots = > + xmlGetProp(root, BAD_CAST OSINFO_MEDIA_PROP_INSTALLER_REBOOTS); > const gchar *const keys[] = { > OSINFO_MEDIA_PROP_URL, > OSINFO_MEDIA_PROP_KERNEL, > @@ -676,6 +678,13 @@ static OsinfoMedia *osinfo_loader_media (OsinfoLoader *loader, > xmlFree(installer); > } > > + if (installer_reboots) { > + osinfo_entity_set_param(OSINFO_ENTITY(media), > + OSINFO_MEDIA_PROP_INSTALLER_REBOOTS, > + (gchar *)installer_reboots); > + xmlFree(installer_reboots); > + } > + > gint nnodes = osinfo_loader_nodeset("./iso/*", ctxt, &nodes, err); > if (error_is_set(err)) > return NULL; > diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c > index 6e33634..aa602f9 100644 > --- a/osinfo/osinfo_media.c > +++ b/osinfo/osinfo_media.c > @@ -151,6 +151,7 @@ enum { > PROP_INITRD_PATH, > PROP_INSTALLER, > PROP_LIVE, > + PROP_INSTALLER_REBOOTS, > }; > > static void > @@ -212,6 +213,11 @@ osinfo_media_get_property (GObject *object, > osinfo_media_get_live (media)); > break; > > + case PROP_INSTALLER_REBOOTS: > + g_value_set_int (value, > + osinfo_media_get_installer_reboots (media)); > + break; > + > default: > /* We don't have any other property... */ > G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); > @@ -288,6 +294,12 @@ osinfo_media_set_property(GObject *object, > g_value_get_boolean (value)); > break; > > + case PROP_INSTALLER_REBOOTS: > + osinfo_entity_set_param_int64 (OSINFO_ENTITY(media), > + OSINFO_MEDIA_PROP_INSTALLER_REBOOTS, > + g_value_get_int (value)); > + break; > + > default: > /* We don't have any other property... */ > G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); > @@ -465,6 +477,33 @@ osinfo_media_class_init (OsinfoMediaClass *klass) > G_PARAM_STATIC_NICK | > G_PARAM_STATIC_BLURB); > g_object_class_install_property (g_klass, PROP_LIVE, pspec); > + > + /** > + * OsinfoMedia::installer-reboots: > + * > + * If media is an installer, this property indicates the number of reboots > + * the installer takes before installation is complete. > + * > + * This property is not applicable to media that has no installer. You can > + * use #osinfo_media_get_installer (or OsinfoMedia::installer) to check > + * that. > + * > + * Warning: Some media allow you to install from live sessions, in which > + * case number of reboots *alone* is not a reliable method for tracking > + * installation. > + */ > + pspec = g_param_spec_int ("installer-reboots", > + "InstallStages", > + "Number of installation stages", These 2 lines were missed in your search and replace. Looks good to me otherwise. Christophe
Attachment:
pgpJkTknOOTba.pgp
Description: PGP signature