[gnome-software/gnome-3-22] trivial: Do not try to fetch the remote metadata for a .flatpak file



commit fb7ce8d7523a3a304c687bd44c5cc033d6694cca
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 9 15:01:46 2017 +0000

    trivial: Do not try to fetch the remote metadata for a .flatpak file

 src/plugins/gs-flatpak.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 3a305a2..ebe8c85 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1560,7 +1560,7 @@ gs_flatpak_fetch_remote_metadata (GsFlatpak *self,
                g_set_error (error,
                             GS_PLUGIN_ERROR,
                             GS_PLUGIN_ERROR_NOT_SUPPORTED,
-                            "no origin set for %s",
+                            "no origin set when getting metadata for %s",
                             gs_app_get_unique_id (app));
                return NULL;
        }
@@ -2041,27 +2041,32 @@ install_runtime_for_app (GsFlatpak *self,
                         GError **error)
 {
        GsApp *runtime;
-       gsize len;
-       const gchar *str;
-       g_autoptr(GBytes) data = gs_flatpak_fetch_remote_metadata (self, app,
-                                                                  cancellable,
-                                                                  error);
 
-       if (data == NULL) {
-               gs_app_set_state_recover (app);
-               return FALSE;
-       }
+       /* only required for ostree-based flatpak apps */
+       if (g_strcmp0 (gs_app_get_flatpak_file_type (app), "flatpak") != 0) {
+               gsize len;
+               const gchar *str;
+               g_autoptr(GBytes) data = NULL;
+               g_autoptr(GsApp) runtime_new = NULL;
 
-       str = g_bytes_get_data (data, &len);
-       runtime = gs_flatpak_create_runtime_from_metadata (self, app, str, len,
-                                                          error);
+               data = gs_flatpak_fetch_remote_metadata (self, app, cancellable, error);
+               if (data == NULL) {
+                       gs_app_set_state_recover (app);
+                       return FALSE;
+               }
+
+               str = g_bytes_get_data (data, &len);
+               runtime_new = gs_flatpak_create_runtime_from_metadata (self, app,
+                                                                      str, len,
+                                                                      error);
+               gs_app_set_update_runtime (app, runtime_new);
+       }
 
        /* no runtime required */
+       runtime = gs_app_get_update_runtime (app);
        if (runtime == NULL)
                return TRUE;
 
-       gs_app_set_update_runtime (app, runtime);
-
        /* the runtime could come from a different remote to the app */
        if (!gs_refine_item_metadata (self, runtime, cancellable, error)) {
                gs_app_set_state_recover (app);
@@ -2168,7 +2173,7 @@ gs_flatpak_app_install (GsFlatpak *self,
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
                                     GS_PLUGIN_ERROR_NOT_SUPPORTED,
-                                    "no origin set for %s",
+                                    "no origin set for remote %s",
                                     gs_app_get_unique_id (app));
                        return FALSE;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]