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@dahmer ~/src/upstream/libosinfo $ osinfo-install-script debian9
> preseed.cfg
> fidencio@dahmer ~/src/upstream/libosinfo $ osinfo-install-script debianstretch
> Error finding OS: debianstretch
> fidencio@dahmer ~/src/upstream/libosinfo $ osinfo-install-script ubuntu19.04
> preseed.cfg
> fidencio@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@dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script 
> debian9
> preseed.cfg
> fidencio@dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script 
> debianstretch
> preseed.cfg
> fidencio@dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script 
> ubuntu19.04
> preseed.cfg
> fidencio@dahmer ~/src/upstream/libosinfo $ ./tools/osinfo-install-script 
> ubuntudisco
> preseed.cfg
> ````
> 
> https://gitlab.com/libosinfo/libosinfo/issues/19
> 
> Signed-off-by: Fabiano FidĂȘncio <[email protected]>
> ---
>  osinfo/osinfo_loader.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 

Reviewed-by: Cole Robinson <[email protected]>

Works in my testing and virt-manager test suite doesn't error. Thanks
for fixing this!

- Cole

_______________________________________________
Libosinfo mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libosinfo

Reply via email to