/** * hif_package_is_gui: * @pkg: a #HifPackage *instance. * * Returns: %TRUE if the package is a GUI package * * Since: 0.1.0 **/ gboolean hif_package_is_gui(HifPackage *pkg) { gboolean ret = FALSE; gchar *tmp; gint idx; HyReldepList reldeplist; HyReldep reldep; int size; /* find if the package depends on GTK or KDE */ reldeplist = hif_package_get_requires(pkg); size = hy_reldeplist_count(reldeplist); for (idx = 0; idx < size && !ret; idx++) { reldep = hy_reldeplist_get_clone(reldeplist, idx); tmp = hy_reldep_str(reldep); if (g_strstr_len(tmp, -1, "libgtk") != NULL || g_strstr_len(tmp, -1, "libQt5Gui.so") != NULL || g_strstr_len(tmp, -1, "libQtGui.so") != NULL || g_strstr_len(tmp, -1, "libqt-mt.so") != NULL) { ret = TRUE; } free(tmp); hy_reldep_free(reldep); } hy_reldeplist_free(reldeplist); return ret; }
END_TEST START_TEST(test_get_requires) { HySack sack = test_globals.sack; HyPackage pkg = by_name(sack, "flying"); HyReldepList reldeplist = hy_package_get_requires(pkg); fail_unless(hy_reldeplist_count(reldeplist) == 1); HyReldep reldep = hy_reldeplist_get_clone(reldeplist, 0); char *depstr = hy_reldep_str(reldep); ck_assert_str_eq(depstr, "P-lib >= 3"); hy_free(depstr); hy_reldep_free(reldep); hy_reldeplist_free(reldeplist); hy_package_free(pkg); }
END_TEST START_TEST(test_query_reldep) { HySack sack = test_globals.sack; HyPackage flying = by_name(sack, "flying"); HyReldepList reldeplist = hy_package_get_requires(flying); HyReldep reldep = hy_reldeplist_get_clone(reldeplist, 0); HyQuery q = hy_query_create(test_globals.sack); fail_if(hy_query_filter_reldep(q, HY_PKG_PROVIDES, reldep)); fail_unless(query_count_results(q) == 3); hy_reldep_free(reldep); hy_reldeplist_free(reldeplist); hy_package_free(flying); hy_query_free(q); }