[gnome-software] trivial: Don't rely on REQUIRE_RELATED to set the runtime properly



commit f775ffd14b27baa7a9cbbbca19bc47657f453aa9
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jan 9 17:03:22 2017 +0000

    trivial: Don't rely on REQUIRE_RELATED to set the runtime properly

 src/gs-cmd.c             |    2 ++
 src/gs-plugin-loader.c   |    4 +++-
 src/gs-plugin-types.h    |    2 ++
 src/gs-shell-details.c   |    2 ++
 src/plugins/gs-flatpak.c |    3 ++-
 5 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 8160407..3ea78dd 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -144,6 +144,8 @@ gs_cmd_refine_flag_from_string (const gchar *flag, GError **error)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME;
        if (g_strcmp0 (flag, "origin-ui") == 0)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI;
+       if (g_strcmp0 (flag, "runtime") == 0)
+               return GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME;
        g_set_error (error,
                     GS_PLUGIN_ERROR,
                     GS_PLUGIN_ERROR_NOT_SUPPORTED,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 0912e41..797cb6f 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -677,6 +677,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderJob *job,
                job->refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
        if (job->refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME)
                job->refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
+       if (job->refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE)
+               job->refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME;
 
        /* try to adopt each application with a plugin */
        gs_plugin_loader_run_adopt (job->plugin_loader, list);
@@ -748,7 +750,7 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderJob *job,
        }
 
        /* also do runtime */
-       if ((job->refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED) > 0) {
+       if ((job->refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME) > 0) {
                g_autoptr(GsAppList) list2 = gs_app_list_new ();
                for (i = 0; i < gs_app_list_length (list); i++) {
                        GsApp *runtime;
diff --git a/src/gs-plugin-types.h b/src/gs-plugin-types.h
index 6293610..a361caa 100644
--- a/src/gs-plugin-types.h
+++ b/src/gs-plugin-types.h
@@ -145,6 +145,7 @@ typedef enum {
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS:                Require the needed permissions
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME:    Require the origin hostname
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI:          Require the origin for UI
+ * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME:            Require the runtime
  *
  * The refine flags.
  **/
@@ -174,6 +175,7 @@ typedef enum {
 #define GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS     (1u << 22)
 #define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME (1u << 23)
 #define GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI       (1u << 24)
+#define GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME         (1u << 25)
 typedef guint64 GsPluginRefineFlags;
 
 /**
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 0c82105..9e67376 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1514,6 +1514,7 @@ gs_shell_details_set_filename (GsShellDetails *self, const gchar *filename)
                                            GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
                                            GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
                                            GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED |
+                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME |
                                            GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS,
                                            GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
                                            self->cancellable,
@@ -1537,6 +1538,7 @@ gs_shell_details_load (GsShellDetails *self)
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS,
                                           GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
                                           self->cancellable,
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 4c325fb..cf31754 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1893,7 +1893,8 @@ gs_flatpak_refine_app (GsFlatpak *self,
        }
 
        /* permissions */
-       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS) {
+       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RUNTIME ||
+           flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS) {
                if (!gs_plugin_refine_item_metadata (self, app,
                                                     cancellable, error)) {
                        g_prefix_error (error, "failed to get permissions: ");


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