From d11480e2e60eef31b1fa2e69769954351a5f2ace Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 13 Aug 2021 18:20:57 +0200 Subject: [PATCH 01/20] Update to 41.beta --- gnome-software.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index f179695..53c1719 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,8 +11,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41~alpha -Release: 2%{?dist} +Version: 41~beta +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -195,6 +195,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Aug 13 2021 Milan Crha - 41~beta-1 +- Update to 41.beta + * Thu Jul 22 2021 Fedora Release Engineering - 41~alpha-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 57f1785..242d155 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.alpha.tar.xz) = 2919e4d33c9a750ddbfb18834e1199a3162c9a8d0f0ddcb2bd95dfcdbe44712438c23c2648386a4f639c576589073184a1848a2155b4f31fc36616577d828a64 +SHA512 (gnome-software-41.beta.tar.xz) = 8d552f508a74c19ed11ae465b901e8b9bda479bff8b9f582b65bbacdba6d91468e4a9676a85f54104d16ba061f0e5daff7a0000aec439e6c4ff2b22cc3a8ecd1 From 0508e1734fc49c342db5b718f2de64b5e8f6eb1e Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 24 Aug 2021 19:18:00 +0200 Subject: [PATCH 02/20] Enable parental controls support https://pagure.io/fedora-workstation/issue/186 --- gnome-software.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 53c1719..64181c8 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41~beta -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -39,6 +39,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 +107,7 @@ This package includes the rpm-ostree backend. %build %meson \ -Dsnap=false \ - -Dmalcontent=false \ + -Dmalcontent=true \ -Dgudev=true \ -Dpackagekit=true \ -Dexternal_appstream=false \ @@ -164,6 +166,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 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Tue Aug 24 2021 Kalev Lember - 41~beta-2 +- Enable parental controls support + * Fri Aug 13 2021 Milan Crha - 41~beta-1 - Update to 41.beta From 61a3273790b02faaeeab49be27f8530e2ebf54b4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Sep 2021 21:10:08 +0200 Subject: [PATCH 03/20] Resolves: #1995817 (gs-updates-section: Check also dependencies' download size) --- gnome-software.spec | 6 +++++- rhbug1995817-fix-updates-page-button.patch | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rhbug1995817-fix-updates-page-button.patch diff --git a/gnome-software.spec b/gnome-software.spec index 64181c8..58b6ccf 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41~beta -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,6 +20,7 @@ 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: rhbug1995817-fix-updates-page-button.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -198,6 +199,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Wed Sep 01 2021 Milan Crha - 41~beta-3 +- Resolves: #1995817 (gs-updates-section: Check also dependencies' download size) + * Tue Aug 24 2021 Kalev Lember - 41~beta-2 - Enable parental controls support diff --git a/rhbug1995817-fix-updates-page-button.patch b/rhbug1995817-fix-updates-page-button.patch new file mode 100644 index 0000000..b89b549 --- /dev/null +++ b/rhbug1995817-fix-updates-page-button.patch @@ -0,0 +1,14 @@ +diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c +index 0f41ba66..fa050513 100644 +--- a/src/gs-updates-section.c ++++ b/src/gs-updates-section.c +@@ -293,6 +293,9 @@ _all_offline_updates_downloaded (GsUpdatesSection *self) + guint64 size = gs_app_get_size_download (app); + if (size != 0) + return FALSE; ++ size = gs_app_get_size_download_dependencies (app); ++ if (size != 0) ++ return FALSE; + } + + return TRUE; From f92a1eb0a1430162f355b078409140fa6b68d6df Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 8 Sep 2021 09:10:47 +0200 Subject: [PATCH 04/20] Update to 41.rc --- gnome-software.spec | 8 +++++--- rhbug1995817-fix-updates-page-button.patch | 14 -------------- sources | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 rhbug1995817-fix-updates-page-button.patch diff --git a/gnome-software.spec b/gnome-software.spec index 58b6ccf..f705316 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,8 +11,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41~beta -Release: 3%{?dist} +Version: 41~rc +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,7 +20,6 @@ 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: rhbug1995817-fix-updates-page-button.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -199,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Wed Sep 08 2021 Milan Crha - 41~rc-1 +- Update to 41.rc + * Wed Sep 01 2021 Milan Crha - 41~beta-3 - Resolves: #1995817 (gs-updates-section: Check also dependencies' download size) diff --git a/rhbug1995817-fix-updates-page-button.patch b/rhbug1995817-fix-updates-page-button.patch deleted file mode 100644 index b89b549..0000000 --- a/rhbug1995817-fix-updates-page-button.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c -index 0f41ba66..fa050513 100644 ---- a/src/gs-updates-section.c -+++ b/src/gs-updates-section.c -@@ -293,6 +293,9 @@ _all_offline_updates_downloaded (GsUpdatesSection *self) - guint64 size = gs_app_get_size_download (app); - if (size != 0) - return FALSE; -+ size = gs_app_get_size_download_dependencies (app); -+ if (size != 0) -+ return FALSE; - } - - return TRUE; diff --git a/sources b/sources index 242d155..6ff6324 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.beta.tar.xz) = 8d552f508a74c19ed11ae465b901e8b9bda479bff8b9f582b65bbacdba6d91468e4a9676a85f54104d16ba061f0e5daff7a0000aec439e6c4ff2b22cc3a8ecd1 +SHA512 (gnome-software-41.rc.tar.xz) = 6aec9a0ffc4957a62f8a25a4ba50b8f7539a701af8813f37310e6372c16b7c9c43ba5d97df05f202339eded5eb45c53bb9480727cfb3053d86ed16e20827cd23 From 604444314892aa569eeebf926131ff7751ada3a6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 13 Sep 2021 15:13:00 +0200 Subject: [PATCH 05/20] Resolves: #2003365 (packagekit: Ensure PkClient::interactive flag being set) --- ...e-PkClient-interactive-flag-being-se.patch | 116 ++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch diff --git a/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch b/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch new file mode 100644 index 0000000..67e1d8e --- /dev/null +++ b/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch @@ -0,0 +1,116 @@ +From 50ea9e8e6c4c3c23607b1ea9cc56e5e1b15c9e42 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Mon, 13 Sep 2021 15:02:37 +0200 +Subject: [PATCH] packagekit: Ensure PkClient::interactive flag being set + +That's required to properly ask or not ask for the root credentials on operations, +which require higher privileges. It's important to set the flag always before the call +to the PkTask/PkClient API, because other thread could change the value while +the corresponding lock was released by the execution thread. + +Downstream bug report: +https://bugzilla.redhat.com/show_bug.cgi?id=2003365 +--- + plugins/packagekit/gs-plugin-packagekit-refresh.c | 1 + + plugins/packagekit/gs-plugin-packagekit.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c b/plugins/packagekit/gs-plugin-packagekit-refresh.c +index 338cc387..ef06bcd2 100644 +--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c ++++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c +@@ -94,6 +94,7 @@ _download_only (GsPlugin *plugin, GsAppList *list, + * we end up downloading a different set of packages than what was + * shown to the user */ + pk_client_set_cache_age (PK_CLIENT (priv->task), G_MAXUINT); ++ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results2 = pk_task_update_packages_sync (priv->task, + package_ids, + cancellable, +diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c +index da083019..c9e4e49f 100644 +--- a/plugins/packagekit/gs-plugin-packagekit.c ++++ b/plugins/packagekit/gs-plugin-packagekit.c +@@ -424,6 +424,7 @@ gs_plugin_app_install (GsPlugin *plugin, + /* actually install the package */ + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->task_mutex); ++ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_task_install_packages_sync (priv->task, + package_ids, + cancellable, +@@ -501,6 +502,7 @@ gs_plugin_app_install (GsPlugin *plugin, + } + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->task_mutex); ++ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_task_install_packages_sync (priv->task, + (gchar **) array_package_ids->pdata, + cancellable, +@@ -542,6 +544,7 @@ gs_plugin_app_install (GsPlugin *plugin, + gs_app_set_state (app, GS_APP_STATE_INSTALLING); + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->task_mutex); ++ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_task_install_files_sync (priv->task, + package_ids, + cancellable, +@@ -627,6 +630,7 @@ gs_plugin_app_remove (GsPlugin *plugin, + gs_app_set_state (app, GS_APP_STATE_REMOVING); + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->task_mutex); ++ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_task_remove_packages_sync (priv->task, + package_ids, + TRUE, GS_PACKAGEKIT_AUTOREMOVE, +@@ -862,6 +866,7 @@ gs_plugin_packagekit_resolve_packages_with_filter (GsPlugin *plugin, + + /* resolve them all at once */ + g_mutex_lock (&priv->client_mutex_refine); ++ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_resolve (priv->client_refine, + filter, + (gchar **) package_ids->pdata, +@@ -953,6 +958,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin, + to_array[0] = filename; + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->client_mutex_refine); ++ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_search_files (priv->client_refine, + pk_bitfield_from_enums (PK_FILTER_ENUM_INSTALLED, -1), + (gchar **) to_array, +@@ -1036,6 +1042,7 @@ gs_plugin_packagekit_refine_updatedetails (GsPlugin *plugin, + + /* get any update details */ + g_mutex_lock (&priv->client_mutex_refine); ++ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_get_update_detail (priv->client_refine, + (gchar **) package_ids, + cancellable, +@@ -1102,6 +1109,7 @@ gs_plugin_packagekit_refine_details2 (GsPlugin *plugin, + + /* get any details */ + g_mutex_lock (&priv->client_mutex_refine); ++ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_get_details (priv->client_refine, + (gchar **) package_ids->pdata, + cancellable, +@@ -1154,6 +1162,7 @@ gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin, + /* get the list of updates */ + filter = pk_bitfield_value (PK_FILTER_ENUM_NONE); + g_mutex_lock (&priv->client_mutex_refine); ++ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_get_updates (priv->client_refine, + filter, + cancellable, +@@ -1812,6 +1821,7 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin, + files = g_strsplit (filename, "\t", -1); + gs_packagekit_helper_add_app (helper, app); + g_mutex_lock (&priv->task_mutex_local); ++ pk_client_set_interactive (PK_CLIENT (priv->task_local), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); + results = pk_client_get_files_local (PK_CLIENT (priv->task_local), + files, + cancellable, +-- +2.31.1 + diff --git a/gnome-software.spec b/gnome-software.spec index f705316..1e6ff21 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41~rc -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,6 +20,7 @@ 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: 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -198,6 +199,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Sep 13 2021 Milan Crha - 41~rc-2 +- Resolves: #2003365 (packagekit: Ensure PkClient::interactive flag being set) + * Wed Sep 08 2021 Milan Crha - 41~rc-1 - Update to 41.rc From 17d18ba3781c0f27f403be936fd759ed539142f3 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 17 Sep 2021 11:02:49 +0200 Subject: [PATCH 06/20] Add patch to not show RPM packaged apps as unsafe (I#1450) Related to: https://pagure.io/fedora-workstation/issue/244 --- 0003-fix-rpm-as-unsafe.patch | 172 +++++++++++++++++++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 0003-fix-rpm-as-unsafe.patch diff --git a/0003-fix-rpm-as-unsafe.patch b/0003-fix-rpm-as-unsafe.patch new file mode 100644 index 0000000..738ff96 --- /dev/null +++ b/0003-fix-rpm-as-unsafe.patch @@ -0,0 +1,172 @@ +From bdaffd23102a6099e4ee86150ee2546fc077e503 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 16 Sep 2021 10:20:34 +0100 +Subject: [PATCH] gs-app-context-bar: Improve handling of non-sandboxed + applications +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Non-sandboxed applications (basically anything provided by standard +RPM or DEB distro packaging) has ‘unknown’ permissions in +gnome-software’s internal model. Previously, this fact was stated +explicitly (“Software has unknown permissions”). + +That’s not particularly helpful to users. They don’t know what the +permissions are, or what having unknown permissions means for how an +application can be trusted. There’s a large amount of RPM/DEB packaged +software out there and distros actually do a pretty good job of vetting +it for malicious things. While the lack of sandboxing for such +applications means that bugs in them can be exploited with sometimes +wide-ranging effects (full access to the user’s home directory, for +example), the applications can be trusted. + +Let the user know that explicitly. Instead of saying the permissions are +unknown, say that an application is not sandboxed and either comes from +a (trusted) distribution repo, or from a (potentially less trusted) +third party repo. + +For GNOME 42 we can look at differentiating on the basis of sandboxing +even more explicitly by (potentially) introducing a ‘trusted’ state for +the tiles as a counterpoint to ‘safe’. It’s too late in the 41 cycle for +that, though. See +https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1451 for that. + +The differentiation between distro repos and third-party repos is done +on the presence of the `GS_APP_QUIRK_PROVENANCE` quirk, which is set by +the `provenance` plugin. In order to work correctly, this requires +distros to configure the list of trusted repo IDs in the +`org.gnome.software.official-repos` GSettings key. Fedora, for example, +does this as a step in the gnome-software package install process. +(See +https://src.fedoraproject.org/rpms/gnome-software/blob/rawhide/f/gnome-software.spec#_130.) + +As part of this, this commit removes the old handling of +`GS_APP_QUIRK_PROVENANCE`: the strings weren’t entirely helpful, and it +didn’t have a converse implemented. + +Signed-off-by: Philip Withnall + +Fixes: #1450 +--- + src/gs-app-context-bar.c | 36 ++++++++++++++++++++----------- + src/gs-safety-context-dialog.c | 39 +++++++++++++++------------------- + 2 files changed, 41 insertions(+), 34 deletions(-) + +diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c +index 6799a26b4..7eab047a2 100644 +--- a/src/gs-app-context-bar.c ++++ b/src/gs-app-context-bar.c +@@ -352,12 +352,33 @@ update_safety_tile (GsAppContextBar *self) + } + } + +- if (permissions == GS_APP_PERMISSIONS_UNKNOWN) ++ /* Unknown permissions typically come from non-sandboxed packaging ++ * systems like RPM or DEB. Telling the user the software has unknown ++ * permissions is unhelpful; it’s more relevant to say it’s not ++ * sandboxed but is (or is not) packaged by a trusted vendor. They will ++ * have (at least) done some basic checks to make sure the software is ++ * not overtly malware. That doesn’t protect the user from exploitable ++ * bugs in the software, but it does mean they’re not accidentally ++ * installing something which is actively malicious. ++ * ++ * FIXME: We could do better by potentially adding a ‘trusted’ state ++ * to indicate that something is probably safe, but isn’t sandboxed. ++ * See https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1451 */ ++ if (permissions == GS_APP_PERMISSIONS_UNKNOWN && ++ gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE)) ++ add_to_safety_rating (&chosen_rating, descriptions, ++ SAFETY_SAFE, ++ /* Translators: This indicates that an application has been packaged ++ * by the user’s distribution and is safe. ++ * It’s used in a context tile, so should be short. */ ++ _("Reviewed by your distribution")); ++ else if (permissions == GS_APP_PERMISSIONS_UNKNOWN) + add_to_safety_rating (&chosen_rating, descriptions, + SAFETY_POTENTIALLY_UNSAFE, +- /* Translators: This indicates that we don’t know what permissions an app requires to run. ++ /* Translators: This indicates that an application has been packaged ++ * by someone other than the user’s distribution, so might not be safe. + * It’s used in a context tile, so should be short. */ +- _("Software has unknown permissions")); ++ _("Provided by a third party")); + + /* Is the code FOSS and hence inspectable? This doesn’t distinguish + * between closed source and open-source-but-not-FOSS software, even +@@ -377,15 +398,6 @@ update_safety_tile (GsAppContextBar *self) + * It’s used in a context tile, so should be short. */ + _("Auditable code")); + +- /* Does the app come from official sources, such as this distro’s main +- * repos? */ +- if (gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE)) +- add_to_safety_rating (&chosen_rating, descriptions, +- SAFETY_SAFE, +- /* Translators: This indicates an app comes from the distribution’s main repositories, so can be trusted. +- * It’s used in a context tile, so should be short. */ +- _("Software comes from a trusted source")); +- + if (gs_app_has_quirk (self->app, GS_APP_QUIRK_DEVELOPER_VERIFIED)) + add_to_safety_rating (&chosen_rating, descriptions, + SAFETY_SAFE, +diff --git a/src/gs-safety-context-dialog.c b/src/gs-safety-context-dialog.c +index 02cc49789..890543070 100644 +--- a/src/gs-safety-context-dialog.c ++++ b/src/gs-safety-context-dialog.c +@@ -125,16 +125,23 @@ update_permissions_list (GsSafetyContextDialog *self) + + permissions = gs_app_get_permissions (self->app); + +- /* Handle unknown permissions. */ +- add_permission_row (self->permissions_list, &chosen_rating, +- (permissions == GS_APP_PERMISSIONS_UNKNOWN), +- GS_CONTEXT_DIALOG_ROW_IMPORTANCE_WARNING, +- "dialog-question-symbolic", +- _("Unknown Permissions"), +- _("The permissions needed by this app aren’t known"), +- NULL, NULL, NULL); +- +- if (permissions != GS_APP_PERMISSIONS_UNKNOWN) { ++ /* Handle unknown permissions. This means the application isn’t ++ * sandboxed, so we can only really base decisions on whether it was ++ * packaged by an organisation we trust or not. ++ * ++ * FIXME: See the comment for GS_APP_PERMISSIONS_UNKNOWN in ++ * gs-app-context-bar.c. */ ++ if (permissions == GS_APP_PERMISSIONS_UNKNOWN) { ++ add_permission_row (self->permissions_list, &chosen_rating, ++ !gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE), ++ GS_CONTEXT_DIALOG_ROW_IMPORTANCE_WARNING, ++ "channel-insecure-symbolic", ++ _("Provided by a third party"), ++ _("Check that you trust the vendor, as the application isn’t sandboxed"), ++ "channel-secure-symbolic", ++ _("Reviewed by your distribution"), ++ _("Application isn’t sandboxed but the distribution has checked that it is not malicious")); ++ } else { + add_permission_row (self->permissions_list, &chosen_rating, + (permissions & GS_APP_PERMISSIONS_NONE) != 0, + GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, +@@ -304,18 +311,6 @@ update_permissions_list (GsSafetyContextDialog *self) + _("Auditable Code"), + _("The source code is public and can be independently audited, which makes the app more likely to be safe")); + +- /* Does the app come from official sources, such as this distro’s main +- * repos? */ +- add_permission_row (self->permissions_list, &chosen_rating, +- gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE), +- GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, +- "test-pass-symbolic", +- /* Translators: This indicates an app comes from the distribution’s main repositories, so can be trusted. +- * It’s used in a context tile, so should be short. */ +- _("App comes from a trusted source"), +- _("Your distribution has verified that this app can be trusted"), +- NULL, NULL, NULL); +- + add_permission_row (self->permissions_list, &chosen_rating, + gs_app_has_quirk (self->app, GS_APP_QUIRK_DEVELOPER_VERIFIED), + GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 1e6ff21..59b85ed 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41~rc -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,6 +21,7 @@ Source0: https://download.gnome.org/sources/gnome-software/41/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch +Patch03: 0003-fix-rpm-as-unsafe.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -199,6 +200,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Sep 17 2021 Milan Crha - 41~rc-3 +- Add patch to not show RPM packaged apps as unsafe (I#1450) + * Mon Sep 13 2021 Milan Crha - 41~rc-2 - Resolves: #2003365 (packagekit: Ensure PkClient::interactive flag being set) From 9e406b9c707992c0583825eeb6238e1b6d483add Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 20 Sep 2021 10:00:53 +0200 Subject: [PATCH 07/20] Update to 41.0 --- ...e-PkClient-interactive-flag-being-se.patch | 116 ------------ 0003-fix-rpm-as-unsafe.patch | 172 ------------------ gnome-software.spec | 15 +- sources | 2 +- 4 files changed, 11 insertions(+), 294 deletions(-) delete mode 100644 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch delete mode 100644 0003-fix-rpm-as-unsafe.patch diff --git a/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch b/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch deleted file mode 100644 index 67e1d8e..0000000 --- a/0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 50ea9e8e6c4c3c23607b1ea9cc56e5e1b15c9e42 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Mon, 13 Sep 2021 15:02:37 +0200 -Subject: [PATCH] packagekit: Ensure PkClient::interactive flag being set - -That's required to properly ask or not ask for the root credentials on operations, -which require higher privileges. It's important to set the flag always before the call -to the PkTask/PkClient API, because other thread could change the value while -the corresponding lock was released by the execution thread. - -Downstream bug report: -https://bugzilla.redhat.com/show_bug.cgi?id=2003365 ---- - plugins/packagekit/gs-plugin-packagekit-refresh.c | 1 + - plugins/packagekit/gs-plugin-packagekit.c | 10 ++++++++++ - 2 files changed, 11 insertions(+) - -diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c b/plugins/packagekit/gs-plugin-packagekit-refresh.c -index 338cc387..ef06bcd2 100644 ---- a/plugins/packagekit/gs-plugin-packagekit-refresh.c -+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c -@@ -94,6 +94,7 @@ _download_only (GsPlugin *plugin, GsAppList *list, - * we end up downloading a different set of packages than what was - * shown to the user */ - pk_client_set_cache_age (PK_CLIENT (priv->task), G_MAXUINT); -+ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results2 = pk_task_update_packages_sync (priv->task, - package_ids, - cancellable, -diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c -index da083019..c9e4e49f 100644 ---- a/plugins/packagekit/gs-plugin-packagekit.c -+++ b/plugins/packagekit/gs-plugin-packagekit.c -@@ -424,6 +424,7 @@ gs_plugin_app_install (GsPlugin *plugin, - /* actually install the package */ - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->task_mutex); -+ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_task_install_packages_sync (priv->task, - package_ids, - cancellable, -@@ -501,6 +502,7 @@ gs_plugin_app_install (GsPlugin *plugin, - } - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->task_mutex); -+ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_task_install_packages_sync (priv->task, - (gchar **) array_package_ids->pdata, - cancellable, -@@ -542,6 +544,7 @@ gs_plugin_app_install (GsPlugin *plugin, - gs_app_set_state (app, GS_APP_STATE_INSTALLING); - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->task_mutex); -+ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_task_install_files_sync (priv->task, - package_ids, - cancellable, -@@ -627,6 +630,7 @@ gs_plugin_app_remove (GsPlugin *plugin, - gs_app_set_state (app, GS_APP_STATE_REMOVING); - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->task_mutex); -+ pk_client_set_interactive (PK_CLIENT (priv->task), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_task_remove_packages_sync (priv->task, - package_ids, - TRUE, GS_PACKAGEKIT_AUTOREMOVE, -@@ -862,6 +866,7 @@ gs_plugin_packagekit_resolve_packages_with_filter (GsPlugin *plugin, - - /* resolve them all at once */ - g_mutex_lock (&priv->client_mutex_refine); -+ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_resolve (priv->client_refine, - filter, - (gchar **) package_ids->pdata, -@@ -953,6 +958,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin, - to_array[0] = filename; - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->client_mutex_refine); -+ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_search_files (priv->client_refine, - pk_bitfield_from_enums (PK_FILTER_ENUM_INSTALLED, -1), - (gchar **) to_array, -@@ -1036,6 +1042,7 @@ gs_plugin_packagekit_refine_updatedetails (GsPlugin *plugin, - - /* get any update details */ - g_mutex_lock (&priv->client_mutex_refine); -+ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_get_update_detail (priv->client_refine, - (gchar **) package_ids, - cancellable, -@@ -1102,6 +1109,7 @@ gs_plugin_packagekit_refine_details2 (GsPlugin *plugin, - - /* get any details */ - g_mutex_lock (&priv->client_mutex_refine); -+ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_get_details (priv->client_refine, - (gchar **) package_ids->pdata, - cancellable, -@@ -1154,6 +1162,7 @@ gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin, - /* get the list of updates */ - filter = pk_bitfield_value (PK_FILTER_ENUM_NONE); - g_mutex_lock (&priv->client_mutex_refine); -+ pk_client_set_interactive (priv->client_refine, gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_get_updates (priv->client_refine, - filter, - cancellable, -@@ -1812,6 +1821,7 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin, - files = g_strsplit (filename, "\t", -1); - gs_packagekit_helper_add_app (helper, app); - g_mutex_lock (&priv->task_mutex_local); -+ pk_client_set_interactive (PK_CLIENT (priv->task_local), gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)); - results = pk_client_get_files_local (PK_CLIENT (priv->task_local), - files, - cancellable, --- -2.31.1 - diff --git a/0003-fix-rpm-as-unsafe.patch b/0003-fix-rpm-as-unsafe.patch deleted file mode 100644 index 738ff96..0000000 --- a/0003-fix-rpm-as-unsafe.patch +++ /dev/null @@ -1,172 +0,0 @@ -From bdaffd23102a6099e4ee86150ee2546fc077e503 Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Thu, 16 Sep 2021 10:20:34 +0100 -Subject: [PATCH] gs-app-context-bar: Improve handling of non-sandboxed - applications -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Non-sandboxed applications (basically anything provided by standard -RPM or DEB distro packaging) has ‘unknown’ permissions in -gnome-software’s internal model. Previously, this fact was stated -explicitly (“Software has unknown permissions”). - -That’s not particularly helpful to users. They don’t know what the -permissions are, or what having unknown permissions means for how an -application can be trusted. There’s a large amount of RPM/DEB packaged -software out there and distros actually do a pretty good job of vetting -it for malicious things. While the lack of sandboxing for such -applications means that bugs in them can be exploited with sometimes -wide-ranging effects (full access to the user’s home directory, for -example), the applications can be trusted. - -Let the user know that explicitly. Instead of saying the permissions are -unknown, say that an application is not sandboxed and either comes from -a (trusted) distribution repo, or from a (potentially less trusted) -third party repo. - -For GNOME 42 we can look at differentiating on the basis of sandboxing -even more explicitly by (potentially) introducing a ‘trusted’ state for -the tiles as a counterpoint to ‘safe’. It’s too late in the 41 cycle for -that, though. See -https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1451 for that. - -The differentiation between distro repos and third-party repos is done -on the presence of the `GS_APP_QUIRK_PROVENANCE` quirk, which is set by -the `provenance` plugin. In order to work correctly, this requires -distros to configure the list of trusted repo IDs in the -`org.gnome.software.official-repos` GSettings key. Fedora, for example, -does this as a step in the gnome-software package install process. -(See -https://src.fedoraproject.org/rpms/gnome-software/blob/rawhide/f/gnome-software.spec#_130.) - -As part of this, this commit removes the old handling of -`GS_APP_QUIRK_PROVENANCE`: the strings weren’t entirely helpful, and it -didn’t have a converse implemented. - -Signed-off-by: Philip Withnall - -Fixes: #1450 ---- - src/gs-app-context-bar.c | 36 ++++++++++++++++++++----------- - src/gs-safety-context-dialog.c | 39 +++++++++++++++------------------- - 2 files changed, 41 insertions(+), 34 deletions(-) - -diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c -index 6799a26b4..7eab047a2 100644 ---- a/src/gs-app-context-bar.c -+++ b/src/gs-app-context-bar.c -@@ -352,12 +352,33 @@ update_safety_tile (GsAppContextBar *self) - } - } - -- if (permissions == GS_APP_PERMISSIONS_UNKNOWN) -+ /* Unknown permissions typically come from non-sandboxed packaging -+ * systems like RPM or DEB. Telling the user the software has unknown -+ * permissions is unhelpful; it’s more relevant to say it’s not -+ * sandboxed but is (or is not) packaged by a trusted vendor. They will -+ * have (at least) done some basic checks to make sure the software is -+ * not overtly malware. That doesn’t protect the user from exploitable -+ * bugs in the software, but it does mean they’re not accidentally -+ * installing something which is actively malicious. -+ * -+ * FIXME: We could do better by potentially adding a ‘trusted’ state -+ * to indicate that something is probably safe, but isn’t sandboxed. -+ * See https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1451 */ -+ if (permissions == GS_APP_PERMISSIONS_UNKNOWN && -+ gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE)) -+ add_to_safety_rating (&chosen_rating, descriptions, -+ SAFETY_SAFE, -+ /* Translators: This indicates that an application has been packaged -+ * by the user’s distribution and is safe. -+ * It’s used in a context tile, so should be short. */ -+ _("Reviewed by your distribution")); -+ else if (permissions == GS_APP_PERMISSIONS_UNKNOWN) - add_to_safety_rating (&chosen_rating, descriptions, - SAFETY_POTENTIALLY_UNSAFE, -- /* Translators: This indicates that we don’t know what permissions an app requires to run. -+ /* Translators: This indicates that an application has been packaged -+ * by someone other than the user’s distribution, so might not be safe. - * It’s used in a context tile, so should be short. */ -- _("Software has unknown permissions")); -+ _("Provided by a third party")); - - /* Is the code FOSS and hence inspectable? This doesn’t distinguish - * between closed source and open-source-but-not-FOSS software, even -@@ -377,15 +398,6 @@ update_safety_tile (GsAppContextBar *self) - * It’s used in a context tile, so should be short. */ - _("Auditable code")); - -- /* Does the app come from official sources, such as this distro’s main -- * repos? */ -- if (gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE)) -- add_to_safety_rating (&chosen_rating, descriptions, -- SAFETY_SAFE, -- /* Translators: This indicates an app comes from the distribution’s main repositories, so can be trusted. -- * It’s used in a context tile, so should be short. */ -- _("Software comes from a trusted source")); -- - if (gs_app_has_quirk (self->app, GS_APP_QUIRK_DEVELOPER_VERIFIED)) - add_to_safety_rating (&chosen_rating, descriptions, - SAFETY_SAFE, -diff --git a/src/gs-safety-context-dialog.c b/src/gs-safety-context-dialog.c -index 02cc49789..890543070 100644 ---- a/src/gs-safety-context-dialog.c -+++ b/src/gs-safety-context-dialog.c -@@ -125,16 +125,23 @@ update_permissions_list (GsSafetyContextDialog *self) - - permissions = gs_app_get_permissions (self->app); - -- /* Handle unknown permissions. */ -- add_permission_row (self->permissions_list, &chosen_rating, -- (permissions == GS_APP_PERMISSIONS_UNKNOWN), -- GS_CONTEXT_DIALOG_ROW_IMPORTANCE_WARNING, -- "dialog-question-symbolic", -- _("Unknown Permissions"), -- _("The permissions needed by this app aren’t known"), -- NULL, NULL, NULL); -- -- if (permissions != GS_APP_PERMISSIONS_UNKNOWN) { -+ /* Handle unknown permissions. This means the application isn’t -+ * sandboxed, so we can only really base decisions on whether it was -+ * packaged by an organisation we trust or not. -+ * -+ * FIXME: See the comment for GS_APP_PERMISSIONS_UNKNOWN in -+ * gs-app-context-bar.c. */ -+ if (permissions == GS_APP_PERMISSIONS_UNKNOWN) { -+ add_permission_row (self->permissions_list, &chosen_rating, -+ !gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE), -+ GS_CONTEXT_DIALOG_ROW_IMPORTANCE_WARNING, -+ "channel-insecure-symbolic", -+ _("Provided by a third party"), -+ _("Check that you trust the vendor, as the application isn’t sandboxed"), -+ "channel-secure-symbolic", -+ _("Reviewed by your distribution"), -+ _("Application isn’t sandboxed but the distribution has checked that it is not malicious")); -+ } else { - add_permission_row (self->permissions_list, &chosen_rating, - (permissions & GS_APP_PERMISSIONS_NONE) != 0, - GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, -@@ -304,18 +311,6 @@ update_permissions_list (GsSafetyContextDialog *self) - _("Auditable Code"), - _("The source code is public and can be independently audited, which makes the app more likely to be safe")); - -- /* Does the app come from official sources, such as this distro’s main -- * repos? */ -- add_permission_row (self->permissions_list, &chosen_rating, -- gs_app_has_quirk (self->app, GS_APP_QUIRK_PROVENANCE), -- GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, -- "test-pass-symbolic", -- /* Translators: This indicates an app comes from the distribution’s main repositories, so can be trusted. -- * It’s used in a context tile, so should be short. */ -- _("App comes from a trusted source"), -- _("Your distribution has verified that this app can be trusted"), -- NULL, NULL, NULL); -- - add_permission_row (self->permissions_list, &chosen_rating, - gs_app_has_quirk (self->app, GS_APP_QUIRK_DEVELOPER_VERIFIED), - GS_CONTEXT_DIALOG_ROW_IMPORTANCE_UNIMPORTANT, --- -GitLab - diff --git a/gnome-software.spec b/gnome-software.spec index 59b85ed..8d1d8cc 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,8 +11,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41~rc -Release: 3%{?dist} +Version: 41.0 +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,8 +20,6 @@ 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: 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch -Patch03: 0003-fix-rpm-as-unsafe.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -130,7 +128,11 @@ 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' ] +%endif FOE %find_lang %name --with-gnome @@ -200,6 +202,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Sep 20 2021 Milan Crha - 41.0-1 +- Update to 41.0 + * Fri Sep 17 2021 Milan Crha - 41~rc-3 - Add patch to not show RPM packaged apps as unsafe (I#1450) diff --git a/sources b/sources index 6ff6324..4578578 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.rc.tar.xz) = 6aec9a0ffc4957a62f8a25a4ba50b8f7539a701af8813f37310e6372c16b7c9c43ba5d97df05f202339eded5eb45c53bb9480727cfb3053d86ed16e20827cd23 +SHA512 (gnome-software-41.0.tar.xz) = 6cc090f835e77d64abb0080d3b72494019d6f69c2144abea4dabdc4f52dc570a372159eb1e0b0d98ae33b31c134cc17673fe3fa243eed762eec55620ab146b26 From a414c78019201155f3a74f4430f609b224b37948 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 4 Oct 2021 17:43:44 +0200 Subject: [PATCH 08/20] Resolves: #2009063 (Correct update notifications) --- 0002-correct-update-notifications.patch | 116 ++++++++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 0002-correct-update-notifications.patch diff --git a/0002-correct-update-notifications.patch b/0002-correct-update-notifications.patch new file mode 100644 index 0000000..a8c8f08 --- /dev/null +++ b/0002-correct-update-notifications.patch @@ -0,0 +1,116 @@ +From 1b0c476d66f89332187da2894b06ec2d4b83fa2a Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Thu, 30 Sep 2021 16:28:11 +0200 +Subject: [PATCH 1/2] gs-update-monitor: Use wall-clock time for + one-notification-per-day check + +Instead of using the g_timeout_add_seconds(), which uses a monotonic time, +which may or may not increase when the machine is suspended, rather use +the wall-clock time, to avoid issues with machine suspend where the monotonic +time does not increase. +--- + src/gs-update-monitor.c | 31 +++++++++++++------------------ + 1 file changed, 13 insertions(+), 18 deletions(-) + +diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c +index bde39fbbb..787c605a1 100644 +--- a/src/gs-update-monitor.c ++++ b/src/gs-update-monitor.c +@@ -44,7 +44,8 @@ struct _GsUpdateMonitor { + guint check_startup_id; /* 60s after startup */ + guint check_hourly_id; /* and then every hour */ + guint check_daily_id; /* every 3rd day */ +- guint notification_blocked_id; /* rate limit notifications */ ++ ++ gint64 last_notification_time_usec; /* to notify once per day only */ + }; + + G_DEFINE_TYPE (GsUpdateMonitor, gs_update_monitor, G_TYPE_OBJECT) +@@ -88,14 +89,6 @@ with_app_data_free (WithAppData *data) + + G_DEFINE_AUTOPTR_CLEANUP_FUNC(WithAppData, with_app_data_free); + +-static gboolean +-reenable_offline_update_notification (gpointer data) +-{ +- GsUpdateMonitor *monitor = data; +- monitor->notification_blocked_id = 0; +- return G_SOURCE_REMOVE; +-} +- + static void + check_updates_kind (GsAppList *apps, + gboolean *out_has_important, +@@ -265,16 +258,22 @@ notify_about_pending_updates (GsUpdateMonitor *monitor, + GsAppList *apps) + { + const gchar *title = NULL, *body = NULL; ++ gint64 time_diff_sec; + g_autoptr(GNotification) nn = NULL; + +- if (monitor->notification_blocked_id > 0) ++ time_diff_sec = (g_get_real_time () - monitor->last_notification_time_usec) / G_USEC_PER_SEC; ++ if (time_diff_sec < SECONDS_IN_A_DAY) { ++ g_debug ("Skipping update notification daily check, because made one only %" G_GINT64_FORMAT "s ago", ++ time_diff_sec); + return; ++ } + +- /* rate limit update notifications to once per day */ +- monitor->notification_blocked_id = g_timeout_add_seconds (24 * SECONDS_IN_AN_HOUR, reenable_offline_update_notification, monitor); +- +- if (!should_notify_about_pending_updates (monitor, apps, &title, &body)) ++ if (!should_notify_about_pending_updates (monitor, apps, &title, &body)) { ++ g_debug ("No update notification needed"); + return; ++ } ++ ++ monitor->last_notification_time_usec = g_get_real_time (); + + g_debug ("Notify about update: '%s'", title); + +@@ -1394,10 +1393,6 @@ gs_update_monitor_dispose (GObject *object) + g_source_remove (monitor->check_startup_id); + monitor->check_startup_id = 0; + } +- if (monitor->notification_blocked_id != 0) { +- g_source_remove (monitor->notification_blocked_id); +- monitor->notification_blocked_id = 0; +- } + if (monitor->cleanup_notifications_id != 0) { + g_source_remove (monitor->cleanup_notifications_id); + monitor->cleanup_notifications_id = 0; +-- +GitLab + + +From 2ff332826f841c4ea1d9458df81648868745ea41 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Thu, 30 Sep 2021 16:47:40 +0200 +Subject: [PATCH 2/2] gs-update-monitor: Correct last notification timestamp + reset + +Do not reset the notification timestamp after the list of updates +is received, that should be done when the notification had been shown. + +Reported downstream at: +https://bugzilla.redhat.com/show_bug.cgi?id=2009063 +--- + src/gs-update-monitor.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c +index 787c605a1..a8421fcc4 100644 +--- a/src/gs-update-monitor.c ++++ b/src/gs-update-monitor.c +@@ -613,7 +613,6 @@ get_updates_finished_cb (GObject *object, GAsyncResult *res, gpointer data) + notify_list = apps; + + notify_about_pending_updates (monitor, notify_list); +- reset_update_notification_timestamp (monitor); + } + } + +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 8d1d8cc..066559f 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,6 +20,7 @@ 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: 0002-correct-update-notifications.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -202,6 +203,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Oct 04 2021 Milan Crha - 41.0-2 +- Resolves: #2009063 (Correct update notifications) + * Mon Sep 20 2021 Milan Crha - 41.0-1 - Update to 41.0 From a5778cb05fab69cb0532adb8cd12e0996154c661 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 7 Oct 2021 09:41:10 +0200 Subject: [PATCH 09/20] Resolves: #2010740 (Refresh on repository setup change) --- 0003-refresh-on-repository-change.patch | 233 ++++++++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 0003-refresh-on-repository-change.patch diff --git a/0003-refresh-on-repository-change.patch b/0003-refresh-on-repository-change.patch new file mode 100644 index 0000000..3af8ef8 --- /dev/null +++ b/0003-refresh-on-repository-change.patch @@ -0,0 +1,233 @@ +From 5c203ae1b07e2c31ca39c3d6a793534d45c49125 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 5 Oct 2021 19:42:37 +0200 +Subject: [PATCH 1/5] gs-shell: Remove left-over function prototype declaration + +The function body does not exist. +--- + src/gs-shell.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/gs-shell.h b/src/gs-shell.h +index bb39fc928..46661db16 100644 +--- a/src/gs-shell.h ++++ b/src/gs-shell.h +@@ -43,8 +43,6 @@ typedef enum { + + GsShell *gs_shell_new (void); + void gs_shell_activate (GsShell *shell); +-void gs_shell_refresh (GsShell *shell, +- GCancellable *cancellable); + void gs_shell_change_mode (GsShell *shell, + GsShellMode mode, + gpointer data, +-- +GitLab + + +From ca49eb3974e220ff17262c6189e3cdf0a92746fe Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 5 Oct 2021 19:45:10 +0200 +Subject: [PATCH 2/5] gs-application: Introduce gs_application_refresh() + +It can be used to call a non-interactive refresh call for the plugins. +--- + src/gs-application.c | 28 ++++++++++++++++++++++++++++ + src/gs-application.h | 3 ++- + 2 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/src/gs-application.c b/src/gs-application.c +index 90487df62..df982df19 100644 +--- a/src/gs-application.c ++++ b/src/gs-application.c +@@ -1371,3 +1371,31 @@ gs_application_emit_install_resources_done (GsApplication *application, + { + g_signal_emit (application, signals[INSTALL_RESOURCES_DONE], 0, ident, op_error, NULL); + } ++ ++static void ++gs_application_refresh_cb (GsPluginLoader *plugin_loader, ++ GAsyncResult *result, ++ GsApplication *self) ++{ ++ gboolean success; ++ g_autoptr(GError) error = NULL; ++ ++ success = gs_plugin_loader_job_action_finish (plugin_loader, result, &error); ++ if (!success && ++ !g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) ++ g_warning ("failed to refresh: %s", error->message); ++} ++ ++void ++gs_application_refresh (GsApplication *self) ++{ ++ g_autoptr(GsPluginJob) plugin_job = NULL; ++ plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH, ++ "interactive", FALSE, ++ "age", (guint64) 1, ++ NULL); ++ gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job, ++ self->cancellable, ++ (GAsyncReadyCallback) gs_application_refresh_cb, ++ self); ++} +diff --git a/src/gs-application.h b/src/gs-application.h +index 40bad4d4c..92978e1f5 100644 +--- a/src/gs-application.h ++++ b/src/gs-application.h +@@ -23,4 +23,5 @@ gboolean gs_application_has_active_window (GsApplication *application); + void gs_application_emit_install_resources_done + (GsApplication *application, + const gchar *ident, +- const GError *op_error); +\ No newline at end of file ++ const GError *op_error); ++void gs_application_refresh (GsApplication *self); +-- +GitLab + + +From 2781d350a9a9ee1fd2078928f4e0933a34e05b9f Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 5 Oct 2021 19:46:17 +0200 +Subject: [PATCH 3/5] gs-repos-dialog: Call refresh on repository setup change + +When a repository is enabled/disabled/removed, call also the refresh +on the plugins, thus the data from those repos are available for the user. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1486 +--- + src/gs-repos-dialog.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c +index 1d6a82f48..c986ad724 100644 +--- a/src/gs-repos-dialog.c ++++ b/src/gs-repos-dialog.c +@@ -13,6 +13,7 @@ + #include "gs-repos-dialog.h" + + #include "gnome-software-private.h" ++#include "gs-application.h" + #include "gs-common.h" + #include "gs-os-release.h" + #include "gs-repo-row.h" +@@ -35,6 +36,8 @@ struct _GsReposDialog + GtkWidget *content_page; + GtkWidget *spinner; + GtkWidget *stack; ++ ++ gboolean changed; + }; + + G_DEFINE_TYPE (GsReposDialog, gs_repos_dialog, HDY_TYPE_WINDOW) +@@ -115,6 +118,8 @@ repo_enabled_cb (GObject *source, + } + + g_debug ("finished %s repo %s", action_str, gs_app_get_id (install_remove_data->repo)); ++ ++ install_remove_data->dialog->changed = TRUE; + } + + static void +@@ -710,6 +715,17 @@ gs_repos_dialog_dispose (GObject *object) + g_clear_object (&dialog->cancellable); + g_clear_object (&dialog->settings); + ++ if (dialog->changed) { ++ GApplication *app; ++ ++ dialog->changed = FALSE; ++ g_debug ("Repository setup changed, calling refresh..."); ++ ++ app = g_application_get_default (); ++ if (app) ++ gs_application_refresh (GS_APPLICATION (app)); ++ } ++ + G_OBJECT_CLASS (gs_repos_dialog_parent_class)->dispose (object); + } + +-- +GitLab + + +From 4c6f4f20c904600a3c5d8ea446ed3c3b0ef0808d Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 6 Oct 2021 14:41:55 +0200 +Subject: [PATCH 4/5] gs-application: Invoke page reload after the refresh is + finished + +The refresh can cause new applications or alternative sources being +found in the newly enabled repositories, thus reload the pages, to +reflect the current state. +--- + src/gs-application.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/gs-application.c b/src/gs-application.c +index df982df19..6ecc093f1 100644 +--- a/src/gs-application.c ++++ b/src/gs-application.c +@@ -1384,6 +1384,9 @@ gs_application_refresh_cb (GsPluginLoader *plugin_loader, + if (!success && + !g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) + g_warning ("failed to refresh: %s", error->message); ++ ++ if (success) ++ g_signal_emit_by_name (self->plugin_loader, "reload", 0, NULL); + } + + void +-- +GitLab + + +From b1277d97ba4495de434eb3be4ea1f17b80ac1ef8 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 6 Oct 2021 14:44:09 +0200 +Subject: [PATCH 5/5] gs-overview-page: Refresh the application after + third-party repositories enable/disable + +The enable/disable can cause other applications being found, thus call +the refresh, to update the repositories information. +--- + src/gs-overview-page.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c +index 9ba33fb2b..bcf02243d 100644 +--- a/src/gs-overview-page.c ++++ b/src/gs-overview-page.c +@@ -13,6 +13,7 @@ + #include + #include + ++#include "gs-application.h" + #include "gs-shell.h" + #include "gs-overview-page.h" + #include "gs-app-list-private.h" +@@ -568,6 +569,8 @@ third_party_response_cb (GtkInfoBar *info_bar, + gint response_id, + GsOverviewPage *self) + { ++ GApplication *application; ++ + if (response_id == GTK_RESPONSE_YES) + fedora_third_party_enable (self); + else +@@ -575,6 +578,10 @@ third_party_response_cb (GtkInfoBar *info_bar, + + self->third_party_needs_question = FALSE; + refresh_third_party_repo (self); ++ ++ application = g_application_get_default (); ++ if (application) ++ gs_application_refresh (GS_APPLICATION (application)); + } + + static gboolean +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 066559f..4102049 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,6 +21,7 @@ Source0: https://download.gnome.org/sources/gnome-software/41/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-correct-update-notifications.patch +Patch03: 0003-refresh-on-repository-change.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -203,6 +204,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Thu Oct 07 2021 Milan Crha - 41.0-3 +- Resolves: #2010740 (Refresh on repository setup change) + * Mon Oct 04 2021 Milan Crha - 41.0-2 - Resolves: #2009063 (Correct update notifications) From bc3e401ebb3a8faadbb0244d3a442cc45b276ef7 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 8 Oct 2021 07:33:58 +0200 Subject: [PATCH 10/20] Resolves: #2011176, #2010660, #2010353 --- 0004-filtered-system-flathub.patch | 331 +++++++++ 0005-repos-dialog-can-show-apps.patch | 163 +++++ 0006-optional-repos-cannot-be-disabled.patch | 665 +++++++++++++++++++ gnome-software.spec | 9 + 4 files changed, 1168 insertions(+) create mode 100644 0004-filtered-system-flathub.patch create mode 100644 0005-repos-dialog-can-show-apps.patch create mode 100644 0006-optional-repos-cannot-be-disabled.patch diff --git a/0004-filtered-system-flathub.patch b/0004-filtered-system-flathub.patch new file mode 100644 index 0000000..93cd865 --- /dev/null +++ b/0004-filtered-system-flathub.patch @@ -0,0 +1,331 @@ +From 03ea59cc8db6bec34d56205d62ec495315e9ea96 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 13:55:57 +0200 +Subject: [PATCH 1/5] gs-page: Use correct action when install/remove repo app + +Since the split of the install/remove action for apps and repos +the GsPage should use correct action too. This can happen for example +when installing a .flatpakrepo file. +--- + src/gs-page.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/gs-page.c b/src/gs-page.c +index ca1fbfc70..dfaadbc39 100644 +--- a/src/gs-page.c ++++ b/src/gs-page.c +@@ -280,7 +280,10 @@ gs_page_install_app (GsPage *page, + } + + helper = g_slice_new0 (GsPageHelper); +- helper->action = GS_PLUGIN_ACTION_INSTALL; ++ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY) ++ helper->action = GS_PLUGIN_ACTION_INSTALL_REPO; ++ else ++ helper->action = GS_PLUGIN_ACTION_INSTALL; + helper->app = g_object_ref (app); + helper->page = g_object_ref (page); + helper->cancellable = g_object_ref (cancellable); +@@ -466,7 +469,10 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable) + + /* pending install */ + helper = g_slice_new0 (GsPageHelper); +- helper->action = GS_PLUGIN_ACTION_REMOVE; ++ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY) ++ helper->action = GS_PLUGIN_ACTION_REMOVE_REPO; ++ else ++ helper->action = GS_PLUGIN_ACTION_REMOVE; + helper->app = g_object_ref (app); + helper->page = g_object_ref (page); + helper->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; +-- +GitLab + + +From 576f9e6d25fcd3edd7fdf769e342a382af1307e3 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 13:58:03 +0200 +Subject: [PATCH 2/5] flatpak: Save also remote's filter on the flatpak-app + +This can be used when updating existing remote, to reflect the new +filter. It can be also used to verify the installed and existing +remotes match with its filter. +--- + plugins/flatpak/gs-flatpak-app.c | 12 ++++++++++++ + plugins/flatpak/gs-flatpak-app.h | 3 +++ + 2 files changed, 15 insertions(+) + +diff --git a/plugins/flatpak/gs-flatpak-app.c b/plugins/flatpak/gs-flatpak-app.c +index cf98248a8..b59515b2f 100644 +--- a/plugins/flatpak/gs-flatpak-app.c ++++ b/plugins/flatpak/gs-flatpak-app.c +@@ -176,3 +176,15 @@ gs_flatpak_app_get_main_app_ref_name (GsApp *app) + { + return gs_app_get_metadata_item (app, "flatpak::mainApp"); + } ++ ++void ++gs_flatpak_app_set_repo_filter (GsApp *app, const gchar *filter) ++{ ++ gs_app_set_metadata (app, "flatpak::RepoFilter", filter); ++} ++ ++const gchar * ++gs_flatpak_app_get_repo_filter (GsApp *app) ++{ ++ return gs_app_get_metadata_item (app, "flatpak::RepoFilter"); ++} +diff --git a/plugins/flatpak/gs-flatpak-app.h b/plugins/flatpak/gs-flatpak-app.h +index ab6c10af4..610c8a8f3 100644 +--- a/plugins/flatpak/gs-flatpak-app.h ++++ b/plugins/flatpak/gs-flatpak-app.h +@@ -58,5 +58,8 @@ void gs_flatpak_app_set_runtime_url (GsApp *app, + void gs_flatpak_app_set_main_app_ref_name (GsApp *app, + const gchar *main_app_ref); + const gchar *gs_flatpak_app_get_main_app_ref_name (GsApp *app); ++void gs_flatpak_app_set_repo_filter (GsApp *app, ++ const gchar *filter); ++const gchar *gs_flatpak_app_get_repo_filter (GsApp *app); + + G_END_DECLS +-- +GitLab + + +From cb809158e81157b53245e4c290ada418d5bcd03d Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 14:02:47 +0200 +Subject: [PATCH 3/5] flatpak: Store filter and description on a remote app + +Store the description also on an installed remote, not only on the file +remote. Similarly store also the filters for the remotes. +--- + plugins/flatpak/gs-flatpak-utils.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/plugins/flatpak/gs-flatpak-utils.c b/plugins/flatpak/gs-flatpak-utils.c +index 8b107b37c..7aa735b0b 100644 +--- a/plugins/flatpak/gs-flatpak-utils.c ++++ b/plugins/flatpak/gs-flatpak-utils.c +@@ -72,6 +72,8 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, + { + g_autofree gchar *title = NULL; + g_autofree gchar *url = NULL; ++ g_autofree gchar *filter = NULL; ++ g_autofree gchar *description = NULL; + g_autoptr(GsApp) app = NULL; + + app = gs_flatpak_app_new (flatpak_remote_get_name (xremote)); +@@ -101,11 +103,19 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, + * not the remote title */ + gs_app_set_origin_ui (app, _("Applications")); + ++ description = flatpak_remote_get_description (xremote); ++ if (description != NULL) ++ gs_app_set_description (app, GS_APP_QUALITY_NORMAL, description); ++ + /* url */ + url = flatpak_remote_get_url (xremote); + if (url != NULL) + gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url); + ++ filter = flatpak_remote_get_filter (xremote); ++ if (filter != NULL) ++ gs_flatpak_app_set_repo_filter (app, filter); ++ + /* success */ + return g_steal_pointer (&app); + } +@@ -127,6 +137,7 @@ gs_flatpak_app_new_from_repo_file (GFile *file, + g_autofree gchar *repo_id = NULL; + g_autofree gchar *repo_title = NULL; + g_autofree gchar *repo_url = NULL; ++ g_autofree gchar *repo_filter = NULL; + g_autoptr(GError) error_local = NULL; + g_autoptr(GKeyFile) kf = NULL; + g_autoptr(GsApp) app = NULL; +@@ -229,6 +240,9 @@ gs_flatpak_app_new_from_repo_file (GFile *file, + g_autoptr(GIcon) icon = gs_remote_icon_new (repo_icon); + gs_app_add_icon (app, icon); + } ++ repo_filter = g_key_file_get_string (kf, "Flatpak Repo", "Filter", NULL); ++ if (repo_filter != NULL && *repo_filter != '\0') ++ gs_flatpak_app_set_repo_filter (app, repo_filter); + + /* success */ + return g_steal_pointer (&app); +-- +GitLab + + +From a4f8501e3e54b702b5ff2af4bb9aaf6f8d6c324c Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 14:05:03 +0200 +Subject: [PATCH 4/5] flatpak: Match existing and file remote only if it + matches also the filter + +The filter can change the content, thus match two remotes only if also +the filter matches. +--- + plugins/flatpak/gs-plugin-flatpak.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c +index 9bdfa80bf..29ba29700 100644 +--- a/plugins/flatpak/gs-plugin-flatpak.c ++++ b/plugins/flatpak/gs-plugin-flatpak.c +@@ -1287,6 +1287,8 @@ gs_plugin_flatpak_file_to_app_repo (GsPlugin *plugin, + g_debug ("%s", error_local->message); + continue; + } ++ if (g_strcmp0 (gs_flatpak_app_get_repo_filter (app), gs_flatpak_app_get_repo_filter (app_tmp)) != 0) ++ continue; + return g_steal_pointer (&app_tmp); + } + +-- +GitLab + + +From 2a94efbda64d94ba6ac27cfd08190b62f52df000 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 14:06:35 +0200 +Subject: [PATCH 5/5] flatpak: Update existing remote from a .flatpakref file + +Update existing remote's title, description and filter when installing +a .flatpakref file, to match what had been installed, with new-enough +flatpak library. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1453 +--- + plugins/flatpak/gs-flatpak-utils.c | 6 ++++++ + plugins/flatpak/gs-flatpak.c | 11 +++++++++-- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/plugins/flatpak/gs-flatpak-utils.c b/plugins/flatpak/gs-flatpak-utils.c +index 7aa735b0b..ec0b397e3 100644 +--- a/plugins/flatpak/gs-flatpak-utils.c ++++ b/plugins/flatpak/gs-flatpak-utils.c +@@ -72,8 +72,10 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, + { + g_autofree gchar *title = NULL; + g_autofree gchar *url = NULL; ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) + g_autofree gchar *filter = NULL; + g_autofree gchar *description = NULL; ++ #endif + g_autoptr(GsApp) app = NULL; + + app = gs_flatpak_app_new (flatpak_remote_get_name (xremote)); +@@ -103,18 +105,22 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, + * not the remote title */ + gs_app_set_origin_ui (app, _("Applications")); + ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) + description = flatpak_remote_get_description (xremote); + if (description != NULL) + gs_app_set_description (app, GS_APP_QUALITY_NORMAL, description); ++ #endif + + /* url */ + url = flatpak_remote_get_url (xremote); + if (url != NULL) + gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url); + ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) + filter = flatpak_remote_get_filter (xremote); + if (filter != NULL) + gs_flatpak_app_set_repo_filter (app, filter); ++ #endif + + /* success */ + return g_steal_pointer (&app); +diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c +index 55a91af2a..fa7df00c9 100644 +--- a/plugins/flatpak/gs-flatpak.c ++++ b/plugins/flatpak/gs-flatpak.c +@@ -1608,9 +1608,16 @@ gs_flatpak_app_install_source (GsFlatpak *self, + gs_app_get_id (app), + cancellable, NULL); + if (xremote != NULL) { +- /* if the remote already exists, just enable it */ +- g_debug ("enabling existing remote %s", flatpak_remote_get_name (xremote)); ++ /* if the remote already exists, just enable it and update it */ ++ g_debug ("modifying existing remote %s", flatpak_remote_get_name (xremote)); + flatpak_remote_set_disabled (xremote, FALSE); ++ if (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REPO) { ++ flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) ++ flatpak_remote_set_filter (xremote, gs_flatpak_app_get_repo_filter (app)); ++ flatpak_remote_set_description (xremote, gs_app_get_description (app)); ++ #endif ++ } + } else if (!is_install) { + g_set_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED, "Cannot enable flatpak remote '%s', remote not found", gs_app_get_id (app)); + } else { +-- +GitLab + +From 1a32bd3eaaf7ec0322c46599e3b949080a410806 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Thu, 7 Oct 2021 19:28:38 +0200 +Subject: [PATCH] flatpak: Update remote appstream data when its filter changed + +When overwriting existing remote, make sure the appstream data is updated +as well when the filter changed, to have shown relevant applications. + +Related to https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1453 +--- + plugins/flatpak/gs-flatpak.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c +index bd87d57ed..88bb69a72 100644 +--- a/plugins/flatpak/gs-flatpak.c ++++ b/plugins/flatpak/gs-flatpak.c +@@ -1623,6 +1623,9 @@ gs_flatpak_app_install_source (GsFlatpak *self, + GError **error) + { + g_autoptr(FlatpakRemote) xremote = NULL; ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) ++ gboolean filter_changed = FALSE; ++ #endif + + xremote = flatpak_installation_get_remote_by_name (self->installation, + gs_app_get_id (app), +@@ -1632,11 +1635,13 @@ gs_flatpak_app_install_source (GsFlatpak *self, + g_debug ("modifying existing remote %s", flatpak_remote_get_name (xremote)); + flatpak_remote_set_disabled (xremote, FALSE); + if (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REPO) { +- flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); + #if FLATPAK_CHECK_VERSION(1, 4, 0) ++ g_autofree gchar *current_filter = flatpak_remote_get_filter (xremote); ++ filter_changed = g_strcmp0 (current_filter, gs_flatpak_app_get_repo_filter (app)) != 0; + flatpak_remote_set_filter (xremote, gs_flatpak_app_get_repo_filter (app)); + flatpak_remote_set_description (xremote, gs_app_get_description (app)); + #endif ++ flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); + } + } else if (!is_install) { + g_set_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED, "Cannot enable flatpak remote '%s', remote not found", gs_app_get_id (app)); +@@ -1666,6 +1671,17 @@ gs_flatpak_app_install_source (GsFlatpak *self, + /* success */ + gs_app_set_state (app, GS_APP_STATE_INSTALLED); + ++ #if FLATPAK_CHECK_VERSION(1, 4, 0) ++ if (filter_changed) { ++ g_autoptr(GError) local_error = NULL; ++ const gchar *remote_name = flatpak_remote_get_name (xremote); ++ if (!flatpak_installation_update_appstream_sync (self->installation, remote_name, NULL, NULL, cancellable, &local_error) && ++ !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { ++ g_warning ("Failed to update appstream data for flatpak remote '%s': %s", ++ remote_name, local_error->message); ++ } ++ } ++ #endif + gs_plugin_repository_changed (self->plugin, app); + + return TRUE; +-- +GitLab + diff --git a/0005-repos-dialog-can-show-apps.patch b/0005-repos-dialog-can-show-apps.patch new file mode 100644 index 0000000..eb985f3 --- /dev/null +++ b/0005-repos-dialog-can-show-apps.patch @@ -0,0 +1,163 @@ +From 1338c8f47b7ebd0e3bd360499c7ab42a0da885e8 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 5 Oct 2021 16:12:33 +0200 +Subject: [PATCH 1/2] packagekit: Update GsApp state and kind only when created + the app instance + +The gs_plugin_packagekit_add_results() can reuse GsApp instances from +the plugin cache, which can already have set property state and kind, +but this was not checked for, which could cause runtime warnings about +invalid state or kind change. + +A reproducer is to open Repositories dialog, which lists available repositories +and the applications being installed in each of them (added as 'related'). +These installed applications can have set state 'updatable' or have refined +their 'kind' already. +--- + plugins/packagekit/packagekit-common.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c +index 16b53727a..dc79c2f62 100644 +--- a/plugins/packagekit/packagekit-common.c ++++ b/plugins/packagekit/packagekit-common.c +@@ -241,12 +241,14 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, + /* process packages */ + for (i = 0; i < array_filtered->len; i++) { + g_autoptr(GsApp) app = NULL; ++ GsAppState state = GS_APP_STATE_UNKNOWN; + package = g_ptr_array_index (array_filtered, i); + + app = gs_plugin_cache_lookup (plugin, pk_package_get_id (package)); + if (app == NULL) { + app = gs_app_new (NULL); + gs_plugin_packagekit_set_packaging_format (plugin, app); ++ gs_app_set_management_plugin (app, "packagekit"); + gs_app_add_source (app, pk_package_get_name (package)); + gs_app_add_source_id (app, pk_package_get_id (package)); + gs_plugin_cache_add (plugin, pk_package_get_id (package), app); +@@ -259,14 +261,13 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, + pk_package_get_summary (package)); + gs_app_set_metadata (app, "GnomeSoftware::Creator", + gs_plugin_get_name (plugin)); +- gs_app_set_management_plugin (app, "packagekit"); + gs_app_set_version (app, pk_package_get_version (package)); + switch (pk_package_get_info (package)) { + case PK_INFO_ENUM_INSTALLED: +- gs_app_set_state (app, GS_APP_STATE_INSTALLED); ++ state = GS_APP_STATE_INSTALLED; + break; + case PK_INFO_ENUM_AVAILABLE: +- gs_app_set_state (app, GS_APP_STATE_AVAILABLE); ++ state = GS_APP_STATE_AVAILABLE; + break; + case PK_INFO_ENUM_INSTALLING: + case PK_INFO_ENUM_UPDATING: +@@ -276,14 +277,16 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, + break; + case PK_INFO_ENUM_UNAVAILABLE: + case PK_INFO_ENUM_REMOVING: +- gs_app_set_state (app, GS_APP_STATE_UNAVAILABLE); ++ state = GS_APP_STATE_UNAVAILABLE; + break; + default: +- gs_app_set_state (app, GS_APP_STATE_UNKNOWN); + g_warning ("unknown info state of %s", + pk_info_enum_to_string (pk_package_get_info (package))); + } +- gs_app_set_kind (app, AS_COMPONENT_KIND_GENERIC); ++ if (state != GS_APP_STATE_UNKNOWN && gs_app_get_state (app) == GS_APP_STATE_UNKNOWN) ++ gs_app_set_state (app, state); ++ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_UNKNOWN) ++ gs_app_set_kind (app, AS_COMPONENT_KIND_GENERIC); + gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_PACKAGE); + gs_app_list_add (list, app); + } +-- +GitLab + + +From 18a893fa83ebd10cea75831e9d9a7398a60c14ce Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 5 Oct 2021 16:18:22 +0200 +Subject: [PATCH 2/2] gs-plugin-loader: Ensure correct list is used on the job + when refining wildcards + +The plugin job is reused when refining the apps, including the wildcards, +but the gs_plugin_loader_run_refine_internal() can be called multiple times, +with different lists. Adding refined wildcards to the original list causes +invalid data being provided to the called. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1485 +--- + lib/gs-plugin-loader.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index 4d5240c32..7f5859a05 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -937,14 +937,24 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, + GCancellable *cancellable, + GError **error) + { ++ g_autoptr(GsAppList) previous_list = NULL; ++ ++ if (list != gs_plugin_job_get_list (helper->plugin_job)) { ++ previous_list = g_object_ref (gs_plugin_job_get_list (helper->plugin_job)); ++ gs_plugin_job_set_list (helper->plugin_job, list); ++ } ++ + /* try to adopt each application with a plugin */ + gs_plugin_loader_run_adopt (helper->plugin_loader, list); + + /* run each plugin */ + if (!gs_plugin_loader_run_refine_filter (helper, list, + GS_PLUGIN_REFINE_FLAGS_DEFAULT, +- cancellable, error)) ++ cancellable, error)) { ++ if (previous_list != NULL) ++ gs_plugin_job_set_list (helper->plugin_job, previous_list); + return FALSE; ++ } + + /* ensure these are sorted by score */ + if (gs_plugin_job_has_refine_flags (helper->plugin_job, +@@ -983,6 +993,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, + addons_list, + cancellable, + error)) { ++ if (previous_list != NULL) ++ gs_plugin_job_set_list (helper->plugin_job, previous_list); + return FALSE; + } + } +@@ -1004,6 +1016,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, + list2, + cancellable, + error)) { ++ if (previous_list != NULL) ++ gs_plugin_job_set_list (helper->plugin_job, previous_list); + return FALSE; + } + } +@@ -1032,11 +1046,16 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, + related_list, + cancellable, + error)) { ++ if (previous_list != NULL) ++ gs_plugin_job_set_list (helper->plugin_job, previous_list); + return FALSE; + } + } + } + ++ if (previous_list != NULL) ++ gs_plugin_job_set_list (helper->plugin_job, previous_list); ++ + /* success */ + return TRUE; + } +-- +GitLab + diff --git a/0006-optional-repos-cannot-be-disabled.patch b/0006-optional-repos-cannot-be-disabled.patch new file mode 100644 index 0000000..20777b4 --- /dev/null +++ b/0006-optional-repos-cannot-be-disabled.patch @@ -0,0 +1,665 @@ +From 429ec744e6cdf2155772d7db463ca193231facdc Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Tue, 21 Sep 2021 14:53:27 +0200 +Subject: gs-repos-dialog: Cannot disable all 3rd-party repositories + +All the 3rd-party repositories should be disable-able, thus the 3rd-party +section should not use the heuristics to disallow disable of some of them. +This could be seen on a 'flathub' Flatpak repository installed for +the system, which is not allowed to be disabled in the Flatpak section. + +diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c +index 57493c2c..7df24e0e 100644 +--- a/src/gs-repo-row.c ++++ b/src/gs-repo-row.c +@@ -27,6 +27,7 @@ typedef struct + guint busy_counter; + gboolean supports_remove; + gboolean supports_enable_disable; ++ gboolean always_allow_enable_disable; + } GsRepoRowPrivate; + + G_DEFINE_TYPE_WITH_PRIVATE (GsRepoRow, gs_repo_row, GTK_TYPE_LIST_BOX_ROW) +@@ -86,7 +87,7 @@ refresh_ui (GsRepoRow *row) + is_system_repo = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE); + + /* Disable for the system repos, if installed */ +- gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || !is_system_repo)); ++ 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); + + /* Set only the 'state' to visually indicate the state is not saved yet */ +@@ -337,13 +338,30 @@ gs_repo_row_class_init (GsRepoRowClass *klass) + gtk_widget_class_bind_template_child_private (widget_class, GsRepoRow, disable_switch); + } + ++/* ++ * gs_repo_row_new: ++ * @plugin_loader: a #GsPluginLoader ++ * @repo: a #GsApp to represent the repo in the new row ++ * @always_allow_enable_disable: always allow enabled/disable of the @repo ++ * ++ * The @plugin_loader is used to check which operations the associated plugin ++ * for the @repo can do and which not, to show only relevant buttons on the row. ++ * ++ * The @always_allow_enable_disable, when %TRUE, means that the @repo in this row ++ * can be always enabled/disabled by the user, if supported by the related plugin, ++ * regardless of the other heuristics, which can avoid the repo enable/disable. ++ * ++ * Returns: (transfer full): a newly created #GsRepoRow ++ */ + GtkWidget * + gs_repo_row_new (GsPluginLoader *plugin_loader, +- GsApp *repo) ++ GsApp *repo, ++ gboolean always_allow_enable_disable) + { + GsRepoRow *row = g_object_new (GS_TYPE_REPO_ROW, NULL); + GsRepoRowPrivate *priv = gs_repo_row_get_instance_private (row); + priv->plugin_loader = g_object_ref (plugin_loader); ++ priv->always_allow_enable_disable = always_allow_enable_disable; + gs_repo_row_set_repo (row, repo); + return GTK_WIDGET (row); + } +diff --git a/src/gs-repo-row.h b/src/gs-repo-row.h +index e6f24bc8..83c8cdf4 100644 +--- a/src/gs-repo-row.h ++++ b/src/gs-repo-row.h +@@ -25,7 +25,8 @@ struct _GsRepoRowClass + }; + + GtkWidget *gs_repo_row_new (GsPluginLoader *plugin_loader, +- GsApp *repo); ++ GsApp *repo, ++ gboolean always_allow_enable_disable); + GsApp *gs_repo_row_get_repo (GsRepoRow *row); + void gs_repo_row_mark_busy (GsRepoRow *row); + void gs_repo_row_unmark_busy (GsRepoRow *row); +diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c +index 98aa0f20..0f24149c 100644 +--- a/src/gs-repos-dialog.c ++++ b/src/gs-repos-dialog.c +@@ -484,7 +484,7 @@ add_repo (GsReposDialog *dialog, + origin_ui = g_strdup (gs_app_get_management_plugin (repo)); + section = g_hash_table_lookup (dialog->sections, origin_ui); + if (section == NULL) { +- section = gs_repos_section_new (dialog->plugin_loader); ++ section = gs_repos_section_new (dialog->plugin_loader, FALSE); + hdy_preferences_group_set_title (HDY_PREFERENCES_GROUP (section), + origin_ui); + g_signal_connect_object (section, "remove-clicked", +@@ -627,7 +627,7 @@ get_sources_cb (GsPluginLoader *plugin_loader, + gtk_container_add (GTK_CONTAINER (widget), row); + gtk_container_add (GTK_CONTAINER (dialog->content_page), widget); + +- section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader)); ++ section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader, TRUE)); + gs_repos_section_set_sort_key (section, "900"); + g_signal_connect_object (section, "switch-clicked", + G_CALLBACK (repo_section_switch_clicked_cb), dialog, 0); +diff --git a/src/gs-repos-section.c b/src/gs-repos-section.c +index 3bf59ad7..a9b08200 100644 +--- a/src/gs-repos-section.c ++++ b/src/gs-repos-section.c +@@ -20,6 +20,7 @@ struct _GsReposSection + GtkListBox *list; + GsPluginLoader *plugin_loader; + gchar *sort_key; ++ gboolean always_allow_enable_disable; + }; + + G_DEFINE_TYPE (GsReposSection, gs_repos_section, HDY_TYPE_PREFERENCES_GROUP) +@@ -130,8 +131,23 @@ gs_repos_section_init (GsReposSection *self) + G_CALLBACK (gs_repos_section_row_activated_cb), self); + } + ++/* ++ * gs_repos_section_new: ++ * @plugin_loader: a #GsPluginLoader ++ * @always_allow_enable_disable: always allow enable/disable of the repos in this section ++ * ++ * Creates a new #GsReposSection. The %plugin_loader is passed ++ * to each #GsRepoRow, the same as the @always_allow_enable_disable. ++ * ++ * The @always_allow_enable_disable, when %TRUE, means that every repo in this section ++ * can be enabled/disabled by the user, if supported by the related plugin, regardless ++ * of the other heuristics, which can avoid the repo enable/disable. ++ * ++ * Returns: (transfer full): a newly created #GsReposSection ++ */ + GtkWidget * +-gs_repos_section_new (GsPluginLoader *plugin_loader) ++gs_repos_section_new (GsPluginLoader *plugin_loader, ++ gboolean always_allow_enable_disable) + { + GsReposSection *self; + +@@ -140,6 +156,7 @@ gs_repos_section_new (GsPluginLoader *plugin_loader) + self = g_object_new (GS_TYPE_REPOS_SECTION, NULL); + + self->plugin_loader = g_object_ref (plugin_loader); ++ self->always_allow_enable_disable = always_allow_enable_disable; + + return GTK_WIDGET (self); + } +@@ -159,7 +176,7 @@ gs_repos_section_add_repo (GsReposSection *self, + if (!self->sort_key) + self->sort_key = g_strdup (gs_app_get_metadata_item (repo, "GnomeSoftware::SortKey")); + +- row = gs_repo_row_new (self->plugin_loader, repo); ++ row = gs_repo_row_new (self->plugin_loader, repo, self->always_allow_enable_disable); + + g_signal_connect (row, "remove-clicked", + G_CALLBACK (repo_remove_clicked_cb), self); +diff --git a/src/gs-repos-section.h b/src/gs-repos-section.h +index 6e29769c..9a58a3e1 100644 +--- a/src/gs-repos-section.h ++++ b/src/gs-repos-section.h +@@ -20,7 +20,8 @@ G_BEGIN_DECLS + + G_DECLARE_FINAL_TYPE (GsReposSection, gs_repos_section, GS, REPOS_SECTION, HdyPreferencesGroup) + +-GtkWidget *gs_repos_section_new (GsPluginLoader *plugin_loader); ++GtkWidget *gs_repos_section_new (GsPluginLoader *plugin_loader, ++ gboolean always_allow_enable_disable); + void gs_repos_section_add_repo (GsReposSection *self, + GsApp *repo); + const gchar *gs_repos_section_get_title (GsReposSection *self); +From dca731ff0daf904911dd6815fb9a1b181329c887 Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 +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 +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 @@ + [] + A list of official repositories that should not be considered 3rd party + ++ ++ [] ++ A list of required repositories that cannot be disabled or removed ++ + + [] + A list of official repositories that should be considered free software +-- +GitLab + + +From d6b8b206a596bb520a0b77066898b44a5ef18920 Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 + diff --git a/gnome-software.spec b/gnome-software.spec index 4102049..4b0dab9 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -22,6 +22,9 @@ Source0: https://download.gnome.org/sources/gnome-software/41/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-correct-update-notifications.patch Patch03: 0003-refresh-on-repository-change.patch +Patch04: 0004-filtered-system-flathub.patch +Patch05: 0005-repos-dialog-can-show-apps.patch +Patch06: 0006-optional-repos-cannot-be-disabled.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -134,6 +137,7 @@ cat >> %{buildroot}%{_datadir}/glib-2.0/schemas/org.gnome.software-fedora.gschem 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 @@ -204,6 +208,11 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Oct 08 2021 Milan Crha - 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 - 41.0-3 - Resolves: #2010740 (Refresh on repository setup change) From 2ad32833b127b5ae4f61f0998aac6ca827b1c91e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 8 Oct 2021 07:35:11 +0200 Subject: [PATCH 11/20] Bump release version --- gnome-software.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index 4b0dab9..b260a7a 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A software center for GNOME License: GPLv2+ From ed242ebfa5bcf22ecea5693d6e1ad2ec4d3bfd4a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 11 Oct 2021 09:19:59 +0200 Subject: [PATCH 12/20] Add patch to mark compulsory only repos, not apps from it --- 0007-compulsory-only-for-repos.patch | 42 ++++++++++++++++++++++++++++ gnome-software.spec | 6 +++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0007-compulsory-only-for-repos.patch diff --git a/0007-compulsory-only-for-repos.patch b/0007-compulsory-only-for-repos.patch new file mode 100644 index 0000000..fb266df --- /dev/null +++ b/0007-compulsory-only-for-repos.patch @@ -0,0 +1,42 @@ +From 895d1ca748f4f33a852853f5f07903fb549fb66f Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 + diff --git a/gnome-software.spec b/gnome-software.spec index b260a7a..5c3f304 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -25,6 +25,7 @@ Patch03: 0003-refresh-on-repository-change.patch Patch04: 0004-filtered-system-flathub.patch Patch05: 0005-repos-dialog-can-show-apps.patch Patch06: 0006-optional-repos-cannot-be-disabled.patch +Patch07: 0007-compulsory-only-for-repos.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -208,6 +209,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Oct 11 2021 Milan Crha - 41.0-5 +- Add patch to mark compulsory only repos, not apps from it + * Fri Oct 08 2021 Milan Crha - 41.0-4 - Resolves: #2011176 (flathub repo can't be added through gnome-software) - Resolves: #2010660 (gs-repos-dialog: Can show also desktop applications) From 3cd73027d3d0187b9d1194c148fcc566e1eaa9c0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 19 Oct 2021 07:57:57 +0200 Subject: [PATCH 13/20] Resolves: #2012863 (gs-installed-page: Change section on application state change) --- 0008-installed-page-section-change.patch | 264 +++++++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 0008-installed-page-section-change.patch diff --git a/0008-installed-page-section-change.patch b/0008-installed-page-section-change.patch new file mode 100644 index 0000000..fd91a2b --- /dev/null +++ b/0008-installed-page-section-change.patch @@ -0,0 +1,264 @@ +From 65551cf41c8d6b3dcf0cf9b2ee2d46201b4e0ea4 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Thu, 14 Oct 2021 15:17:52 +0200 +Subject: [PATCH] gs-installed-page: Change section on application state change + +When an application is being installed, it's shown in the "In Progress" +section, but when the installation is finished it had been left in +that section, even it belongs to a different section. + +Similarly with the uninstall, the application was sorted to the top +of the section, but it might be better to be added to the "In Progress" +section. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1492 +--- + src/gs-installed-page.c | 168 +++++++++++++++++++++++++++++++++------- + 1 file changed, 141 insertions(+), 27 deletions(-) + +diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c +index 67a4b7a51..56bf19df7 100644 +--- a/src/gs-installed-page.c ++++ b/src/gs-installed-page.c +@@ -59,6 +59,9 @@ static GParamSpec *obj_props[PROP_IS_NARROW + 1] = { NULL, }; + + static void gs_installed_page_pending_apps_changed_cb (GsPluginLoader *plugin_loader, + GsInstalledPage *self); ++static void gs_installed_page_notify_state_changed_cb (GsApp *app, ++ GParamSpec *pspec, ++ GsInstalledPage *self); + + typedef enum { + GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING, +@@ -91,6 +94,30 @@ gs_installed_page_get_app_section (GsApp *app) + return GS_UPDATE_LIST_SECTION_ADDONS; + } + ++static GsInstalledPageSection ++gs_installed_page_get_row_section (GsInstalledPage *self, ++ GsAppRow *app_row) ++{ ++ GtkWidget *parent; ++ ++ g_return_val_if_fail (GS_IS_INSTALLED_PAGE (self), GS_UPDATE_LIST_SECTION_LAST); ++ g_return_val_if_fail (GS_IS_APP_ROW (app_row), GS_UPDATE_LIST_SECTION_LAST); ++ ++ parent = gtk_widget_get_parent (GTK_WIDGET (app_row)); ++ if (parent == self->list_box_install_in_progress) ++ return GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING; ++ if (parent == self->list_box_install_apps) ++ return GS_UPDATE_LIST_SECTION_REMOVABLE_APPS; ++ if (parent == self->list_box_install_system_apps) ++ return GS_UPDATE_LIST_SECTION_SYSTEM_APPS; ++ if (parent == self->list_box_install_addons) ++ return GS_UPDATE_LIST_SECTION_ADDONS; ++ ++ g_warn_if_reached (); ++ ++ return GS_UPDATE_LIST_SECTION_LAST; ++} ++ + static void + gs_installed_page_invalidate (GsInstalledPage *self) + { +@@ -121,15 +148,29 @@ row_unrevealed (GObject *row, GParamSpec *pspec, gpointer data) + static void + gs_installed_page_unreveal_row (GsAppRow *app_row) + { +- g_signal_connect (app_row, "unrevealed", +- G_CALLBACK (row_unrevealed), NULL); +- gs_app_row_unreveal (app_row); ++ GsApp *app = gs_app_row_get_app (app_row); ++ if (app != NULL) { ++ g_signal_handlers_disconnect_matched (app, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ++ G_CALLBACK (gs_installed_page_notify_state_changed_cb), NULL); ++ } ++ ++ /* This check is required, because GsAppRow does not emit ++ * the signal when the row is not realized. This can happen ++ * when installing/uninstalling an app without visiting ++ * the Installed page. */ ++ if (!gtk_widget_get_mapped (GTK_WIDGET (app_row))) { ++ row_unrevealed (G_OBJECT (app_row), NULL, NULL); ++ } else { ++ g_signal_connect (app_row, "unrevealed", ++ G_CALLBACK (row_unrevealed), NULL); ++ gs_app_row_unreveal (app_row); ++ } + } + +-static void +-gs_installed_page_app_removed (GsPage *page, GsApp *app) ++static GsAppRow * /* (transfer none) */ ++gs_installed_page_find_app_row (GsInstalledPage *self, ++ GsApp *app) + { +- GsInstalledPage *self = GS_INSTALLED_PAGE (page); + GtkWidget *lists[] = { + self->list_box_install_in_progress, + self->list_box_install_apps, +@@ -145,10 +186,22 @@ gs_installed_page_app_removed (GsPage *page, GsApp *app) + for (GList *l = children; l; l = l->next) { + GsAppRow *app_row = GS_APP_ROW (l->data); + if (gs_app_row_get_app (app_row) == app) { +- gs_installed_page_unreveal_row (app_row); ++ return app_row; + } + } + } ++ ++ return NULL; ++} ++ ++ ++static void ++gs_installed_page_app_removed (GsPage *page, GsApp *app) ++{ ++ GsInstalledPage *self = GS_INSTALLED_PAGE (page); ++ GsAppRow *app_row = gs_installed_page_find_app_row (self, app); ++ if (app_row != NULL) ++ gs_installed_page_unreveal_row (app_row); + } + + static void +@@ -161,12 +214,56 @@ gs_installed_page_app_remove_cb (GsAppRow *app_row, + gs_page_remove_app (GS_PAGE (self), app, self->cancellable); + } + +-static gboolean +-gs_installed_page_invalidate_sort_idle (gpointer user_data) ++static void ++gs_installed_page_maybe_move_app_row (GsInstalledPage *self, ++ GsAppRow *app_row) ++{ ++ GsInstalledPageSection current_section, expected_section; ++ ++ current_section = gs_installed_page_get_row_section (self, app_row); ++ g_return_if_fail (current_section != GS_UPDATE_LIST_SECTION_LAST); ++ ++ expected_section = gs_installed_page_get_app_section (gs_app_row_get_app (app_row)); ++ if (expected_section != current_section) { ++ GtkWidget *widget = GTK_WIDGET (app_row); ++ ++ g_object_ref (app_row); ++ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget); ++ switch (expected_section) { ++ case GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING: ++ widget = self->list_box_install_in_progress; ++ break; ++ case GS_UPDATE_LIST_SECTION_REMOVABLE_APPS: ++ widget = self->list_box_install_apps; ++ break; ++ case GS_UPDATE_LIST_SECTION_SYSTEM_APPS: ++ widget = self->list_box_install_system_apps; ++ break; ++ case GS_UPDATE_LIST_SECTION_ADDONS: ++ widget = self->list_box_install_addons; ++ break; ++ default: ++ g_warn_if_reached (); ++ widget = NULL; ++ break; ++ } ++ ++ if (widget != NULL) ++ gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (app_row)); ++ ++ g_object_unref (app_row); ++ } ++} ++ ++static void ++gs_installed_page_notify_state_changed_cb (GsApp *app, ++ GParamSpec *pspec, ++ GsInstalledPage *self) + { +- GsAppRow *app_row = user_data; +- GsApp *app = gs_app_row_get_app (app_row); + GsAppState state = gs_app_get_state (app); ++ GsAppRow *app_row = gs_installed_page_find_app_row (self, app); ++ ++ g_assert (app_row != NULL); + + gtk_list_box_row_changed (GTK_LIST_BOX_ROW (app_row)); + +@@ -177,17 +274,8 @@ gs_installed_page_invalidate_sort_idle (gpointer user_data) + state != GS_APP_STATE_UPDATABLE && + state != GS_APP_STATE_UPDATABLE_LIVE) + gs_installed_page_unreveal_row (app_row); +- +- g_object_unref (app_row); +- return G_SOURCE_REMOVE; +-} +- +-static void +-gs_installed_page_notify_state_changed_cb (GsApp *app, +- GParamSpec *pspec, +- GsAppRow *app_row) +-{ +- g_idle_add (gs_installed_page_invalidate_sort_idle, g_object_ref (app_row)); ++ else ++ gs_installed_page_maybe_move_app_row (self, app_row); + } + + static gboolean +@@ -229,7 +317,7 @@ gs_installed_page_add_app (GsInstalledPage *self, GsAppList *list, GsApp *app) + G_CALLBACK (gs_installed_page_app_remove_cb), self); + g_signal_connect_object (app, "notify::state", + G_CALLBACK (gs_installed_page_notify_state_changed_cb), +- app_row, 0); ++ self, 0); + + switch (gs_installed_page_get_app_section (app)) { + case GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING: +@@ -294,6 +382,32 @@ out: + gs_installed_page_pending_apps_changed_cb (plugin_loader, self); + } + ++static void ++gs_installed_page_remove_all_cb (GtkWidget *child, ++ gpointer user_data) ++{ ++ GtkContainer *container = user_data; ++ ++ if (GS_IS_APP_ROW (child)) { ++ GsApp *app = gs_app_row_get_app (GS_APP_ROW (child)); ++ if (app != NULL) { ++ g_signal_handlers_disconnect_matched (app, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ++ G_CALLBACK (gs_installed_page_notify_state_changed_cb), NULL); ++ } ++ } else { ++ g_warn_if_reached (); ++ } ++ ++ gtk_container_remove (container, child); ++} ++ ++static void ++gs_container_remove_all_with_cb (GtkContainer *container, ++ GtkCallback callback) ++{ ++ gtk_container_foreach (container, callback, container); ++} ++ + static void + gs_installed_page_load (GsInstalledPage *self) + { +@@ -305,10 +419,10 @@ gs_installed_page_load (GsInstalledPage *self) + self->waiting = TRUE; + + /* remove old entries */ +- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_in_progress)); +- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_apps)); +- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_system_apps)); +- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_addons)); ++ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_in_progress), gs_installed_page_remove_all_cb); ++ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_apps), gs_installed_page_remove_all_cb); ++ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_system_apps), gs_installed_page_remove_all_cb); ++ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_addons), gs_installed_page_remove_all_cb); + + flags = GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON | + GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY | +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 5c3f304..4614b31 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,6 +26,7 @@ Patch04: 0004-filtered-system-flathub.patch Patch05: 0005-repos-dialog-can-show-apps.patch Patch06: 0006-optional-repos-cannot-be-disabled.patch Patch07: 0007-compulsory-only-for-repos.patch +Patch08: 0008-installed-page-section-change.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -209,6 +210,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Tue Oct 19 2021 Milan Crha - 41.0-6 +- Resolves: #2012863 (gs-installed-page: Change section on application state change) + * Mon Oct 11 2021 Milan Crha - 41.0-5 - Add patch to mark compulsory only repos, not apps from it From 5b17ec160032404e5bd2d0e73bea46ee854a8492 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 29 Oct 2021 10:09:12 +0200 Subject: [PATCH 14/20] Update to 41.1 --- 0002-correct-update-notifications.patch | 116 ---- 0003-refresh-on-repository-change.patch | 233 ------- 0004-filtered-system-flathub.patch | 331 --------- 0005-repos-dialog-can-show-apps.patch | 163 ----- 0006-optional-repos-cannot-be-disabled.patch | 665 ------------------- 0007-compulsory-only-for-repos.patch | 42 -- 0008-installed-page-section-change.patch | 264 -------- gnome-software.spec | 14 +- sources | 2 +- 9 files changed, 6 insertions(+), 1824 deletions(-) delete mode 100644 0002-correct-update-notifications.patch delete mode 100644 0003-refresh-on-repository-change.patch delete mode 100644 0004-filtered-system-flathub.patch delete mode 100644 0005-repos-dialog-can-show-apps.patch delete mode 100644 0006-optional-repos-cannot-be-disabled.patch delete mode 100644 0007-compulsory-only-for-repos.patch delete mode 100644 0008-installed-page-section-change.patch diff --git a/0002-correct-update-notifications.patch b/0002-correct-update-notifications.patch deleted file mode 100644 index a8c8f08..0000000 --- a/0002-correct-update-notifications.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 1b0c476d66f89332187da2894b06ec2d4b83fa2a Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Thu, 30 Sep 2021 16:28:11 +0200 -Subject: [PATCH 1/2] gs-update-monitor: Use wall-clock time for - one-notification-per-day check - -Instead of using the g_timeout_add_seconds(), which uses a monotonic time, -which may or may not increase when the machine is suspended, rather use -the wall-clock time, to avoid issues with machine suspend where the monotonic -time does not increase. ---- - src/gs-update-monitor.c | 31 +++++++++++++------------------ - 1 file changed, 13 insertions(+), 18 deletions(-) - -diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c -index bde39fbbb..787c605a1 100644 ---- a/src/gs-update-monitor.c -+++ b/src/gs-update-monitor.c -@@ -44,7 +44,8 @@ struct _GsUpdateMonitor { - guint check_startup_id; /* 60s after startup */ - guint check_hourly_id; /* and then every hour */ - guint check_daily_id; /* every 3rd day */ -- guint notification_blocked_id; /* rate limit notifications */ -+ -+ gint64 last_notification_time_usec; /* to notify once per day only */ - }; - - G_DEFINE_TYPE (GsUpdateMonitor, gs_update_monitor, G_TYPE_OBJECT) -@@ -88,14 +89,6 @@ with_app_data_free (WithAppData *data) - - G_DEFINE_AUTOPTR_CLEANUP_FUNC(WithAppData, with_app_data_free); - --static gboolean --reenable_offline_update_notification (gpointer data) --{ -- GsUpdateMonitor *monitor = data; -- monitor->notification_blocked_id = 0; -- return G_SOURCE_REMOVE; --} -- - static void - check_updates_kind (GsAppList *apps, - gboolean *out_has_important, -@@ -265,16 +258,22 @@ notify_about_pending_updates (GsUpdateMonitor *monitor, - GsAppList *apps) - { - const gchar *title = NULL, *body = NULL; -+ gint64 time_diff_sec; - g_autoptr(GNotification) nn = NULL; - -- if (monitor->notification_blocked_id > 0) -+ time_diff_sec = (g_get_real_time () - monitor->last_notification_time_usec) / G_USEC_PER_SEC; -+ if (time_diff_sec < SECONDS_IN_A_DAY) { -+ g_debug ("Skipping update notification daily check, because made one only %" G_GINT64_FORMAT "s ago", -+ time_diff_sec); - return; -+ } - -- /* rate limit update notifications to once per day */ -- monitor->notification_blocked_id = g_timeout_add_seconds (24 * SECONDS_IN_AN_HOUR, reenable_offline_update_notification, monitor); -- -- if (!should_notify_about_pending_updates (monitor, apps, &title, &body)) -+ if (!should_notify_about_pending_updates (monitor, apps, &title, &body)) { -+ g_debug ("No update notification needed"); - return; -+ } -+ -+ monitor->last_notification_time_usec = g_get_real_time (); - - g_debug ("Notify about update: '%s'", title); - -@@ -1394,10 +1393,6 @@ gs_update_monitor_dispose (GObject *object) - g_source_remove (monitor->check_startup_id); - monitor->check_startup_id = 0; - } -- if (monitor->notification_blocked_id != 0) { -- g_source_remove (monitor->notification_blocked_id); -- monitor->notification_blocked_id = 0; -- } - if (monitor->cleanup_notifications_id != 0) { - g_source_remove (monitor->cleanup_notifications_id); - monitor->cleanup_notifications_id = 0; --- -GitLab - - -From 2ff332826f841c4ea1d9458df81648868745ea41 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Thu, 30 Sep 2021 16:47:40 +0200 -Subject: [PATCH 2/2] gs-update-monitor: Correct last notification timestamp - reset - -Do not reset the notification timestamp after the list of updates -is received, that should be done when the notification had been shown. - -Reported downstream at: -https://bugzilla.redhat.com/show_bug.cgi?id=2009063 ---- - src/gs-update-monitor.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c -index 787c605a1..a8421fcc4 100644 ---- a/src/gs-update-monitor.c -+++ b/src/gs-update-monitor.c -@@ -613,7 +613,6 @@ get_updates_finished_cb (GObject *object, GAsyncResult *res, gpointer data) - notify_list = apps; - - notify_about_pending_updates (monitor, notify_list); -- reset_update_notification_timestamp (monitor); - } - } - --- -GitLab - diff --git a/0003-refresh-on-repository-change.patch b/0003-refresh-on-repository-change.patch deleted file mode 100644 index 3af8ef8..0000000 --- a/0003-refresh-on-repository-change.patch +++ /dev/null @@ -1,233 +0,0 @@ -From 5c203ae1b07e2c31ca39c3d6a793534d45c49125 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 5 Oct 2021 19:42:37 +0200 -Subject: [PATCH 1/5] gs-shell: Remove left-over function prototype declaration - -The function body does not exist. ---- - src/gs-shell.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/gs-shell.h b/src/gs-shell.h -index bb39fc928..46661db16 100644 ---- a/src/gs-shell.h -+++ b/src/gs-shell.h -@@ -43,8 +43,6 @@ typedef enum { - - GsShell *gs_shell_new (void); - void gs_shell_activate (GsShell *shell); --void gs_shell_refresh (GsShell *shell, -- GCancellable *cancellable); - void gs_shell_change_mode (GsShell *shell, - GsShellMode mode, - gpointer data, --- -GitLab - - -From ca49eb3974e220ff17262c6189e3cdf0a92746fe Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 5 Oct 2021 19:45:10 +0200 -Subject: [PATCH 2/5] gs-application: Introduce gs_application_refresh() - -It can be used to call a non-interactive refresh call for the plugins. ---- - src/gs-application.c | 28 ++++++++++++++++++++++++++++ - src/gs-application.h | 3 ++- - 2 files changed, 30 insertions(+), 1 deletion(-) - -diff --git a/src/gs-application.c b/src/gs-application.c -index 90487df62..df982df19 100644 ---- a/src/gs-application.c -+++ b/src/gs-application.c -@@ -1371,3 +1371,31 @@ gs_application_emit_install_resources_done (GsApplication *application, - { - g_signal_emit (application, signals[INSTALL_RESOURCES_DONE], 0, ident, op_error, NULL); - } -+ -+static void -+gs_application_refresh_cb (GsPluginLoader *plugin_loader, -+ GAsyncResult *result, -+ GsApplication *self) -+{ -+ gboolean success; -+ g_autoptr(GError) error = NULL; -+ -+ success = gs_plugin_loader_job_action_finish (plugin_loader, result, &error); -+ if (!success && -+ !g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) -+ g_warning ("failed to refresh: %s", error->message); -+} -+ -+void -+gs_application_refresh (GsApplication *self) -+{ -+ g_autoptr(GsPluginJob) plugin_job = NULL; -+ plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH, -+ "interactive", FALSE, -+ "age", (guint64) 1, -+ NULL); -+ gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job, -+ self->cancellable, -+ (GAsyncReadyCallback) gs_application_refresh_cb, -+ self); -+} -diff --git a/src/gs-application.h b/src/gs-application.h -index 40bad4d4c..92978e1f5 100644 ---- a/src/gs-application.h -+++ b/src/gs-application.h -@@ -23,4 +23,5 @@ gboolean gs_application_has_active_window (GsApplication *application); - void gs_application_emit_install_resources_done - (GsApplication *application, - const gchar *ident, -- const GError *op_error); -\ No newline at end of file -+ const GError *op_error); -+void gs_application_refresh (GsApplication *self); --- -GitLab - - -From 2781d350a9a9ee1fd2078928f4e0933a34e05b9f Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 5 Oct 2021 19:46:17 +0200 -Subject: [PATCH 3/5] gs-repos-dialog: Call refresh on repository setup change - -When a repository is enabled/disabled/removed, call also the refresh -on the plugins, thus the data from those repos are available for the user. - -Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1486 ---- - src/gs-repos-dialog.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c -index 1d6a82f48..c986ad724 100644 ---- a/src/gs-repos-dialog.c -+++ b/src/gs-repos-dialog.c -@@ -13,6 +13,7 @@ - #include "gs-repos-dialog.h" - - #include "gnome-software-private.h" -+#include "gs-application.h" - #include "gs-common.h" - #include "gs-os-release.h" - #include "gs-repo-row.h" -@@ -35,6 +36,8 @@ struct _GsReposDialog - GtkWidget *content_page; - GtkWidget *spinner; - GtkWidget *stack; -+ -+ gboolean changed; - }; - - G_DEFINE_TYPE (GsReposDialog, gs_repos_dialog, HDY_TYPE_WINDOW) -@@ -115,6 +118,8 @@ repo_enabled_cb (GObject *source, - } - - g_debug ("finished %s repo %s", action_str, gs_app_get_id (install_remove_data->repo)); -+ -+ install_remove_data->dialog->changed = TRUE; - } - - static void -@@ -710,6 +715,17 @@ gs_repos_dialog_dispose (GObject *object) - g_clear_object (&dialog->cancellable); - g_clear_object (&dialog->settings); - -+ if (dialog->changed) { -+ GApplication *app; -+ -+ dialog->changed = FALSE; -+ g_debug ("Repository setup changed, calling refresh..."); -+ -+ app = g_application_get_default (); -+ if (app) -+ gs_application_refresh (GS_APPLICATION (app)); -+ } -+ - G_OBJECT_CLASS (gs_repos_dialog_parent_class)->dispose (object); - } - --- -GitLab - - -From 4c6f4f20c904600a3c5d8ea446ed3c3b0ef0808d Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 6 Oct 2021 14:41:55 +0200 -Subject: [PATCH 4/5] gs-application: Invoke page reload after the refresh is - finished - -The refresh can cause new applications or alternative sources being -found in the newly enabled repositories, thus reload the pages, to -reflect the current state. ---- - src/gs-application.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/gs-application.c b/src/gs-application.c -index df982df19..6ecc093f1 100644 ---- a/src/gs-application.c -+++ b/src/gs-application.c -@@ -1384,6 +1384,9 @@ gs_application_refresh_cb (GsPluginLoader *plugin_loader, - if (!success && - !g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) - g_warning ("failed to refresh: %s", error->message); -+ -+ if (success) -+ g_signal_emit_by_name (self->plugin_loader, "reload", 0, NULL); - } - - void --- -GitLab - - -From b1277d97ba4495de434eb3be4ea1f17b80ac1ef8 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 6 Oct 2021 14:44:09 +0200 -Subject: [PATCH 5/5] gs-overview-page: Refresh the application after - third-party repositories enable/disable - -The enable/disable can cause other applications being found, thus call -the refresh, to update the repositories information. ---- - src/gs-overview-page.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c -index 9ba33fb2b..bcf02243d 100644 ---- a/src/gs-overview-page.c -+++ b/src/gs-overview-page.c -@@ -13,6 +13,7 @@ - #include - #include - -+#include "gs-application.h" - #include "gs-shell.h" - #include "gs-overview-page.h" - #include "gs-app-list-private.h" -@@ -568,6 +569,8 @@ third_party_response_cb (GtkInfoBar *info_bar, - gint response_id, - GsOverviewPage *self) - { -+ GApplication *application; -+ - if (response_id == GTK_RESPONSE_YES) - fedora_third_party_enable (self); - else -@@ -575,6 +578,10 @@ third_party_response_cb (GtkInfoBar *info_bar, - - self->third_party_needs_question = FALSE; - refresh_third_party_repo (self); -+ -+ application = g_application_get_default (); -+ if (application) -+ gs_application_refresh (GS_APPLICATION (application)); - } - - static gboolean --- -GitLab - diff --git a/0004-filtered-system-flathub.patch b/0004-filtered-system-flathub.patch deleted file mode 100644 index 93cd865..0000000 --- a/0004-filtered-system-flathub.patch +++ /dev/null @@ -1,331 +0,0 @@ -From 03ea59cc8db6bec34d56205d62ec495315e9ea96 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 13:55:57 +0200 -Subject: [PATCH 1/5] gs-page: Use correct action when install/remove repo app - -Since the split of the install/remove action for apps and repos -the GsPage should use correct action too. This can happen for example -when installing a .flatpakrepo file. ---- - src/gs-page.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/src/gs-page.c b/src/gs-page.c -index ca1fbfc70..dfaadbc39 100644 ---- a/src/gs-page.c -+++ b/src/gs-page.c -@@ -280,7 +280,10 @@ gs_page_install_app (GsPage *page, - } - - helper = g_slice_new0 (GsPageHelper); -- helper->action = GS_PLUGIN_ACTION_INSTALL; -+ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY) -+ helper->action = GS_PLUGIN_ACTION_INSTALL_REPO; -+ else -+ helper->action = GS_PLUGIN_ACTION_INSTALL; - helper->app = g_object_ref (app); - helper->page = g_object_ref (page); - helper->cancellable = g_object_ref (cancellable); -@@ -466,7 +469,10 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable) - - /* pending install */ - helper = g_slice_new0 (GsPageHelper); -- helper->action = GS_PLUGIN_ACTION_REMOVE; -+ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_REPOSITORY) -+ helper->action = GS_PLUGIN_ACTION_REMOVE_REPO; -+ else -+ helper->action = GS_PLUGIN_ACTION_REMOVE; - helper->app = g_object_ref (app); - helper->page = g_object_ref (page); - helper->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL; --- -GitLab - - -From 576f9e6d25fcd3edd7fdf769e342a382af1307e3 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 13:58:03 +0200 -Subject: [PATCH 2/5] flatpak: Save also remote's filter on the flatpak-app - -This can be used when updating existing remote, to reflect the new -filter. It can be also used to verify the installed and existing -remotes match with its filter. ---- - plugins/flatpak/gs-flatpak-app.c | 12 ++++++++++++ - plugins/flatpak/gs-flatpak-app.h | 3 +++ - 2 files changed, 15 insertions(+) - -diff --git a/plugins/flatpak/gs-flatpak-app.c b/plugins/flatpak/gs-flatpak-app.c -index cf98248a8..b59515b2f 100644 ---- a/plugins/flatpak/gs-flatpak-app.c -+++ b/plugins/flatpak/gs-flatpak-app.c -@@ -176,3 +176,15 @@ gs_flatpak_app_get_main_app_ref_name (GsApp *app) - { - return gs_app_get_metadata_item (app, "flatpak::mainApp"); - } -+ -+void -+gs_flatpak_app_set_repo_filter (GsApp *app, const gchar *filter) -+{ -+ gs_app_set_metadata (app, "flatpak::RepoFilter", filter); -+} -+ -+const gchar * -+gs_flatpak_app_get_repo_filter (GsApp *app) -+{ -+ return gs_app_get_metadata_item (app, "flatpak::RepoFilter"); -+} -diff --git a/plugins/flatpak/gs-flatpak-app.h b/plugins/flatpak/gs-flatpak-app.h -index ab6c10af4..610c8a8f3 100644 ---- a/plugins/flatpak/gs-flatpak-app.h -+++ b/plugins/flatpak/gs-flatpak-app.h -@@ -58,5 +58,8 @@ void gs_flatpak_app_set_runtime_url (GsApp *app, - void gs_flatpak_app_set_main_app_ref_name (GsApp *app, - const gchar *main_app_ref); - const gchar *gs_flatpak_app_get_main_app_ref_name (GsApp *app); -+void gs_flatpak_app_set_repo_filter (GsApp *app, -+ const gchar *filter); -+const gchar *gs_flatpak_app_get_repo_filter (GsApp *app); - - G_END_DECLS --- -GitLab - - -From cb809158e81157b53245e4c290ada418d5bcd03d Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 14:02:47 +0200 -Subject: [PATCH 3/5] flatpak: Store filter and description on a remote app - -Store the description also on an installed remote, not only on the file -remote. Similarly store also the filters for the remotes. ---- - plugins/flatpak/gs-flatpak-utils.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/plugins/flatpak/gs-flatpak-utils.c b/plugins/flatpak/gs-flatpak-utils.c -index 8b107b37c..7aa735b0b 100644 ---- a/plugins/flatpak/gs-flatpak-utils.c -+++ b/plugins/flatpak/gs-flatpak-utils.c -@@ -72,6 +72,8 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, - { - g_autofree gchar *title = NULL; - g_autofree gchar *url = NULL; -+ g_autofree gchar *filter = NULL; -+ g_autofree gchar *description = NULL; - g_autoptr(GsApp) app = NULL; - - app = gs_flatpak_app_new (flatpak_remote_get_name (xremote)); -@@ -101,11 +103,19 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, - * not the remote title */ - gs_app_set_origin_ui (app, _("Applications")); - -+ description = flatpak_remote_get_description (xremote); -+ if (description != NULL) -+ gs_app_set_description (app, GS_APP_QUALITY_NORMAL, description); -+ - /* url */ - url = flatpak_remote_get_url (xremote); - if (url != NULL) - gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url); - -+ filter = flatpak_remote_get_filter (xremote); -+ if (filter != NULL) -+ gs_flatpak_app_set_repo_filter (app, filter); -+ - /* success */ - return g_steal_pointer (&app); - } -@@ -127,6 +137,7 @@ gs_flatpak_app_new_from_repo_file (GFile *file, - g_autofree gchar *repo_id = NULL; - g_autofree gchar *repo_title = NULL; - g_autofree gchar *repo_url = NULL; -+ g_autofree gchar *repo_filter = NULL; - g_autoptr(GError) error_local = NULL; - g_autoptr(GKeyFile) kf = NULL; - g_autoptr(GsApp) app = NULL; -@@ -229,6 +240,9 @@ gs_flatpak_app_new_from_repo_file (GFile *file, - g_autoptr(GIcon) icon = gs_remote_icon_new (repo_icon); - gs_app_add_icon (app, icon); - } -+ repo_filter = g_key_file_get_string (kf, "Flatpak Repo", "Filter", NULL); -+ if (repo_filter != NULL && *repo_filter != '\0') -+ gs_flatpak_app_set_repo_filter (app, repo_filter); - - /* success */ - return g_steal_pointer (&app); --- -GitLab - - -From a4f8501e3e54b702b5ff2af4bb9aaf6f8d6c324c Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 14:05:03 +0200 -Subject: [PATCH 4/5] flatpak: Match existing and file remote only if it - matches also the filter - -The filter can change the content, thus match two remotes only if also -the filter matches. ---- - plugins/flatpak/gs-plugin-flatpak.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c -index 9bdfa80bf..29ba29700 100644 ---- a/plugins/flatpak/gs-plugin-flatpak.c -+++ b/plugins/flatpak/gs-plugin-flatpak.c -@@ -1287,6 +1287,8 @@ gs_plugin_flatpak_file_to_app_repo (GsPlugin *plugin, - g_debug ("%s", error_local->message); - continue; - } -+ if (g_strcmp0 (gs_flatpak_app_get_repo_filter (app), gs_flatpak_app_get_repo_filter (app_tmp)) != 0) -+ continue; - return g_steal_pointer (&app_tmp); - } - --- -GitLab - - -From 2a94efbda64d94ba6ac27cfd08190b62f52df000 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 14:06:35 +0200 -Subject: [PATCH 5/5] flatpak: Update existing remote from a .flatpakref file - -Update existing remote's title, description and filter when installing -a .flatpakref file, to match what had been installed, with new-enough -flatpak library. - -Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1453 ---- - plugins/flatpak/gs-flatpak-utils.c | 6 ++++++ - plugins/flatpak/gs-flatpak.c | 11 +++++++++-- - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/plugins/flatpak/gs-flatpak-utils.c b/plugins/flatpak/gs-flatpak-utils.c -index 7aa735b0b..ec0b397e3 100644 ---- a/plugins/flatpak/gs-flatpak-utils.c -+++ b/plugins/flatpak/gs-flatpak-utils.c -@@ -72,8 +72,10 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, - { - g_autofree gchar *title = NULL; - g_autofree gchar *url = NULL; -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) - g_autofree gchar *filter = NULL; - g_autofree gchar *description = NULL; -+ #endif - g_autoptr(GsApp) app = NULL; - - app = gs_flatpak_app_new (flatpak_remote_get_name (xremote)); -@@ -103,18 +105,22 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin, - * not the remote title */ - gs_app_set_origin_ui (app, _("Applications")); - -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) - description = flatpak_remote_get_description (xremote); - if (description != NULL) - gs_app_set_description (app, GS_APP_QUALITY_NORMAL, description); -+ #endif - - /* url */ - url = flatpak_remote_get_url (xremote); - if (url != NULL) - gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url); - -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) - filter = flatpak_remote_get_filter (xremote); - if (filter != NULL) - gs_flatpak_app_set_repo_filter (app, filter); -+ #endif - - /* success */ - return g_steal_pointer (&app); -diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c -index 55a91af2a..fa7df00c9 100644 ---- a/plugins/flatpak/gs-flatpak.c -+++ b/plugins/flatpak/gs-flatpak.c -@@ -1608,9 +1608,16 @@ gs_flatpak_app_install_source (GsFlatpak *self, - gs_app_get_id (app), - cancellable, NULL); - if (xremote != NULL) { -- /* if the remote already exists, just enable it */ -- g_debug ("enabling existing remote %s", flatpak_remote_get_name (xremote)); -+ /* if the remote already exists, just enable it and update it */ -+ g_debug ("modifying existing remote %s", flatpak_remote_get_name (xremote)); - flatpak_remote_set_disabled (xremote, FALSE); -+ if (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REPO) { -+ flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) -+ flatpak_remote_set_filter (xremote, gs_flatpak_app_get_repo_filter (app)); -+ flatpak_remote_set_description (xremote, gs_app_get_description (app)); -+ #endif -+ } - } else if (!is_install) { - g_set_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED, "Cannot enable flatpak remote '%s', remote not found", gs_app_get_id (app)); - } else { --- -GitLab - -From 1a32bd3eaaf7ec0322c46599e3b949080a410806 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Thu, 7 Oct 2021 19:28:38 +0200 -Subject: [PATCH] flatpak: Update remote appstream data when its filter changed - -When overwriting existing remote, make sure the appstream data is updated -as well when the filter changed, to have shown relevant applications. - -Related to https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1453 ---- - plugins/flatpak/gs-flatpak.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c -index bd87d57ed..88bb69a72 100644 ---- a/plugins/flatpak/gs-flatpak.c -+++ b/plugins/flatpak/gs-flatpak.c -@@ -1623,6 +1623,9 @@ gs_flatpak_app_install_source (GsFlatpak *self, - GError **error) - { - g_autoptr(FlatpakRemote) xremote = NULL; -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) -+ gboolean filter_changed = FALSE; -+ #endif - - xremote = flatpak_installation_get_remote_by_name (self->installation, - gs_app_get_id (app), -@@ -1632,11 +1635,13 @@ gs_flatpak_app_install_source (GsFlatpak *self, - g_debug ("modifying existing remote %s", flatpak_remote_get_name (xremote)); - flatpak_remote_set_disabled (xremote, FALSE); - if (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REPO) { -- flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); - #if FLATPAK_CHECK_VERSION(1, 4, 0) -+ g_autofree gchar *current_filter = flatpak_remote_get_filter (xremote); -+ filter_changed = g_strcmp0 (current_filter, gs_flatpak_app_get_repo_filter (app)) != 0; - flatpak_remote_set_filter (xremote, gs_flatpak_app_get_repo_filter (app)); - flatpak_remote_set_description (xremote, gs_app_get_description (app)); - #endif -+ flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app)); - } - } else if (!is_install) { - g_set_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED, "Cannot enable flatpak remote '%s', remote not found", gs_app_get_id (app)); -@@ -1666,6 +1671,17 @@ gs_flatpak_app_install_source (GsFlatpak *self, - /* success */ - gs_app_set_state (app, GS_APP_STATE_INSTALLED); - -+ #if FLATPAK_CHECK_VERSION(1, 4, 0) -+ if (filter_changed) { -+ g_autoptr(GError) local_error = NULL; -+ const gchar *remote_name = flatpak_remote_get_name (xremote); -+ if (!flatpak_installation_update_appstream_sync (self->installation, remote_name, NULL, NULL, cancellable, &local_error) && -+ !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { -+ g_warning ("Failed to update appstream data for flatpak remote '%s': %s", -+ remote_name, local_error->message); -+ } -+ } -+ #endif - gs_plugin_repository_changed (self->plugin, app); - - return TRUE; --- -GitLab - diff --git a/0005-repos-dialog-can-show-apps.patch b/0005-repos-dialog-can-show-apps.patch deleted file mode 100644 index eb985f3..0000000 --- a/0005-repos-dialog-can-show-apps.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 1338c8f47b7ebd0e3bd360499c7ab42a0da885e8 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 5 Oct 2021 16:12:33 +0200 -Subject: [PATCH 1/2] packagekit: Update GsApp state and kind only when created - the app instance - -The gs_plugin_packagekit_add_results() can reuse GsApp instances from -the plugin cache, which can already have set property state and kind, -but this was not checked for, which could cause runtime warnings about -invalid state or kind change. - -A reproducer is to open Repositories dialog, which lists available repositories -and the applications being installed in each of them (added as 'related'). -These installed applications can have set state 'updatable' or have refined -their 'kind' already. ---- - plugins/packagekit/packagekit-common.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c -index 16b53727a..dc79c2f62 100644 ---- a/plugins/packagekit/packagekit-common.c -+++ b/plugins/packagekit/packagekit-common.c -@@ -241,12 +241,14 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, - /* process packages */ - for (i = 0; i < array_filtered->len; i++) { - g_autoptr(GsApp) app = NULL; -+ GsAppState state = GS_APP_STATE_UNKNOWN; - package = g_ptr_array_index (array_filtered, i); - - app = gs_plugin_cache_lookup (plugin, pk_package_get_id (package)); - if (app == NULL) { - app = gs_app_new (NULL); - gs_plugin_packagekit_set_packaging_format (plugin, app); -+ gs_app_set_management_plugin (app, "packagekit"); - gs_app_add_source (app, pk_package_get_name (package)); - gs_app_add_source_id (app, pk_package_get_id (package)); - gs_plugin_cache_add (plugin, pk_package_get_id (package), app); -@@ -259,14 +261,13 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, - pk_package_get_summary (package)); - gs_app_set_metadata (app, "GnomeSoftware::Creator", - gs_plugin_get_name (plugin)); -- gs_app_set_management_plugin (app, "packagekit"); - gs_app_set_version (app, pk_package_get_version (package)); - switch (pk_package_get_info (package)) { - case PK_INFO_ENUM_INSTALLED: -- gs_app_set_state (app, GS_APP_STATE_INSTALLED); -+ state = GS_APP_STATE_INSTALLED; - break; - case PK_INFO_ENUM_AVAILABLE: -- gs_app_set_state (app, GS_APP_STATE_AVAILABLE); -+ state = GS_APP_STATE_AVAILABLE; - break; - case PK_INFO_ENUM_INSTALLING: - case PK_INFO_ENUM_UPDATING: -@@ -276,14 +277,16 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin, - break; - case PK_INFO_ENUM_UNAVAILABLE: - case PK_INFO_ENUM_REMOVING: -- gs_app_set_state (app, GS_APP_STATE_UNAVAILABLE); -+ state = GS_APP_STATE_UNAVAILABLE; - break; - default: -- gs_app_set_state (app, GS_APP_STATE_UNKNOWN); - g_warning ("unknown info state of %s", - pk_info_enum_to_string (pk_package_get_info (package))); - } -- gs_app_set_kind (app, AS_COMPONENT_KIND_GENERIC); -+ if (state != GS_APP_STATE_UNKNOWN && gs_app_get_state (app) == GS_APP_STATE_UNKNOWN) -+ gs_app_set_state (app, state); -+ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_UNKNOWN) -+ gs_app_set_kind (app, AS_COMPONENT_KIND_GENERIC); - gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_PACKAGE); - gs_app_list_add (list, app); - } --- -GitLab - - -From 18a893fa83ebd10cea75831e9d9a7398a60c14ce Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 5 Oct 2021 16:18:22 +0200 -Subject: [PATCH 2/2] gs-plugin-loader: Ensure correct list is used on the job - when refining wildcards - -The plugin job is reused when refining the apps, including the wildcards, -but the gs_plugin_loader_run_refine_internal() can be called multiple times, -with different lists. Adding refined wildcards to the original list causes -invalid data being provided to the called. - -Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1485 ---- - lib/gs-plugin-loader.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index 4d5240c32..7f5859a05 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -937,14 +937,24 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, - GCancellable *cancellable, - GError **error) - { -+ g_autoptr(GsAppList) previous_list = NULL; -+ -+ if (list != gs_plugin_job_get_list (helper->plugin_job)) { -+ previous_list = g_object_ref (gs_plugin_job_get_list (helper->plugin_job)); -+ gs_plugin_job_set_list (helper->plugin_job, list); -+ } -+ - /* try to adopt each application with a plugin */ - gs_plugin_loader_run_adopt (helper->plugin_loader, list); - - /* run each plugin */ - if (!gs_plugin_loader_run_refine_filter (helper, list, - GS_PLUGIN_REFINE_FLAGS_DEFAULT, -- cancellable, error)) -+ cancellable, error)) { -+ if (previous_list != NULL) -+ gs_plugin_job_set_list (helper->plugin_job, previous_list); - return FALSE; -+ } - - /* ensure these are sorted by score */ - if (gs_plugin_job_has_refine_flags (helper->plugin_job, -@@ -983,6 +993,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, - addons_list, - cancellable, - error)) { -+ if (previous_list != NULL) -+ gs_plugin_job_set_list (helper->plugin_job, previous_list); - return FALSE; - } - } -@@ -1004,6 +1016,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, - list2, - cancellable, - error)) { -+ if (previous_list != NULL) -+ gs_plugin_job_set_list (helper->plugin_job, previous_list); - return FALSE; - } - } -@@ -1032,11 +1046,16 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper, - related_list, - cancellable, - error)) { -+ if (previous_list != NULL) -+ gs_plugin_job_set_list (helper->plugin_job, previous_list); - return FALSE; - } - } - } - -+ if (previous_list != NULL) -+ gs_plugin_job_set_list (helper->plugin_job, previous_list); -+ - /* success */ - return TRUE; - } --- -GitLab - diff --git a/0006-optional-repos-cannot-be-disabled.patch b/0006-optional-repos-cannot-be-disabled.patch deleted file mode 100644 index 20777b4..0000000 --- a/0006-optional-repos-cannot-be-disabled.patch +++ /dev/null @@ -1,665 +0,0 @@ -From 429ec744e6cdf2155772d7db463ca193231facdc Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Tue, 21 Sep 2021 14:53:27 +0200 -Subject: gs-repos-dialog: Cannot disable all 3rd-party repositories - -All the 3rd-party repositories should be disable-able, thus the 3rd-party -section should not use the heuristics to disallow disable of some of them. -This could be seen on a 'flathub' Flatpak repository installed for -the system, which is not allowed to be disabled in the Flatpak section. - -diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c -index 57493c2c..7df24e0e 100644 ---- a/src/gs-repo-row.c -+++ b/src/gs-repo-row.c -@@ -27,6 +27,7 @@ typedef struct - guint busy_counter; - gboolean supports_remove; - gboolean supports_enable_disable; -+ gboolean always_allow_enable_disable; - } GsRepoRowPrivate; - - G_DEFINE_TYPE_WITH_PRIVATE (GsRepoRow, gs_repo_row, GTK_TYPE_LIST_BOX_ROW) -@@ -86,7 +87,7 @@ refresh_ui (GsRepoRow *row) - is_system_repo = gs_app_has_quirk (priv->repo, GS_APP_QUIRK_PROVENANCE); - - /* Disable for the system repos, if installed */ -- gtk_widget_set_sensitive (priv->disable_switch, priv->supports_enable_disable && (state_sensitive || !is_system_repo)); -+ 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); - - /* Set only the 'state' to visually indicate the state is not saved yet */ -@@ -337,13 +338,30 @@ gs_repo_row_class_init (GsRepoRowClass *klass) - gtk_widget_class_bind_template_child_private (widget_class, GsRepoRow, disable_switch); - } - -+/* -+ * gs_repo_row_new: -+ * @plugin_loader: a #GsPluginLoader -+ * @repo: a #GsApp to represent the repo in the new row -+ * @always_allow_enable_disable: always allow enabled/disable of the @repo -+ * -+ * The @plugin_loader is used to check which operations the associated plugin -+ * for the @repo can do and which not, to show only relevant buttons on the row. -+ * -+ * The @always_allow_enable_disable, when %TRUE, means that the @repo in this row -+ * can be always enabled/disabled by the user, if supported by the related plugin, -+ * regardless of the other heuristics, which can avoid the repo enable/disable. -+ * -+ * Returns: (transfer full): a newly created #GsRepoRow -+ */ - GtkWidget * - gs_repo_row_new (GsPluginLoader *plugin_loader, -- GsApp *repo) -+ GsApp *repo, -+ gboolean always_allow_enable_disable) - { - GsRepoRow *row = g_object_new (GS_TYPE_REPO_ROW, NULL); - GsRepoRowPrivate *priv = gs_repo_row_get_instance_private (row); - priv->plugin_loader = g_object_ref (plugin_loader); -+ priv->always_allow_enable_disable = always_allow_enable_disable; - gs_repo_row_set_repo (row, repo); - return GTK_WIDGET (row); - } -diff --git a/src/gs-repo-row.h b/src/gs-repo-row.h -index e6f24bc8..83c8cdf4 100644 ---- a/src/gs-repo-row.h -+++ b/src/gs-repo-row.h -@@ -25,7 +25,8 @@ struct _GsRepoRowClass - }; - - GtkWidget *gs_repo_row_new (GsPluginLoader *plugin_loader, -- GsApp *repo); -+ GsApp *repo, -+ gboolean always_allow_enable_disable); - GsApp *gs_repo_row_get_repo (GsRepoRow *row); - void gs_repo_row_mark_busy (GsRepoRow *row); - void gs_repo_row_unmark_busy (GsRepoRow *row); -diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c -index 98aa0f20..0f24149c 100644 ---- a/src/gs-repos-dialog.c -+++ b/src/gs-repos-dialog.c -@@ -484,7 +484,7 @@ add_repo (GsReposDialog *dialog, - origin_ui = g_strdup (gs_app_get_management_plugin (repo)); - section = g_hash_table_lookup (dialog->sections, origin_ui); - if (section == NULL) { -- section = gs_repos_section_new (dialog->plugin_loader); -+ section = gs_repos_section_new (dialog->plugin_loader, FALSE); - hdy_preferences_group_set_title (HDY_PREFERENCES_GROUP (section), - origin_ui); - g_signal_connect_object (section, "remove-clicked", -@@ -627,7 +627,7 @@ get_sources_cb (GsPluginLoader *plugin_loader, - gtk_container_add (GTK_CONTAINER (widget), row); - gtk_container_add (GTK_CONTAINER (dialog->content_page), widget); - -- section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader)); -+ section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader, TRUE)); - gs_repos_section_set_sort_key (section, "900"); - g_signal_connect_object (section, "switch-clicked", - G_CALLBACK (repo_section_switch_clicked_cb), dialog, 0); -diff --git a/src/gs-repos-section.c b/src/gs-repos-section.c -index 3bf59ad7..a9b08200 100644 ---- a/src/gs-repos-section.c -+++ b/src/gs-repos-section.c -@@ -20,6 +20,7 @@ struct _GsReposSection - GtkListBox *list; - GsPluginLoader *plugin_loader; - gchar *sort_key; -+ gboolean always_allow_enable_disable; - }; - - G_DEFINE_TYPE (GsReposSection, gs_repos_section, HDY_TYPE_PREFERENCES_GROUP) -@@ -130,8 +131,23 @@ gs_repos_section_init (GsReposSection *self) - G_CALLBACK (gs_repos_section_row_activated_cb), self); - } - -+/* -+ * gs_repos_section_new: -+ * @plugin_loader: a #GsPluginLoader -+ * @always_allow_enable_disable: always allow enable/disable of the repos in this section -+ * -+ * Creates a new #GsReposSection. The %plugin_loader is passed -+ * to each #GsRepoRow, the same as the @always_allow_enable_disable. -+ * -+ * The @always_allow_enable_disable, when %TRUE, means that every repo in this section -+ * can be enabled/disabled by the user, if supported by the related plugin, regardless -+ * of the other heuristics, which can avoid the repo enable/disable. -+ * -+ * Returns: (transfer full): a newly created #GsReposSection -+ */ - GtkWidget * --gs_repos_section_new (GsPluginLoader *plugin_loader) -+gs_repos_section_new (GsPluginLoader *plugin_loader, -+ gboolean always_allow_enable_disable) - { - GsReposSection *self; - -@@ -140,6 +156,7 @@ gs_repos_section_new (GsPluginLoader *plugin_loader) - self = g_object_new (GS_TYPE_REPOS_SECTION, NULL); - - self->plugin_loader = g_object_ref (plugin_loader); -+ self->always_allow_enable_disable = always_allow_enable_disable; - - return GTK_WIDGET (self); - } -@@ -159,7 +176,7 @@ gs_repos_section_add_repo (GsReposSection *self, - if (!self->sort_key) - self->sort_key = g_strdup (gs_app_get_metadata_item (repo, "GnomeSoftware::SortKey")); - -- row = gs_repo_row_new (self->plugin_loader, repo); -+ row = gs_repo_row_new (self->plugin_loader, repo, self->always_allow_enable_disable); - - g_signal_connect (row, "remove-clicked", - G_CALLBACK (repo_remove_clicked_cb), self); -diff --git a/src/gs-repos-section.h b/src/gs-repos-section.h -index 6e29769c..9a58a3e1 100644 ---- a/src/gs-repos-section.h -+++ b/src/gs-repos-section.h -@@ -20,7 +20,8 @@ G_BEGIN_DECLS - - G_DECLARE_FINAL_TYPE (GsReposSection, gs_repos_section, GS, REPOS_SECTION, HdyPreferencesGroup) - --GtkWidget *gs_repos_section_new (GsPluginLoader *plugin_loader); -+GtkWidget *gs_repos_section_new (GsPluginLoader *plugin_loader, -+ gboolean always_allow_enable_disable); - void gs_repos_section_add_repo (GsReposSection *self, - GsApp *repo); - const gchar *gs_repos_section_get_title (GsReposSection *self); -From dca731ff0daf904911dd6815fb9a1b181329c887 Mon Sep 17 00:00:00 2001 -From: Milan Crha -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 -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 -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 @@ - [] - A list of official repositories that should not be considered 3rd party - -+ -+ [] -+ A list of required repositories that cannot be disabled or removed -+ - - [] - A list of official repositories that should be considered free software --- -GitLab - - -From d6b8b206a596bb520a0b77066898b44a5ef18920 Mon Sep 17 00:00:00 2001 -From: Milan Crha -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 - diff --git a/0007-compulsory-only-for-repos.patch b/0007-compulsory-only-for-repos.patch deleted file mode 100644 index fb266df..0000000 --- a/0007-compulsory-only-for-repos.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 895d1ca748f4f33a852853f5f07903fb549fb66f Mon Sep 17 00:00:00 2001 -From: Milan Crha -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 - diff --git a/0008-installed-page-section-change.patch b/0008-installed-page-section-change.patch deleted file mode 100644 index fd91a2b..0000000 --- a/0008-installed-page-section-change.patch +++ /dev/null @@ -1,264 +0,0 @@ -From 65551cf41c8d6b3dcf0cf9b2ee2d46201b4e0ea4 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Thu, 14 Oct 2021 15:17:52 +0200 -Subject: [PATCH] gs-installed-page: Change section on application state change - -When an application is being installed, it's shown in the "In Progress" -section, but when the installation is finished it had been left in -that section, even it belongs to a different section. - -Similarly with the uninstall, the application was sorted to the top -of the section, but it might be better to be added to the "In Progress" -section. - -Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1492 ---- - src/gs-installed-page.c | 168 +++++++++++++++++++++++++++++++++------- - 1 file changed, 141 insertions(+), 27 deletions(-) - -diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c -index 67a4b7a51..56bf19df7 100644 ---- a/src/gs-installed-page.c -+++ b/src/gs-installed-page.c -@@ -59,6 +59,9 @@ static GParamSpec *obj_props[PROP_IS_NARROW + 1] = { NULL, }; - - static void gs_installed_page_pending_apps_changed_cb (GsPluginLoader *plugin_loader, - GsInstalledPage *self); -+static void gs_installed_page_notify_state_changed_cb (GsApp *app, -+ GParamSpec *pspec, -+ GsInstalledPage *self); - - typedef enum { - GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING, -@@ -91,6 +94,30 @@ gs_installed_page_get_app_section (GsApp *app) - return GS_UPDATE_LIST_SECTION_ADDONS; - } - -+static GsInstalledPageSection -+gs_installed_page_get_row_section (GsInstalledPage *self, -+ GsAppRow *app_row) -+{ -+ GtkWidget *parent; -+ -+ g_return_val_if_fail (GS_IS_INSTALLED_PAGE (self), GS_UPDATE_LIST_SECTION_LAST); -+ g_return_val_if_fail (GS_IS_APP_ROW (app_row), GS_UPDATE_LIST_SECTION_LAST); -+ -+ parent = gtk_widget_get_parent (GTK_WIDGET (app_row)); -+ if (parent == self->list_box_install_in_progress) -+ return GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING; -+ if (parent == self->list_box_install_apps) -+ return GS_UPDATE_LIST_SECTION_REMOVABLE_APPS; -+ if (parent == self->list_box_install_system_apps) -+ return GS_UPDATE_LIST_SECTION_SYSTEM_APPS; -+ if (parent == self->list_box_install_addons) -+ return GS_UPDATE_LIST_SECTION_ADDONS; -+ -+ g_warn_if_reached (); -+ -+ return GS_UPDATE_LIST_SECTION_LAST; -+} -+ - static void - gs_installed_page_invalidate (GsInstalledPage *self) - { -@@ -121,15 +148,29 @@ row_unrevealed (GObject *row, GParamSpec *pspec, gpointer data) - static void - gs_installed_page_unreveal_row (GsAppRow *app_row) - { -- g_signal_connect (app_row, "unrevealed", -- G_CALLBACK (row_unrevealed), NULL); -- gs_app_row_unreveal (app_row); -+ GsApp *app = gs_app_row_get_app (app_row); -+ if (app != NULL) { -+ g_signal_handlers_disconnect_matched (app, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, -+ G_CALLBACK (gs_installed_page_notify_state_changed_cb), NULL); -+ } -+ -+ /* This check is required, because GsAppRow does not emit -+ * the signal when the row is not realized. This can happen -+ * when installing/uninstalling an app without visiting -+ * the Installed page. */ -+ if (!gtk_widget_get_mapped (GTK_WIDGET (app_row))) { -+ row_unrevealed (G_OBJECT (app_row), NULL, NULL); -+ } else { -+ g_signal_connect (app_row, "unrevealed", -+ G_CALLBACK (row_unrevealed), NULL); -+ gs_app_row_unreveal (app_row); -+ } - } - --static void --gs_installed_page_app_removed (GsPage *page, GsApp *app) -+static GsAppRow * /* (transfer none) */ -+gs_installed_page_find_app_row (GsInstalledPage *self, -+ GsApp *app) - { -- GsInstalledPage *self = GS_INSTALLED_PAGE (page); - GtkWidget *lists[] = { - self->list_box_install_in_progress, - self->list_box_install_apps, -@@ -145,10 +186,22 @@ gs_installed_page_app_removed (GsPage *page, GsApp *app) - for (GList *l = children; l; l = l->next) { - GsAppRow *app_row = GS_APP_ROW (l->data); - if (gs_app_row_get_app (app_row) == app) { -- gs_installed_page_unreveal_row (app_row); -+ return app_row; - } - } - } -+ -+ return NULL; -+} -+ -+ -+static void -+gs_installed_page_app_removed (GsPage *page, GsApp *app) -+{ -+ GsInstalledPage *self = GS_INSTALLED_PAGE (page); -+ GsAppRow *app_row = gs_installed_page_find_app_row (self, app); -+ if (app_row != NULL) -+ gs_installed_page_unreveal_row (app_row); - } - - static void -@@ -161,12 +214,56 @@ gs_installed_page_app_remove_cb (GsAppRow *app_row, - gs_page_remove_app (GS_PAGE (self), app, self->cancellable); - } - --static gboolean --gs_installed_page_invalidate_sort_idle (gpointer user_data) -+static void -+gs_installed_page_maybe_move_app_row (GsInstalledPage *self, -+ GsAppRow *app_row) -+{ -+ GsInstalledPageSection current_section, expected_section; -+ -+ current_section = gs_installed_page_get_row_section (self, app_row); -+ g_return_if_fail (current_section != GS_UPDATE_LIST_SECTION_LAST); -+ -+ expected_section = gs_installed_page_get_app_section (gs_app_row_get_app (app_row)); -+ if (expected_section != current_section) { -+ GtkWidget *widget = GTK_WIDGET (app_row); -+ -+ g_object_ref (app_row); -+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget); -+ switch (expected_section) { -+ case GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING: -+ widget = self->list_box_install_in_progress; -+ break; -+ case GS_UPDATE_LIST_SECTION_REMOVABLE_APPS: -+ widget = self->list_box_install_apps; -+ break; -+ case GS_UPDATE_LIST_SECTION_SYSTEM_APPS: -+ widget = self->list_box_install_system_apps; -+ break; -+ case GS_UPDATE_LIST_SECTION_ADDONS: -+ widget = self->list_box_install_addons; -+ break; -+ default: -+ g_warn_if_reached (); -+ widget = NULL; -+ break; -+ } -+ -+ if (widget != NULL) -+ gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (app_row)); -+ -+ g_object_unref (app_row); -+ } -+} -+ -+static void -+gs_installed_page_notify_state_changed_cb (GsApp *app, -+ GParamSpec *pspec, -+ GsInstalledPage *self) - { -- GsAppRow *app_row = user_data; -- GsApp *app = gs_app_row_get_app (app_row); - GsAppState state = gs_app_get_state (app); -+ GsAppRow *app_row = gs_installed_page_find_app_row (self, app); -+ -+ g_assert (app_row != NULL); - - gtk_list_box_row_changed (GTK_LIST_BOX_ROW (app_row)); - -@@ -177,17 +274,8 @@ gs_installed_page_invalidate_sort_idle (gpointer user_data) - state != GS_APP_STATE_UPDATABLE && - state != GS_APP_STATE_UPDATABLE_LIVE) - gs_installed_page_unreveal_row (app_row); -- -- g_object_unref (app_row); -- return G_SOURCE_REMOVE; --} -- --static void --gs_installed_page_notify_state_changed_cb (GsApp *app, -- GParamSpec *pspec, -- GsAppRow *app_row) --{ -- g_idle_add (gs_installed_page_invalidate_sort_idle, g_object_ref (app_row)); -+ else -+ gs_installed_page_maybe_move_app_row (self, app_row); - } - - static gboolean -@@ -229,7 +317,7 @@ gs_installed_page_add_app (GsInstalledPage *self, GsAppList *list, GsApp *app) - G_CALLBACK (gs_installed_page_app_remove_cb), self); - g_signal_connect_object (app, "notify::state", - G_CALLBACK (gs_installed_page_notify_state_changed_cb), -- app_row, 0); -+ self, 0); - - switch (gs_installed_page_get_app_section (app)) { - case GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING: -@@ -294,6 +382,32 @@ out: - gs_installed_page_pending_apps_changed_cb (plugin_loader, self); - } - -+static void -+gs_installed_page_remove_all_cb (GtkWidget *child, -+ gpointer user_data) -+{ -+ GtkContainer *container = user_data; -+ -+ if (GS_IS_APP_ROW (child)) { -+ GsApp *app = gs_app_row_get_app (GS_APP_ROW (child)); -+ if (app != NULL) { -+ g_signal_handlers_disconnect_matched (app, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, -+ G_CALLBACK (gs_installed_page_notify_state_changed_cb), NULL); -+ } -+ } else { -+ g_warn_if_reached (); -+ } -+ -+ gtk_container_remove (container, child); -+} -+ -+static void -+gs_container_remove_all_with_cb (GtkContainer *container, -+ GtkCallback callback) -+{ -+ gtk_container_foreach (container, callback, container); -+} -+ - static void - gs_installed_page_load (GsInstalledPage *self) - { -@@ -305,10 +419,10 @@ gs_installed_page_load (GsInstalledPage *self) - self->waiting = TRUE; - - /* remove old entries */ -- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_in_progress)); -- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_apps)); -- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_system_apps)); -- gs_container_remove_all (GTK_CONTAINER (self->list_box_install_addons)); -+ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_in_progress), gs_installed_page_remove_all_cb); -+ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_apps), gs_installed_page_remove_all_cb); -+ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_system_apps), gs_installed_page_remove_all_cb); -+ gs_container_remove_all_with_cb (GTK_CONTAINER (self->list_box_install_addons), gs_installed_page_remove_all_cb); - - flags = GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON | - GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY | --- -GitLab - diff --git a/gnome-software.spec b/gnome-software.spec index 4614b31..534b88b 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,8 +11,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.0 -Release: 6%{?dist} +Version: 41.1 +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,13 +20,6 @@ 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: 0002-correct-update-notifications.patch -Patch03: 0003-refresh-on-repository-change.patch -Patch04: 0004-filtered-system-flathub.patch -Patch05: 0005-repos-dialog-can-show-apps.patch -Patch06: 0006-optional-repos-cannot-be-disabled.patch -Patch07: 0007-compulsory-only-for-repos.patch -Patch08: 0008-installed-page-section-change.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -210,6 +203,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Oct 29 2021 Milan Crha - 41.1-1 +- Update to 41.1 + * Tue Oct 19 2021 Milan Crha - 41.0-6 - Resolves: #2012863 (gs-installed-page: Change section on application state change) diff --git a/sources b/sources index 4578578..9e33e1e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.0.tar.xz) = 6cc090f835e77d64abb0080d3b72494019d6f69c2144abea4dabdc4f52dc570a372159eb1e0b0d98ae33b31c134cc17673fe3fa243eed762eec55620ab146b26 +SHA512 (gnome-software-41.1.tar.xz) = e5586d901f9b178961a9030cafbc1ec346d3a52e91af11234d28eaeb7d95e12083d8a9e7e90fb7c64e720b7394e83733fcbb6912ca1ef0bcd2c431acad25fe3c From 3983063edf2d6f6348c3cb1665e2006b4f58de3a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Dec 2021 09:30:50 +0100 Subject: [PATCH 15/20] Update to 41.2 --- gnome-software.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 534b88b..c7b5b09 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,7 +11,7 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.1 +Version: 41.2 Release: 1%{?dist} Summary: A software center for GNOME @@ -203,6 +203,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Dec 03 2021 Milan Crha - 41.2-1 +- Update to 41.2 + * Fri Oct 29 2021 Milan Crha - 41.1-1 - Update to 41.1 diff --git a/sources b/sources index 9e33e1e..f57b0c8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.1.tar.xz) = e5586d901f9b178961a9030cafbc1ec346d3a52e91af11234d28eaeb7d95e12083d8a9e7e90fb7c64e720b7394e83733fcbb6912ca1ef0bcd2c431acad25fe3c +SHA512 (gnome-software-41.2.tar.xz) = 0c7662940c0fcd3267ad08e2d16f753eb5933c28311166a718cbedb06ab932a5bfe961848e13f265474f33ee5421d99a5638976edeb49a801fad41b4bb8ce90b From e827fb0df3e6b07f667969ad379308fc46d23954 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 7 Jan 2022 11:09:03 +0100 Subject: [PATCH 16/20] Update to 41.3 --- gnome-software.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index c7b5b09..17b047c 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,7 +11,7 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.2 +Version: 41.3 Release: 1%{?dist} Summary: A software center for GNOME @@ -203,6 +203,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Jan 07 2022 Milan Crha - 41.3-1 +- Update to 41.3 + * Fri Dec 03 2021 Milan Crha - 41.2-1 - Update to 41.2 diff --git a/sources b/sources index f57b0c8..7a27bfc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.2.tar.xz) = 0c7662940c0fcd3267ad08e2d16f753eb5933c28311166a718cbedb06ab932a5bfe961848e13f265474f33ee5421d99a5638976edeb49a801fad41b4bb8ce90b +SHA512 (gnome-software-41.3.tar.xz) = 7b19ed7e3b6f8662b6351fbb6eddb45f99cdbf9e6912e11b36301cdfd6f62cb3256da031e6640f9ad397384a23530d11488c78a1af60ce130a99838f97f8a0ed From 6784ccf868d52f24d25f02de37a951b82436a90d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 26 Jan 2022 10:05:30 +0100 Subject: [PATCH 17/20] Resolves: #2010353 (Optional software repos can't be disabled) --- 0006-optional-repos-cannot-be-disabled.patch | 498 +++++++++++++++++++ 0007-compulsory-only-for-repos.patch | 42 ++ gnome-software.spec | 7 +- 3 files changed, 546 insertions(+), 1 deletion(-) create mode 100644 0006-optional-repos-cannot-be-disabled.patch create mode 100644 0007-compulsory-only-for-repos.patch diff --git a/0006-optional-repos-cannot-be-disabled.patch b/0006-optional-repos-cannot-be-disabled.patch new file mode 100644 index 0000000..b581147 --- /dev/null +++ b/0006-optional-repos-cannot-be-disabled.patch @@ -0,0 +1,498 @@ +From dca731ff0daf904911dd6815fb9a1b181329c887 Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 +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 +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 @@ + [] + A list of official repositories that should not be considered 3rd party + ++ ++ [] ++ A list of required repositories that cannot be disabled or removed ++ + + [] + A list of official repositories that should be considered free software +-- +GitLab + + +From d6b8b206a596bb520a0b77066898b44a5ef18920 Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 + diff --git a/0007-compulsory-only-for-repos.patch b/0007-compulsory-only-for-repos.patch new file mode 100644 index 0000000..fb266df --- /dev/null +++ b/0007-compulsory-only-for-repos.patch @@ -0,0 +1,42 @@ +From 895d1ca748f4f33a852853f5f07903fb549fb66f Mon Sep 17 00:00:00 2001 +From: Milan Crha +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 + diff --git a/gnome-software.spec b/gnome-software.spec index 17b047c..400b9c8 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 41.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -20,6 +20,8 @@ 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 BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -203,6 +205,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Wed Jan 26 2022 Milan Crha - 41.3-2 +- Resolves: #2010353 (Optional software repos can't be disabled) + * Fri Jan 07 2022 Milan Crha - 41.3-1 - Update to 41.3 From 3eeea97c18954e94c9a8fce349cb1e59563dfebd Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 11 Feb 2022 11:42:49 +0100 Subject: [PATCH 18/20] Update to 41.4 --- gnome-software.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 400b9c8..d890754 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,8 +11,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.3 -Release: 2%{?dist} +Version: 41.4 +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -205,6 +205,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Feb 11 2022 Milan Crha - 41.4-1 +- Update to 41.4 + * Wed Jan 26 2022 Milan Crha - 41.3-2 - Resolves: #2010353 (Optional software repos can't be disabled) diff --git a/sources b/sources index 7a27bfc..000d259 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.3.tar.xz) = 7b19ed7e3b6f8662b6351fbb6eddb45f99cdbf9e6912e11b36301cdfd6f62cb3256da031e6640f9ad397384a23530d11488c78a1af60ce130a99838f97f8a0ed +SHA512 (gnome-software-41.4.tar.xz) = 97c51fd21bd5fd2f7d11e00811747992ff0e404380f84cda07e5c7cae3962034c9169ebad95f875056233c9b1d44347a0c15c61e0f018bb3128e7c7d5d3c74b2 From 0b1309adc37bad4d07d7c52b06838504392bd483 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Mar 2022 10:16:41 +0100 Subject: [PATCH 19/20] Update to 41.5 --- gnome-software.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index d890754..1de7699 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -11,7 +11,7 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.4 +Version: 41.5 Release: 1%{?dist} Summary: A software center for GNOME @@ -205,6 +205,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Mar 18 2022 Milan Crha - 41.5-1 +- Update to 41.5 + * Fri Feb 11 2022 Milan Crha - 41.4-1 - Update to 41.4 diff --git a/sources b/sources index 000d259..a3384a0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.4.tar.xz) = 97c51fd21bd5fd2f7d11e00811747992ff0e404380f84cda07e5c7cae3962034c9169ebad95f875056233c9b1d44347a0c15c61e0f018bb3128e7c7d5d3c74b2 +SHA512 (gnome-software-41.5.tar.xz) = 60701d50dd8e7fa01c05c8ee7823b053d40b0fa145419601ece732827527d4d7ae9af178b5b6622ac4d729d3d430c14981a2fd4b0f086dd6d05a49fd507f2cb6 From 7e83c917c222d8507184dee6d938fcc3704671a5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 12 Sep 2022 09:02:05 +0200 Subject: [PATCH 20/20] Resolves: 2125569 (Correct property name in GsRemovalDialog .ui file) --- 0008-gs-removal-dialog-crrect-property-name.patch | 12 ++++++++++++ gnome-software.spec | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 0008-gs-removal-dialog-crrect-property-name.patch diff --git a/0008-gs-removal-dialog-crrect-property-name.patch b/0008-gs-removal-dialog-crrect-property-name.patch new file mode 100644 index 0000000..47325af --- /dev/null +++ b/0008-gs-removal-dialog-crrect-property-name.patch @@ -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 @@ + + +