[gnome-software] trivial: Fix make check if /var/lib/flatpak is not available
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Fix make check if /var/lib/flatpak is not available
- Date: Tue, 28 Feb 2017 12:00:10 +0000 (UTC)
commit 69421ec070c4d872eab5dcbdc0371f115e48c152
Author: Richard Hughes <richard hughsie com>
Date: Mon Feb 27 20:17:46 2017 +0000
trivial: Fix make check if /var/lib/flatpak is not available
src/gs-utils.c | 3 ++
src/plugins/gs-flatpak.c | 61 ++++++++++++++++++++++++++++++++-------------
2 files changed, 46 insertions(+), 18 deletions(-)
---
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 7f08ffe..97138bf 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -677,6 +677,9 @@ gs_utils_error_convert_gio (GError **perror)
case G_IO_ERROR_NO_SPACE:
error->code = GS_PLUGIN_ERROR_NO_SPACE;
break;
+ case G_IO_ERROR_PERMISSION_DENIED:
+ error->code = GS_PLUGIN_ERROR_NO_SECURITY;
+ break;
case G_IO_ERROR_HOST_NOT_FOUND:
case G_IO_ERROR_HOST_UNREACHABLE:
case G_IO_ERROR_CONNECTION_REFUSED:
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index ef4fb6c..721080b 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1456,13 +1456,23 @@ gs_plugin_refine_item_origin (GsFlatpak *self,
/* check the system installation if we're on a user one */
if (gs_app_get_scope (app) == AS_APP_SCOPE_USER &&
gs_app_get_flatpak_kind (app) == FLATPAK_REF_KIND_RUNTIME) {
+ g_autoptr(GError) error_local = NULL;
g_autoptr(FlatpakInstallation) installation =
gs_flatpak_get_installation_counterpart (self,
cancellable,
- error);
-
+ &error_local);
if (installation == NULL) {
- g_prefix_error (error, "failed to get counterpart: ");
+ if (g_error_matches (error_local,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NO_SECURITY)) {
+ g_debug ("ignoring: %s", error_local->message);
+ return TRUE;
+ }
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "failed to get counterpart: %s",
+ error_local->message);
return FALSE;
}
if (!gs_flatpak_refine_origin_from_installation (self,
@@ -1571,24 +1581,39 @@ gs_plugin_refine_item_state (GsFlatpak *self,
* available system-wide then mark it installed, and vice-versa */
if (gs_app_get_flatpak_kind (app) == FLATPAK_REF_KIND_RUNTIME &&
gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) {
- g_autoptr(GPtrArray) xrefs2 = NULL;
+ g_autoptr(GError) error_local = NULL;
g_autoptr(FlatpakInstallation) installation =
gs_flatpak_get_installation_counterpart (self,
cancellable,
- error);
- if (installation == NULL)
- return FALSE;
- xrefs2 = flatpak_installation_list_installed_refs (installation,
- cancellable, error);
- if (xrefs2 == NULL) {
- gs_plugin_flatpak_error_convert (error);
- return FALSE;
- }
- for (i = 0; i < xrefs2->len; i++) {
- FlatpakInstalledRef *xref = g_ptr_array_index (xrefs2, i);
- if (!gs_flatpak_app_matches_xref (self, app, FLATPAK_REF(xref)))
- continue;
- gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+ &error_local);
+ if (installation == NULL) {
+ if (g_error_matches (error_local,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NO_SECURITY)) {
+ g_debug ("ignoring: %s", error_local->message);
+ } else {
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "failed to get counterpart: %s",
+ error_local->message);
+ return FALSE;
+ }
+ } else {
+ g_autoptr(GPtrArray) xrefs2 = NULL;
+ xrefs2 = flatpak_installation_list_installed_refs (installation,
+ cancellable,
+ error);
+ if (xrefs2 == NULL) {
+ gs_plugin_flatpak_error_convert (error);
+ return FALSE;
+ }
+ for (i = 0; i < xrefs2->len; i++) {
+ FlatpakInstalledRef *xref = g_ptr_array_index (xrefs2, i);
+ if (!gs_flatpak_app_matches_xref (self, app, FLATPAK_REF(xref)))
+ continue;
+ gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]