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 |
5 changed files with 626 additions and 4 deletions
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">
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
%global tarball_version %%(echo %{version} | tr '~' '.')
|
||||
|
||||
Name: gnome-software
|
||||
Version: 41~alpha
|
||||
Version: 41.5
|
||||
Release: 2%{?dist}
|
||||
Summary: A software center for GNOME
|
||||
|
||||
|
|
@ -20,6 +20,9 @@ URL: https://wiki.gnome.org/Apps/Software
|
|||
Source0: https://download.gnome.org/sources/gnome-software/41/%{name}-%{tarball_version}.tar.xz
|
||||
|
||||
Patch01: 0001-crash-with-broken-theme.patch
|
||||
Patch02: 0006-optional-repos-cannot-be-disabled.patch
|
||||
Patch03: 0007-compulsory-only-for-repos.patch
|
||||
Patch04: 0008-gs-removal-dialog-crrect-property-name.patch
|
||||
|
||||
BuildRequires: appstream-devel >= %{appstream_version}
|
||||
BuildRequires: gcc
|
||||
|
|
@ -39,6 +42,8 @@ BuildRequires: libdnf-devel
|
|||
BuildRequires: libhandy1-devel
|
||||
BuildRequires: libsoup-devel
|
||||
BuildRequires: libxmlb-devel >= %{libxmlb_version}
|
||||
BuildRequires: malcontent-devel
|
||||
BuildRequires: malcontent-ui-devel
|
||||
BuildRequires: meson
|
||||
BuildRequires: PackageKit-glib-devel >= %{packagekit_version}
|
||||
BuildRequires: polkit-devel
|
||||
|
|
@ -105,7 +110,7 @@ This package includes the rpm-ostree backend.
|
|||
%build
|
||||
%meson \
|
||||
-Dsnap=false \
|
||||
-Dmalcontent=false \
|
||||
-Dmalcontent=true \
|
||||
-Dgudev=true \
|
||||
-Dpackagekit=true \
|
||||
-Dexternal_appstream=false \
|
||||
|
|
@ -126,7 +131,12 @@ desktop-file-edit %{buildroot}%{_datadir}/applications/org.gnome.Software.deskto
|
|||
# set up for Fedora
|
||||
cat >> %{buildroot}%{_datadir}/glib-2.0/schemas/org.gnome.software-fedora.gschema.override << FOE
|
||||
[org.gnome.software]
|
||||
official-repos = [ 'anaconda', 'fedora', 'fedora-debuginfo', 'fedora-source', 'koji-override-0', 'koji-override-1', 'rawhide', 'rawhide-debuginfo', 'rawhide-source', 'updates', 'updates-debuginfo', 'updates-source', 'updates-testing', 'updates-testing-debuginfo', 'updates-testing-source', 'fedora-modular', 'fedora-modular-debuginfo', 'fedora-modular-source', 'rawhide-modular', 'rawhide-modular-debuginfo', 'rawhide-modular-source' ]
|
||||
%if 0%{?rhel}
|
||||
official-repos = [ 'rhel-%{?rhel}' ]
|
||||
%else
|
||||
official-repos = [ 'anaconda', 'fedora', 'fedora-debuginfo', 'fedora-source', 'koji-override-0', 'koji-override-1', 'rawhide', 'rawhide-debuginfo', 'rawhide-source', 'updates', 'updates-debuginfo', 'updates-source', 'updates-testing', 'updates-testing-debuginfo', 'updates-testing-source', 'fedora-modular', 'fedora-modular-debuginfo', 'fedora-modular-source', 'rawhide-modular', 'rawhide-modular-debuginfo', 'rawhide-modular-source', 'fedora-cisco-openh264', 'fedora-cisco-openh264-debuginfo' ]
|
||||
required-repos = [ 'fedora', 'updates' ]
|
||||
%endif
|
||||
FOE
|
||||
|
||||
%find_lang %name --with-gnome
|
||||
|
|
@ -164,6 +174,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
|||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_hardcoded-blocklist.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_hardcoded-popular.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_icons.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_malcontent.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_modalias.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_os-release.so
|
||||
%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_packagekit-refine-repos.so
|
||||
|
|
@ -195,6 +206,65 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
|||
%{_datadir}/gtk-doc/html/gnome-software
|
||||
|
||||
%changelog
|
||||
* Mon Sep 12 2022 Milan Crha <mcrha@redhat.com> - 41.5-2
|
||||
- Resolves: 2125569 (Correct property name in GsRemovalDialog .ui file)
|
||||
|
||||
* Fri Mar 18 2022 Milan Crha <mcrha@redhat.com> - 41.5-1
|
||||
- Update to 41.5
|
||||
|
||||
* Fri Feb 11 2022 Milan Crha <mcrha@redhat.com> - 41.4-1
|
||||
- Update to 41.4
|
||||
|
||||
* Wed Jan 26 2022 Milan Crha <mcrha@redhat.com> - 41.3-2
|
||||
- Resolves: #2010353 (Optional software repos can't be disabled)
|
||||
|
||||
* Fri Jan 07 2022 Milan Crha <mcrha@redhat.com> - 41.3-1
|
||||
- Update to 41.3
|
||||
|
||||
* Fri Dec 03 2021 Milan Crha <mcrha@redhat.com> - 41.2-1
|
||||
- Update to 41.2
|
||||
|
||||
* Fri Oct 29 2021 Milan Crha <mcrha@redhat.com> - 41.1-1
|
||||
- Update to 41.1
|
||||
|
||||
* Tue Oct 19 2021 Milan Crha <mcrha@redhat.com> - 41.0-6
|
||||
- Resolves: #2012863 (gs-installed-page: Change section on application state change)
|
||||
|
||||
* Mon Oct 11 2021 Milan Crha <mcrha@redhat.com> - 41.0-5
|
||||
- Add patch to mark compulsory only repos, not apps from it
|
||||
|
||||
* Fri Oct 08 2021 Milan Crha <mcrha@redhat.com> - 41.0-4
|
||||
- Resolves: #2011176 (flathub repo can't be added through gnome-software)
|
||||
- Resolves: #2010660 (gs-repos-dialog: Can show also desktop applications)
|
||||
- Resolves: #2010353 (Optional repos cannot be disabled)
|
||||
|
||||
* Thu Oct 07 2021 Milan Crha <mcrha@redhat.com> - 41.0-3
|
||||
- Resolves: #2010740 (Refresh on repository setup change)
|
||||
|
||||
* Mon Oct 04 2021 Milan Crha <mcrha@redhat.com> - 41.0-2
|
||||
- Resolves: #2009063 (Correct update notifications)
|
||||
|
||||
* Mon Sep 20 2021 Milan Crha <mcrha@redhat.com> - 41.0-1
|
||||
- Update to 41.0
|
||||
|
||||
* Fri Sep 17 2021 Milan Crha <mcrha@redhat.com> - 41~rc-3
|
||||
- Add patch to not show RPM packaged apps as unsafe (I#1450)
|
||||
|
||||
* Mon Sep 13 2021 Milan Crha <mcrha@redhat.com> - 41~rc-2
|
||||
- Resolves: #2003365 (packagekit: Ensure PkClient::interactive flag being set)
|
||||
|
||||
* Wed Sep 08 2021 Milan Crha <mcrha@redhat.com> - 41~rc-1
|
||||
- Update to 41.rc
|
||||
|
||||
* Wed Sep 01 2021 Milan Crha <mcrha@redhat.com> - 41~beta-3
|
||||
- Resolves: #1995817 (gs-updates-section: Check also dependencies' download size)
|
||||
|
||||
* Tue Aug 24 2021 Kalev Lember <klember@redhat.com> - 41~beta-2
|
||||
- Enable parental controls support
|
||||
|
||||
* Fri Aug 13 2021 Milan Crha <mcrha@redhat.com> - 41~beta-1
|
||||
- Update to 41.beta
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 41~alpha-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (gnome-software-41.alpha.tar.xz) = 2919e4d33c9a750ddbfb18834e1199a3162c9a8d0f0ddcb2bd95dfcdbe44712438c23c2648386a4f639c576589073184a1848a2155b4f31fc36616577d828a64
|
||||
SHA512 (gnome-software-41.5.tar.xz) = 60701d50dd8e7fa01c05c8ee7823b053d40b0fa145419601ece732827527d4d7ae9af178b5b6622ac4d729d3d430c14981a2fd4b0f086dd6d05a49fd507f2cb6
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue