[Libosinfo] [libosinfo PATCH] loader: Fully support multiple short-id values
Cole Robinson
crobinso at redhat.com
Tue Apr 30 18:46:03 UTC 2019
On 4/26/19 4:23 AM, Fabiano Fidêncio wrote:
> osinfo-db schema allows for multiple short-id, and there's already some
> entries that rely on that. For example, debian and ubuntu have something
> like:
> ```
> <short-id>debian9</short-id>
> <short-id>debianstretch</short-id>
> ```
>
> or
>
> ```
> <short-id>ubuntu19.04</short-id>
> <short-id>ubuntudisco</short-id>
> ```
>
> However, OsinfoLoader has always been treating "short-id" as a single
> property entry and, as a consequence of this, apps would always have to
> use the first listed id as shown below:
> ```
> fidencio at dahmer ~/src/upstream/libosinfo $ osinfo-install-script debian9
> preseed.cfg
> fidencio at dahmer ~/src/upstream/libosinfo $ osinfo-install-script debianstretch
> Error finding OS: debianstretch
> fidencio at dahmer ~/src/upstream/libosinfo $ osinfo-install-script ubuntu19.04
> preseed.cfg
> fidencio at dahmer ~/src/upstream/libosinfo $ osinfo-install-script ubuntudisco
> Error finding OS: ubuntudisco
> ```
>
> As OsinfoEntity already has support for multiple property entries, let's
> take advantage of this and properly treat OSINFO_PRODUCT_PROP_SHORT_ID as
> so.
>
> This doesn't break any compatibility with the existent code as
> osinfo_entity_get_param_value() will *always* return the first added
> entry, as it was done before.
>
> OsinfoFilter also already has support for multiple property entries and
> the filter works as expected.
>
> Here's the result of the very same example used above with this fix:
> ```
> fidencio at dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script debian9
> preseed.cfg
> fidencio at dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script debianstretch
> preseed.cfg
> fidencio at dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script ubuntu19.04
> preseed.cfg
> fidencio at dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script ubuntudisco
> preseed.cfg
> ````
>
> https://gitlab.com/libosinfo/libosinfo/issues/19
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
> osinfo/osinfo_loader.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
Reviewed-by: Cole Robinson <crobinso at redhat.com>
Works in my testing and virt-manager test suite doesn't error. Thanks
for fixing this!
- Cole
More information about the Libosinfo
mailing list