diff options
Diffstat (limited to 'osinfo/osinfo_db.c')
-rw-r--r-- | osinfo/osinfo_db.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c index 7b5ea9b..074726a 100644 --- a/osinfo/osinfo_db.c +++ b/osinfo/osinfo_db.c @@ -1086,6 +1086,13 @@ static void fill_tree(OsinfoDb *db, OsinfoTree *tree, * the tree could be identified, its OsinfoEntify::id and OsinfoMedia::os * properties will be set. * + * The match for @tree in @db is not guaranteed to be unique and + * this method will only return the first match found. The order + * in which matches are identified is not guaranteed, so when there + * are multiple matches, the returned match may vary over time. + * Applications are recommended to use the #osinfo_db_identify_all_tree + * method instead to receive all matched tree. + * * Returns: TRUE if @tree was found in @db, FALSE otherwise * * Since: 1.6.0 @@ -1111,6 +1118,35 @@ gboolean osinfo_db_identify_tree(OsinfoDb *db, return TRUE; } +/** + * osinfo_db_identify_treelist: + * @db: an #OsinfoDb database + * @tree: the installation tree data + * + * Try to match a newly created @tree with a tree description from @db. + * The return list will contain any #OsinfoTree instances from @db that + * matched @tree. Usuaully there will only be one match returned, but + * applications should be prepared to deal with multiple matches. The + * returned #OsinfoTree instances will have their OsinfoEntify::id and + * OsinfoTree::os properties will be set, while @tree is left unmodified. + * + * Returns: (transfer full): a list containing any matches for @tree found in @db + * + * Since: 1.10.0 + */ +OsinfoTreeList *osinfo_db_identify_treelist(OsinfoDb *db, OsinfoTree *tree) +{ + OsinfoTreeList *matched_tree = osinfo_treelist_new(); + + g_return_val_if_fail(OSINFO_IS_TREE(tree), FALSE); + g_return_val_if_fail(OSINFO_IS_DB(db), FALSE); + + osinfo_db_guess_os_from_tree_internal(db, tree, matched_tree, + FALSE, NULL); + + return matched_tree; +} + struct osinfo_db_populate_values_args { GHashTable *values; const gchar *property; |