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

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



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

Signed-off-by: Fabiano Fidêncio <fidencio 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 ff731ed..c7963ec 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


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