[libosinfo PATCH v2 3/8] db: Consider the tree arch when guessing an OS from tree

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

 



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

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

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 136cf79..b6d9282 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -761,6 +761,7 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
     OsinfoOs *ret = NULL;
     GList *oss = NULL;
     GList *os_iter;
+    const gchar *tree_arch;
     const gchar *treeinfo_family;
     const gchar *treeinfo_variant;
     const gchar *treeinfo_version;
@@ -769,6 +770,7 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
     g_return_val_if_fail(OSINFO_IS_DB(db), NULL);
     g_return_val_if_fail(tree != NULL, NULL);
 
+    tree_arch = osinfo_tree_get_architecture(tree);
     treeinfo_family = osinfo_tree_get_treeinfo_family(tree);
     treeinfo_variant = osinfo_tree_get_treeinfo_variant(tree);
     treeinfo_version = osinfo_tree_get_treeinfo_version(tree);
@@ -785,6 +787,7 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
 
         for (tree_iter = trees; tree_iter; tree_iter = tree_iter->next) {
             OsinfoTree *os_tree = OSINFO_TREE(tree_iter->data);
+            const gchar *os_tree_arch;
             const gchar *os_treeinfo_family;
             const gchar *os_treeinfo_variant;
             const gchar *os_treeinfo_version;
@@ -793,12 +796,14 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
             if (!osinfo_tree_has_treeinfo(os_tree))
                 continue;
 
+            os_tree_arch = osinfo_tree_get_architecture(os_tree);
             os_treeinfo_family = osinfo_tree_get_treeinfo_family(os_tree);
             os_treeinfo_variant = osinfo_tree_get_treeinfo_variant(os_tree);
             os_treeinfo_version = osinfo_tree_get_treeinfo_version(os_tree);
             os_treeinfo_arch = osinfo_tree_get_treeinfo_arch(os_tree);
 
-            if (match_regex(os_treeinfo_family, treeinfo_family) &&
+            if (match_regex(os_tree_arch, tree_arch) &&
+                match_regex(os_treeinfo_family, treeinfo_family) &&
                 match_regex(os_treeinfo_variant, treeinfo_variant) &&
                 match_regex(os_treeinfo_version, treeinfo_version) &&
                 match_regex(os_treeinfo_arch, treeinfo_arch)) {
-- 
2.20.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux