On Mon, Aug 17, 2015 at 8:14 PM, Zeeshan Ali (Khattak) <zeeshanak@xxxxxxxxx> wrote: > Add API to allow applications to query the expected pattern of username > from install scripts. > --- > data/schemas/libosinfo.rng | 5 +++++ > osinfo/libosinfo.syms | 5 +++++ > osinfo/osinfo_install_script.c | 16 ++++++++++++++++ > osinfo/osinfo_install_script.h | 2 ++ > osinfo/osinfo_loader.c | 1 + > 5 files changed, 29 insertions(+) > > diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng > index b23d210..a019894 100644 > --- a/data/schemas/libosinfo.rng > +++ b/data/schemas/libosinfo.rng > @@ -603,6 +603,11 @@ > </element> > </optional> > <optional> > + <element name='username-pattern'> > + <text/> > + </element> > + </optional> > + <optional> > <element name='product-key-format'> > <text/> > </element> > diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms > index 68d54ff..7e83f8b 100644 > --- a/osinfo/libosinfo.syms > +++ b/osinfo/libosinfo.syms > @@ -520,6 +520,11 @@ LIBOSINFO_0.2.12 { > osinfo_media_get_volume_size; > } LIBOSINFO_0.2.11; > > +LIBOSINFO_0.2.13 { > + global: > + osinfo_install_script_get_username_pattern; > +} LIBOSINFO_0.2.12; > + > /* Symbols in next release... > > LIBOSINFO_0.0.2 { > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > index 9ded116..6842d3c 100644 > --- a/osinfo/osinfo_install_script.c > +++ b/osinfo/osinfo_install_script.c > @@ -441,6 +441,22 @@ const gchar *osinfo_install_script_get_product_key_format(OsinfoInstallScript *s > OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT); > } > > +/** > + * osinfo_install_script_get_username_pattern: > + * @script: the install script > + * > + * If this function returns a non-NULL string, it means that the @script > + * requires the username to match the returned regular expression string. > + * > + * Returns: (transfer none) (allow-nullable): Regular express string that > + * username must match, or %NULL. > + */ > +const gchar *osinfo_install_script_get_username_pattern(OsinfoInstallScript *script) > +{ > + return osinfo_entity_get_param_value(OSINFO_ENTITY(script), > + OSINFO_INSTALL_SCRIPT_PROP_USERNAME_PATTERN); > +} > + > void osinfo_install_script_set_output_prefix(OsinfoInstallScript *script, > const gchar *prefix) > { > diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h > index c494192..62c19bb 100644 > --- a/osinfo/osinfo_install_script.h > +++ b/osinfo/osinfo_install_script.h > @@ -52,6 +52,7 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate; > #define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA "template-data" > #define OSINFO_INSTALL_SCRIPT_PROP_PROFILE "profile" > #define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format" > +#define OSINFO_INSTALL_SCRIPT_PROP_USERNAME_PATTERN "username-pattern" > #define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME "expected-filename" > #define OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT "path-format" > #define OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS "can-pre-install-drivers" > @@ -153,6 +154,7 @@ const gchar *osinfo_install_script_get_template_data(OsinfoInstallScript *script > const gchar *osinfo_install_script_get_profile(OsinfoInstallScript *script); > > const gchar *osinfo_install_script_get_product_key_format(OsinfoInstallScript *script); > +const gchar *osinfo_install_script_get_username_pattern(OsinfoInstallScript *script); > > void osinfo_install_script_set_output_prefix(OsinfoInstallScript *script, const gchar *prefix); > > diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c > index 4e8f942..8eec254 100644 > --- a/osinfo/osinfo_loader.c > +++ b/osinfo/osinfo_loader.c > @@ -819,6 +819,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader, > gchar *id = (gchar *)xmlGetProp(root, BAD_CAST "id"); > const OsinfoEntityKey keys[] = { > { OSINFO_INSTALL_SCRIPT_PROP_PROFILE, G_TYPE_STRING }, > + { OSINFO_INSTALL_SCRIPT_PROP_USERNAME_PATTERN, G_TYPE_STRING }, > { OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT, G_TYPE_STRING }, > { OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT, G_TYPE_STRING }, > { OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME, G_TYPE_STRING }, > -- > 2.4.3 > > _______________________________________________ > Libosinfo mailing list > Libosinfo@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libosinfo Both patches look good, ACK from me. Best Regards, -- Fabiano Fidêncio _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo