Re: [PATCHv4 02/11] loader: Parse OsinfoInstallConfigParam::value-map from XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> <cfergeau@xxxxxxxxxx> 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 @@
> >                  <attribute name="policy">
> >                    <ref name='policies'/>
> >                  </attribute>
> > +                <optional>
> > +                  <attribute name="value-map"/>
> > +                </optional>
> >                </element>
> >              </oneOrMore>
> >            </element>
> > 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 <cfergeau@xxxxxxxxxx>
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:

    <?xml version="1.0" encoding="UTF-8"?>
    <libosinfo version="0.0.1">
      <datamap id="http://example.com/osinfo/test";>
        <entry inval="generic-val1" outval="foo"/>
        <entry> inval="generic-val2" outval="bar"/>
      </datamap>
    </libosinfo>

    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

Attachment: pgp1UIhRL6dRC.pgp
Description: PGP signature

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux