[gnome-software/1237-fedora-rpm-repo-hidden-by-rpm-fusion-repo: 7/8] gs-plugin-appstream: Search with appstream origin, if available
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1237-fedora-rpm-repo-hidden-by-rpm-fusion-repo: 7/8] gs-plugin-appstream: Search with appstream origin, if available
- Date: Thu, 3 Jun 2021 06:55:38 +0000 (UTC)
commit 70b639553f31541066b8cff1ee91af6502d1ba6b
Author: Milan Crha <mcrha redhat com>
Date: Wed May 5 18:42:52 2021 +0200
gs-plugin-appstream: Search with appstream origin, if available
When the app has set an appstream origin, then search with it, to better
match the application in case it's provided by multiple repositories.
plugins/core/gs-plugin-appstream.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index c771f74a5..000509421 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -809,7 +809,7 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
- const gchar *id;
+ const gchar *id, *origin;
g_autoptr(GError) error_local = NULL;
g_autoptr(GRWLockReaderLocker) locker = NULL;
g_autoptr(GString) xpath = g_string_new (NULL);
@@ -822,9 +822,16 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
locker = g_rw_lock_reader_locker_new (&priv->silo_lock);
+ origin = gs_app_get_origin_appstream (app);
+
/* look in AppStream then fall back to AppData */
- xb_string_append_union (xpath, "components/component/id[text()='%s']/../pkgname/..", id);
- xb_string_append_union (xpath, "components/component[@type='webapp']/id[text()='%s']/..", id);
+ if (origin && *origin) {
+ xb_string_append_union (xpath,
"components[@origin='%s']/component/id[text()='%s']/../pkgname/..", origin, id);
+ xb_string_append_union (xpath,
"components[@origin='%s']/component[@type='webapp']/id[text()='%s']/..", origin, id);
+ } else {
+ xb_string_append_union (xpath, "components/component/id[text()='%s']/../pkgname/..", id);
+ xb_string_append_union (xpath, "components/component[@type='webapp']/id[text()='%s']/..", id);
+ }
xb_string_append_union (xpath, "component/id[text()='%s']/..", id);
components = xb_silo_query (priv->silo, xpath->str, 0, &error_local);
if (components == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]