Compare commits
20 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e83c917c2 | ||
|
|
0b1309adc3 | ||
|
|
3eeea97c18 | ||
|
|
6784ccf868 | ||
|
|
e827fb0df3 | ||
|
|
3983063edf | ||
|
|
5b17ec1600 | ||
|
|
3cd73027d3 | ||
|
|
ed242ebfa5 | ||
|
|
2ad32833b1 | ||
|
|
bc3e401ebb | ||
|
|
a5778cb05f | ||
|
|
a414c78019 | ||
|
|
9e406b9c70 | ||
|
|
17d18ba378 | ||
|
|
6044443148 | ||
|
|
f92a1eb0a1 | ||
|
|
61a3273790 | ||
|
|
0508e1734f | ||
|
|
d11480e2e6 |
12 changed files with 1461 additions and 7696 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1 @@
|
|||
/gnome-software-*.tar.xz
|
||||
/gnome-software-*-build
|
||||
|
|
|
|||
48
0001-crash-with-broken-theme.patch
Normal file
48
0001-crash-with-broken-theme.patch
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
From 3a644c151f27f439c36170f0958fd21cf1cc54d0 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Thu, 3 Jun 2021 08:33:53 +0200
|
||||
Subject: [PATCH] gs-feature-tile: Do not abort when the theme is broken
|
||||
|
||||
Just print a warning when the theme doesn't provide 'theme_fg_color' and
|
||||
fallback to black color.
|
||||
|
||||
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1228
|
||||
---
|
||||
src/gs-feature-tile.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
|
||||
index 1c85083eb..158af1e56 100644
|
||||
--- a/src/gs-feature-tile.c
|
||||
+++ b/src/gs-feature-tile.c
|
||||
@@ -268,7 +268,6 @@ gs_feature_tile_refresh (GsAppTile *self)
|
||||
if (key_colors != tile->key_colors_cache) {
|
||||
g_autoptr(GArray) colors = NULL;
|
||||
GdkRGBA fg_rgba;
|
||||
- gboolean fg_rgba_valid;
|
||||
GsHSBC fg_hsbc;
|
||||
|
||||
/* Look up the foreground colour for the feature tile,
|
||||
@@ -283,8 +282,17 @@ gs_feature_tile_refresh (GsAppTile *self)
|
||||
* @min_abs_contrast contrast with the foreground, so
|
||||
* that the text is legible.
|
||||
*/
|
||||
- fg_rgba_valid = gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba);
|
||||
- g_assert (fg_rgba_valid);
|
||||
+ if (!gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba)) {
|
||||
+ static gboolean i_know = FALSE;
|
||||
+ if (!i_know) {
|
||||
+ i_know = TRUE;
|
||||
+ g_warning ("The theme doesn't provide 'theme_fg_color', fallbacking to black");
|
||||
+ }
|
||||
+ fg_rgba.red = 0.0;
|
||||
+ fg_rgba.green = 0.0;
|
||||
+ fg_rgba.blue = 0.0;
|
||||
+ fg_rgba.alpha = 1.0;
|
||||
+ }
|
||||
|
||||
gtk_rgb_to_hsv (fg_rgba.red, fg_rgba.green, fg_rgba.blue,
|
||||
&fg_hsbc.hue, &fg_hsbc.saturation, &fg_hsbc.brightness);
|
||||
--
|
||||
GitLab
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,686 +0,0 @@
|
|||
From 0c79d9fb08a348a45a18f15427c945a63b44982e Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 24 Nov 2025 16:06:51 +0100
|
||||
Subject: [PATCH 1/3] flatpak: Fix XbSilo lifetime in
|
||||
gs_flatpak_refine_wildcard()
|
||||
|
||||
The function uses pre-cached data in the hash tables, consisting of XbNode-s
|
||||
from an XbSilo. The nodes are referenced, but the silos the node belongs to
|
||||
is not referenced (by the XbNode).
|
||||
|
||||
This change keeps the XbSilo alive as long as it's needed for the nodes
|
||||
in the pre-cached data. It also does not call gs_flatpak_ref_silo() multiple
|
||||
times for the same GsFlatpak instance, which could invalidate the XbNode-s
|
||||
in the pre-cached data when a change in the silo or in the installation
|
||||
had been received while the function was still processing the apps.
|
||||
|
||||
Related downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2416542
|
||||
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/2900
|
||||
---
|
||||
plugins/flatpak/gs-flatpak.c | 18 ++++++++---
|
||||
plugins/flatpak/gs-flatpak.h | 4 +++
|
||||
plugins/flatpak/gs-plugin-flatpak.c | 49 ++++++++++++++++++++---------
|
||||
3 files changed, 51 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
|
||||
index b409475c7..a40ab54fb 100644
|
||||
--- a/plugins/flatpak/gs-flatpak.c
|
||||
+++ b/plugins/flatpak/gs-flatpak.c
|
||||
@@ -3748,16 +3748,19 @@ gboolean
|
||||
gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
|
||||
GsAppList *list, GsPluginRefineRequireFlags require_flags,
|
||||
gboolean interactive,
|
||||
+ XbSilo **inout_silo,
|
||||
+ gchar **inout_silo_filename,
|
||||
+ GHashTable **inout_installed_by_desktopid,
|
||||
GHashTable **inout_components_by_id,
|
||||
GHashTable **inout_components_by_bundle,
|
||||
GCancellable *cancellable, GError **error)
|
||||
{
|
||||
const gchar *id;
|
||||
GPtrArray* components = NULL;
|
||||
+ XbSilo *silo;
|
||||
+ GHashTable *silo_installed_by_desktopid;
|
||||
+ const gchar *silo_filename;
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
- g_autoptr(XbSilo) silo = NULL;
|
||||
- g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
|
||||
- g_autofree gchar *silo_filename = NULL;
|
||||
|
||||
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
|
||||
|
||||
@@ -3766,10 +3769,15 @@ gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
|
||||
if (id == NULL)
|
||||
return TRUE;
|
||||
|
||||
- silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
|
||||
- if (silo == NULL)
|
||||
+ if (*inout_silo == NULL)
|
||||
+ *inout_silo = gs_flatpak_ref_silo (self, interactive, inout_silo_filename, inout_installed_by_desktopid, cancellable, error);
|
||||
+ if (*inout_silo == NULL)
|
||||
return FALSE;
|
||||
|
||||
+ silo = *inout_silo;
|
||||
+ silo_filename = *inout_silo_filename;
|
||||
+ silo_installed_by_desktopid = *inout_installed_by_desktopid;
|
||||
+
|
||||
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardQuerySilo, "Flatpak (query silo)", NULL);
|
||||
|
||||
if (*inout_components_by_id != NULL) {
|
||||
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
|
||||
index 66ff59967..34e1416b5 100644
|
||||
--- a/plugins/flatpak/gs-flatpak.h
|
||||
+++ b/plugins/flatpak/gs-flatpak.h
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <gnome-software.h>
|
||||
#include <flatpak.h>
|
||||
+#include <xmlb.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -108,6 +109,9 @@ gboolean gs_flatpak_refine_wildcard (GsFlatpak *self,
|
||||
GsAppList *list,
|
||||
GsPluginRefineRequireFlags require_flags,
|
||||
gboolean interactive,
|
||||
+ XbSilo **inout_silo,
|
||||
+ gchar **inout_silo_filename,
|
||||
+ GHashTable **inout_installed_by_desktopid,
|
||||
GHashTable **inout_components_by_id,
|
||||
GHashTable **inout_components_by_bundle,
|
||||
GCancellable *cancellable,
|
||||
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
|
||||
index 3d0503d46..f5d4a1d67 100644
|
||||
--- a/plugins/flatpak/gs-plugin-flatpak.c
|
||||
+++ b/plugins/flatpak/gs-plugin-flatpak.c
|
||||
@@ -667,12 +667,29 @@ gs_plugin_flatpak_refine_app (GsPluginFlatpak *self,
|
||||
return gs_flatpak_refine_app (flatpak, app, require_flags, interactive, FALSE, event_callback, event_user_data, cancellable, error);
|
||||
}
|
||||
|
||||
+typedef struct {
|
||||
+ XbSilo *silo;
|
||||
+ gchar *silo_filename;
|
||||
+ GHashTable *installed_by_desktopid;
|
||||
+ GHashTable *components_by_id;
|
||||
+ GHashTable *components_by_bundle;
|
||||
+} RefineInstallationData;
|
||||
+
|
||||
static void
|
||||
-unref_nonnull_hash_table (gpointer ptr)
|
||||
+refine_installation_data_free (gpointer ptr)
|
||||
{
|
||||
- GHashTable *hash_table = ptr;
|
||||
- if (hash_table != NULL)
|
||||
- g_hash_table_unref (hash_table);
|
||||
+ RefineInstallationData *data = ptr;
|
||||
+
|
||||
+ if (data == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ g_clear_pointer (&data->silo_filename, g_free);
|
||||
+ g_clear_pointer (&data->installed_by_desktopid, g_hash_table_unref);
|
||||
+ g_clear_pointer (&data->components_by_id, g_hash_table_unref);
|
||||
+ g_clear_pointer (&data->components_by_bundle, g_hash_table_unref);
|
||||
+ /* free the silo as the last, just in case, because the data from it is in the above hash tables */
|
||||
+ g_clear_object (&data->silo);
|
||||
+ g_free (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -761,8 +778,7 @@ refine_thread_cb (GTask *task,
|
||||
gboolean interactive = (data->job_flags & GS_PLUGIN_REFINE_FLAGS_INTERACTIVE) != 0;
|
||||
GsPluginEventCallback event_callback = data->event_callback;
|
||||
void *event_user_data = data->event_user_data;
|
||||
- g_autoptr(GPtrArray) array_components_by_id = NULL; /* (element-type GHashTable) */
|
||||
- g_autoptr(GPtrArray) array_components_by_bundle = NULL; /* (element-type GHashTable) */
|
||||
+ g_autoptr(GPtrArray) installation_data = NULL; /* (element-type RefineInstallationData) */
|
||||
g_autoptr(GsAppList) app_list = NULL;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
@@ -783,10 +799,9 @@ refine_thread_cb (GTask *task,
|
||||
* (e.g. inserting an app in the list on every call results in
|
||||
* an infinite loop) */
|
||||
app_list = gs_app_list_copy (list);
|
||||
- array_components_by_id = g_ptr_array_new_full (self->installations->len, unref_nonnull_hash_table);
|
||||
- g_ptr_array_set_size (array_components_by_id, self->installations->len);
|
||||
- array_components_by_bundle = g_ptr_array_new_full (self->installations->len, unref_nonnull_hash_table);
|
||||
- g_ptr_array_set_size (array_components_by_bundle, self->installations->len);
|
||||
+
|
||||
+ installation_data = g_ptr_array_new_full (self->installations->len, refine_installation_data_free);
|
||||
+ g_ptr_array_set_size (installation_data, self->installations->len);
|
||||
|
||||
for (guint j = 0; j < gs_app_list_length (app_list); j++) {
|
||||
GsApp *app = gs_app_list_index (app_list, j);
|
||||
@@ -796,16 +811,20 @@ refine_thread_cb (GTask *task,
|
||||
|
||||
for (guint i = 0; i < self->installations->len; i++) {
|
||||
GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
|
||||
- GHashTable *components_by_id = array_components_by_id->pdata[i];
|
||||
- GHashTable *components_by_bundle = array_components_by_bundle->pdata[i];
|
||||
+ RefineInstallationData *inst_data = g_ptr_array_index (installation_data, i);
|
||||
+
|
||||
+ if (inst_data == NULL) {
|
||||
+ inst_data = g_new0 (RefineInstallationData, 1);
|
||||
+ installation_data->pdata[i] = inst_data;
|
||||
+ }
|
||||
|
||||
- if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &components_by_id, &components_by_bundle,
|
||||
+ if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &inst_data->silo,
|
||||
+ &inst_data->silo_filename, &inst_data->installed_by_desktopid,
|
||||
+ &inst_data->components_by_id, &inst_data->components_by_bundle,
|
||||
cancellable, &local_error)) {
|
||||
g_task_return_error (task, g_steal_pointer (&local_error));
|
||||
return;
|
||||
}
|
||||
- array_components_by_id->pdata[i] = components_by_id;
|
||||
- array_components_by_bundle->pdata[i] = components_by_bundle;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 546c6ee17b5959d2a696a6cb346a1f8b94aba303 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 7 Jan 2026 18:37:52 +0100
|
||||
Subject: [PATCH 2/3] flatpak: Simplify wildcard app lookup function
|
||||
|
||||
By flipping the order of traversing app and installation the code
|
||||
can be simplified to not have too many in/out arguments.
|
||||
|
||||
Suggested by Philip Withnall
|
||||
---
|
||||
plugins/flatpak/gs-flatpak.c | 251 ++++++++++++++--------------
|
||||
plugins/flatpak/gs-flatpak.h | 9 +-
|
||||
plugins/flatpak/gs-plugin-flatpak.c | 61 +------
|
||||
3 files changed, 130 insertions(+), 191 deletions(-)
|
||||
|
||||
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
|
||||
index a40ab54fb..782b0bb48 100644
|
||||
--- a/plugins/flatpak/gs-flatpak.c
|
||||
+++ b/plugins/flatpak/gs-flatpak.c
|
||||
@@ -3745,167 +3745,158 @@ gs_flatpak_refine_app (GsFlatpak *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
-gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
|
||||
- GsAppList *list, GsPluginRefineRequireFlags require_flags,
|
||||
- gboolean interactive,
|
||||
- XbSilo **inout_silo,
|
||||
- gchar **inout_silo_filename,
|
||||
- GHashTable **inout_installed_by_desktopid,
|
||||
- GHashTable **inout_components_by_id,
|
||||
- GHashTable **inout_components_by_bundle,
|
||||
- GCancellable *cancellable, GError **error)
|
||||
+gs_flatpak_refine_wildcards (GsFlatpak *self,
|
||||
+ GPtrArray *wildcard_apps,
|
||||
+ GsAppList *list,
|
||||
+ GsPluginRefineRequireFlags require_flags,
|
||||
+ gboolean interactive,
|
||||
+ GCancellable *cancellable,
|
||||
+ GError **error)
|
||||
{
|
||||
- const gchar *id;
|
||||
- GPtrArray* components = NULL;
|
||||
- XbSilo *silo;
|
||||
- GHashTable *silo_installed_by_desktopid;
|
||||
- const gchar *silo_filename;
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
+ g_autoptr(XbSilo) silo = NULL;
|
||||
+ g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
|
||||
+ g_autoptr(GHashTable) components_by_id = NULL;
|
||||
+ g_autoptr(GHashTable) components_by_bundle = NULL;
|
||||
+ g_autoptr(GPtrArray) components_with_id = NULL;
|
||||
+ g_autoptr(GPtrArray) bundles = NULL;
|
||||
+ g_autofree gchar *silo_filename = NULL;
|
||||
|
||||
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
|
||||
|
||||
- /* not enough info to find */
|
||||
- id = gs_app_get_id (app);
|
||||
- if (id == NULL)
|
||||
- return TRUE;
|
||||
-
|
||||
- if (*inout_silo == NULL)
|
||||
- *inout_silo = gs_flatpak_ref_silo (self, interactive, inout_silo_filename, inout_installed_by_desktopid, cancellable, error);
|
||||
- if (*inout_silo == NULL)
|
||||
+ silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
|
||||
+ if (silo == NULL)
|
||||
return FALSE;
|
||||
|
||||
- silo = *inout_silo;
|
||||
- silo_filename = *inout_silo_filename;
|
||||
- silo_installed_by_desktopid = *inout_installed_by_desktopid;
|
||||
-
|
||||
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardQuerySilo, "Flatpak (query silo)", NULL);
|
||||
|
||||
- if (*inout_components_by_id != NULL) {
|
||||
- components = g_hash_table_lookup (*inout_components_by_id, gs_app_get_id (app));
|
||||
- } else {
|
||||
- g_autoptr(GPtrArray) components_with_id = NULL;
|
||||
- *inout_components_by_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_ptr_array_unref);
|
||||
- components_with_id = xb_silo_query (silo, "components/component/id", 0, &error_local);
|
||||
- if (components_with_id == NULL) {
|
||||
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
- return TRUE;
|
||||
- g_propagate_error (error, g_steal_pointer (&error_local));
|
||||
- return FALSE;
|
||||
+ components_by_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_ptr_array_unref);
|
||||
+ components_with_id = xb_silo_query (silo, "components/component/id", 0, &error_local);
|
||||
+ if (components_with_id == NULL) {
|
||||
+ if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
+ return TRUE;
|
||||
+ g_propagate_error (error, g_steal_pointer (&error_local));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ for (guint i = 0; i < components_with_id->len; i++) {
|
||||
+ XbNode *node = g_ptr_array_index (components_with_id, i);
|
||||
+ XbNode *comp_node = xb_node_get_parent (node);
|
||||
+ const gchar *comp_id = xb_node_get_text (node);
|
||||
+ GPtrArray *comps = g_hash_table_lookup (components_by_id, comp_id);
|
||||
+ if (comps == NULL) {
|
||||
+ comps = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
+ g_hash_table_insert (components_by_id, g_strdup (comp_id), comps);
|
||||
}
|
||||
- for (guint i = 0; i < components_with_id->len; i++) {
|
||||
- XbNode *node = g_ptr_array_index (components_with_id, i);
|
||||
- XbNode *comp_node = xb_node_get_parent (node);
|
||||
- const gchar *comp_id = xb_node_get_text (node);
|
||||
- GPtrArray *comps = g_hash_table_lookup (*inout_components_by_id, comp_id);
|
||||
- if (comps == NULL) {
|
||||
- comps = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
- g_hash_table_insert (*inout_components_by_id, g_strdup (comp_id), comps);
|
||||
+ g_ptr_array_add (comps, comp_node);
|
||||
+ }
|
||||
+
|
||||
+ components_by_bundle = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||
+ bundles = xb_silo_query (silo, "/components/component/bundle[@type='flatpak']", 0, NULL);
|
||||
+ for (guint b = 0; bundles != NULL && b < bundles->len; b++) {
|
||||
+ XbNode *bundle_node = g_ptr_array_index (bundles, b);
|
||||
+ g_autoptr(XbNode) component_node = xb_node_get_parent (bundle_node);
|
||||
+ g_autoptr(XbNode) components_node = xb_node_get_parent (component_node);
|
||||
+ const gchar *origin = xb_node_get_attr (components_node, "origin");
|
||||
+ if (origin != NULL) {
|
||||
+ const gchar *bundle = xb_node_get_text (bundle_node);
|
||||
+ if (bundle != NULL) {
|
||||
+ g_autofree gchar *key = g_strconcat (origin, "\n", bundle, NULL);
|
||||
+ g_hash_table_insert (components_by_bundle, g_steal_pointer (&key), g_steal_pointer (&component_node));
|
||||
}
|
||||
- g_ptr_array_add (comps, comp_node);
|
||||
- if (components == NULL && g_strcmp0 (id, comp_id) == 0)
|
||||
- components = comps;
|
||||
}
|
||||
}
|
||||
|
||||
GS_PROFILER_END_SCOPED (FlatpakRefineWildcardQuerySilo);
|
||||
|
||||
- if (components == NULL)
|
||||
- return TRUE;
|
||||
-
|
||||
gs_flatpak_ensure_remote_title (self, interactive, cancellable);
|
||||
|
||||
- if (*inout_components_by_bundle == NULL) {
|
||||
- g_autoptr(GPtrArray) bundles = NULL;
|
||||
-
|
||||
- *inout_components_by_bundle = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||
- bundles = xb_silo_query (silo, "/components/component/bundle[@type='flatpak']", 0, NULL);
|
||||
- for (guint b = 0; bundles != NULL && b < bundles->len; b++) {
|
||||
- XbNode *bundle_node = g_ptr_array_index (bundles, b);
|
||||
- g_autoptr(XbNode) component_node = xb_node_get_parent (bundle_node);
|
||||
- g_autoptr(XbNode) components_node = xb_node_get_parent (component_node);
|
||||
- const gchar *origin = xb_node_get_attr (components_node, "origin");
|
||||
- if (origin != NULL) {
|
||||
- const gchar *bundle = xb_node_get_text (bundle_node);
|
||||
- if (bundle != NULL) {
|
||||
- g_autofree gchar *key = g_strconcat (origin, "\n", bundle, NULL);
|
||||
- g_hash_table_insert (*inout_components_by_bundle, g_steal_pointer (&key), g_steal_pointer (&component_node));
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ for (guint j = 0; j < wildcard_apps->len; j++) {
|
||||
+ GsApp *app = g_ptr_array_index (wildcard_apps, j);
|
||||
+ GPtrArray *components = NULL;
|
||||
+ const gchar *id;
|
||||
|
||||
+ /* not enough info to find */
|
||||
+ id = gs_app_get_id (app);
|
||||
+ if (id == NULL)
|
||||
+ continue;
|
||||
|
||||
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardGenerateApps, "Flatpak (create app)", NULL);
|
||||
- for (guint i = 0; i < components->len; i++) {
|
||||
- XbNode *component = g_ptr_array_index (components, i);
|
||||
- g_autoptr(GsApp) new = NULL;
|
||||
+ components = g_hash_table_lookup (components_by_id, id);
|
||||
+ if (components == NULL)
|
||||
+ continue;
|
||||
|
||||
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardCreateAppstreamApp, "Flatpak (create Appstream app)", NULL);
|
||||
- new = gs_appstream_create_app (self->plugin, silo, component, silo_filename ? silo_filename : "",
|
||||
- self->scope, error);
|
||||
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardCreateAppstreamApp);
|
||||
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardGenerateApps, "Flatpak (create app)", NULL);
|
||||
+ for (guint i = 0; i < components->len; i++) {
|
||||
+ XbNode *component = g_ptr_array_index (components, i);
|
||||
+ g_autoptr(GsApp) new = NULL;
|
||||
|
||||
- if (new == NULL)
|
||||
- return FALSE;
|
||||
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardCreateAppstreamApp, "Flatpak (create Appstream app)", NULL);
|
||||
+ new = gs_appstream_create_app (self->plugin, silo, component, silo_filename ? silo_filename : "",
|
||||
+ self->scope, error);
|
||||
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardCreateAppstreamApp);
|
||||
|
||||
- gs_flatpak_claim_app (self, new);
|
||||
-
|
||||
- /* The appstream plugin did not find the component in the plugin's cache,
|
||||
- thus read the required info from the 'bundle' element. */
|
||||
- if (gs_flatpak_app_get_ref_name (new) == NULL ||
|
||||
- gs_flatpak_app_get_ref_arch (new) == NULL) {
|
||||
- const gchar *xref_str = NULL;
|
||||
- g_autoptr(XbNode) child = NULL;
|
||||
- g_autoptr(XbNode) next = NULL;
|
||||
- for (child = xb_node_get_child (component); child != NULL && xref_str == NULL;
|
||||
- g_object_unref (child), child = g_steal_pointer (&next)) {
|
||||
- next = xb_node_get_next (child);
|
||||
- if (g_strcmp0 (xb_node_get_element (child), "bundle") == 0 &&
|
||||
- g_strcmp0 (xb_node_get_attr (child, "type"), "flatpak") == 0) {
|
||||
- xref_str = xb_node_get_text (child);
|
||||
- break;
|
||||
+ if (new == NULL)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ gs_flatpak_claim_app (self, new);
|
||||
+
|
||||
+ /* The appstream plugin did not find the component in the plugin's cache,
|
||||
+ thus read the required info from the 'bundle' element. */
|
||||
+ if (gs_flatpak_app_get_ref_name (new) == NULL ||
|
||||
+ gs_flatpak_app_get_ref_arch (new) == NULL) {
|
||||
+ const gchar *xref_str = NULL;
|
||||
+ g_autoptr(XbNode) child = NULL;
|
||||
+ g_autoptr(XbNode) next = NULL;
|
||||
+ for (child = xb_node_get_child (component); child != NULL && xref_str == NULL;
|
||||
+ g_object_unref (child), child = g_steal_pointer (&next)) {
|
||||
+ next = xb_node_get_next (child);
|
||||
+ if (g_strcmp0 (xb_node_get_element (child), "bundle") == 0 &&
|
||||
+ g_strcmp0 (xb_node_get_attr (child, "type"), "flatpak") == 0) {
|
||||
+ xref_str = xb_node_get_text (child);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
- if (xref_str != NULL) {
|
||||
- g_auto(GStrv) split = NULL;
|
||||
-
|
||||
- /* get the kind/name/arch/branch */
|
||||
- split = g_strsplit (xref_str, "/", -1);
|
||||
- if (g_strv_length (split) == 4) {
|
||||
- const gchar *comp_type = xb_node_get_attr (component, "type");
|
||||
- AsComponentKind kind = as_component_kind_from_string (comp_type);
|
||||
- if (kind != AS_COMPONENT_KIND_UNKNOWN)
|
||||
- gs_app_set_kind (new, kind);
|
||||
- else if (g_ascii_strcasecmp (split[0], "app") == 0)
|
||||
- gs_app_set_kind (new, AS_COMPONENT_KIND_DESKTOP_APP);
|
||||
- else if (g_ascii_strcasecmp (split[0], "runtime") == 0)
|
||||
- gs_flatpak_set_runtime_kind_from_id (new);
|
||||
- gs_flatpak_app_set_ref_name (new, split[1]);
|
||||
- gs_flatpak_app_set_ref_arch (new, split[2]);
|
||||
- gs_app_set_branch (new, split[3]);
|
||||
- gs_app_set_metadata (new, "GnomeSoftware::packagename-value", xref_str);
|
||||
+ if (xref_str != NULL) {
|
||||
+ g_auto(GStrv) split = NULL;
|
||||
+
|
||||
+ /* get the kind/name/arch/branch */
|
||||
+ split = g_strsplit (xref_str, "/", -1);
|
||||
+ if (g_strv_length (split) == 4) {
|
||||
+ const gchar *comp_type = xb_node_get_attr (component, "type");
|
||||
+ AsComponentKind kind = as_component_kind_from_string (comp_type);
|
||||
+ if (kind != AS_COMPONENT_KIND_UNKNOWN)
|
||||
+ gs_app_set_kind (new, kind);
|
||||
+ else if (g_ascii_strcasecmp (split[0], "app") == 0)
|
||||
+ gs_app_set_kind (new, AS_COMPONENT_KIND_DESKTOP_APP);
|
||||
+ else if (g_ascii_strcasecmp (split[0], "runtime") == 0)
|
||||
+ gs_flatpak_set_runtime_kind_from_id (new);
|
||||
+ gs_flatpak_app_set_ref_name (new, split[1]);
|
||||
+ gs_flatpak_app_set_ref_arch (new, split[2]);
|
||||
+ gs_app_set_branch (new, split[3]);
|
||||
+ gs_app_set_metadata (new, "GnomeSoftware::packagename-value", xref_str);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
- }
|
||||
|
||||
- if (gs_flatpak_app_get_ref_name (new) == NULL ||
|
||||
- gs_flatpak_app_get_ref_arch (new) == NULL) {
|
||||
- g_debug ("Failed to get ref info for '%s' from wildcard '%s', skipping it...", gs_app_get_id (new), id);
|
||||
- } else {
|
||||
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardRefineNewApp, "Flatpak (refine new app)", NULL);
|
||||
- if (!gs_flatpak_refine_app_internal (self, new, require_flags, interactive, FALSE, *inout_components_by_bundle,
|
||||
- silo, silo_filename, silo_installed_by_desktopid, cancellable, error))
|
||||
- return FALSE;
|
||||
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardRefineNewApp);
|
||||
+ if (gs_flatpak_app_get_ref_name (new) == NULL ||
|
||||
+ gs_flatpak_app_get_ref_arch (new) == NULL) {
|
||||
+ g_debug ("Failed to get ref info for '%s' from wildcard '%s', skipping it...", gs_app_get_id (new), id);
|
||||
+ } else {
|
||||
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardRefineNewApp, "Flatpak (refine new app)", NULL);
|
||||
+ if (!gs_flatpak_refine_app_internal (self, new, require_flags, interactive, FALSE, components_by_bundle,
|
||||
+ silo, silo_filename, silo_installed_by_desktopid, cancellable, error))
|
||||
+ return FALSE;
|
||||
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardRefineNewApp);
|
||||
|
||||
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardSubsumeMetadata, "Flatpak (subsume metadata)", NULL);
|
||||
- gs_app_subsume_metadata (new, app);
|
||||
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardSubsumeMetadata);
|
||||
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardSubsumeMetadata, "Flatpak (subsume metadata)", NULL);
|
||||
+ gs_app_subsume_metadata (new, app);
|
||||
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardSubsumeMetadata);
|
||||
|
||||
- gs_app_list_add (list, new);
|
||||
+ gs_app_list_add (list, new);
|
||||
+ }
|
||||
}
|
||||
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardGenerateApps);
|
||||
}
|
||||
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardGenerateApps);
|
||||
|
||||
GS_PROFILER_END_SCOPED (FlatpakRefineWildcard);
|
||||
|
||||
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
|
||||
index 34e1416b5..1f7d35a8f 100644
|
||||
--- a/plugins/flatpak/gs-flatpak.h
|
||||
+++ b/plugins/flatpak/gs-flatpak.h
|
||||
@@ -104,16 +104,11 @@ gboolean gs_flatpak_refine_app_state (GsFlatpak *self,
|
||||
void *event_user_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
-gboolean gs_flatpak_refine_wildcard (GsFlatpak *self,
|
||||
- GsApp *app,
|
||||
+gboolean gs_flatpak_refine_wildcards (GsFlatpak *self,
|
||||
+ GPtrArray *wildcard_apps,
|
||||
GsAppList *list,
|
||||
GsPluginRefineRequireFlags require_flags,
|
||||
gboolean interactive,
|
||||
- XbSilo **inout_silo,
|
||||
- gchar **inout_silo_filename,
|
||||
- GHashTable **inout_installed_by_desktopid,
|
||||
- GHashTable **inout_components_by_id,
|
||||
- GHashTable **inout_components_by_bundle,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean gs_flatpak_launch (GsFlatpak *self,
|
||||
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
|
||||
index f5d4a1d67..c06b1fb5f 100644
|
||||
--- a/plugins/flatpak/gs-plugin-flatpak.c
|
||||
+++ b/plugins/flatpak/gs-plugin-flatpak.c
|
||||
@@ -667,31 +667,6 @@ gs_plugin_flatpak_refine_app (GsPluginFlatpak *self,
|
||||
return gs_flatpak_refine_app (flatpak, app, require_flags, interactive, FALSE, event_callback, event_user_data, cancellable, error);
|
||||
}
|
||||
|
||||
-typedef struct {
|
||||
- XbSilo *silo;
|
||||
- gchar *silo_filename;
|
||||
- GHashTable *installed_by_desktopid;
|
||||
- GHashTable *components_by_id;
|
||||
- GHashTable *components_by_bundle;
|
||||
-} RefineInstallationData;
|
||||
-
|
||||
-static void
|
||||
-refine_installation_data_free (gpointer ptr)
|
||||
-{
|
||||
- RefineInstallationData *data = ptr;
|
||||
-
|
||||
- if (data == NULL)
|
||||
- return;
|
||||
-
|
||||
- g_clear_pointer (&data->silo_filename, g_free);
|
||||
- g_clear_pointer (&data->installed_by_desktopid, g_hash_table_unref);
|
||||
- g_clear_pointer (&data->components_by_id, g_hash_table_unref);
|
||||
- g_clear_pointer (&data->components_by_bundle, g_hash_table_unref);
|
||||
- /* free the silo as the last, just in case, because the data from it is in the above hash tables */
|
||||
- g_clear_object (&data->silo);
|
||||
- g_free (data);
|
||||
-}
|
||||
-
|
||||
static gboolean
|
||||
refine_app (GsPluginFlatpak *self,
|
||||
GsApp *app,
|
||||
@@ -778,8 +753,7 @@ refine_thread_cb (GTask *task,
|
||||
gboolean interactive = (data->job_flags & GS_PLUGIN_REFINE_FLAGS_INTERACTIVE) != 0;
|
||||
GsPluginEventCallback event_callback = data->event_callback;
|
||||
void *event_user_data = data->event_user_data;
|
||||
- g_autoptr(GPtrArray) installation_data = NULL; /* (element-type RefineInstallationData) */
|
||||
- g_autoptr(GsAppList) app_list = NULL;
|
||||
+ g_autoptr(GPtrArray) wildcard_apps = g_ptr_array_new_with_free_func (g_object_unref); /* (element-type GsApp) (owned) */
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
assert_in_worker (self);
|
||||
@@ -790,38 +764,17 @@ refine_thread_cb (GTask *task,
|
||||
g_task_return_error (task, g_steal_pointer (&local_error));
|
||||
return;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- /* Refine wildcards.
|
||||
- *
|
||||
- * Use a copy of the list for the loop because a function called
|
||||
- * on the plugin may affect the list which can lead to problems
|
||||
- * (e.g. inserting an app in the list on every call results in
|
||||
- * an infinite loop) */
|
||||
- app_list = gs_app_list_copy (list);
|
||||
-
|
||||
- installation_data = g_ptr_array_new_full (self->installations->len, refine_installation_data_free);
|
||||
- g_ptr_array_set_size (installation_data, self->installations->len);
|
||||
-
|
||||
- for (guint j = 0; j < gs_app_list_length (app_list); j++) {
|
||||
- GsApp *app = gs_app_list_index (app_list, j);
|
||||
|
||||
- if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD))
|
||||
- continue;
|
||||
+ if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD) && gs_app_get_id (app) != NULL)
|
||||
+ g_ptr_array_add (wildcard_apps, g_object_ref (app));
|
||||
+ }
|
||||
|
||||
+ /* Refine wildcards. */
|
||||
+ if (wildcard_apps->len > 0) {
|
||||
for (guint i = 0; i < self->installations->len; i++) {
|
||||
GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
|
||||
- RefineInstallationData *inst_data = g_ptr_array_index (installation_data, i);
|
||||
-
|
||||
- if (inst_data == NULL) {
|
||||
- inst_data = g_new0 (RefineInstallationData, 1);
|
||||
- installation_data->pdata[i] = inst_data;
|
||||
- }
|
||||
|
||||
- if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &inst_data->silo,
|
||||
- &inst_data->silo_filename, &inst_data->installed_by_desktopid,
|
||||
- &inst_data->components_by_id, &inst_data->components_by_bundle,
|
||||
- cancellable, &local_error)) {
|
||||
+ if (!gs_flatpak_refine_wildcards (flatpak, wildcard_apps, list, require_flags, interactive, cancellable, &local_error)) {
|
||||
g_task_return_error (task, g_steal_pointer (&local_error));
|
||||
return;
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 8472d717356a801e6c0171156738ea48480fa695 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 7 Jan 2026 18:45:47 +0100
|
||||
Subject: [PATCH 3/3] flatpak: Hold silo lock when refining wildcard apps
|
||||
|
||||
The refine can take a long time, thus hold the silo lock to not have
|
||||
it invalidated from another thread. Object reference is not enough
|
||||
for the XbSilo, it breaks as soon as the underlying file changes.
|
||||
---
|
||||
plugins/flatpak/gs-flatpak.c | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
|
||||
index 782b0bb48..c5437125d 100644
|
||||
--- a/plugins/flatpak/gs-flatpak.c
|
||||
+++ b/plugins/flatpak/gs-flatpak.c
|
||||
@@ -59,7 +59,7 @@ struct _GsFlatpak {
|
||||
AsComponentScope scope;
|
||||
GsPlugin *plugin;
|
||||
XbSilo *silo;
|
||||
- GMutex silo_lock;
|
||||
+ GRecMutex silo_lock;
|
||||
gchar *silo_filename;
|
||||
GHashTable *silo_installed_by_desktopid;
|
||||
gint silo_change_stamp;
|
||||
@@ -1187,11 +1187,11 @@ gs_flatpak_ref_silo (GsFlatpak *self,
|
||||
g_autoptr(GFile) file = NULL;
|
||||
g_autoptr(GPtrArray) xremotes = NULL;
|
||||
g_autoptr(GPtrArray) desktop_paths = NULL;
|
||||
- g_autoptr(GMutexLocker) locker = NULL;
|
||||
+ g_autoptr(GRecMutexLocker) locker = NULL;
|
||||
g_autoptr(XbBuilder) builder = NULL;
|
||||
g_autoptr(GMainContext) old_thread_default = NULL;
|
||||
|
||||
- locker = g_mutex_locker_new (&self->silo_lock);
|
||||
+ locker = g_rec_mutex_locker_new (&self->silo_lock);
|
||||
/* everything is okay */
|
||||
if (self->silo != NULL && xb_silo_is_valid (self->silo) &&
|
||||
g_atomic_int_get (&self->silo_change_stamp_current) == g_atomic_int_get (&self->silo_change_stamp)) {
|
||||
@@ -3754,6 +3754,7 @@ gs_flatpak_refine_wildcards (GsFlatpak *self,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
+ g_autoptr(GRecMutexLocker) silo_locker = NULL;
|
||||
g_autoptr(XbSilo) silo = NULL;
|
||||
g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
|
||||
g_autoptr(GHashTable) components_by_id = NULL;
|
||||
@@ -3764,6 +3765,11 @@ gs_flatpak_refine_wildcards (GsFlatpak *self,
|
||||
|
||||
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
|
||||
|
||||
+ /* the refine can take a long time, thus hold the silo lock to not have
|
||||
+ it invalidated from another thread; object reference is not enough
|
||||
+ for the XbSilo, it breaks as soon as the underlying file changes */
|
||||
+ silo_locker = g_rec_mutex_locker_new (&self->silo_lock);
|
||||
+
|
||||
silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
|
||||
if (silo == NULL)
|
||||
return FALSE;
|
||||
@@ -4810,7 +4816,7 @@ gs_flatpak_finalize (GObject *object)
|
||||
g_object_unref (self->plugin);
|
||||
g_hash_table_unref (self->broken_remotes);
|
||||
g_mutex_clear (&self->broken_remotes_mutex);
|
||||
- g_mutex_clear (&self->silo_lock);
|
||||
+ g_rec_mutex_clear (&self->silo_lock);
|
||||
g_hash_table_unref (self->app_silos);
|
||||
g_mutex_clear (&self->app_silos_mutex);
|
||||
g_clear_pointer (&self->remote_title, g_hash_table_unref);
|
||||
@@ -4831,7 +4837,7 @@ gs_flatpak_init (GsFlatpak *self)
|
||||
{
|
||||
/* XbSilo needs external locking as we destroy the silo and build a new
|
||||
* one when something changes */
|
||||
- g_mutex_init (&self->silo_lock);
|
||||
+ g_rec_mutex_init (&self->silo_lock);
|
||||
|
||||
g_mutex_init (&self->installed_refs_mutex);
|
||||
self->installed_refs = NULL;
|
||||
--
|
||||
GitLab
|
||||
|
||||
498
0006-optional-repos-cannot-be-disabled.patch
Normal file
498
0006-optional-repos-cannot-be-disabled.patch
Normal file
|
|
@ -0,0 +1,498 @@
|
|||
From dca731ff0daf904911dd6815fb9a1b181329c887 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Tue, 5 Oct 2021 11:00:20 +0200
|
||||
Subject: [PATCH 1/4] gs-repo-row: Use GS_APP_QUIRK_COMPULSORY to recognize
|
||||
required repositories
|
||||
|
||||
The GS_APP_QUIRK_PROVENANCE quirk does not mean it's also required repository,
|
||||
thus use the GS_APP_QUIRK_COMPULSORY for repos, which cannot be disabled.
|
||||
The GS_APP_QUIRK_PROVENANCE is used only for repositories, which cannot be removed.
|
||||
---
|
||||
src/gs-repo-row.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c
|
||||
index 87926092f..bbf67c194 100644
|
||||
--- a/src/gs-repo-row.c
|
||||
+++ b/src/gs-repo-row.c
|
||||
@@ -48,7 +48,8 @@ refresh_ui (GsRepoRow *row)
|
||||
gboolean active = FALSE;
|
||||
gboolean state_sensitive = FALSE;
|
||||
gboolean busy = priv->busy_counter> 0;
|
||||
- gboolean is_system_repo;
|
||||
+ gboolean is_provenance;
|
||||
+ gboolean is_compulsory;
|
||||
|
||||
if (priv->repo == NULL) {
|
||||
gtk_widget_set_sensitive (priv->disable_switch, FALSE);
|
||||
@@ -87,11 +88,12 @@ refresh_ui (GsRepoRow *row)
|
||||
break;
|
||||
}
|
||||
|
||||
- is_system_repo = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE);
|
||||
+ is_provenance = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE);
|
||||
+ is_compulsory = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_COMPULSORY);
|
||||
|
||||
/* Disable for the system repos, if installed */
|
||||
- gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || !is_system_repo || priv->always_allow_enable_disable));
|
||||
- gtk_widget_set_visible (priv->remove_button, priv->supports_remove && !is_system_repo);
|
||||
+ gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || !is_compulsory || priv->always_allow_enable_disable));
|
||||
+ gtk_widget_set_visible (priv->remove_button, priv->supports_remove && !is_provenance && !is_compulsory);
|
||||
|
||||
/* Set only the 'state' to visually indicate the state is not saved yet */
|
||||
if (busy)
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 026218b9d3211de243dfc49eca8b8d46633882b0 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Tue, 5 Oct 2021 11:03:31 +0200
|
||||
Subject: [PATCH 2/4] gs-plugin-provenance: Improve search speed in list of
|
||||
repositories
|
||||
|
||||
Use a GHashTable for bare repository names and a GPtrArray for those
|
||||
with wildcards. This helps with speed, due to not traversing all
|
||||
the repository names with the fnmatch() call.
|
||||
---
|
||||
plugins/core/gs-plugin-provenance.c | 55 ++++++++++++++++++++---------
|
||||
1 file changed, 38 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/plugins/core/gs-plugin-provenance.c b/plugins/core/gs-plugin-provenance.c
|
||||
index 97ff76798..a72c25a27 100644
|
||||
--- a/plugins/core/gs-plugin-provenance.c
|
||||
+++ b/plugins/core/gs-plugin-provenance.c
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
struct GsPluginData {
|
||||
GSettings *settings;
|
||||
- gchar **sources;
|
||||
+ GHashTable *repos; /* gchar *name ~> NULL */
|
||||
+ GPtrArray *wildcards; /* non-NULL, when have names with wildcards */
|
||||
};
|
||||
|
||||
static gchar **
|
||||
@@ -42,8 +43,24 @@ gs_plugin_provenance_settings_changed_cb (GSettings *settings,
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
if (g_strcmp0 (key, "official-repos") == 0) {
|
||||
- g_strfreev (priv->sources);
|
||||
- priv->sources = gs_plugin_provenance_get_sources (plugin);
|
||||
+ /* The keys are stolen by the hash table, thus free only the array */
|
||||
+ g_autofree gchar **repos = NULL;
|
||||
+ g_hash_table_remove_all (priv->repos);
|
||||
+ g_clear_pointer (&priv->wildcards, g_ptr_array_unref);
|
||||
+ repos = gs_plugin_provenance_get_sources (plugin);
|
||||
+ for (guint ii = 0; repos && repos[ii]; ii++) {
|
||||
+ if (strchr (repos[ii], '*') ||
|
||||
+ strchr (repos[ii], '?') ||
|
||||
+ strchr (repos[ii], '[')) {
|
||||
+ if (priv->wildcards == NULL)
|
||||
+ priv->wildcards = g_ptr_array_new_with_free_func (g_free);
|
||||
+ g_ptr_array_add (priv->wildcards, g_steal_pointer (&(repos[ii])));
|
||||
+ } else {
|
||||
+ g_hash_table_insert (priv->repos, g_steal_pointer (&(repos[ii])), NULL);
|
||||
+ }
|
||||
+ }
|
||||
+ if (priv->wildcards != NULL)
|
||||
+ g_ptr_array_add (priv->wildcards, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +69,10 @@ gs_plugin_initialize (GsPlugin *plugin)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData));
|
||||
priv->settings = g_settings_new ("org.gnome.software");
|
||||
+ priv->repos = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
g_signal_connect (priv->settings, "changed",
|
||||
G_CALLBACK (gs_plugin_provenance_settings_changed_cb), plugin);
|
||||
- priv->sources = gs_plugin_provenance_get_sources (plugin);
|
||||
+ gs_plugin_provenance_settings_changed_cb (priv->settings, "official-repos", plugin);
|
||||
|
||||
/* after the package source is set */
|
||||
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "dummy");
|
||||
@@ -66,7 +84,8 @@ void
|
||||
gs_plugin_destroy (GsPlugin *plugin)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
- g_strfreev (priv->sources);
|
||||
+ g_hash_table_unref (priv->repos);
|
||||
+ g_clear_pointer (&priv->wildcards, g_ptr_array_unref);
|
||||
g_object_unref (priv->settings);
|
||||
}
|
||||
|
||||
@@ -74,12 +93,12 @@ static gboolean
|
||||
refine_app (GsPlugin *plugin,
|
||||
GsApp *app,
|
||||
GsPluginRefineFlags flags,
|
||||
+ GHashTable *repos,
|
||||
+ GPtrArray *wildcards,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
- GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
const gchar *origin;
|
||||
- gchar **sources;
|
||||
|
||||
/* not required */
|
||||
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE) == 0)
|
||||
@@ -87,14 +106,10 @@ refine_app (GsPlugin *plugin,
|
||||
if (gs_app_has_quirk (app, GS_APP_QUIRK_PROVENANCE))
|
||||
return TRUE;
|
||||
|
||||
- /* nothing to search */
|
||||
- sources = priv->sources;
|
||||
- if (sources == NULL || sources[0] == NULL)
|
||||
- return TRUE;
|
||||
-
|
||||
/* simple case */
|
||||
origin = gs_app_get_origin (app);
|
||||
- if (origin != NULL && gs_utils_strv_fnmatch (sources, origin)) {
|
||||
+ if (origin != NULL && (g_hash_table_contains (repos, origin) ||
|
||||
+ (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, origin)))) {
|
||||
gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -103,7 +118,8 @@ refine_app (GsPlugin *plugin,
|
||||
* provenance quirk to the system-configured repositories (but not
|
||||
* user-configured ones). */
|
||||
if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY &&
|
||||
- gs_utils_strv_fnmatch (sources, gs_app_get_id (app))) {
|
||||
+ (g_hash_table_contains (repos, gs_app_get_id (app)) ||
|
||||
+ (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, gs_app_get_id (app))))) {
|
||||
if (gs_app_get_scope (app) != AS_COMPONENT_SCOPE_USER)
|
||||
gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
return TRUE;
|
||||
@@ -118,7 +134,8 @@ refine_app (GsPlugin *plugin,
|
||||
return TRUE;
|
||||
if (g_str_has_prefix (origin + 1, "installed:"))
|
||||
origin += 10;
|
||||
- if (gs_utils_strv_fnmatch (sources, origin + 1)) {
|
||||
+ if (g_hash_table_contains (repos, origin + 1) ||
|
||||
+ (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, origin + 1))) {
|
||||
gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -133,17 +150,21 @@ gs_plugin_refine (GsPlugin *plugin,
|
||||
GError **error)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
+ g_autoptr(GHashTable) repos = NULL;
|
||||
+ g_autoptr(GPtrArray) wildcards = NULL;
|
||||
|
||||
/* nothing to do here */
|
||||
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE) == 0)
|
||||
return TRUE;
|
||||
+ repos = g_hash_table_ref (priv->repos);
|
||||
+ wildcards = priv->wildcards != NULL ? g_ptr_array_ref (priv->wildcards) : NULL;
|
||||
/* nothing to search */
|
||||
- if (priv->sources == NULL || priv->sources[0] == NULL)
|
||||
+ if (g_hash_table_size (repos) == 0)
|
||||
return TRUE;
|
||||
|
||||
for (guint i = 0; i < gs_app_list_length (list); i++) {
|
||||
GsApp *app = gs_app_list_index (list, i);
|
||||
- if (!refine_app (plugin, app, flags, cancellable, error))
|
||||
+ if (!refine_app (plugin, app, flags, repos, wildcards, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From b5e3356aff5fcd257248f9bb697e272c879249ae Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Tue, 5 Oct 2021 13:03:44 +0200
|
||||
Subject: [PATCH 3/4] settings: Add 'required-repos' key
|
||||
|
||||
To be used to list repositories, which cannot be removed or disabled.
|
||||
It's a complementary option for the 'official-repos' key.
|
||||
---
|
||||
data/org.gnome.software.gschema.xml | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
|
||||
index db1c27ce4..0e5706b7c 100644
|
||||
--- a/data/org.gnome.software.gschema.xml
|
||||
+++ b/data/org.gnome.software.gschema.xml
|
||||
@@ -94,6 +94,10 @@
|
||||
<default>[]</default>
|
||||
<summary>A list of official repositories that should not be considered 3rd party</summary>
|
||||
</key>
|
||||
+ <key name="required-repos" type="as">
|
||||
+ <default>[]</default>
|
||||
+ <summary>A list of required repositories that cannot be disabled or removed</summary>
|
||||
+ </key>
|
||||
<key name="free-repos" type="as">
|
||||
<default>[]</default>
|
||||
<summary>A list of official repositories that should be considered free software</summary>
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From d6b8b206a596bb520a0b77066898b44a5ef18920 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Tue, 5 Oct 2021 14:16:56 +0200
|
||||
Subject: [PATCH 4/4] gs-plugin-provenance: Handle also 'required-repos' key
|
||||
|
||||
Let it handle also 'required-repos' settings key, beside the 'official-repos'
|
||||
key, which are close enough to share the same code and memory. With this
|
||||
done the repositories can be marked as compulsory, independently from the official
|
||||
repositories.
|
||||
|
||||
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1479
|
||||
---
|
||||
plugins/core/gs-plugin-provenance.c | 142 +++++++++++++++++++++-------
|
||||
1 file changed, 108 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/plugins/core/gs-plugin-provenance.c b/plugins/core/gs-plugin-provenance.c
|
||||
index a72c25a27..22f3c98e1 100644
|
||||
--- a/plugins/core/gs-plugin-provenance.c
|
||||
+++ b/plugins/core/gs-plugin-provenance.c
|
||||
@@ -14,26 +14,61 @@
|
||||
/*
|
||||
* SECTION:
|
||||
* Sets the package provenance to TRUE if installed by an official
|
||||
- * software source.
|
||||
+ * software source. Also sets compulsory quirk when a required repository.
|
||||
*/
|
||||
|
||||
struct GsPluginData {
|
||||
GSettings *settings;
|
||||
- GHashTable *repos; /* gchar *name ~> NULL */
|
||||
- GPtrArray *wildcards; /* non-NULL, when have names with wildcards */
|
||||
+ GHashTable *repos; /* gchar *name ~> guint flags */
|
||||
+ GPtrArray *provenance_wildcards; /* non-NULL, when have names with wildcards */
|
||||
+ GPtrArray *compulsory_wildcards; /* non-NULL, when have names with wildcards */
|
||||
};
|
||||
|
||||
+static GHashTable *
|
||||
+gs_plugin_provenance_remove_by_flag (GHashTable *old_repos,
|
||||
+ GsAppQuirk quirk)
|
||||
+{
|
||||
+ GHashTable *new_repos = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
+ GHashTableIter iter;
|
||||
+ gpointer key, value;
|
||||
+ g_hash_table_iter_init (&iter, old_repos);
|
||||
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
+ guint flags = GPOINTER_TO_UINT (value);
|
||||
+ flags = flags & (~quirk);
|
||||
+ if (flags != 0)
|
||||
+ g_hash_table_insert (new_repos, g_strdup (key), GUINT_TO_POINTER (flags));
|
||||
+ }
|
||||
+ return new_repos;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+gs_plugin_provenance_add_quirks (GsApp *app,
|
||||
+ guint quirks)
|
||||
+{
|
||||
+ GsAppQuirk array[] = {
|
||||
+ GS_APP_QUIRK_PROVENANCE,
|
||||
+ GS_APP_QUIRK_COMPULSORY
|
||||
+ };
|
||||
+ for (guint ii = 0; ii < G_N_ELEMENTS (array); ii++) {
|
||||
+ if ((quirks & array[ii]) != 0)
|
||||
+ gs_app_add_quirk (app, array[ii]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static gchar **
|
||||
-gs_plugin_provenance_get_sources (GsPlugin *plugin)
|
||||
+gs_plugin_provenance_get_sources (GsPlugin *plugin,
|
||||
+ const gchar *key)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
const gchar *tmp;
|
||||
tmp = g_getenv ("GS_SELF_TEST_PROVENANCE_SOURCES");
|
||||
if (tmp != NULL) {
|
||||
+ if (g_strcmp0 (key, "required-repos") == 0)
|
||||
+ return NULL;
|
||||
g_debug ("using custom provenance sources of %s", tmp);
|
||||
return g_strsplit (tmp, ",", -1);
|
||||
}
|
||||
- return g_settings_get_strv (priv->settings, "official-repos");
|
||||
+ return g_settings_get_strv (priv->settings, key);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -42,25 +77,43 @@ gs_plugin_provenance_settings_changed_cb (GSettings *settings,
|
||||
GsPlugin *plugin)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
+ GsAppQuirk quirk = GS_APP_QUIRK_NONE;
|
||||
+ GPtrArray **pwildcards = NULL;
|
||||
+
|
||||
if (g_strcmp0 (key, "official-repos") == 0) {
|
||||
+ quirk = GS_APP_QUIRK_PROVENANCE;
|
||||
+ pwildcards = &priv->provenance_wildcards;
|
||||
+ } else if (g_strcmp0 (key, "required-repos") == 0) {
|
||||
+ quirk = GS_APP_QUIRK_COMPULSORY;
|
||||
+ pwildcards = &priv->compulsory_wildcards;
|
||||
+ }
|
||||
+
|
||||
+ if (quirk != GS_APP_QUIRK_NONE) {
|
||||
/* The keys are stolen by the hash table, thus free only the array */
|
||||
g_autofree gchar **repos = NULL;
|
||||
- g_hash_table_remove_all (priv->repos);
|
||||
- g_clear_pointer (&priv->wildcards, g_ptr_array_unref);
|
||||
- repos = gs_plugin_provenance_get_sources (plugin);
|
||||
+ g_autoptr(GHashTable) old_repos = priv->repos;
|
||||
+ g_autoptr(GPtrArray) old_wildcards = *pwildcards;
|
||||
+ GHashTable *new_repos = gs_plugin_provenance_remove_by_flag (old_repos, quirk);
|
||||
+ GPtrArray *new_wildcards = NULL;
|
||||
+ repos = gs_plugin_provenance_get_sources (plugin, key);
|
||||
for (guint ii = 0; repos && repos[ii]; ii++) {
|
||||
- if (strchr (repos[ii], '*') ||
|
||||
- strchr (repos[ii], '?') ||
|
||||
- strchr (repos[ii], '[')) {
|
||||
- if (priv->wildcards == NULL)
|
||||
- priv->wildcards = g_ptr_array_new_with_free_func (g_free);
|
||||
- g_ptr_array_add (priv->wildcards, g_steal_pointer (&(repos[ii])));
|
||||
+ gchar *repo = g_steal_pointer (&(repos[ii]));
|
||||
+ if (strchr (repo, '*') ||
|
||||
+ strchr (repo, '?') ||
|
||||
+ strchr (repo, '[')) {
|
||||
+ if (new_wildcards == NULL)
|
||||
+ new_wildcards = g_ptr_array_new_with_free_func (g_free);
|
||||
+ g_ptr_array_add (new_wildcards, repo);
|
||||
} else {
|
||||
- g_hash_table_insert (priv->repos, g_steal_pointer (&(repos[ii])), NULL);
|
||||
+ g_hash_table_insert (new_repos, repo,
|
||||
+ GUINT_TO_POINTER (quirk |
|
||||
+ GPOINTER_TO_UINT (g_hash_table_lookup (new_repos, repo))));
|
||||
}
|
||||
}
|
||||
- if (priv->wildcards != NULL)
|
||||
- g_ptr_array_add (priv->wildcards, NULL);
|
||||
+ if (new_wildcards != NULL)
|
||||
+ g_ptr_array_add (new_wildcards, NULL);
|
||||
+ priv->repos = new_repos;
|
||||
+ *pwildcards = new_wildcards;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +126,7 @@ gs_plugin_initialize (GsPlugin *plugin)
|
||||
g_signal_connect (priv->settings, "changed",
|
||||
G_CALLBACK (gs_plugin_provenance_settings_changed_cb), plugin);
|
||||
gs_plugin_provenance_settings_changed_cb (priv->settings, "official-repos", plugin);
|
||||
+ gs_plugin_provenance_settings_changed_cb (priv->settings, "required-repos", plugin);
|
||||
|
||||
/* after the package source is set */
|
||||
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "dummy");
|
||||
@@ -85,20 +139,42 @@ gs_plugin_destroy (GsPlugin *plugin)
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
g_hash_table_unref (priv->repos);
|
||||
- g_clear_pointer (&priv->wildcards, g_ptr_array_unref);
|
||||
+ g_clear_pointer (&priv->provenance_wildcards, g_ptr_array_unref);
|
||||
+ g_clear_pointer (&priv->compulsory_wildcards, g_ptr_array_unref);
|
||||
g_object_unref (priv->settings);
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+gs_plugin_provenance_find_repo_flags (GHashTable *repos,
|
||||
+ GPtrArray *provenance_wildcards,
|
||||
+ GPtrArray *compulsory_wildcards,
|
||||
+ const gchar *repo,
|
||||
+ guint *out_flags)
|
||||
+{
|
||||
+ if (repo == NULL || *repo == '\0')
|
||||
+ return FALSE;
|
||||
+ *out_flags = GPOINTER_TO_UINT (g_hash_table_lookup (repos, repo));
|
||||
+ if (provenance_wildcards != NULL &&
|
||||
+ gs_utils_strv_fnmatch ((gchar **) provenance_wildcards->pdata, repo))
|
||||
+ *out_flags |= GS_APP_QUIRK_PROVENANCE;
|
||||
+ if (compulsory_wildcards != NULL &&
|
||||
+ gs_utils_strv_fnmatch ((gchar **) compulsory_wildcards->pdata, repo))
|
||||
+ *out_flags |= GS_APP_QUIRK_COMPULSORY;
|
||||
+ return *out_flags != 0;
|
||||
+}
|
||||
+
|
||||
static gboolean
|
||||
refine_app (GsPlugin *plugin,
|
||||
GsApp *app,
|
||||
GsPluginRefineFlags flags,
|
||||
GHashTable *repos,
|
||||
- GPtrArray *wildcards,
|
||||
+ GPtrArray *provenance_wildcards,
|
||||
+ GPtrArray *compulsory_wildcards,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *origin;
|
||||
+ guint quirks;
|
||||
|
||||
/* not required */
|
||||
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE) == 0)
|
||||
@@ -108,9 +184,8 @@ refine_app (GsPlugin *plugin,
|
||||
|
||||
/* simple case */
|
||||
origin = gs_app_get_origin (app);
|
||||
- if (origin != NULL && (g_hash_table_contains (repos, origin) ||
|
||||
- (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, origin)))) {
|
||||
- gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
+ if (gs_plugin_provenance_find_repo_flags (repos, provenance_wildcards, compulsory_wildcards, origin, &quirks)) {
|
||||
+ gs_plugin_provenance_add_quirks (app, quirks);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -118,10 +193,9 @@ refine_app (GsPlugin *plugin,
|
||||
* provenance quirk to the system-configured repositories (but not
|
||||
* user-configured ones). */
|
||||
if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY &&
|
||||
- (g_hash_table_contains (repos, gs_app_get_id (app)) ||
|
||||
- (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, gs_app_get_id (app))))) {
|
||||
+ gs_plugin_provenance_find_repo_flags (repos, provenance_wildcards, compulsory_wildcards, gs_app_get_id (app), &quirks)) {
|
||||
if (gs_app_get_scope (app) != AS_COMPONENT_SCOPE_USER)
|
||||
- gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
+ gs_plugin_provenance_add_quirks (app, quirks);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -134,11 +208,9 @@ refine_app (GsPlugin *plugin,
|
||||
return TRUE;
|
||||
if (g_str_has_prefix (origin + 1, "installed:"))
|
||||
origin += 10;
|
||||
- if (g_hash_table_contains (repos, origin + 1) ||
|
||||
- (wildcards != NULL && gs_utils_strv_fnmatch ((gchar **) wildcards->pdata, origin + 1))) {
|
||||
- gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
- return TRUE;
|
||||
- }
|
||||
+ if (gs_plugin_provenance_find_repo_flags (repos, provenance_wildcards, compulsory_wildcards, origin + 1, &quirks))
|
||||
+ gs_plugin_provenance_add_quirks (app, quirks);
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -151,20 +223,22 @@ gs_plugin_refine (GsPlugin *plugin,
|
||||
{
|
||||
GsPluginData *priv = gs_plugin_get_data (plugin);
|
||||
g_autoptr(GHashTable) repos = NULL;
|
||||
- g_autoptr(GPtrArray) wildcards = NULL;
|
||||
+ g_autoptr(GPtrArray) provenance_wildcards = NULL;
|
||||
+ g_autoptr(GPtrArray) compulsory_wildcards = NULL;
|
||||
|
||||
/* nothing to do here */
|
||||
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE) == 0)
|
||||
return TRUE;
|
||||
repos = g_hash_table_ref (priv->repos);
|
||||
- wildcards = priv->wildcards != NULL ? g_ptr_array_ref (priv->wildcards) : NULL;
|
||||
+ provenance_wildcards = priv->provenance_wildcards != NULL ? g_ptr_array_ref (priv->provenance_wildcards) : NULL;
|
||||
+ compulsory_wildcards = priv->compulsory_wildcards != NULL ? g_ptr_array_ref (priv->compulsory_wildcards) : NULL;
|
||||
/* nothing to search */
|
||||
- if (g_hash_table_size (repos) == 0)
|
||||
+ if (g_hash_table_size (repos) == 0 && provenance_wildcards == NULL && compulsory_wildcards == NULL)
|
||||
return TRUE;
|
||||
|
||||
for (guint i = 0; i < gs_app_list_length (list); i++) {
|
||||
GsApp *app = gs_app_list_index (list, i);
|
||||
- if (!refine_app (plugin, app, flags, repos, wildcards, cancellable, error))
|
||||
+ if (!refine_app (plugin, app, flags, repos, provenance_wildcards, compulsory_wildcards, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
42
0007-compulsory-only-for-repos.patch
Normal file
42
0007-compulsory-only-for-repos.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
From 895d1ca748f4f33a852853f5f07903fb549fb66f Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Mon, 11 Oct 2021 09:13:59 +0200
|
||||
Subject: [PATCH] gs-plugin-provenance: Set COMPULSORY quirk only on REPOSITORY
|
||||
apps
|
||||
|
||||
The compulsory quirk related to repositories, which cannot be removed,
|
||||
not to the applications provided by those repositories, thus set that
|
||||
quirk only on repositories, not on the apps from it.
|
||||
|
||||
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1488
|
||||
---
|
||||
plugins/core/gs-plugin-provenance.c | 13 +++++--------
|
||||
1 file changed, 5 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/plugins/core/gs-plugin-provenance.c b/plugins/core/gs-plugin-provenance.c
|
||||
index 22f3c98e..e44a55f0 100644
|
||||
--- a/plugins/core/gs-plugin-provenance.c
|
||||
+++ b/plugins/core/gs-plugin-provenance.c
|
||||
@@ -45,14 +45,11 @@ static void
|
||||
gs_plugin_provenance_add_quirks (GsApp *app,
|
||||
guint quirks)
|
||||
{
|
||||
- GsAppQuirk array[] = {
|
||||
- GS_APP_QUIRK_PROVENANCE,
|
||||
- GS_APP_QUIRK_COMPULSORY
|
||||
- };
|
||||
- for (guint ii = 0; ii < G_N_ELEMENTS (array); ii++) {
|
||||
- if ((quirks & array[ii]) != 0)
|
||||
- gs_app_add_quirk (app, array[ii]);
|
||||
- }
|
||||
+ if ((quirks & GS_APP_QUIRK_PROVENANCE) != 0)
|
||||
+ gs_app_add_quirk (app, GS_APP_QUIRK_PROVENANCE);
|
||||
+ if ((quirks & GS_APP_QUIRK_COMPULSORY) != 0 &&
|
||||
+ gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY)
|
||||
+ gs_app_add_quirk (app, GS_APP_QUIRK_COMPULSORY);
|
||||
}
|
||||
|
||||
static gchar **
|
||||
--
|
||||
2.31.1
|
||||
|
||||
12
0008-gs-removal-dialog-crrect-property-name.patch
Normal file
12
0008-gs-removal-dialog-crrect-property-name.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
diff -up gnome-software-41.5/src/gs-removal-dialog.ui.4 gnome-software-41.5/src/gs-removal-dialog.ui
|
||||
--- gnome-software-41.5/src/gs-removal-dialog.ui.4 2022-09-12 08:59:57.819169830 +0200
|
||||
+++ gnome-software-41.5/src/gs-removal-dialog.ui 2022-09-12 09:00:25.148201673 +0200
|
||||
@@ -20,7 +20,7 @@
|
||||
</child>
|
||||
</object>
|
||||
<template class="GsRemovalDialog" parent="GtkMessageDialog">
|
||||
- <property name="text" translatable="yes">Incompatible Software</property>
|
||||
+ <property name="title" translatable="yes">Incompatible Software</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<child type="action">
|
||||
1
dnf5-plugin/.gitignore
vendored
1
dnf5-plugin/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
checkout-gs-dnf5
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d checkout-gs-dnf5 ]; then
|
||||
git clone --branch main https://gitlab.gnome.org/mcrha/gnome-software.git checkout-gs-dnf5 && \
|
||||
cd checkout-gs-dnf5 && \
|
||||
git checkout -b wip/dnf5daemon origin/wip/dnf5daemon && \
|
||||
cd - >/dev/null
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to clone dnf5-plugin repository" 1>&2
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
PATCH_PATH=../0001-dnf5-plugin.patch
|
||||
|
||||
cd checkout-gs-dnf5 && \
|
||||
echo "Updating gs-dnf5 git 'main' repository" && \
|
||||
git checkout main && \
|
||||
git pull --rebase && \
|
||||
echo "Updating gs-dnf5 git 'dnf5-pugin' repository" && \
|
||||
git checkout wip/dnf5daemon && \
|
||||
git pull --rebase && \
|
||||
echo -n "at " >../${PATCH_PATH} && \
|
||||
git log HEAD | head -n 5 | grep -E "commit|Date" >>../${PATCH_PATH} && \
|
||||
echo "" >>../${PATCH_PATH} && \
|
||||
git diff main >>../${PATCH_PATH} && \
|
||||
cd - >/dev/null
|
||||
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Patch '${PATCH_PATH}' updated"
|
||||
else
|
||||
echo "Failed to update patch '${PATCH_PATH}'" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
1055
gnome-software.spec
1055
gnome-software.spec
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
runpath:
|
||||
allowed_paths:
|
||||
- /usr/lib/gnome-software
|
||||
- /usr/lib/rpm-ostree
|
||||
- /usr/lib64/gnome-software
|
||||
- /usr/lib64/rpm-ostree
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (gnome-software-49.3.tar.xz) = 0414ea55ad3b83bcd50514985e3d2026207801c040934805bb26d162e88f0619a9d70aa6ba324a29acfab02573490b928c83594b54f57ec2a8ad00e6c127f657
|
||||
SHA512 (gnome-software-41.5.tar.xz) = 60701d50dd8e7fa01c05c8ee7823b053d40b0fa145419601ece732827527d4d7ae9af178b5b6622ac4d729d3d430c14981a2fd4b0f086dd6d05a49fd507f2cb6
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue