[gnome-software] Fix searching for application installed as flatpakrefs
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Fix searching for application installed as flatpakrefs
- Date: Wed, 8 Mar 2017 16:34:40 +0000 (UTC)
commit c30a1d6652a0f5155a2edc24445fecb515fe41f7
Author: Richard Hughes <richard hughsie com>
Date: Wed Mar 8 15:30:59 2017 +0000
Fix searching for application installed as flatpakrefs
Update the appstream branch of the correct GsFlatpak when the install has
completed as the temporary object will not return results.
plugins/flatpak/gs-flatpak.c | 4 ++++
plugins/flatpak/gs-self-test.c | 29 +++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 59612e4..44c18c4 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2662,6 +2662,10 @@ gs_flatpak_app_install (GsFlatpak *self,
gs_app_set_state_recover (app);
return FALSE;
}
+
+ /* update search tokens for new remote */
+ if (!gs_flatpak_refresh_appstream (self, G_MAXUINT, 0, cancellable, error))
+ return FALSE;
}
/* install required runtime if not already installed */
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index 5b2b53b..2e0528a 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -708,6 +708,7 @@ gs_plugins_flatpak_runtime_repo_func (GsPluginLoader *plugin_loader)
static void
gs_plugins_flatpak_ref_func (GsPluginLoader *plugin_loader)
{
+ GsApp *app_tmp;
GsApp *runtime;
gboolean ret;
const gchar *fn = "/tmp/test.flatpakref";
@@ -720,6 +721,8 @@ gs_plugins_flatpak_ref_func (GsPluginLoader *plugin_loader)
g_autoptr(GsApp) app = NULL;
g_autoptr(GsApp) app_source = NULL;
g_autoptr(GsAppList) list = NULL;
+ g_autoptr(GsAppList) search1 = NULL;
+ g_autoptr(GsAppList) search2 = NULL;
g_autoptr(GsAppList) sources = NULL;
g_autoptr(GString) str = g_string_new (NULL);
@@ -848,6 +851,20 @@ gs_plugins_flatpak_ref_func (GsPluginLoader *plugin_loader)
g_assert_cmpstr (gs_app_get_update_version (app), ==, NULL);
g_assert_cmpstr (gs_app_get_update_details (app), ==, NULL);
+ /* search for the application */
+ search1 = gs_plugin_loader_search (plugin_loader,
+ "chiron",
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+ NULL,
+ &error);
+ gs_test_flush_main_context ();
+ g_assert_no_error (error);
+ g_assert (search1 != NULL);
+ g_assert_cmpint (gs_app_list_length (search1), ==, 1);
+ app_tmp = gs_app_list_index (search1, 0);
+ g_assert_cmpstr (gs_app_get_id (app_tmp), ==, "org.test.Chiron.desktop");
+
/* remove app */
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_REMOVE,
@@ -884,6 +901,18 @@ gs_plugins_flatpak_ref_func (GsPluginLoader *plugin_loader)
g_assert_no_error (error);
g_assert (sources != NULL);
g_assert_cmpint (gs_app_list_length (sources), ==, 0);
+
+ /* there should be no matches now */
+ search2 = gs_plugin_loader_search (plugin_loader,
+ "chiron",
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+ NULL,
+ &error);
+ gs_test_flush_main_context ();
+ g_assert_no_error (error);
+ g_assert (search2 != NULL);
+ g_assert_cmpint (gs_app_list_length (search2), ==, 0);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]