[Libosinfo] [libosinfo PATCH 6/8] db: Consider the media arch when guess an OS from media

Fabiano Fidêncio fidencio at redhat.com
Wed Mar 27 11:24:28 UTC 2019


https://gitlab.com/libosinfo/libosinfo/issues/20

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_db.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 1038142..2cecaf6 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -545,6 +545,7 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db,
     OsinfoOs *ret = NULL;
     GList *oss = NULL;
     GList *os_iter;
+    const gchar *media_arch;
     const gchar *media_volume;
     const gchar *media_system;
     const gchar *media_publisher;
@@ -554,6 +555,7 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db,
     g_return_val_if_fail(OSINFO_IS_DB(db), NULL);
     g_return_val_if_fail(media != NULL, NULL);
 
+    media_arch = osinfo_media_get_architecture(media);
     media_volume = osinfo_media_get_volume_id(media);
     media_system = osinfo_media_get_system_id(media);
     media_publisher = osinfo_media_get_publisher_id(media);
@@ -571,6 +573,7 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db,
 
         for (media_iter = medias; media_iter; media_iter = media_iter->next) {
             OsinfoMedia *os_media = OSINFO_MEDIA(media_iter->data);
+            const gchar *os_arch = osinfo_media_get_architecture(os_media);
             const gchar *os_volume = osinfo_media_get_volume_id(os_media);
             const gchar *os_system = osinfo_media_get_system_id(os_media);
             const gchar *os_publisher = osinfo_media_get_publisher_id(os_media);
@@ -587,7 +590,8 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db,
             if (os_vol_size <= 0)
                 os_vol_size = media_vol_size;
 
-            if (match_regex(os_volume, media_volume) &&
+            if (match_regex(os_arch, media_arch) &&
+                match_regex(os_volume, media_volume) &&
                 match_regex(os_application, media_application) &&
                 match_regex(os_system, media_system) &&
                 match_regex(os_publisher, media_publisher) &&
-- 
2.20.1




More information about the Libosinfo mailing list