diff --git a/0001-db-Take-the-media-s-volume-size-into-account-when-so.patch b/0001-db-Take-the-media-s-volume-size-into-account-when-so.patch new file mode 100644 index 0000000..2023182 --- /dev/null +++ b/0001-db-Take-the-media-s-volume-size-into-account-when-so.patch @@ -0,0 +1,51 @@ +From 71cf18b07b830f7966dbd6b6705c0f9cddb5c587 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Tue, 5 Nov 2019 15:56:28 +0100 +Subject: [PATCH] db: Take the media's volume size into account when sorting + the medias +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If volume-size is not taken into account, when dealing with identical +ISOs, we may end up wrongly matching an entry that has its volume-size +with one which doesn't have the value, simply because the one which does +not have the value may be declared first the in XML entry. + +Signed-off-by: Fabiano Fidêncio +Reviewed-by; Daniel P. Berrangé +--- + osinfo/osinfo_db.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c +index 328b251a..e2845df2 100644 +--- a/osinfo/osinfo_db.c ++++ b/osinfo/osinfo_db.c +@@ -538,11 +538,21 @@ static gint media_volume_compare(gconstpointer a, gconstpointer b) + /* Order doesn't matter then */ + return 0; + +- if (strstr(volume_a, volume_b) != NULL) ++ if (strstr(volume_a, volume_b) != NULL) { ++ gint64 volume_size_a = osinfo_media_get_volume_size(media_a); ++ gint64 volume_size_b = osinfo_media_get_volume_size(media_b); ++ ++ if (volume_size_a != -1 && volume_size_b == -1) ++ return -1; ++ ++ if (volume_size_b != -1 && volume_size_a == -1) ++ return 1; ++ + return -1; +- else ++ } else { + /* Sub-string comes later */ + return 1; ++ } + } + + static gboolean compare_media(OsinfoMedia *media, +-- +2.23.0 + diff --git a/libosinfo.spec b/libosinfo.spec index 7a0a787..ed34b23 100644 --- a/libosinfo.spec +++ b/libosinfo.spec @@ -3,12 +3,13 @@ Summary: A library for managing OS information for virtualization Name: libosinfo Version: 1.6.0 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Source: https://releases.pagure.io/%{name}/%{name}-%{version}.tar.gz URL: https://libosinfo.org/ ### Patches ### +Patch0001: 0001-db-Take-the-media-s-volume-size-into-account-when-so.patch BuildRequires: gettext-devel BuildRequires: glib2-devel @@ -98,6 +99,9 @@ fi %{_datadir}/vala/vapi/libosinfo-1.0.vapi %changelog +* Fri Nov 08 2019 Fabiano Fidêncio - 1.6.0-2 +- Improve ISO detection mechanism + * Fri Jul 26 2019 Fabiano Fidêncio - 1.6.0-1 - Update to 1.6.0 release