[gnome-software] Respect the failure flags when running a plugin action
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Respect the failure flags when running a plugin action
- Date: Sat, 18 Feb 2017 20:44:08 +0000 (UTC)
commit b902afa37cfb1a40be74ddb476abcbefbfe07064
Author: Richard Hughes <richard hughsie com>
Date: Sat Feb 18 20:41:53 2017 +0000
Respect the failure flags when running a plugin action
src/gs-plugin-loader.c | 1 +
src/gs-self-test.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 9c335ef..29f9c1c 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2902,6 +2902,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
job = gs_plugin_loader_job_new (plugin_loader);
job->app = g_object_ref (app);
job->action = action;
+ job->failure_flags = failure_flags;
switch (action) {
case GS_PLUGIN_ACTION_INSTALL:
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index fcdc43b..824ca8e 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -1095,6 +1095,7 @@ static void
gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
{
GsApp *app;
+ GsApp *runtime;
const gchar *root;
gboolean ret;
gint kf_remote_repo_version;
@@ -1279,6 +1280,40 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
g_assert (!g_file_test (metadata_fn, G_FILE_TEST_IS_REGULAR));
g_assert (!g_file_test (desktop_fn, G_FILE_TEST_IS_REGULAR));
+
+ /* remove the remote (fail, as the runtime is still installed) */
+ ret = gs_plugin_loader_app_action (plugin_loader, app_source,
+ GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY |
+ GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE,
+ NULL,
+ &error);
+ g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED);
+ g_assert (!ret);
+ g_clear_error (&error);
+ g_assert_cmpint (gs_app_get_state (app_source), ==, AS_APP_STATE_INSTALLED);
+
+ /* remove the runtime */
+ runtime = gs_app_get_runtime (app);
+ g_assert (runtime != NULL);
+ g_assert_cmpstr (gs_app_get_unique_id (runtime), ==,
"user/flatpak/test/runtime/org.test.Runtime.runtime/master");
+ ret = gs_plugin_loader_app_action (plugin_loader, runtime,
+ GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+ NULL,
+ &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+
+ /* remove the remote */
+ ret = gs_plugin_loader_app_action (plugin_loader, app_source,
+ GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ANY,
+ NULL,
+ &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ g_assert_cmpint (gs_app_get_state (app_source), ==, AS_APP_STATE_AVAILABLE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]