From 6818c689ad62b605f445280baface87c448537fb Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 13 Aug 2021 18:20:57 +0200 Subject: [PATCH 001/155] 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 d11480e2e60eef31b1fa2e69769954351a5f2ace Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 13 Aug 2021 18:20:57 +0200 Subject: [PATCH 002/155] 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 94b79ff8862694fe12bfcfe7f707169eb4105ec2 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 24 Aug 2021 19:18:00 +0200 Subject: [PATCH 003/155] 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 0508e1734fc49c342db5b718f2de64b5e8f6eb1e Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 24 Aug 2021 19:18:00 +0200 Subject: [PATCH 004/155] 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 4ba65e69d0b643c1984d1ad0405f8adfb9b38d68 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Sep 2021 21:10:08 +0200 Subject: [PATCH 005/155] 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 61a3273790b02faaeeab49be27f8530e2ebf54b4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Sep 2021 21:10:08 +0200 Subject: [PATCH 006/155] 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 4f4ac53d683ca82be006f1bfc0c6117cd3040c96 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 8 Sep 2021 09:10:47 +0200 Subject: [PATCH 007/155] 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 f92a1eb0a1430162f355b078409140fa6b68d6df Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 8 Sep 2021 09:10:47 +0200 Subject: [PATCH 008/155] 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 95dd5f06f66e80223432fcc9e0c7363ac27e05d2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 13 Sep 2021 15:13:00 +0200 Subject: [PATCH 009/155] 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 604444314892aa569eeebf926131ff7751ada3a6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 13 Sep 2021 15:13:00 +0200 Subject: [PATCH 010/155] 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 011/155] 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 0537bfe484decc0254d74ea8b46b11a5c1c9f30d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 20 Sep 2021 09:51:11 +0200 Subject: [PATCH 012/155] Update to 41.0 --- ...e-PkClient-interactive-flag-being-se.patch | 116 ------------------ gnome-software.spec | 14 ++- sources | 2 +- 3 files changed, 11 insertions(+), 121 deletions(-) delete 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 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/gnome-software.spec b/gnome-software.spec index 1e6ff21..8c2a938 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: 2%{?dist} +Version: 41.0 +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: 0002-packagekit-Ensure-PkClient-interactive-flag-being-se.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -129,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 @@ -199,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 + * Mon Sep 13 2021 Milan Crha - 41~rc-2 - Resolves: #2003365 (packagekit: Ensure PkClient::interactive flag being set) 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 9e406b9c707992c0583825eeb6238e1b6d483add Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 20 Sep 2021 10:00:53 +0200 Subject: [PATCH 013/155] 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 014/155] 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 015/155] 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 016/155] 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 017/155] 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 a63a7bde164181cf2604642c74e0594409f931de Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 4 Oct 2021 17:43:44 +0200 Subject: [PATCH 018/155] 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 8c2a938..cbc22a8 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 f47313a4ef978dde6fd7d1760c9baeaaca73f76a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 7 Oct 2021 09:41:10 +0200 Subject: [PATCH 019/155] 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 cbc22a8..3d5d2f8 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 53b2166dfb243b9b5649972921de0d81ce06d639 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 8 Oct 2021 07:37:33 +0200 Subject: [PATCH 020/155] 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 | 11 +- 4 files changed, 1169 insertions(+), 1 deletion(-) 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 3d5d2f8..d40099d 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+ @@ -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 ed242ebfa5bcf22ecea5693d6e1ad2ec4d3bfd4a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 11 Oct 2021 09:19:59 +0200 Subject: [PATCH 021/155] 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 5b411a73e700c6611ed3bdf584588460b51386b0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 11 Oct 2021 09:19:59 +0200 Subject: [PATCH 022/155] 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 d40099d..3993d43 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 023/155] 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 77240ed208913c9a4d53cd8c121916d9955aba9e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 19 Oct 2021 07:57:57 +0200 Subject: [PATCH 024/155] 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 3993d43..5c9d9fc 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 856444f98aa4286c5520714658e54e317cec090b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 29 Oct 2021 10:09:12 +0200 Subject: [PATCH 025/155] 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 5c9d9fc..7222117 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 5b17ec160032404e5bd2d0e73bea46ee854a8492 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 29 Oct 2021 10:09:12 +0200 Subject: [PATCH 026/155] 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 398071803670444cf1289d525fb94e6a9b499d5a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Dec 2021 09:30:50 +0100 Subject: [PATCH 027/155] 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 7222117..d8a8ee1 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 3983063edf2d6f6348c3cb1665e2006b4f58de3a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Dec 2021 09:30:50 +0100 Subject: [PATCH 028/155] 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 81a6f050fb44907df5fe4504dc5768816e1dc37a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 7 Jan 2022 11:06:27 +0100 Subject: [PATCH 029/155] Update to 42.alpha --- gnome-software.spec | 22 ++++++++++------------ sources | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index d8a8ee1..e8a559b 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -1,7 +1,7 @@ %global appstream_version 0.14.0 %global libxmlb_version 0.1.7 %global glib2_version 2.61.1 -%global gtk3_version 3.22.4 +%global gtk4_version 4.4.0 %global json_glib_version 1.2.0 %global libsoup_version 2.52.0 %global packagekit_version 1.1.1 @@ -11,13 +11,13 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 41.2 +Version: 42~alpha Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ URL: https://wiki.gnome.org/Apps/Software -Source0: https://download.gnome.org/sources/gnome-software/41/%{name}-%{tarball_version}.tar.xz +Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch @@ -32,11 +32,11 @@ BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: gnome-online-accounts-devel BuildRequires: gsettings-desktop-schemas-devel BuildRequires: gspell-devel -BuildRequires: gtk3-devel >= %{gtk3_version} +BuildRequires: pkgconfig(gtk4) >= %{gtk4_version} BuildRequires: gtk-doc BuildRequires: json-glib-devel >= %{json_glib_version} BuildRequires: libdnf-devel -BuildRequires: libhandy1-devel +BuildRequires: pkgconfig(libadwaita-1) BuildRequires: libsoup-devel BuildRequires: libxmlb-devel >= %{libxmlb_version} BuildRequires: malcontent-devel @@ -61,7 +61,6 @@ Requires: glib2%{?_isa} >= %{glib2_version} # gnome-menus is needed for app folder .directory entries Requires: gnome-menus%{?_isa} Requires: gsettings-desktop-schemas%{?_isa} -Requires: gtk3%{?_isa} >= %{gtk3_version} Requires: json-glib%{?_isa} >= %{json_glib_version} Requires: iso-codes # librsvg2 is needed for gdk-pixbuf svg loader @@ -75,7 +74,7 @@ Obsoletes: gnome-software-snap < 3.33.1 Obsoletes: gnome-software-editor < 3.35.1 # this is not a library version -%define gs_plugin_version 16 +%define gs_plugin_version 17 %description gnome-software is an application that makes it easy to add, remove @@ -106,6 +105,7 @@ This package includes the rpm-ostree backend. %build %meson \ + -Dsoup2=true \ -Dsnap=false \ -Dmalcontent=true \ -Dgudev=true \ @@ -153,8 +153,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg %{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg %{_datadir}/icons/hicolor/scalable/actions/app-remove-symbolic.svg -%{_datadir}/icons/hicolor/scalable/actions/carousel-arrow-next-symbolic.svg -%{_datadir}/icons/hicolor/scalable/actions/carousel-arrow-previous-symbolic.svg %{_datadir}/icons/hicolor/scalable/status/software-installed-symbolic.svg %{_datadir}/metainfo/org.gnome.Software.appdata.xml %{_datadir}/metainfo/org.gnome.Software.Plugin.Flatpak.metainfo.xml @@ -174,14 +172,11 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_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 -%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_packagekit-refresh.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_packagekit.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_provenance-license.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_provenance.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_repos.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so -%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_systemd-updates.so %{_sysconfdir}/xdg/autostart/gnome-software-service.desktop %{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service @@ -203,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Jan 07 2022 Milan Crha - 42.alpha-1 +- Update to 42.alpha + * Fri Dec 03 2021 Milan Crha - 41.2-1 - Update to 41.2 diff --git a/sources b/sources index f57b0c8..3210d9f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-41.2.tar.xz) = 0c7662940c0fcd3267ad08e2d16f753eb5933c28311166a718cbedb06ab932a5bfe961848e13f265474f33ee5421d99a5638976edeb49a801fad41b4bb8ce90b +SHA512 (gnome-software-42.alpha.tar.xz) = fa63ab4cffe72f9f8b348cd7e021da515963258271310d3933d985f00190c3ffe0f1d664d65ec5ff577d153c6de5d11eef9b1e6d9aa1e171d27f0f1b570dbdeb From e827fb0df3e6b07f667969ad379308fc46d23954 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 7 Jan 2022 11:09:03 +0100 Subject: [PATCH 030/155] 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 9365ecb05c965a42863c674691ca733ea28e936c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 06:45:38 +0000 Subject: [PATCH 031/155] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- gnome-software.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index e8a559b..221afbc 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,7 +12,7 @@ Name: gnome-software Version: 42~alpha -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -198,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 42~alpha-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Fri Jan 07 2022 Milan Crha - 42.alpha-1 - Update to 42.alpha From 6784ccf868d52f24d25f02de37a951b82436a90d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 26 Jan 2022 10:05:30 +0100 Subject: [PATCH 032/155] 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 142b342f076d0d237abb8feacb0c46ffbe7f0c0f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 11 Feb 2022 11:39:45 +0100 Subject: [PATCH 033/155] Update to 42.beta --- gnome-software.spec | 12 +++++++----- sources | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 221afbc..7929076 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -1,4 +1,5 @@ %global appstream_version 0.14.0 +%global libadwaita_version 1.0.1 %global libxmlb_version 0.1.7 %global glib2_version 2.61.1 %global gtk4_version 4.4.0 @@ -11,8 +12,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 42~alpha -Release: 2%{?dist} +Version: 42~beta +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -36,7 +37,7 @@ BuildRequires: pkgconfig(gtk4) >= %{gtk4_version} BuildRequires: gtk-doc BuildRequires: json-glib-devel >= %{json_glib_version} BuildRequires: libdnf-devel -BuildRequires: pkgconfig(libadwaita-1) +BuildRequires: pkgconfig(libadwaita-1) >= %{libadwaita_version} BuildRequires: libsoup-devel BuildRequires: libxmlb-devel >= %{libxmlb_version} BuildRequires: malcontent-devel @@ -147,8 +148,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_bindir}/gnome-software %{_datadir}/applications/gnome-software-local-file.desktop %{_datadir}/applications/org.gnome.Software.desktop -%dir %{_datadir}/gnome-software -%{_datadir}/gnome-software/*.png %{_mandir}/man1/gnome-software.1.gz %{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg %{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg @@ -198,6 +197,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Feb 11 2022 Milan Crha - 42.beta-1 +- Update to 42.beta + * Thu Jan 20 2022 Fedora Release Engineering - 42~alpha-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index 3210d9f..2f9377d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.alpha.tar.xz) = fa63ab4cffe72f9f8b348cd7e021da515963258271310d3933d985f00190c3ffe0f1d664d65ec5ff577d153c6de5d11eef9b1e6d9aa1e171d27f0f1b570dbdeb +SHA512 (gnome-software-42.beta.tar.xz) = 3ae22c9a37a134a6340191aabc7b02f6b53322820853aacd36e6d43893d7118d177defff44de93b627e488411798570b9c82c99b354966a899563e27d8c32a6a From 3eeea97c18954e94c9a8fce349cb1e59563dfebd Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 11 Feb 2022 11:42:49 +0100 Subject: [PATCH 034/155] 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 f6af9a7826fd165c5f82401798d9769940d92b56 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 11 Feb 2022 12:28:17 +0100 Subject: [PATCH 035/155] Correct files list for popular plugin removal --- gnome-software.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index 7929076..d77af53 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -166,7 +166,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_fwupd.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_generic-updates.so %{_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 @@ -178,6 +177,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so %{_sysconfdir}/xdg/autostart/gnome-software-service.desktop %{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml +%{_datadir}/app-info/xmls/org.gnome.Software.Popular.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service %{_datadir}/dbus-1/services/org.gnome.Software.service %{_datadir}/gnome-shell/search-providers/org.gnome.Software-search-provider.ini From 1fac831a3136d218196aece5b6da4200f953641b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 16 Feb 2022 17:41:29 +0100 Subject: [PATCH 036/155] Resolves: #2054939 (Crash on a PackageKit app install) --- 0002-packagekit-crash-on-app-install.patch | 28 ++++++++++++++++++++++ gnome-software.spec | 6 ++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 0002-packagekit-crash-on-app-install.patch diff --git a/0002-packagekit-crash-on-app-install.patch b/0002-packagekit-crash-on-app-install.patch new file mode 100644 index 0000000..04e85b3 --- /dev/null +++ b/0002-packagekit-crash-on-app-install.patch @@ -0,0 +1,28 @@ +From 73d1c9fd58d2fdf2c2d84e70cce678390679baa9 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 16 Feb 2022 15:01:46 +0100 +Subject: [PATCH] PackageKit: Fix a crash on app install + +The array should be NULL-terminated, thus add the NULL at the end. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1648 +--- + plugins/packagekit/gs-plugin-packagekit.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c +index 1ad913af5..56ddb1ccc 100644 +--- a/plugins/packagekit/gs-plugin-packagekit.c ++++ b/plugins/packagekit/gs-plugin-packagekit.c +@@ -612,6 +612,8 @@ gs_plugin_app_install (GsPlugin *plugin, + return FALSE; + } + ++ g_ptr_array_add (array_package_ids, NULL); ++ + gs_app_set_state (app, GS_APP_STATE_INSTALLING); + + for (i = 0; i < gs_app_list_length (addons); i++) { +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index d77af53..b30cd16 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -13,7 +13,7 @@ Name: gnome-software Version: 42~beta -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,6 +21,7 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 0002-packagekit-crash-on-app-install.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -197,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Wed Feb 16 2022 Milan Crha - 42.beta-2 +- Resolves: #2054939 (Crash on a PackageKit app install) + * Fri Feb 11 2022 Milan Crha - 42.beta-1 - Update to 42.beta From 422e17de7730df6eb6696ce702c7733faaaf591c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 16 Feb 2022 17:49:57 +0100 Subject: [PATCH 037/155] Add a temporary workaround for gtk_widget_measure error flood on GsAppRow --- ...pprow-gtk_widget_measure-error-flood.patch | 39 +++++++++++++++++++ gnome-software.spec | 4 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch diff --git a/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch b/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch new file mode 100644 index 0000000..0a24881 --- /dev/null +++ b/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch @@ -0,0 +1,39 @@ +diff -up gnome-software-42.beta/src/gs-app-row.ui.3 gnome-software-42.beta/src/gs-app-row.ui +--- gnome-software-42.beta/src/gs-app-row.ui.3 2022-02-10 20:53:14.109477000 +0100 ++++ gnome-software-42.beta/src/gs-app-row.ui 2022-02-16 17:49:02.583817963 +0100 +@@ -26,7 +26,7 @@ + center + + +- True ++ False + 0.0 + 0.5 + end +@@ -80,7 +80,7 @@ + False + 0.0 + 0.5 +- True ++ False + word-char + end + 2 +@@ -119,7 +119,7 @@ + True + 24 + 24 +- True ++ False + word-char + end + 2 +@@ -187,7 +187,7 @@ + False + warning-text + start +- True ++ False + 0 + + diff --git a/gnome-software.spec b/gnome-software.spec index b30cd16..280f9df 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -22,6 +22,7 @@ Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-packagekit-crash-on-app-install.patch +Patch03: 0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -103,7 +104,7 @@ and update software in the GNOME desktop. This package includes the rpm-ostree backend. %prep -%autosetup -p1 -n %{name}-%{tarball_version} +%autosetup -p1 -S gendiff -n %{name}-%{tarball_version} %build %meson \ @@ -200,6 +201,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %changelog * Wed Feb 16 2022 Milan Crha - 42.beta-2 - Resolves: #2054939 (Crash on a PackageKit app install) +- Add a temporary workaround for gtk_widget_measure error flood on GsAppRow * Fri Feb 11 2022 Milan Crha - 42.beta-1 - Update to 42.beta From 913366d7d63e62d9fbd302a9c820237b69ad3df2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 21 Feb 2022 10:30:51 +0100 Subject: [PATCH 038/155] Resolves: #2056082 (Enable PackageKit autoremove option) --- gnome-software.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index 280f9df..eb8cb8b 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -13,7 +13,7 @@ Name: gnome-software Version: 42~beta -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -113,6 +113,7 @@ This package includes the rpm-ostree backend. -Dmalcontent=true \ -Dgudev=true \ -Dpackagekit=true \ + -Dpackagekit_autoremove=true \ -Dexternal_appstream=false \ -Drpm_ostree=true \ -Dtests=false @@ -199,6 +200,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Feb 21 2022 Milan Crha - 42.beta-3 +- Resolves: #2056082 (Enable PackageKit autoremove option) + * Wed Feb 16 2022 Milan Crha - 42.beta-2 - Resolves: #2054939 (Crash on a PackageKit app install) - Add a temporary workaround for gtk_widget_measure error flood on GsAppRow From f3f073c56f8e1a73d147ef540210328338cd92d5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 7 Mar 2022 08:15:08 +0100 Subject: [PATCH 039/155] Update to 42.rc --- 0001-crash-with-broken-theme.patch | 24 ++++-------- 0002-packagekit-crash-on-app-install.patch | 28 ------------- ...pprow-gtk_widget_measure-error-flood.patch | 39 ------------------- gnome-software.spec | 11 +++--- sources | 2 +- 5 files changed, 14 insertions(+), 90 deletions(-) delete mode 100644 0002-packagekit-crash-on-app-install.patch delete mode 100644 0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch diff --git a/0001-crash-with-broken-theme.patch b/0001-crash-with-broken-theme.patch index fd37e80..ddbef4a 100644 --- a/0001-crash-with-broken-theme.patch +++ b/0001-crash-with-broken-theme.patch @@ -1,29 +1,22 @@ -From 3a644c151f27f439c36170f0958fd21cf1cc54d0 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Thu, 3 Jun 2021 08:33:53 +0200 Subject: [PATCH] gs-feature-tile: Do not abort when the theme is broken Just print a warning when the theme doesn't provide 'theme_fg_color' and fallback to black color. Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1228 ---- - src/gs-feature-tile.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) -diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c -index 1c85083eb..158af1e56 100644 ---- a/src/gs-feature-tile.c -+++ b/src/gs-feature-tile.c -@@ -268,7 +268,6 @@ gs_feature_tile_refresh (GsAppTile *self) +diff -up gnome-software-42.rc/src/gs-feature-tile.c.1 gnome-software-42.rc/src/gs-feature-tile.c +--- gnome-software-42.rc/src/gs-feature-tile.c.1 2022-03-04 16:23:58.566735700 +0100 ++++ gnome-software-42.rc/src/gs-feature-tile.c 2022-03-07 08:06:29.046595524 +0100 +@@ -411,7 +411,6 @@ gs_feature_tile_refresh (GsAppTile *self if (key_colors != tile->key_colors_cache) { g_autoptr(GArray) colors = NULL; GdkRGBA fg_rgba; - gboolean fg_rgba_valid; GsHSBC fg_hsbc; - - /* Look up the foreground colour for the feature tile, -@@ -283,8 +282,17 @@ gs_feature_tile_refresh (GsAppTile *self) + const GsHSBC *chosen_hsbc; + GsHSBC chosen_hsbc_modified; +@@ -429,8 +428,17 @@ gs_feature_tile_refresh (GsAppTile *self * @min_abs_contrast contrast with the foreground, so * that the text is legible. */ @@ -43,6 +36,3 @@ index 1c85083eb..158af1e56 100644 gtk_rgb_to_hsv (fg_rgba.red, fg_rgba.green, fg_rgba.blue, &fg_hsbc.hue, &fg_hsbc.saturation, &fg_hsbc.brightness); --- -GitLab - diff --git a/0002-packagekit-crash-on-app-install.patch b/0002-packagekit-crash-on-app-install.patch deleted file mode 100644 index 04e85b3..0000000 --- a/0002-packagekit-crash-on-app-install.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 73d1c9fd58d2fdf2c2d84e70cce678390679baa9 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 16 Feb 2022 15:01:46 +0100 -Subject: [PATCH] PackageKit: Fix a crash on app install - -The array should be NULL-terminated, thus add the NULL at the end. - -Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1648 ---- - plugins/packagekit/gs-plugin-packagekit.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c -index 1ad913af5..56ddb1ccc 100644 ---- a/plugins/packagekit/gs-plugin-packagekit.c -+++ b/plugins/packagekit/gs-plugin-packagekit.c -@@ -612,6 +612,8 @@ gs_plugin_app_install (GsPlugin *plugin, - return FALSE; - } - -+ g_ptr_array_add (array_package_ids, NULL); -+ - gs_app_set_state (app, GS_APP_STATE_INSTALLING); - - for (i = 0; i < gs_app_list_length (addons); i++) { --- -GitLab - diff --git a/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch b/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch deleted file mode 100644 index 0a24881..0000000 --- a/0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff -up gnome-software-42.beta/src/gs-app-row.ui.3 gnome-software-42.beta/src/gs-app-row.ui ---- gnome-software-42.beta/src/gs-app-row.ui.3 2022-02-10 20:53:14.109477000 +0100 -+++ gnome-software-42.beta/src/gs-app-row.ui 2022-02-16 17:49:02.583817963 +0100 -@@ -26,7 +26,7 @@ - center - - -- True -+ False - 0.0 - 0.5 - end -@@ -80,7 +80,7 @@ - False - 0.0 - 0.5 -- True -+ False - word-char - end - 2 -@@ -119,7 +119,7 @@ - True - 24 - 24 -- True -+ False - word-char - end - 2 -@@ -187,7 +187,7 @@ - False - warning-text - start -- True -+ False - 0 - - diff --git a/gnome-software.spec b/gnome-software.spec index eb8cb8b..913fede 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,8 +12,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 42~beta -Release: 3%{?dist} +Version: 42~rc +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,8 +21,6 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch -Patch02: 0002-packagekit-crash-on-app-install.patch -Patch03: 0003-workaround-gsapprow-gtk_widget_measure-error-flood.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -178,7 +176,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_provenance.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_repos.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so -%{_sysconfdir}/xdg/autostart/gnome-software-service.desktop +%{_sysconfdir}/xdg/autostart/org.gnome.Software.desktop %{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml %{_datadir}/app-info/xmls/org.gnome.Software.Popular.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service @@ -200,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon Mar 07 2022 Milan Crha - 42.rc-1 +- Update to 42.rc + * Mon Feb 21 2022 Milan Crha - 42.beta-3 - Resolves: #2056082 (Enable PackageKit autoremove option) diff --git a/sources b/sources index 2f9377d..6afee80 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.beta.tar.xz) = 3ae22c9a37a134a6340191aabc7b02f6b53322820853aacd36e6d43893d7118d177defff44de93b627e488411798570b9c82c99b354966a899563e27d8c32a6a +SHA512 (gnome-software-42.rc.tar.xz) = cd9c465d73b8998c0ebc49d5e40fec22522e0f125cbce5ff59a7a13d779a3793ac57dfb606d9b918e0c198b6b6cd62657483dc8e83a77ed84966c5f44980f38b From 154dca4c08a12081aa5dd30c7955e2adaf1dae18 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 10 Mar 2022 17:34:44 +0100 Subject: [PATCH 040/155] Add upstream patches for gs-download-utils (i#1677 and i#1679) --- 1282.patch | 182 ++++++++++++++++++++++++++++++++++++++++++++ 1285.patch | 45 +++++++++++ gnome-software.spec | 7 +- 3 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 1282.patch create mode 100644 1285.patch diff --git a/1282.patch b/1282.patch new file mode 100644 index 0000000..f6cc6fd --- /dev/null +++ b/1282.patch @@ -0,0 +1,182 @@ +From edbeab87ce5aa48bd9fe49dd22acfcce2b8b0fc0 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 10 Mar 2022 13:20:58 +0000 +Subject: [PATCH 1/3] =?UTF-8?q?gs-download-utils:=20Don=E2=80=99t=20use=20?= + =?UTF-8?q?ETag=20when=20writing=20local=20file?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The ETag we care about for the download is the ETag returned by the +server, not the ETag of the local file. Passing the server’s ETag to the +local file operations may result in the local file not being written to, +with a “The file was externally modified” error. + +Signed-off-by: Philip Withnall + +Fixes: #1677 +--- + lib/gs-download-utils.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c +index f3a64479b..a6d930587 100644 +--- a/lib/gs-download-utils.c ++++ b/lib/gs-download-utils.c +@@ -134,6 +134,9 @@ static void download_progress (GTask *task); + * existing content of the output stream (if it’s a file, for example) will not + * be overwritten. + * ++ * Note that @last_etag must be the ETag value returned by the server last time ++ * the file was downloaded, not the local file ETag generated by GLib. ++ * + * If specified, @progress_callback will be called zero or more times until + * @callback is called, providing progress updates on the download. + * +@@ -644,9 +647,20 @@ gs_download_file_async (SoupSession *soup_session, + /* Query the old ETag if the file already exists. */ + data->last_etag = gs_utils_get_file_etag (output_file, cancellable); + +- /* Create the output file. */ ++ /* Create the output file. ++ * ++ * Note that `data->last_etag` is *not* passed in here, as the ETag from ++ * the server and the file modification ETag that GLib uses are ++ * different things. For g_file_replace_async(), GLib always uses an ++ * ETag it generates internally based on the file mtime (see ++ * _g_local_file_info_create_etag()), which will never match what the ++ * server returns in its ETag header. ++ * ++ * This is fine, as we are using the ETag to avoid an unnecessary HTTP ++ * download if possible. We don’t care about tracking changes to the ++ * file on disk. */ + g_file_replace_async (output_file, +- data->last_etag, ++ NULL, /* ETag */ + FALSE, /* make_backup */ + G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, + io_priority, +@@ -699,7 +713,7 @@ download_file_cb (GObject *source_object, + return; + } + +- /* Update the ETag. */ ++ /* Update the stored HTTP ETag. */ + gs_utils_set_file_etag (data->output_file, new_etag, cancellable); + + g_task_return_boolean (task, TRUE); +-- +GitLab + + +From 040e2dca3904d965450158dcdaeedfca12965682 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 10 Mar 2022 13:27:21 +0000 +Subject: [PATCH 2/3] gs-utils: Add some debug messages for getting/setting + ETags + +Signed-off-by: Philip Withnall + +Helps: #1677 +--- + lib/gs-utils.c | 28 +++++++++++++++++++++++----- + 1 file changed, 23 insertions(+), 5 deletions(-) + +diff --git a/lib/gs-utils.c b/lib/gs-utils.c +index 89349b1fe..6dc4d28a0 100644 +--- a/lib/gs-utils.c ++++ b/lib/gs-utils.c +@@ -1509,14 +1509,18 @@ gs_utils_get_file_etag (GFile *file, + GCancellable *cancellable) + { + g_autoptr(GFileInfo) info = NULL; ++ g_autoptr(GError) local_error = NULL; + + g_return_val_if_fail (G_IS_FILE (file), NULL); + g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); + +- info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, NULL); ++ info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, &local_error); + +- if (info == NULL) ++ if (info == NULL) { ++ g_debug ("Error getting attribute ‘%s’ for file ‘%s’: %s", ++ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message); + return NULL; ++ } + + return g_strdup (g_file_info_get_attribute_string (info, METADATA_ETAG_ATTRIBUTE)); + } +@@ -1542,15 +1546,29 @@ gs_utils_set_file_etag (GFile *file, + const gchar *etag, + GCancellable *cancellable) + { ++ g_autoptr(GError) local_error = NULL; ++ + g_return_val_if_fail (G_IS_FILE (file), FALSE); + g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); + + if (etag == NULL || *etag == '\0') { +- return g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID, +- NULL, G_FILE_QUERY_INFO_NONE, cancellable, NULL); ++ if (!g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID, ++ NULL, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) { ++ g_debug ("Error clearing attribute ‘%s’ on file ‘%s’: %s", ++ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message); ++ return FALSE; ++ } ++ ++ return TRUE; ++ } ++ ++ if (!g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) { ++ g_debug ("Error setting attribute ‘%s’ to ‘%s’ on file ‘%s’: %s", ++ METADATA_ETAG_ATTRIBUTE, etag, g_file_peek_path (file), local_error->message); ++ return FALSE; + } + +- return g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, NULL); ++ return TRUE; + } + + /** +-- +GitLab + + +From c46d656c51938adb994b4597c766259bf1813fe5 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 10 Mar 2022 13:27:50 +0000 +Subject: [PATCH 3/3] gs-utils: Change ETag attribute namespace from metadata + to xattr +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The xattr namespace is likely to be supported on all modern Linux +distributions for local files, and doesn’t require IPC with +`gvfsd-metadata`. + +Signed-off-by: Philip Withnall + +Helps: #1677 +--- + lib/gs-utils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/gs-utils.c b/lib/gs-utils.c +index 6dc4d28a0..b8eefe36e 100644 +--- a/lib/gs-utils.c ++++ b/lib/gs-utils.c +@@ -1488,7 +1488,7 @@ gs_utils_get_file_size (const gchar *filename, + return size; + } + +-#define METADATA_ETAG_ATTRIBUTE "metadata::etag" ++#define METADATA_ETAG_ATTRIBUTE "xattr::gnome-software::etag" + + /** + * gs_utils_get_file_etag: +-- +GitLab + diff --git a/1285.patch b/1285.patch new file mode 100644 index 0000000..1caae0c --- /dev/null +++ b/1285.patch @@ -0,0 +1,45 @@ +From 92da7c98217856785dfea518890fa25acd3a055e Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 10 Mar 2022 14:25:05 +0000 +Subject: [PATCH] =?UTF-8?q?gs-download-utils:=20Ignore=20cancellation=20er?= + =?UTF-8?q?rors=20when=20there=E2=80=99s=20a=20cache=20hit?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In order to avoid overwriting an existing cache file when the server has +said it’s up to date, we cancel closing the output stream. + +Avoid propagating that cancellation error up to the caller; to them, the +operation should seem like a success rather than returning +`G_IO_ERROR_CANCELLED`. + +Signed-off-by: Philip Withnall + +Fixes: #1679 +--- + lib/gs-download-utils.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c +index f3a64479b..4ab15c098 100644 +--- a/lib/gs-download-utils.c ++++ b/lib/gs-download-utils.c +@@ -467,7 +467,13 @@ close_stream_cb (GObject *source_object, + * overwrite errors set earlier in the operation. */ + if (!g_output_stream_close_finish (G_OUTPUT_STREAM (source_object), + result, &local_error)) { +- if (data->error == NULL) ++ /* If we are aborting writing the output stream (perhaps ++ * because of a cache hit), don’t report the error at ++ * all. */ ++ if (data->discard_output_stream && ++ g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) ++ g_clear_error (&local_error); ++ else if (data->error == NULL) + data->error = g_steal_pointer (&local_error); + else if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_debug ("Error closing output stream: %s", local_error->message); +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 913fede..41d6c9d 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -13,7 +13,7 @@ Name: gnome-software Version: 42~rc -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,6 +21,8 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 1282.patch +Patch03: 1285.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -198,6 +200,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Thu Mar 10 2022 Milan Crha - 42.rc-2 +- Add upstream patches for gs-download-utils (i#1677 and i#1679) + * Mon Mar 07 2022 Milan Crha - 42.rc-1 - Update to 42.rc From 0db1b574e2399a7f816e40c1a7d4de06d56e1613 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Mar 2022 10:13:22 +0100 Subject: [PATCH 041/155] Update to 42.0 --- 1282.patch | 182 -------------------------------------------- 1285.patch | 45 ----------- gnome-software.spec | 9 ++- sources | 2 +- 4 files changed, 6 insertions(+), 232 deletions(-) delete mode 100644 1282.patch delete mode 100644 1285.patch diff --git a/1282.patch b/1282.patch deleted file mode 100644 index f6cc6fd..0000000 --- a/1282.patch +++ /dev/null @@ -1,182 +0,0 @@ -From edbeab87ce5aa48bd9fe49dd22acfcce2b8b0fc0 Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Thu, 10 Mar 2022 13:20:58 +0000 -Subject: [PATCH 1/3] =?UTF-8?q?gs-download-utils:=20Don=E2=80=99t=20use=20?= - =?UTF-8?q?ETag=20when=20writing=20local=20file?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The ETag we care about for the download is the ETag returned by the -server, not the ETag of the local file. Passing the server’s ETag to the -local file operations may result in the local file not being written to, -with a “The file was externally modified” error. - -Signed-off-by: Philip Withnall - -Fixes: #1677 ---- - lib/gs-download-utils.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c -index f3a64479b..a6d930587 100644 ---- a/lib/gs-download-utils.c -+++ b/lib/gs-download-utils.c -@@ -134,6 +134,9 @@ static void download_progress (GTask *task); - * existing content of the output stream (if it’s a file, for example) will not - * be overwritten. - * -+ * Note that @last_etag must be the ETag value returned by the server last time -+ * the file was downloaded, not the local file ETag generated by GLib. -+ * - * If specified, @progress_callback will be called zero or more times until - * @callback is called, providing progress updates on the download. - * -@@ -644,9 +647,20 @@ gs_download_file_async (SoupSession *soup_session, - /* Query the old ETag if the file already exists. */ - data->last_etag = gs_utils_get_file_etag (output_file, cancellable); - -- /* Create the output file. */ -+ /* Create the output file. -+ * -+ * Note that `data->last_etag` is *not* passed in here, as the ETag from -+ * the server and the file modification ETag that GLib uses are -+ * different things. For g_file_replace_async(), GLib always uses an -+ * ETag it generates internally based on the file mtime (see -+ * _g_local_file_info_create_etag()), which will never match what the -+ * server returns in its ETag header. -+ * -+ * This is fine, as we are using the ETag to avoid an unnecessary HTTP -+ * download if possible. We don’t care about tracking changes to the -+ * file on disk. */ - g_file_replace_async (output_file, -- data->last_etag, -+ NULL, /* ETag */ - FALSE, /* make_backup */ - G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, - io_priority, -@@ -699,7 +713,7 @@ download_file_cb (GObject *source_object, - return; - } - -- /* Update the ETag. */ -+ /* Update the stored HTTP ETag. */ - gs_utils_set_file_etag (data->output_file, new_etag, cancellable); - - g_task_return_boolean (task, TRUE); --- -GitLab - - -From 040e2dca3904d965450158dcdaeedfca12965682 Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Thu, 10 Mar 2022 13:27:21 +0000 -Subject: [PATCH 2/3] gs-utils: Add some debug messages for getting/setting - ETags - -Signed-off-by: Philip Withnall - -Helps: #1677 ---- - lib/gs-utils.c | 28 +++++++++++++++++++++++----- - 1 file changed, 23 insertions(+), 5 deletions(-) - -diff --git a/lib/gs-utils.c b/lib/gs-utils.c -index 89349b1fe..6dc4d28a0 100644 ---- a/lib/gs-utils.c -+++ b/lib/gs-utils.c -@@ -1509,14 +1509,18 @@ gs_utils_get_file_etag (GFile *file, - GCancellable *cancellable) - { - g_autoptr(GFileInfo) info = NULL; -+ g_autoptr(GError) local_error = NULL; - - g_return_val_if_fail (G_IS_FILE (file), NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - -- info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, NULL); -+ info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, &local_error); - -- if (info == NULL) -+ if (info == NULL) { -+ g_debug ("Error getting attribute ‘%s’ for file ‘%s’: %s", -+ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message); - return NULL; -+ } - - return g_strdup (g_file_info_get_attribute_string (info, METADATA_ETAG_ATTRIBUTE)); - } -@@ -1542,15 +1546,29 @@ gs_utils_set_file_etag (GFile *file, - const gchar *etag, - GCancellable *cancellable) - { -+ g_autoptr(GError) local_error = NULL; -+ - g_return_val_if_fail (G_IS_FILE (file), FALSE); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE); - - if (etag == NULL || *etag == '\0') { -- return g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID, -- NULL, G_FILE_QUERY_INFO_NONE, cancellable, NULL); -+ if (!g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID, -+ NULL, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) { -+ g_debug ("Error clearing attribute ‘%s’ on file ‘%s’: %s", -+ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message); -+ return FALSE; -+ } -+ -+ return TRUE; -+ } -+ -+ if (!g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) { -+ g_debug ("Error setting attribute ‘%s’ to ‘%s’ on file ‘%s’: %s", -+ METADATA_ETAG_ATTRIBUTE, etag, g_file_peek_path (file), local_error->message); -+ return FALSE; - } - -- return g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, NULL); -+ return TRUE; - } - - /** --- -GitLab - - -From c46d656c51938adb994b4597c766259bf1813fe5 Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Thu, 10 Mar 2022 13:27:50 +0000 -Subject: [PATCH 3/3] gs-utils: Change ETag attribute namespace from metadata - to xattr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The xattr namespace is likely to be supported on all modern Linux -distributions for local files, and doesn’t require IPC with -`gvfsd-metadata`. - -Signed-off-by: Philip Withnall - -Helps: #1677 ---- - lib/gs-utils.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/gs-utils.c b/lib/gs-utils.c -index 6dc4d28a0..b8eefe36e 100644 ---- a/lib/gs-utils.c -+++ b/lib/gs-utils.c -@@ -1488,7 +1488,7 @@ gs_utils_get_file_size (const gchar *filename, - return size; - } - --#define METADATA_ETAG_ATTRIBUTE "metadata::etag" -+#define METADATA_ETAG_ATTRIBUTE "xattr::gnome-software::etag" - - /** - * gs_utils_get_file_etag: --- -GitLab - diff --git a/1285.patch b/1285.patch deleted file mode 100644 index 1caae0c..0000000 --- a/1285.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 92da7c98217856785dfea518890fa25acd3a055e Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Thu, 10 Mar 2022 14:25:05 +0000 -Subject: [PATCH] =?UTF-8?q?gs-download-utils:=20Ignore=20cancellation=20er?= - =?UTF-8?q?rors=20when=20there=E2=80=99s=20a=20cache=20hit?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In order to avoid overwriting an existing cache file when the server has -said it’s up to date, we cancel closing the output stream. - -Avoid propagating that cancellation error up to the caller; to them, the -operation should seem like a success rather than returning -`G_IO_ERROR_CANCELLED`. - -Signed-off-by: Philip Withnall - -Fixes: #1679 ---- - lib/gs-download-utils.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c -index f3a64479b..4ab15c098 100644 ---- a/lib/gs-download-utils.c -+++ b/lib/gs-download-utils.c -@@ -467,7 +467,13 @@ close_stream_cb (GObject *source_object, - * overwrite errors set earlier in the operation. */ - if (!g_output_stream_close_finish (G_OUTPUT_STREAM (source_object), - result, &local_error)) { -- if (data->error == NULL) -+ /* If we are aborting writing the output stream (perhaps -+ * because of a cache hit), don’t report the error at -+ * all. */ -+ if (data->discard_output_stream && -+ g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) -+ g_clear_error (&local_error); -+ else if (data->error == NULL) - data->error = g_steal_pointer (&local_error); - else if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - g_debug ("Error closing output stream: %s", local_error->message); --- -GitLab - diff --git a/gnome-software.spec b/gnome-software.spec index 41d6c9d..bc27980 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,8 +12,8 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 42~rc -Release: 2%{?dist} +Version: 42.0 +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -21,8 +21,6 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch -Patch02: 1282.patch -Patch03: 1285.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -200,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Fri Mar 18 2022 Milan Crha - 42.0-1 +- Update to 42.0 + * Thu Mar 10 2022 Milan Crha - 42.rc-2 - Add upstream patches for gs-download-utils (i#1677 and i#1679) diff --git a/sources b/sources index 6afee80..2a6fbea 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.rc.tar.xz) = cd9c465d73b8998c0ebc49d5e40fec22522e0f125cbce5ff59a7a13d779a3793ac57dfb606d9b918e0c198b6b6cd62657483dc8e83a77ed84966c5f44980f38b +SHA512 (gnome-software-42.0.tar.xz) = f630232d164d1a7adcf9a91133769c6fe4ce62cdaeccd49b991330682eeccfddc8f83c7326802aaabdb4fc537243c0fd19741c702f4d23d75ebd71e9abb3da92 From 0b1309adc37bad4d07d7c52b06838504392bd483 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 18 Mar 2022 10:16:41 +0100 Subject: [PATCH 042/155] 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 82d21baa53b72f37b9370b734b414157750bceab Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 27 Apr 2022 09:09:39 +0200 Subject: [PATCH 043/155] Update to 42.1 --- gnome-software.spec | 15 +++++++++------ sources | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index bc27980..ee7eb05 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -9,10 +9,13 @@ %global fwupd_version 1.3.3 %global flatpak_version 1.5.1 +# this is not a library version +%define gs_plugin_version 18 + %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 42.0 +Version: 42.1 Release: 1%{?dist} Summary: A software center for GNOME @@ -74,9 +77,6 @@ Recommends: PackageKit%{?_isa} >= %{packagekit_version} Obsoletes: gnome-software-snap < 3.33.1 Obsoletes: gnome-software-editor < 3.35.1 -# this is not a library version -%define gs_plugin_version 17 - %description gnome-software is an application that makes it easy to add, remove and update software in the GNOME desktop. @@ -177,8 +177,8 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_repos.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so %{_sysconfdir}/xdg/autostart/org.gnome.Software.desktop -%{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml -%{_datadir}/app-info/xmls/org.gnome.Software.Popular.xml +%{_datadir}/swcatalog/xml/org.gnome.Software.Featured.xml +%{_datadir}/swcatalog/xml/org.gnome.Software.Popular.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service %{_datadir}/dbus-1/services/org.gnome.Software.service %{_datadir}/gnome-shell/search-providers/org.gnome.Software-search-provider.ini @@ -198,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Wed Apr 27 2022 Milan Crha - 42.1-1 +- Update to 42.1 + * Fri Mar 18 2022 Milan Crha - 42.0-1 - Update to 42.0 diff --git a/sources b/sources index 2a6fbea..326494a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.0.tar.xz) = f630232d164d1a7adcf9a91133769c6fe4ce62cdaeccd49b991330682eeccfddc8f83c7326802aaabdb4fc537243c0fd19741c702f4d23d75ebd71e9abb3da92 +SHA512 (gnome-software-42.1.tar.xz) = 292a17e94c7409198fdff4250a88cb240a126c3d77a9cfee1ea8608fdc482d75af6f8fc91c5c6c068b474edea6dcb197f88ec09081a8b270d5f3eda67db755ad From b0b459586b215a14dac347bd45e930e9a15eb07a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 30 May 2022 17:51:05 +0200 Subject: [PATCH 044/155] Update to 42.2; Add patch to correct order of the setup of the GsShell --- 0002-shell-setup-order.patch | 134 +++++++++++++++++++++++++++++++++++ gnome-software.spec | 7 +- sources | 2 +- 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 0002-shell-setup-order.patch diff --git a/0002-shell-setup-order.patch b/0002-shell-setup-order.patch new file mode 100644 index 0000000..c0ba76b --- /dev/null +++ b/0002-shell-setup-order.patch @@ -0,0 +1,134 @@ +diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c +index 38cc31bb5..c73adce6d 100644 +--- a/lib/gs-appstream.c ++++ b/lib/gs-appstream.c +@@ -1626,12 +1626,12 @@ gs_appstream_add_categories (XbSilo *silo, + for (guint k = 0; k < groups->len; k++) { + const gchar *group = g_ptr_array_index (groups, k); + guint cnt = gs_appstream_count_component_for_groups (silo, group); +- for (guint l = 0; l < cnt; l++) { +- gs_category_increment_size (parent); ++ if (cnt > 0) { ++ gs_category_increment_size (parent, cnt); + if (children->len > 1) { + /* Parent category has multiple groups, so increment + * each group's size too */ +- gs_category_increment_size (cat); ++ gs_category_increment_size (cat, cnt); + } + } + } +diff --git a/lib/gs-category.c b/lib/gs-category.c +index b311c4941..4baede3bc 100644 +--- a/lib/gs-category.c ++++ b/lib/gs-category.c +@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *category, guint size) + /** + * gs_category_increment_size: + * @category: a #GsCategory ++ * @value: how many to add + * +- * Adds one to the size count if an application is available ++ * Adds @value to the size count. + * + * Since: 3.22 + **/ + void +-gs_category_increment_size (GsCategory *category) ++gs_category_increment_size (GsCategory *category, ++ guint value) + { + g_return_if_fail (GS_IS_CATEGORY (category)); + +- category->size++; ++ category->size += value; + g_object_notify_by_pspec (G_OBJECT (category), obj_props[PROP_SIZE]); + } + +diff --git a/lib/gs-category.h b/lib/gs-category.h +index ecd2e1e23..1e82591aa 100644 +--- a/lib/gs-category.h ++++ b/lib/gs-category.h +@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsCategory *category, + GPtrArray *gs_category_get_children (GsCategory *category); + + guint gs_category_get_size (GsCategory *category); +-void gs_category_increment_size (GsCategory *category); ++void gs_category_increment_size (GsCategory *category, ++ guint value); + + G_END_DECLS +diff --git a/src/gs-shell.c b/src/gs-shell.c +index db449a9b0..796d7b05a 100644 +--- a/src/gs-shell.c ++++ b/src/gs-shell.c +@@ -107,6 +107,7 @@ struct _GsShell + GtkWidget *primary_menu; + GtkWidget *sub_page_header_title; + ++ gboolean active_after_setup; + gboolean is_narrow; + guint allocation_changed_cb_id; + +@@ -165,6 +166,12 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkWindow *window) + void + gs_shell_activate (GsShell *shell) + { ++ /* Waiting for plugin loader to setup first */ ++ if (shell->plugin_loader == NULL) { ++ shell->active_after_setup = TRUE; ++ return; ++ } ++ + gtk_widget_show (GTK_WIDGET (shell)); + gtk_window_present (GTK_WINDOW (shell)); + } +@@ -2237,6 +2244,11 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can + if (g_settings_get_boolean (shell->settings, "first-run")) + g_settings_set_boolean (shell->settings, "first-run", FALSE); + } ++ ++ if (shell->active_after_setup) { ++ shell->active_after_setup = FALSE; ++ gs_shell_activate (shell); ++ } + } + + void +diff --git a/src/gs-application.c b/src/gs-application.c +index e3f5f55c7..bdadd5c34 100644 +--- a/src/gs-application.c ++++ b/src/gs-application.c +@@ -968,12 +968,9 @@ gs_application_startup (GApplication *application) + G_CALLBACK (gs_application_shell_loaded_cb), + app); + +- gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); + app->main_window = GTK_WINDOW (app->shell); + gtk_application_add_window (GTK_APPLICATION (app), app->main_window); + +- app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); +- + gs_application_update_software_sources_presence (application); + + /* Set up the plugins. */ +@@ -990,6 +987,7 @@ startup_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) + { ++ GsApplication *app = GS_APPLICATION (user_data); + GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object); + g_autoptr(GError) local_error = NULL; + +@@ -1002,6 +1000,11 @@ startup_cb (GObject *source_object, + + /* show the priority of each plugin */ + gs_plugin_loader_dump_state (plugin_loader); ++ ++ /* Setup the shell only after the plugin loader finished its setup, ++ thus all plugins are loaded and ready for the jobs. */ ++ gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); ++ app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); + } + + static void diff --git a/gnome-software.spec b/gnome-software.spec index ee7eb05..61f0509 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -15,7 +15,7 @@ %global tarball_version %%(echo %{version} | tr '~' '.') Name: gnome-software -Version: 42.1 +Version: 42.2 Release: 1%{?dist} Summary: A software center for GNOME @@ -24,6 +24,7 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 0002-shell-setup-order.patch BuildRequires: appstream-devel >= %{appstream_version} BuildRequires: gcc @@ -198,6 +199,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Mon May 30 2022 Milan Crha - 42.2-1 +- Update to 42.2 +- Add patch to correct order of the setup of the GsShell + * Wed Apr 27 2022 Milan Crha - 42.1-1 - Update to 42.1 diff --git a/sources b/sources index 326494a..fc682d9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.1.tar.xz) = 292a17e94c7409198fdff4250a88cb240a126c3d77a9cfee1ea8608fdc482d75af6f8fc91c5c6c068b474edea6dcb197f88ec09081a8b270d5f3eda67db755ad +SHA512 (gnome-software-42.2.tar.xz) = 2b231afbedb241b8957fa902c37cd85734cdb8b2071cd32ac75ae2e9e064483fe1e9e8d49f2e6df478fdd01e9c6225a85887ba2af1792a9150b89cea75ef8bb4 From 5575960754e99686dc508bdf62786708af80cbe6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 13 Jun 2022 14:43:28 +0200 Subject: [PATCH 045/155] Add patch for crash under gs_flatpak_refine_app_unlocked() --- ...under-gs-flatpak-refine-app-unlocked.patch | 386 ++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 0003-crash-under-gs-flatpak-refine-app-unlocked.patch diff --git a/0003-crash-under-gs-flatpak-refine-app-unlocked.patch b/0003-crash-under-gs-flatpak-refine-app-unlocked.patch new file mode 100644 index 0000000..701e7ef --- /dev/null +++ b/0003-crash-under-gs-flatpak-refine-app-unlocked.patch @@ -0,0 +1,386 @@ +diff -up gnome-software-42.2/lib/gs-appstream.c.3 gnome-software-42.2/lib/gs-appstream.c +--- gnome-software-42.2/lib/gs-appstream.c.3 2022-06-13 14:34:05.477145977 +0200 ++++ gnome-software-42.2/lib/gs-appstream.c 2022-06-13 14:36:26.640218337 +0200 +@@ -20,7 +20,13 @@ GsApp * + gs_appstream_create_app (GsPlugin *plugin, XbSilo *silo, XbNode *component, GError **error) + { + GsApp *app; +- g_autoptr(GsApp) app_new = gs_app_new (NULL); ++ g_autoptr(GsApp) app_new = NULL; ++ ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), NULL); ++ g_return_val_if_fail (XB_IS_SILO (silo), NULL); ++ g_return_val_if_fail (XB_IS_NODE (component), NULL); ++ ++ app_new = gs_app_new (NULL); + + /* refine enough to get the unique ID */ + if (!gs_appstream_refine_app (plugin, app_new, silo, component, +@@ -967,6 +973,11 @@ gs_appstream_refine_app (GsPlugin *plugi + g_autoptr(GPtrArray) launchables = NULL; + g_autoptr(XbNode) req = NULL; + ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); ++ g_return_val_if_fail (GS_IS_APP (app), FALSE); ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (XB_IS_NODE (component), FALSE); ++ + /* is compatible */ + req = xb_node_query_first (component, + "requires/id[@type='id']" +@@ -1411,6 +1422,11 @@ gs_appstream_search (GsPlugin *plugin, + { AS_SEARCH_TOKEN_MATCH_NONE, NULL } + }; + ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (values != NULL, FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + /* add some weighted queries */ + for (guint i = 0; queries[i].xpath != NULL; i++) { + g_autoptr(GError) error_query = NULL; +@@ -1487,6 +1503,11 @@ gs_appstream_add_category_apps (GsPlugin + { + GPtrArray *desktop_groups; + ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_CATEGORY (category), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + desktop_groups = gs_category_get_desktop_groups (category); + if (desktop_groups->len == 0) { + g_warning ("no desktop_groups for %s", gs_category_get_id (category)); +@@ -1577,6 +1598,9 @@ gs_appstream_add_categories (XbSilo *sil + GCancellable *cancellable, + GError **error) + { ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (list != NULL, FALSE); ++ + for (guint j = 0; j < list->len; j++) { + GsCategory *parent = GS_CATEGORY (g_ptr_array_index (list, j)); + GPtrArray *children = gs_category_get_children (parent); +@@ -1611,6 +1635,9 @@ gs_appstream_add_popular (XbSilo *silo, + g_autoptr(GError) error_local = NULL; + g_autoptr(GPtrArray) array = NULL; + ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + /* find out how many packages are in each category */ + array = xb_silo_query (silo, + "components/component/kudos/" +@@ -1648,6 +1675,10 @@ gs_appstream_add_recent (GsPlugin *plugi + g_autoptr(GError) error_local = NULL; + g_autoptr(GPtrArray) array = NULL; + ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + /* use predicate conditions to the max */ + xpath = g_strdup_printf ("components/component/releases/" + "release[@timestamp>%" G_GUINT64_FORMAT "]/../..", +@@ -1686,6 +1717,10 @@ gs_appstream_add_alternates (XbSilo *sil + g_autoptr(GPtrArray) ids = NULL; + g_autoptr(GString) xpath = g_string_new (NULL); + ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_APP (app), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + /* probably a package we know nothing about */ + if (gs_app_get_id (app) == NULL) + return TRUE; +@@ -1743,6 +1778,9 @@ gs_appstream_add_featured (XbSilo *silo, + g_autoptr(GError) error_local = NULL; + g_autoptr(GPtrArray) array = NULL; + ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ + /* find out how many packages are in each category */ + array = xb_silo_query (silo, + "components/component/custom/value[@key='GnomeSoftware::FeatureTile']/../..|" +@@ -1782,6 +1820,11 @@ gs_appstream_url_to_app (GsPlugin *plugi + g_autofree gchar *xpath = NULL; + g_autoptr(GPtrArray) components = NULL; + ++ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); ++ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); ++ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); ++ g_return_val_if_fail (url != NULL, FALSE); ++ + /* not us */ + scheme = gs_utils_get_url_scheme (url); + if (g_strcmp0 (scheme, "appstream") != 0) +@@ -1812,6 +1855,9 @@ gs_appstream_component_add_keyword (XbBu + g_autoptr(XbBuilderNode) keyword = NULL; + g_autoptr(XbBuilderNode) keywords = NULL; + ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ g_return_if_fail (str != NULL); ++ + /* create if it does not already exist */ + keywords = xb_builder_node_get_child (component, "keywords", NULL); + if (keywords == NULL) +@@ -1831,6 +1877,9 @@ gs_appstream_component_add_provide (XbBu + g_autoptr(XbBuilderNode) provide = NULL; + g_autoptr(XbBuilderNode) provides = NULL; + ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ g_return_if_fail (str != NULL); ++ + /* create if it does not already exist */ + provides = xb_builder_node_get_child (component, "provides", NULL); + if (provides == NULL) +@@ -1850,6 +1899,9 @@ gs_appstream_component_add_category (XbB + g_autoptr(XbBuilderNode) category = NULL; + g_autoptr(XbBuilderNode) categories = NULL; + ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ g_return_if_fail (str != NULL); ++ + /* create if it does not already exist */ + categories = xb_builder_node_get_child (component, "categories", NULL); + if (categories == NULL) +@@ -1868,6 +1920,9 @@ gs_appstream_component_add_icon (XbBuild + { + g_autoptr(XbBuilderNode) icon = NULL; + ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ g_return_if_fail (str != NULL); ++ + /* create str if it does not already exist */ + icon = xb_builder_node_get_child (component, "icon", NULL); + if (icon == NULL) { +@@ -1881,7 +1936,11 @@ gs_appstream_component_add_icon (XbBuild + void + gs_appstream_component_add_extra_info (XbBuilderNode *component) + { +- const gchar *kind = xb_builder_node_get_attr (component, "type"); ++ const gchar *kind; ++ ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ ++ kind = xb_builder_node_get_attr (component, "type"); + + /* add the gnome-software-specific 'Addon' group and ensure they + * all have an icon set */ +@@ -1927,9 +1986,14 @@ gs_appstream_component_add_extra_info (X + void + gs_appstream_component_fix_url (XbBuilderNode *component, const gchar *baseurl) + { +- const gchar *text = xb_builder_node_get_text (component); ++ const gchar *text; + g_autofree gchar *url = NULL; + ++ g_return_if_fail (XB_IS_BUILDER_NODE (component)); ++ g_return_if_fail (baseurl != NULL); ++ ++ text = xb_builder_node_get_text (component); ++ + if (text == NULL) + return; + +diff -up gnome-software-42.2/plugins/flatpak/gs-flatpak.c.3 gnome-software-42.2/plugins/flatpak/gs-flatpak.c +--- gnome-software-42.2/plugins/flatpak/gs-flatpak.c.3 2022-05-30 13:43:00.000000000 +0200 ++++ gnome-software-42.2/plugins/flatpak/gs-flatpak.c 2022-06-13 14:34:05.480145978 +0200 +@@ -467,10 +467,18 @@ gs_flatpak_create_source (GsFlatpak *sel + } + + static void ++gs_flatpak_invalidate_silo (GsFlatpak *self) ++{ ++ g_rw_lock_writer_lock (&self->silo_lock); ++ if (self->silo != NULL) ++ xb_silo_invalidate (self->silo); ++ g_rw_lock_writer_unlock (&self->silo_lock); ++} ++ ++static void + gs_flatpak_internal_data_changed (GsFlatpak *self) + { + g_autoptr(GMutexLocker) locker = NULL; +- g_autoptr(GRWLockWriterLocker) writer_locker = NULL; + + /* drop the installed refs cache */ + locker = g_mutex_locker_new (&self->installed_refs_mutex); +@@ -487,10 +495,7 @@ gs_flatpak_internal_data_changed (GsFlat + g_hash_table_remove_all (self->broken_remotes); + g_clear_pointer (&locker, g_mutex_locker_free); + +- writer_locker = g_rw_lock_writer_locker_new (&self->silo_lock); +- if (self->silo) +- xb_silo_invalidate (self->silo); +- g_clear_pointer (&writer_locker, g_rw_lock_writer_locker_free); ++ gs_flatpak_invalidate_silo (self); + + self->requires_full_rescan = TRUE; + } +@@ -2009,10 +2014,7 @@ gs_flatpak_refresh (GsFlatpak *self, + g_mutex_unlock (&self->installed_refs_mutex); + + /* manually do this in case we created the first appstream file */ +- g_rw_lock_reader_lock (&self->silo_lock); +- if (self->silo != NULL) +- xb_silo_invalidate (self->silo); +- g_rw_lock_reader_unlock (&self->silo_lock); ++ gs_flatpak_invalidate_silo (self); + + /* update AppStream metadata */ + if (!gs_flatpak_refresh_appstream (self, cache_age_secs, interactive, cancellable, error)) +@@ -3197,6 +3199,20 @@ gs_flatpak_refine_app_unlocked (GsFlatpa + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); + ++ if (self->silo == NULL) { ++ g_clear_pointer (&locker, g_rw_lock_reader_locker_free); ++ if (!gs_flatpak_rescan_appstream_store (self, interactive, cancellable, error)) ++ return FALSE; ++ ++ locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } ++ } ++ + /* always do AppStream properties */ + if (!gs_flatpak_refine_appstream (self, app, self->silo, flags, interactive, cancellable, error)) + return FALSE; +@@ -3394,6 +3410,13 @@ gs_flatpak_refine_wildcard (GsFlatpak *s + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); + ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } ++ + /* find all apps when matching any prefixes */ + xpath = g_strdup_printf ("components/component/id[text()='%s']/..", id); + components = xb_silo_query (self->silo, xpath, 0, &error_local); +@@ -3487,10 +3510,7 @@ gs_flatpak_app_remove_source (GsFlatpak + } + + /* invalidate cache */ +- g_rw_lock_reader_lock (&self->silo_lock); +- if (self->silo != NULL) +- xb_silo_invalidate (self->silo); +- g_rw_lock_reader_unlock (&self->silo_lock); ++ gs_flatpak_invalidate_silo (self); + + gs_app_set_state (app, is_remove ? GS_APP_STATE_UNAVAILABLE : GS_APP_STATE_AVAILABLE); + +@@ -3953,6 +3973,13 @@ gs_flatpak_search (GsFlatpak *self, + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } ++ + if (!gs_appstream_search (self->plugin, self->silo, values, list_tmp, + cancellable, error)) + return FALSE; +@@ -4022,6 +4049,12 @@ gs_flatpak_add_category_apps (GsFlatpak + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + return gs_appstream_add_category_apps (self->plugin, self->silo, + category, list, + cancellable, error); +@@ -4040,6 +4073,12 @@ gs_flatpak_add_categories (GsFlatpak *se + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + return gs_appstream_add_categories (self->silo, + list, cancellable, error); + } +@@ -4058,6 +4097,12 @@ gs_flatpak_add_popular (GsFlatpak *self, + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + if (!gs_appstream_add_popular (self->silo, list_tmp, + cancellable, error)) + return FALSE; +@@ -4081,6 +4126,12 @@ gs_flatpak_add_featured (GsFlatpak *self + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + if (!gs_appstream_add_featured (self->silo, list_tmp, + cancellable, error)) + return FALSE; +@@ -4105,6 +4156,12 @@ gs_flatpak_add_alternates (GsFlatpak *se + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + if (!gs_appstream_add_alternates (self->silo, app, list_tmp, + cancellable, error)) + return FALSE; +@@ -4129,6 +4186,12 @@ gs_flatpak_add_recent (GsFlatpak *self, + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + if (!gs_appstream_add_recent (self->plugin, self->silo, list_tmp, age, + cancellable, error)) + return FALSE; +@@ -4154,6 +4217,12 @@ gs_flatpak_url_to_app (GsFlatpak *self, + return FALSE; + + locker = g_rw_lock_reader_locker_new (&self->silo_lock); ++ if (self->silo == NULL) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "failed to setup XbSilo for '%s'", ++ gs_flatpak_get_id (self)); ++ return FALSE; ++ } + if (!gs_appstream_url_to_app (self->plugin, self->silo, list_tmp, url, cancellable, error)) + return FALSE; + diff --git a/gnome-software.spec b/gnome-software.spec index 61f0509..e2ed0ec 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -16,7 +16,7 @@ Name: gnome-software Version: 42.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -25,6 +25,7 @@ Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-shell-setup-order.patch +Patch03: 0003-crash-under-gs-flatpak-refine-app-unlocked.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 +* Mon Jun 13 2022 Milan Crha - 42.2-2 +- Add patch for crash under gs_flatpak_refine_app_unlocked() + * Mon May 30 2022 Milan Crha - 42.2-1 - Update to 42.2 - Add patch to correct order of the setup of the GsShell From 1e2c0b7474885bf58b1e63ba6373ee9ad3f6e47f Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 16 Jun 2022 11:18:32 +0100 Subject: [PATCH 046/155] Filter private libraries from Provides --- gnome-software.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index e2ed0ec..102f7d1 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -14,9 +14,11 @@ %global tarball_version %%(echo %{version} | tr '~' '.') +%global __provides_exclude_from ^%{_libdir}/%{name}/plugins-%{gs_plugin_version}/.*\\.so.*$ + Name: gnome-software Version: 42.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -200,6 +202,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Thu Jun 16 2022 David King - 42.2-3 +- Filter private libraries from Provides + * Mon Jun 13 2022 Milan Crha - 42.2-2 - Add patch for crash under gs_flatpak_refine_app_unlocked() From d2c0a6431e436b98dc9bbad79e0487e6e34b4c62 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 16 Jun 2022 11:28:31 +0100 Subject: [PATCH 047/155] Use pkgconfig for BuildRequires https://fedoraproject.org/wiki/Packaging:PkgConfigBuildRequires --- gnome-software.spec | 61 +++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 102f7d1..45d45ed 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -1,13 +1,13 @@ %global appstream_version 0.14.0 -%global libadwaita_version 1.0.1 -%global libxmlb_version 0.1.7 +%global flatpak_version 1.5.1 +%global fwupd_version 1.3.3 %global glib2_version 2.61.1 %global gtk4_version 4.4.0 %global json_glib_version 1.2.0 +%global libadwaita_version 1.0.1 %global libsoup_version 2.52.0 +%global libxmlb_version 0.1.7 %global packagekit_version 1.1.1 -%global fwupd_version 1.3.3 -%global flatpak_version 1.5.1 # this is not a library version %define gs_plugin_version 18 @@ -29,36 +29,36 @@ Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-shell-setup-order.patch Patch03: 0003-crash-under-gs-flatpak-refine-app-unlocked.patch -BuildRequires: appstream-devel >= %{appstream_version} -BuildRequires: gcc -BuildRequires: gettext -BuildRequires: libxslt BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils -BuildRequires: fwupd-devel >= %{fwupd_version} -BuildRequires: glib2-devel >= %{glib2_version} -BuildRequires: gnome-online-accounts-devel -BuildRequires: gsettings-desktop-schemas-devel -BuildRequires: gspell-devel -BuildRequires: pkgconfig(gtk4) >= %{gtk4_version} +BuildRequires: gcc +BuildRequires: gettext BuildRequires: gtk-doc -BuildRequires: json-glib-devel >= %{json_glib_version} -BuildRequires: libdnf-devel -BuildRequires: pkgconfig(libadwaita-1) >= %{libadwaita_version} -BuildRequires: libsoup-devel -BuildRequires: libxmlb-devel >= %{libxmlb_version} -BuildRequires: malcontent-devel -BuildRequires: malcontent-ui-devel +BuildRequires: libxslt BuildRequires: meson -BuildRequires: PackageKit-glib-devel >= %{packagekit_version} -BuildRequires: polkit-devel -BuildRequires: flatpak-devel >= %{flatpak_version} -BuildRequires: ostree-devel -BuildRequires: rpm-devel -BuildRequires: rpm-ostree-devel -BuildRequires: libgudev1-devel -BuildRequires: sysprof-capture-devel -BuildRequires: valgrind-devel +BuildRequires: pkgconfig(appstream) >= %{appstream_version} +BuildRequires: pkgconfig(flatpak) >= %{flatpak_version} +BuildRequires: pkgconfig(fwupd) >= %{fwupd_version} +BuildRequires: pkgconfig(gdk-pixbuf-2.0) +BuildRequires: pkgconfig(gio-unix-2.0) >= %{glib2_version} +BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} +BuildRequires: pkgconfig(gmodule-2.0) >= %{glib2_version} +BuildRequires: pkgconfig(gsettings-desktop-schemas) +BuildRequires: pkgconfig(gtk4) >= %{gtk4_version} +BuildRequires: pkgconfig(gudev-1.0) +BuildRequires: pkgconfig(json-glib-1.0) >= %{json_glib_version} +BuildRequires: pkgconfig(libadwaita-1) >= %{libadwaita_version} +BuildRequires: pkgconfig(libdnf) +BuildRequires: pkgconfig(libsoup-2.4) +BuildRequires: pkgconfig(malcontent-0) +BuildRequires: pkgconfig(ostree-1) +BuildRequires: pkgconfig(packagekit-glib2) >= %{packagekit_version} +BuildRequires: pkgconfig(polkit-gobject-1) +BuildRequires: pkgconfig(rpm) +BuildRequires: pkgconfig(rpm-ostree-1) +BuildRequires: pkgconfig(sysprof-capture-4) +BuildRequires: pkgconfig(valgrind) +BuildRequires: pkgconfig(xmlb) >= %{libxmlb_version} Requires: appstream-data Requires: appstream%{?_isa} >= %{appstream_version} @@ -204,6 +204,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %changelog * Thu Jun 16 2022 David King - 42.2-3 - Filter private libraries from Provides +- Use pkgconfig for BuildRequires * Mon Jun 13 2022 Milan Crha - 42.2-2 - Add patch for crash under gs_flatpak_refine_app_unlocked() From 597c207c2d9b64f849c54605dd74e720ab277e50 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 16 Jun 2022 11:44:26 +0100 Subject: [PATCH 048/155] Improve directory ownership --- gnome-software.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index 45d45ed..ceee634 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -153,7 +153,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_bindir}/gnome-software %{_datadir}/applications/gnome-software-local-file.desktop %{_datadir}/applications/org.gnome.Software.desktop -%{_mandir}/man1/gnome-software.1.gz +%{_mandir}/man1/gnome-software.1* %{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg %{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg %{_datadir}/icons/hicolor/scalable/actions/app-remove-symbolic.svg @@ -181,6 +181,8 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_repos.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so %{_sysconfdir}/xdg/autostart/org.gnome.Software.desktop +%dir %{_datadir}/swcatalog +%dir %{_datadir}/swcatalog/xml %{_datadir}/swcatalog/xml/org.gnome.Software.Featured.xml %{_datadir}/swcatalog/xml/org.gnome.Software.Popular.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service @@ -199,12 +201,15 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %dir %{_includedir}/gnome-software %{_includedir}/gnome-software/*.h %{_libdir}/gnome-software/libgnomesoftware.so -%{_datadir}/gtk-doc/html/gnome-software +%dir %{_datadir}/gtk-doc +%dir %{_datadir}/gtk-doc/html +%{_datadir}/gtk-doc/html/gnome-software/ %changelog * Thu Jun 16 2022 David King - 42.2-3 - Filter private libraries from Provides - Use pkgconfig for BuildRequires +- Improve directory onwership * Mon Jun 13 2022 Milan Crha - 42.2-2 - Add patch for crash under gs_flatpak_refine_app_unlocked() From 5d7e2fdfe9b89c9071c4c6603fb4bcb3b6ac2f3b Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 17 Jun 2022 13:08:37 +0100 Subject: [PATCH 049/155] Add patch to make fwupd user requests work --- 0018-fwupd-Fix-the-user-action-dialogs.patch | 46 ++++++++++++++++++++ gnome-software.spec | 6 ++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0018-fwupd-Fix-the-user-action-dialogs.patch diff --git a/0018-fwupd-Fix-the-user-action-dialogs.patch b/0018-fwupd-Fix-the-user-action-dialogs.patch new file mode 100644 index 0000000..e45e21e --- /dev/null +++ b/0018-fwupd-Fix-the-user-action-dialogs.patch @@ -0,0 +1,46 @@ +From 9aba963f2274e929658b632d6f6ce9c73ee83156 Mon Sep 17 00:00:00 2001 +From: Richard Hughes +Date: Tue, 14 Jun 2022 13:04:31 +0100 +Subject: [PATCH 18/18] fwupd: Fix the user action dialogs + +When gnome-software was ported from appstream-glib to libappstream we +missed that the locale arguments are now swapped -- i.e. the former +specified "locale, value" and the latter specified "value, locale". + +This fixes installing software on any devices that require some kind of +user-prompting to complete the update, e.g. buttons that need pressing +or cables that need replugging. +--- + plugins/fwupd/gs-fwupd-app.c | 2 +- + plugins/fwupd/gs-plugin-fwupd.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c +index 03103a3e9..7fcbdadab 100644 +--- a/plugins/fwupd/gs-fwupd-app.c ++++ b/plugins/fwupd/gs-fwupd-app.c +@@ -283,7 +283,7 @@ gs_fwupd_app_set_from_release (GsApp *app, FwupdRelease *rel) + as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT); + as_screenshot_add_image (ss, im); + if (fwupd_release_get_detach_caption (rel) != NULL) +- as_screenshot_set_caption (ss, NULL, fwupd_release_get_detach_caption (rel)); ++ as_screenshot_set_caption (ss, fwupd_release_get_detach_caption (rel), NULL); + gs_app_set_action_screenshot (app, ss); + } + } +diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c +index cac6a324a..3171eb96d 100644 +--- a/plugins/fwupd/gs-plugin-fwupd.c ++++ b/plugins/fwupd/gs-plugin-fwupd.c +@@ -945,7 +945,7 @@ gs_plugin_fwupd_install (GsPluginFwupd *self, + + /* caption is required */ + as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT); +- as_screenshot_set_caption (ss, NULL, fwupd_device_get_update_message (dev)); ++ as_screenshot_set_caption (ss, fwupd_device_get_update_message (dev), NULL); + gs_app_set_action_screenshot (app, ss); + + /* require the dialog */ +-- +2.36.1 + diff --git a/gnome-software.spec b/gnome-software.spec index ceee634..57180c7 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 42.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -28,6 +28,7 @@ Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-shell-setup-order.patch Patch03: 0003-crash-under-gs-flatpak-refine-app-unlocked.patch +Patch04: 0018-fwupd-Fix-the-user-action-dialogs.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -206,6 +207,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Fri Jun 17 2022 Richard Hughes - 42.2-4 +- Add patch to make fwupd user requests work + * Thu Jun 16 2022 David King - 42.2-3 - Filter private libraries from Provides - Use pkgconfig for BuildRequires From 4afe518accfd1faa928103929e6dfcfe39ff38c6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 1 Jul 2022 12:41:08 +0200 Subject: [PATCH 050/155] Update to 43.alpha --- 0002-shell-setup-order.patch | 113 +++-- ...under-gs-flatpak-refine-app-unlocked.patch | 386 ------------------ 0018-fwupd-Fix-the-user-action-dialogs.patch | 46 --- gnome-software.spec | 24 +- sources | 2 +- 5 files changed, 71 insertions(+), 500 deletions(-) delete mode 100644 0003-crash-under-gs-flatpak-refine-app-unlocked.patch delete mode 100644 0018-fwupd-Fix-the-user-action-dialogs.patch diff --git a/0002-shell-setup-order.patch b/0002-shell-setup-order.patch index c0ba76b..37da5c0 100644 --- a/0002-shell-setup-order.patch +++ b/0002-shell-setup-order.patch @@ -1,8 +1,7 @@ -diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c -index 38cc31bb5..c73adce6d 100644 ---- a/lib/gs-appstream.c -+++ b/lib/gs-appstream.c -@@ -1626,12 +1626,12 @@ gs_appstream_add_categories (XbSilo *silo, +diff -up gnome-software-43.alpha/lib/gs-appstream.c.2 gnome-software-43.alpha/lib/gs-appstream.c +--- gnome-software-43.alpha/lib/gs-appstream.c.2 2022-06-30 20:03:37.000000000 +0200 ++++ gnome-software-43.alpha/lib/gs-appstream.c 2022-07-01 12:01:07.781026426 +0200 +@@ -1648,12 +1648,12 @@ gs_appstream_add_categories (XbSilo *sil for (guint k = 0; k < groups->len; k++) { const gchar *group = g_ptr_array_index (groups, k); guint cnt = gs_appstream_count_component_for_groups (silo, group); @@ -18,11 +17,10 @@ index 38cc31bb5..c73adce6d 100644 } } } -diff --git a/lib/gs-category.c b/lib/gs-category.c -index b311c4941..4baede3bc 100644 ---- a/lib/gs-category.c -+++ b/lib/gs-category.c -@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *category, guint size) +diff -up gnome-software-43.alpha/lib/gs-category.c.2 gnome-software-43.alpha/lib/gs-category.c +--- gnome-software-43.alpha/lib/gs-category.c.2 2022-06-30 20:03:37.000000000 +0200 ++++ gnome-software-43.alpha/lib/gs-category.c 2022-07-01 12:01:07.781026426 +0200 +@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *catego /** * gs_category_increment_size: * @category: a #GsCategory @@ -45,11 +43,10 @@ index b311c4941..4baede3bc 100644 g_object_notify_by_pspec (G_OBJECT (category), obj_props[PROP_SIZE]); } -diff --git a/lib/gs-category.h b/lib/gs-category.h -index ecd2e1e23..1e82591aa 100644 ---- a/lib/gs-category.h -+++ b/lib/gs-category.h -@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsCategory *category, +diff -up gnome-software-43.alpha/lib/gs-category.h.2 gnome-software-43.alpha/lib/gs-category.h +--- gnome-software-43.alpha/lib/gs-category.h.2 2022-06-30 20:03:37.000000000 +0200 ++++ gnome-software-43.alpha/lib/gs-category.h 2022-07-01 12:01:07.781026426 +0200 +@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsC GPtrArray *gs_category_get_children (GsCategory *category); guint gs_category_get_size (GsCategory *category); @@ -58,11 +55,46 @@ index ecd2e1e23..1e82591aa 100644 + guint value); G_END_DECLS -diff --git a/src/gs-shell.c b/src/gs-shell.c -index db449a9b0..796d7b05a 100644 ---- a/src/gs-shell.c -+++ b/src/gs-shell.c -@@ -107,6 +107,7 @@ struct _GsShell +diff -up gnome-software-43.alpha/src/gs-application.c.2 gnome-software-43.alpha/src/gs-application.c +--- gnome-software-43.alpha/src/gs-application.c.2 2022-06-30 20:03:37.000000000 +0200 ++++ gnome-software-43.alpha/src/gs-application.c 2022-07-01 12:02:05.799267693 +0200 +@@ -1036,12 +1036,9 @@ gs_application_startup (GApplication *ap + G_CALLBACK (gs_application_shell_loaded_cb), + app); + +- gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); + app->main_window = GTK_WINDOW (app->shell); + gtk_application_add_window (GTK_APPLICATION (app), app->main_window); + +- app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); +- + gs_application_update_software_sources_presence (application); + + /* Remove possibly obsolete notifications */ +@@ -1067,6 +1064,7 @@ startup_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) + { ++ GsApplication *app = GS_APPLICATION (user_data); + GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object); + g_autoptr(GError) local_error = NULL; + +@@ -1079,6 +1077,11 @@ startup_cb (GObject *source_object, + + /* show the priority of each plugin */ + gs_plugin_loader_dump_state (plugin_loader); ++ ++ /* Setup the shell only after the plugin loader finished its setup, ++ thus all plugins are loaded and ready for the jobs. */ ++ gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); ++ app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); + } + + static void +diff -up gnome-software-43.alpha/src/gs-shell.c.2 gnome-software-43.alpha/src/gs-shell.c +--- gnome-software-43.alpha/src/gs-shell.c.2 2022-06-30 20:03:37.000000000 +0200 ++++ gnome-software-43.alpha/src/gs-shell.c 2022-07-01 12:01:07.782026430 +0200 +@@ -109,6 +109,7 @@ struct _GsShell GtkWidget *primary_menu; GtkWidget *sub_page_header_title; @@ -70,7 +102,7 @@ index db449a9b0..796d7b05a 100644 gboolean is_narrow; guint allocation_changed_cb_id; -@@ -165,6 +166,12 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkWindow *window) +@@ -167,6 +168,12 @@ gs_shell_modal_dialog_present (GsShell * void gs_shell_activate (GsShell *shell) { @@ -83,7 +115,7 @@ index db449a9b0..796d7b05a 100644 gtk_widget_show (GTK_WIDGET (shell)); gtk_window_present (GTK_WINDOW (shell)); } -@@ -2237,6 +2244,11 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can +@@ -2265,6 +2272,11 @@ gs_shell_setup (GsShell *shell, GsPlugin if (g_settings_get_boolean (shell->settings, "first-run")) g_settings_set_boolean (shell->settings, "first-run", FALSE); } @@ -95,40 +127,3 @@ index db449a9b0..796d7b05a 100644 } void -diff --git a/src/gs-application.c b/src/gs-application.c -index e3f5f55c7..bdadd5c34 100644 ---- a/src/gs-application.c -+++ b/src/gs-application.c -@@ -968,12 +968,9 @@ gs_application_startup (GApplication *application) - G_CALLBACK (gs_application_shell_loaded_cb), - app); - -- gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); - app->main_window = GTK_WINDOW (app->shell); - gtk_application_add_window (GTK_APPLICATION (app), app->main_window); - -- app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); -- - gs_application_update_software_sources_presence (application); - - /* Set up the plugins. */ -@@ -990,6 +987,7 @@ startup_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) - { -+ GsApplication *app = GS_APPLICATION (user_data); - GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object); - g_autoptr(GError) local_error = NULL; - -@@ -1002,6 +1000,11 @@ startup_cb (GObject *source_object, - - /* show the priority of each plugin */ - gs_plugin_loader_dump_state (plugin_loader); -+ -+ /* Setup the shell only after the plugin loader finished its setup, -+ thus all plugins are loaded and ready for the jobs. */ -+ gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); -+ app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); - } - - static void diff --git a/0003-crash-under-gs-flatpak-refine-app-unlocked.patch b/0003-crash-under-gs-flatpak-refine-app-unlocked.patch deleted file mode 100644 index 701e7ef..0000000 --- a/0003-crash-under-gs-flatpak-refine-app-unlocked.patch +++ /dev/null @@ -1,386 +0,0 @@ -diff -up gnome-software-42.2/lib/gs-appstream.c.3 gnome-software-42.2/lib/gs-appstream.c ---- gnome-software-42.2/lib/gs-appstream.c.3 2022-06-13 14:34:05.477145977 +0200 -+++ gnome-software-42.2/lib/gs-appstream.c 2022-06-13 14:36:26.640218337 +0200 -@@ -20,7 +20,13 @@ GsApp * - gs_appstream_create_app (GsPlugin *plugin, XbSilo *silo, XbNode *component, GError **error) - { - GsApp *app; -- g_autoptr(GsApp) app_new = gs_app_new (NULL); -+ g_autoptr(GsApp) app_new = NULL; -+ -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), NULL); -+ g_return_val_if_fail (XB_IS_SILO (silo), NULL); -+ g_return_val_if_fail (XB_IS_NODE (component), NULL); -+ -+ app_new = gs_app_new (NULL); - - /* refine enough to get the unique ID */ - if (!gs_appstream_refine_app (plugin, app_new, silo, component, -@@ -967,6 +973,11 @@ gs_appstream_refine_app (GsPlugin *plugi - g_autoptr(GPtrArray) launchables = NULL; - g_autoptr(XbNode) req = NULL; - -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); -+ g_return_val_if_fail (GS_IS_APP (app), FALSE); -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (XB_IS_NODE (component), FALSE); -+ - /* is compatible */ - req = xb_node_query_first (component, - "requires/id[@type='id']" -@@ -1411,6 +1422,11 @@ gs_appstream_search (GsPlugin *plugin, - { AS_SEARCH_TOKEN_MATCH_NONE, NULL } - }; - -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (values != NULL, FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - /* add some weighted queries */ - for (guint i = 0; queries[i].xpath != NULL; i++) { - g_autoptr(GError) error_query = NULL; -@@ -1487,6 +1503,11 @@ gs_appstream_add_category_apps (GsPlugin - { - GPtrArray *desktop_groups; - -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_CATEGORY (category), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - desktop_groups = gs_category_get_desktop_groups (category); - if (desktop_groups->len == 0) { - g_warning ("no desktop_groups for %s", gs_category_get_id (category)); -@@ -1577,6 +1598,9 @@ gs_appstream_add_categories (XbSilo *sil - GCancellable *cancellable, - GError **error) - { -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (list != NULL, FALSE); -+ - for (guint j = 0; j < list->len; j++) { - GsCategory *parent = GS_CATEGORY (g_ptr_array_index (list, j)); - GPtrArray *children = gs_category_get_children (parent); -@@ -1611,6 +1635,9 @@ gs_appstream_add_popular (XbSilo *silo, - g_autoptr(GError) error_local = NULL; - g_autoptr(GPtrArray) array = NULL; - -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - /* find out how many packages are in each category */ - array = xb_silo_query (silo, - "components/component/kudos/" -@@ -1648,6 +1675,10 @@ gs_appstream_add_recent (GsPlugin *plugi - g_autoptr(GError) error_local = NULL; - g_autoptr(GPtrArray) array = NULL; - -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - /* use predicate conditions to the max */ - xpath = g_strdup_printf ("components/component/releases/" - "release[@timestamp>%" G_GUINT64_FORMAT "]/../..", -@@ -1686,6 +1717,10 @@ gs_appstream_add_alternates (XbSilo *sil - g_autoptr(GPtrArray) ids = NULL; - g_autoptr(GString) xpath = g_string_new (NULL); - -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_APP (app), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - /* probably a package we know nothing about */ - if (gs_app_get_id (app) == NULL) - return TRUE; -@@ -1743,6 +1778,9 @@ gs_appstream_add_featured (XbSilo *silo, - g_autoptr(GError) error_local = NULL; - g_autoptr(GPtrArray) array = NULL; - -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ - /* find out how many packages are in each category */ - array = xb_silo_query (silo, - "components/component/custom/value[@key='GnomeSoftware::FeatureTile']/../..|" -@@ -1782,6 +1820,11 @@ gs_appstream_url_to_app (GsPlugin *plugi - g_autofree gchar *xpath = NULL; - g_autoptr(GPtrArray) components = NULL; - -+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), FALSE); -+ g_return_val_if_fail (XB_IS_SILO (silo), FALSE); -+ g_return_val_if_fail (GS_IS_APP_LIST (list), FALSE); -+ g_return_val_if_fail (url != NULL, FALSE); -+ - /* not us */ - scheme = gs_utils_get_url_scheme (url); - if (g_strcmp0 (scheme, "appstream") != 0) -@@ -1812,6 +1855,9 @@ gs_appstream_component_add_keyword (XbBu - g_autoptr(XbBuilderNode) keyword = NULL; - g_autoptr(XbBuilderNode) keywords = NULL; - -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ g_return_if_fail (str != NULL); -+ - /* create if it does not already exist */ - keywords = xb_builder_node_get_child (component, "keywords", NULL); - if (keywords == NULL) -@@ -1831,6 +1877,9 @@ gs_appstream_component_add_provide (XbBu - g_autoptr(XbBuilderNode) provide = NULL; - g_autoptr(XbBuilderNode) provides = NULL; - -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ g_return_if_fail (str != NULL); -+ - /* create if it does not already exist */ - provides = xb_builder_node_get_child (component, "provides", NULL); - if (provides == NULL) -@@ -1850,6 +1899,9 @@ gs_appstream_component_add_category (XbB - g_autoptr(XbBuilderNode) category = NULL; - g_autoptr(XbBuilderNode) categories = NULL; - -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ g_return_if_fail (str != NULL); -+ - /* create if it does not already exist */ - categories = xb_builder_node_get_child (component, "categories", NULL); - if (categories == NULL) -@@ -1868,6 +1920,9 @@ gs_appstream_component_add_icon (XbBuild - { - g_autoptr(XbBuilderNode) icon = NULL; - -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ g_return_if_fail (str != NULL); -+ - /* create str if it does not already exist */ - icon = xb_builder_node_get_child (component, "icon", NULL); - if (icon == NULL) { -@@ -1881,7 +1936,11 @@ gs_appstream_component_add_icon (XbBuild - void - gs_appstream_component_add_extra_info (XbBuilderNode *component) - { -- const gchar *kind = xb_builder_node_get_attr (component, "type"); -+ const gchar *kind; -+ -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ -+ kind = xb_builder_node_get_attr (component, "type"); - - /* add the gnome-software-specific 'Addon' group and ensure they - * all have an icon set */ -@@ -1927,9 +1986,14 @@ gs_appstream_component_add_extra_info (X - void - gs_appstream_component_fix_url (XbBuilderNode *component, const gchar *baseurl) - { -- const gchar *text = xb_builder_node_get_text (component); -+ const gchar *text; - g_autofree gchar *url = NULL; - -+ g_return_if_fail (XB_IS_BUILDER_NODE (component)); -+ g_return_if_fail (baseurl != NULL); -+ -+ text = xb_builder_node_get_text (component); -+ - if (text == NULL) - return; - -diff -up gnome-software-42.2/plugins/flatpak/gs-flatpak.c.3 gnome-software-42.2/plugins/flatpak/gs-flatpak.c ---- gnome-software-42.2/plugins/flatpak/gs-flatpak.c.3 2022-05-30 13:43:00.000000000 +0200 -+++ gnome-software-42.2/plugins/flatpak/gs-flatpak.c 2022-06-13 14:34:05.480145978 +0200 -@@ -467,10 +467,18 @@ gs_flatpak_create_source (GsFlatpak *sel - } - - static void -+gs_flatpak_invalidate_silo (GsFlatpak *self) -+{ -+ g_rw_lock_writer_lock (&self->silo_lock); -+ if (self->silo != NULL) -+ xb_silo_invalidate (self->silo); -+ g_rw_lock_writer_unlock (&self->silo_lock); -+} -+ -+static void - gs_flatpak_internal_data_changed (GsFlatpak *self) - { - g_autoptr(GMutexLocker) locker = NULL; -- g_autoptr(GRWLockWriterLocker) writer_locker = NULL; - - /* drop the installed refs cache */ - locker = g_mutex_locker_new (&self->installed_refs_mutex); -@@ -487,10 +495,7 @@ gs_flatpak_internal_data_changed (GsFlat - g_hash_table_remove_all (self->broken_remotes); - g_clear_pointer (&locker, g_mutex_locker_free); - -- writer_locker = g_rw_lock_writer_locker_new (&self->silo_lock); -- if (self->silo) -- xb_silo_invalidate (self->silo); -- g_clear_pointer (&writer_locker, g_rw_lock_writer_locker_free); -+ gs_flatpak_invalidate_silo (self); - - self->requires_full_rescan = TRUE; - } -@@ -2009,10 +2014,7 @@ gs_flatpak_refresh (GsFlatpak *self, - g_mutex_unlock (&self->installed_refs_mutex); - - /* manually do this in case we created the first appstream file */ -- g_rw_lock_reader_lock (&self->silo_lock); -- if (self->silo != NULL) -- xb_silo_invalidate (self->silo); -- g_rw_lock_reader_unlock (&self->silo_lock); -+ gs_flatpak_invalidate_silo (self); - - /* update AppStream metadata */ - if (!gs_flatpak_refresh_appstream (self, cache_age_secs, interactive, cancellable, error)) -@@ -3197,6 +3199,20 @@ gs_flatpak_refine_app_unlocked (GsFlatpa - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); - -+ if (self->silo == NULL) { -+ g_clear_pointer (&locker, g_rw_lock_reader_locker_free); -+ if (!gs_flatpak_rescan_appstream_store (self, interactive, cancellable, error)) -+ return FALSE; -+ -+ locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } -+ } -+ - /* always do AppStream properties */ - if (!gs_flatpak_refine_appstream (self, app, self->silo, flags, interactive, cancellable, error)) - return FALSE; -@@ -3394,6 +3410,13 @@ gs_flatpak_refine_wildcard (GsFlatpak *s - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); - -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } -+ - /* find all apps when matching any prefixes */ - xpath = g_strdup_printf ("components/component/id[text()='%s']/..", id); - components = xb_silo_query (self->silo, xpath, 0, &error_local); -@@ -3487,10 +3510,7 @@ gs_flatpak_app_remove_source (GsFlatpak - } - - /* invalidate cache */ -- g_rw_lock_reader_lock (&self->silo_lock); -- if (self->silo != NULL) -- xb_silo_invalidate (self->silo); -- g_rw_lock_reader_unlock (&self->silo_lock); -+ gs_flatpak_invalidate_silo (self); - - gs_app_set_state (app, is_remove ? GS_APP_STATE_UNAVAILABLE : GS_APP_STATE_AVAILABLE); - -@@ -3953,6 +3973,13 @@ gs_flatpak_search (GsFlatpak *self, - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } -+ - if (!gs_appstream_search (self->plugin, self->silo, values, list_tmp, - cancellable, error)) - return FALSE; -@@ -4022,6 +4049,12 @@ gs_flatpak_add_category_apps (GsFlatpak - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - return gs_appstream_add_category_apps (self->plugin, self->silo, - category, list, - cancellable, error); -@@ -4040,6 +4073,12 @@ gs_flatpak_add_categories (GsFlatpak *se - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - return gs_appstream_add_categories (self->silo, - list, cancellable, error); - } -@@ -4058,6 +4097,12 @@ gs_flatpak_add_popular (GsFlatpak *self, - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - if (!gs_appstream_add_popular (self->silo, list_tmp, - cancellable, error)) - return FALSE; -@@ -4081,6 +4126,12 @@ gs_flatpak_add_featured (GsFlatpak *self - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - if (!gs_appstream_add_featured (self->silo, list_tmp, - cancellable, error)) - return FALSE; -@@ -4105,6 +4156,12 @@ gs_flatpak_add_alternates (GsFlatpak *se - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - if (!gs_appstream_add_alternates (self->silo, app, list_tmp, - cancellable, error)) - return FALSE; -@@ -4129,6 +4186,12 @@ gs_flatpak_add_recent (GsFlatpak *self, - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - if (!gs_appstream_add_recent (self->plugin, self->silo, list_tmp, age, - cancellable, error)) - return FALSE; -@@ -4154,6 +4217,12 @@ gs_flatpak_url_to_app (GsFlatpak *self, - return FALSE; - - locker = g_rw_lock_reader_locker_new (&self->silo_lock); -+ if (self->silo == NULL) { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "failed to setup XbSilo for '%s'", -+ gs_flatpak_get_id (self)); -+ return FALSE; -+ } - if (!gs_appstream_url_to_app (self->plugin, self->silo, list_tmp, url, cancellable, error)) - return FALSE; - diff --git a/0018-fwupd-Fix-the-user-action-dialogs.patch b/0018-fwupd-Fix-the-user-action-dialogs.patch deleted file mode 100644 index e45e21e..0000000 --- a/0018-fwupd-Fix-the-user-action-dialogs.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 9aba963f2274e929658b632d6f6ce9c73ee83156 Mon Sep 17 00:00:00 2001 -From: Richard Hughes -Date: Tue, 14 Jun 2022 13:04:31 +0100 -Subject: [PATCH 18/18] fwupd: Fix the user action dialogs - -When gnome-software was ported from appstream-glib to libappstream we -missed that the locale arguments are now swapped -- i.e. the former -specified "locale, value" and the latter specified "value, locale". - -This fixes installing software on any devices that require some kind of -user-prompting to complete the update, e.g. buttons that need pressing -or cables that need replugging. ---- - plugins/fwupd/gs-fwupd-app.c | 2 +- - plugins/fwupd/gs-plugin-fwupd.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c -index 03103a3e9..7fcbdadab 100644 ---- a/plugins/fwupd/gs-fwupd-app.c -+++ b/plugins/fwupd/gs-fwupd-app.c -@@ -283,7 +283,7 @@ gs_fwupd_app_set_from_release (GsApp *app, FwupdRelease *rel) - as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT); - as_screenshot_add_image (ss, im); - if (fwupd_release_get_detach_caption (rel) != NULL) -- as_screenshot_set_caption (ss, NULL, fwupd_release_get_detach_caption (rel)); -+ as_screenshot_set_caption (ss, fwupd_release_get_detach_caption (rel), NULL); - gs_app_set_action_screenshot (app, ss); - } - } -diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c -index cac6a324a..3171eb96d 100644 ---- a/plugins/fwupd/gs-plugin-fwupd.c -+++ b/plugins/fwupd/gs-plugin-fwupd.c -@@ -945,7 +945,7 @@ gs_plugin_fwupd_install (GsPluginFwupd *self, - - /* caption is required */ - as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT); -- as_screenshot_set_caption (ss, NULL, fwupd_device_get_update_message (dev)); -+ as_screenshot_set_caption (ss, fwupd_device_get_update_message (dev), NULL); - gs_app_set_action_screenshot (app, ss); - - /* require the dialog */ --- -2.36.1 - diff --git a/gnome-software.spec b/gnome-software.spec index 57180c7..b1a88f5 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -10,25 +10,23 @@ %global packagekit_version 1.1.1 # this is not a library version -%define gs_plugin_version 18 +%define gs_plugin_version 19 %global tarball_version %%(echo %{version} | tr '~' '.') %global __provides_exclude_from ^%{_libdir}/%{name}/plugins-%{gs_plugin_version}/.*\\.so.*$ Name: gnome-software -Version: 42.2 -Release: 4%{?dist} +Version: 43.alpha +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ URL: https://wiki.gnome.org/Apps/Software -Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz +Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-shell-setup-order.patch -Patch03: 0003-crash-under-gs-flatpak-refine-app-unlocked.patch -Patch04: 0018-fwupd-Fix-the-user-action-dialogs.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -63,6 +61,7 @@ BuildRequires: pkgconfig(xmlb) >= %{libxmlb_version} Requires: appstream-data Requires: appstream%{?_isa} >= %{appstream_version} +Requires: epiphany-runtime%{?_isa} Requires: flatpak%{?_isa} >= %{flatpak_version} Requires: flatpak-libs%{?_isa} >= %{flatpak_version} Requires: fwupd%{?_isa} >= %{fwupd_version} @@ -119,6 +118,9 @@ This package includes the rpm-ostree backend. -Dpackagekit_autoremove=true \ -Dexternal_appstream=false \ -Drpm_ostree=true \ + -Dwebapps=true \ + -Dhardcoded_foss_webapps=true \ + -Dhardcoded_proprietary_webapps=false \ -Dtests=false %meson_build @@ -159,13 +161,15 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg %{_datadir}/icons/hicolor/scalable/actions/app-remove-symbolic.svg %{_datadir}/icons/hicolor/scalable/status/software-installed-symbolic.svg -%{_datadir}/metainfo/org.gnome.Software.appdata.xml +%{_datadir}/metainfo/org.gnome.Software.metainfo.xml +%{_datadir}/metainfo/org.gnome.Software.Plugin.Epiphany.metainfo.xml %{_datadir}/metainfo/org.gnome.Software.Plugin.Flatpak.metainfo.xml %{_datadir}/metainfo/org.gnome.Software.Plugin.Fwupd.metainfo.xml %dir %{_libdir}/gnome-software/plugins-%{gs_plugin_version} %{_libdir}/gnome-software/libgnomesoftware.so.%{gs_plugin_version} %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_appstream.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_dummy.so +%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_epiphany.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_fedora-langpacks.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_fedora-pkgdb-collections.so %{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_flatpak.so @@ -184,8 +188,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_sysconfdir}/xdg/autostart/org.gnome.Software.desktop %dir %{_datadir}/swcatalog %dir %{_datadir}/swcatalog/xml +%{_datadir}/swcatalog/xml/gnome-pwa-list-foss.xml +%{_datadir}/swcatalog/xml/org.gnome.Software.Curated.xml %{_datadir}/swcatalog/xml/org.gnome.Software.Featured.xml -%{_datadir}/swcatalog/xml/org.gnome.Software.Popular.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service %{_datadir}/dbus-1/services/org.gnome.Software.service %{_datadir}/gnome-shell/search-providers/org.gnome.Software-search-provider.ini @@ -207,6 +212,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Fri Jul 01 2022 Milan Crha - 43.alpha-1 +- Update to 43.alpha + * Fri Jun 17 2022 Richard Hughes - 42.2-4 - Add patch to make fwupd user requests work diff --git a/sources b/sources index fc682d9..5bbe6b2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-42.2.tar.xz) = 2b231afbedb241b8957fa902c37cd85734cdb8b2071cd32ac75ae2e9e064483fe1e9e8d49f2e6df478fdd01e9c6225a85887ba2af1792a9150b89cea75ef8bb4 +SHA512 (gnome-software-43.alpha.tar.xz) = 796b77e763f0ad0c8103b39563ce792b9354126762594addba38a993628f273938a27ed09b9d3c469fb9d11d7a86502960faf9c88914347ec5263e0f626dbb1e From 9786c4ea7ff32ab52f758959778d7a2f791242c0 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 7 Jul 2022 09:39:41 -0700 Subject: [PATCH 051/155] Backport MR #1401 to fix issue #1816 and fedora-workstation #107 --- 1401.patch | 630 ++++++++++++++++++++++++++++++++++++++++++++ gnome-software.spec | 11 +- 2 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 1401.patch diff --git a/1401.patch b/1401.patch new file mode 100644 index 0000000..dfe1925 --- /dev/null +++ b/1401.patch @@ -0,0 +1,630 @@ +From 892acd197630fb3f52ddfac5fc73196ba6759318 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 17:47:11 +0200 +Subject: [PATCH 01/10] plugin-loader: Actively track count of running jobs + +This helps to avoid mistakes when hinting a job finished. +--- + lib/gs-plugin-loader.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index a7f86d5f2..e5c2a2c23 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -56,6 +56,7 @@ struct _GsPluginLoader + GsAppList *pending_apps; /* (nullable) (owned) */ + + GThreadPool *queued_ops_pool; ++ gint active_jobs; + + GSettings *settings; + +@@ -3911,6 +3912,19 @@ cancellable_data_free (CancellableData *data) + + G_DEFINE_AUTOPTR_CLEANUP_FUNC (CancellableData, cancellable_data_free) + ++static void ++plugin_loader_task_freed_cb (gpointer user_data, ++ GObject *freed_object) ++{ ++ g_autoptr(GsPluginLoader) plugin_loader = user_data; ++ if (g_atomic_int_dec_and_test (&plugin_loader->active_jobs)) { ++ /* if the plugin used updates-changed during its job, actually schedule ++ * the signal emission now */ ++ if (plugin_loader->updates_changed_cnt > 0) ++ gs_plugin_loader_updates_changed (plugin_loader); ++ } ++} ++ + static gboolean job_process_setup_complete_cb (GCancellable *cancellable, + gpointer user_data); + static void job_process_cb (GTask *task); +@@ -3977,6 +3991,10 @@ gs_plugin_loader_job_process_async (GsPluginLoader *plugin_loader, + g_task_set_name (task, task_name); + g_task_set_task_data (task, g_object_ref (plugin_job), (GDestroyNotify) g_object_unref); + ++ g_atomic_int_inc (&plugin_loader->active_jobs); ++ g_object_weak_ref (G_OBJECT (task), ++ plugin_loader_task_freed_cb, g_object_ref (plugin_loader)); ++ + /* Wait until the plugin has finished setting up. + * + * Do this using a #GCancellable. While we’re not using the #GCancellable +-- +GitLab + + +From 89a3767bd0ad94d3f3d83f8c4ecbb2b79072f536 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 17:51:13 +0200 +Subject: [PATCH 02/10] plugin-loader: Remove obsolete + gs_plugin_loader_hint_job_finished() + +The function is not needed, since the plugin loader tracks count +of active jobs automatically now. +--- + lib/gs-plugin-job-refresh-metadata.c | 5 ----- + lib/gs-plugin-loader.c | 28 ---------------------------- + lib/gs-plugin-loader.h | 2 -- + 3 files changed, 35 deletions(-) + +diff --git a/lib/gs-plugin-job-refresh-metadata.c b/lib/gs-plugin-job-refresh-metadata.c +index a57b194bc..8d0b95b5d 100644 +--- a/lib/gs-plugin-job-refresh-metadata.c ++++ b/lib/gs-plugin-job-refresh-metadata.c +@@ -387,7 +387,6 @@ finish_op (GTask *task, + GError *error) + { + GsPluginJobRefreshMetadata *self = g_task_get_source_object (task); +- GsPluginLoader *plugin_loader = g_task_get_task_data (task); + g_autoptr(GError) error_owned = g_steal_pointer (&error); + g_autofree gchar *job_debug = NULL; + +@@ -408,10 +407,6 @@ finish_op (GTask *task, + progress_cb (self); + g_source_destroy (self->progress_source); + +- /* If any plugin emitted updates-changed, actually schedule it to be +- * emitted now (even if the overall operation failed). */ +- gs_plugin_loader_hint_job_finished (plugin_loader); +- + /* Get the results of the parallel ops. */ + if (self->saved_error != NULL) { + g_task_return_error (task, g_steal_pointer (&self->saved_error)); +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index e5c2a2c23..fc374256d 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -3676,9 +3676,6 @@ gs_plugin_loader_process_thread_cb (GTask *task, + /* sort these again as the refine may have added useful metadata */ + gs_plugin_loader_job_sorted_truncation_again (helper->plugin_job, list); + +- /* Hint that the job has finished. */ +- gs_plugin_loader_hint_job_finished (plugin_loader); +- + #ifdef HAVE_SYSPROF + if (plugin_loader->sysprof_writer != NULL) { + g_autofree gchar *sysprof_name = g_strconcat ("process-thread:", gs_plugin_action_to_string (action), NULL); +@@ -3849,9 +3846,6 @@ run_job_cb (GObject *source_object, + } + #endif /* HAVE_SYSPROF */ + +- /* Hint that the job has finished. */ +- gs_plugin_loader_hint_job_finished (plugin_loader); +- + /* FIXME: This will eventually go away when + * gs_plugin_loader_job_process_finish() is removed. */ + job_class = GS_PLUGIN_JOB_GET_CLASS (plugin_job); +@@ -4459,25 +4453,3 @@ gs_plugin_loader_get_category_manager (GsPluginLoader *plugin_loader) + + return plugin_loader->category_manager; + } +- +-/** +- * gs_plugin_loader_hint_job_finished: +- * @plugin_loader: a #GsPluginLoader +- * +- * Hint to the @plugin_loader that the set of changes caused by the current +- * #GsPluginJob is likely to be finished. +- * +- * The @plugin_loader may emit queued-up signals as a result. +- * +- * Since: 42 +- */ +-void +-gs_plugin_loader_hint_job_finished (GsPluginLoader *plugin_loader) +-{ +- g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader)); +- +- /* if the plugin used updates-changed during its job, actually schedule +- * the signal emission now */ +- if (plugin_loader->updates_changed_cnt > 0) +- gs_plugin_loader_updates_changed (plugin_loader); +-} +diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h +index 0d2035bfd..bb2c7d8e6 100644 +--- a/lib/gs-plugin-loader.h ++++ b/lib/gs-plugin-loader.h +@@ -126,6 +126,4 @@ gboolean gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader, + void gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, + GsAppList *list); + +-void gs_plugin_loader_hint_job_finished (GsPluginLoader *plugin_loader); +- + G_END_DECLS +-- +GitLab + + +From 680726fa2fa5b7f39aa86da05f161604a132085f Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 17:55:31 +0200 +Subject: [PATCH 03/10] plugin-loader: Schedule 'updates-changed' signal when + received with no job running + +This helps to avoid a race condition when a plugin calls +updates-changed at the end of the job, but the job is +finished before the callback gets called in the main thread. +--- + lib/gs-plugin-loader.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index fc374256d..d728bfc5c 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -1774,12 +1774,6 @@ gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) + return FALSE; + } + +-static void +-gs_plugin_loader_job_actions_changed_cb (GsPlugin *plugin, GsPluginLoader *plugin_loader) +-{ +- plugin_loader->updates_changed_cnt++; +-} +- + static void + gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) + { +@@ -1791,6 +1785,20 @@ gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) + g_object_ref (plugin_loader)); + } + ++static void ++gs_plugin_loader_job_updates_changed_cb (GsPlugin *plugin, ++ GsPluginLoader *plugin_loader) ++{ ++ plugin_loader->updates_changed_cnt++; ++ ++ /* Schedule emit of updates changed when no job is active. ++ This helps to avoid a race condition when a plugin calls ++ updates-changed at the end of the job, but the job is ++ finished before the callback gets called in the main thread. */ ++ if (!g_atomic_int_get (&plugin_loader->active_jobs)) ++ gs_plugin_loader_updates_changed (plugin_loader); ++} ++ + static gboolean + gs_plugin_loader_reload_delay_cb (gpointer user_data) + { +@@ -1849,7 +1857,7 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader, + return; + } + g_signal_connect (plugin, "updates-changed", +- G_CALLBACK (gs_plugin_loader_job_actions_changed_cb), ++ G_CALLBACK (gs_plugin_loader_job_updates_changed_cb), + plugin_loader); + g_signal_connect (plugin, "reload", + G_CALLBACK (gs_plugin_loader_reload_cb), +-- +GitLab + + +From 3c915f31197addf8becf9aa62a07dae35b440044 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 17:58:32 +0200 +Subject: [PATCH 04/10] plugin-loader: Change how updates-checked is scheduled + for emission + +This way the GSource can be removed without leaking the plugin loader. +--- + lib/gs-plugin-loader.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index d728bfc5c..9f64a3559 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -1760,7 +1760,7 @@ gs_plugin_loader_ask_untrusted_cb (GsPlugin *plugin, + } + + static gboolean +-gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) ++gs_plugin_loader_job_updates_changed_delay_cb (gpointer user_data) + { + GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (user_data); + +@@ -1770,7 +1770,6 @@ gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) + plugin_loader->updates_changed_id = 0; + plugin_loader->updates_changed_cnt = 0; + +- g_object_unref (plugin_loader); + return FALSE; + } + +@@ -1780,9 +1779,11 @@ gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) + if (plugin_loader->updates_changed_id != 0) + return; + plugin_loader->updates_changed_id = +- g_timeout_add_seconds (GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY, +- gs_plugin_loader_job_actions_changed_delay_cb, +- g_object_ref (plugin_loader)); ++ g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, ++ GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY, ++ gs_plugin_loader_job_updates_changed_delay_cb, ++ g_object_ref (plugin_loader), ++ g_object_unref); + } + + static void +-- +GitLab + + +From 2930c01ee97a10577fa2860bd8df1124cfb7128d Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:02:11 +0200 +Subject: [PATCH 05/10] plugin-loader: Add + gs_plugin_loader_emit_updates_changed() + +It will help to avoid delays with the GUI after changes in the updates. +--- + lib/gs-plugin-loader.c | 23 +++++++++++++++++++++++ + lib/gs-plugin-loader.h | 1 + + 2 files changed, 24 insertions(+) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index 9f64a3559..c0e711477 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -4462,3 +4462,26 @@ gs_plugin_loader_get_category_manager (GsPluginLoader *plugin_loader) + + return plugin_loader->category_manager; + } ++ ++/** ++ * gs_plugin_loader_emit_updates_changed: ++ * @self: a #GsPluginLoader ++ * ++ * Emits the #GsPluginLoader:updates-changed signal in the nearest ++ * idle in the main thread. ++ * ++ * Since: 43 ++ **/ ++void ++gs_plugin_loader_emit_updates_changed (GsPluginLoader *self) ++{ ++ g_return_if_fail (GS_IS_PLUGIN_LOADER (self)); ++ ++ if (self->updates_changed_id != 0) ++ g_source_remove (self->updates_changed_id); ++ ++ self->updates_changed_id = ++ g_idle_add_full (G_PRIORITY_HIGH_IDLE, ++ gs_plugin_loader_job_updates_changed_delay_cb, ++ g_object_ref (self), g_object_unref); ++} +diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h +index bb2c7d8e6..91c5f643c 100644 +--- a/lib/gs-plugin-loader.h ++++ b/lib/gs-plugin-loader.h +@@ -125,5 +125,6 @@ gboolean gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader, + + void gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, + GsAppList *list); ++void gs_plugin_loader_emit_updates_changed (GsPluginLoader *self); + + G_END_DECLS +-- +GitLab + + +From edfbbfb0be112b76becc1f38c920cfd45a95885c Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:05:38 +0200 +Subject: [PATCH 06/10] gs-app: Add gs_app_is_downloaded() + +This avoid code duplication on two places. It also makes sure the places +agree on the way the app is/is-not downloaded is determined. +--- + lib/gs-app.c | 32 ++++++++++++++++++++++++++++++++ + lib/gs-app.h | 1 + + 2 files changed, 33 insertions(+) + +diff --git a/lib/gs-app.c b/lib/gs-app.c +index 29898765b..d7f8be279 100644 +--- a/lib/gs-app.c ++++ b/lib/gs-app.c +@@ -6656,3 +6656,35 @@ gs_app_set_has_translations (GsApp *app, + priv->has_translations = has_translations; + gs_app_queue_notify (app, obj_props[PROP_HAS_TRANSLATIONS]); + } ++ ++/** ++ * gs_app_is_downloaded: ++ * @app: a #GsApp ++ * ++ * Returns whether the @app is downloaded for updates or not, ++ * considering also its dependencies. ++ * ++ * Returns: %TRUE, when the @app is downloaded, %FALSE otherwise ++ * ++ * Since: 43 ++ **/ ++gboolean ++gs_app_is_downloaded (GsApp *app) ++{ ++ GsSizeType size_type; ++ guint64 size_bytes = 0; ++ ++ g_return_val_if_fail (GS_IS_APP (app), FALSE); ++ ++ if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_PROXY)) { ++ size_type = gs_app_get_size_download (app, &size_bytes); ++ if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) ++ return FALSE; ++ } ++ ++ size_type = gs_app_get_size_download_dependencies (app, &size_bytes); ++ if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) ++ return FALSE; ++ ++ return TRUE; ++} +diff --git a/lib/gs-app.h b/lib/gs-app.h +index d78503c3e..a053299f2 100644 +--- a/lib/gs-app.h ++++ b/lib/gs-app.h +@@ -516,5 +516,6 @@ void gs_app_set_relations (GsApp *app, + gboolean gs_app_get_has_translations (GsApp *app); + void gs_app_set_has_translations (GsApp *app, + gboolean has_translations); ++gboolean gs_app_is_downloaded (GsApp *app); + + G_END_DECLS +-- +GitLab + + +From c6903fd6b74ddbde5db045ea67fc826824153210 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:15:04 +0200 +Subject: [PATCH 07/10] updates-section: Use gs_app_is_downloaded() + +--- + src/gs-updates-section.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c +index ca39e6fab..69e083984 100644 +--- a/src/gs-updates-section.c ++++ b/src/gs-updates-section.c +@@ -288,15 +288,7 @@ _all_offline_updates_downloaded (GsUpdatesSection *self) + /* use the download size to figure out what is downloaded and what not */ + for (guint i = 0; i < gs_app_list_length (self->list); i++) { + GsApp *app = gs_app_list_index (self->list, i); +- GsSizeType size_type; +- guint64 size_bytes; +- +- size_type = gs_app_get_size_download (app, &size_bytes); +- if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) +- return FALSE; +- +- size_type = gs_app_get_size_download_dependencies (app, &size_bytes); +- if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) ++ if (!gs_app_is_downloaded (app)) + return FALSE; + } + +-- +GitLab + + +From 972def24d2bc54b09fe57879efb4c30962858dc0 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:15:25 +0200 +Subject: [PATCH 08/10] update-monitor: Use gs_app_is_downloaded() + +--- + src/gs-update-monitor.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c +index 324ff4d3e..a2dc9bb92 100644 +--- a/src/gs-update-monitor.c ++++ b/src/gs-update-monitor.c +@@ -125,22 +125,18 @@ check_updates_kind (GsAppList *apps, + + for (ii = 0; ii < len && (!has_important || all_downloaded || !any_downloaded); ii++) { + gboolean is_important; +- guint64 size_download_bytes; + + app = gs_app_list_index (apps, ii); + + is_important = gs_app_get_update_urgency (app) == AS_URGENCY_KIND_CRITICAL; + has_important = has_important || is_important; + +- /* took from gs-updates-section.c: _all_offline_updates_downloaded(); +- the app is considered downloaded, when its download size is 0 */ +- if (gs_app_get_size_download (app, &size_download_bytes) != GS_SIZE_TYPE_VALID || +- size_download_bytes != 0) { +- all_downloaded = FALSE; +- } else { ++ if (gs_app_is_downloaded (app)) { + any_downloaded = TRUE; + if (is_important) + any_important_downloaded = TRUE; ++ } else { ++ all_downloaded = FALSE; + } + } + +-- +GitLab + + +From 1aaa9617fc81651f17ed2f864bec35b958d67eed Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:17:18 +0200 +Subject: [PATCH 09/10] update-monitor: Force reload of the Updates page before + showing notification + +Thus it reflects what the update-monitor notifies about. +--- + src/gs-update-monitor.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c +index a2dc9bb92..01e5869eb 100644 +--- a/src/gs-update-monitor.c ++++ b/src/gs-update-monitor.c +@@ -288,6 +288,10 @@ notify_about_pending_updates (GsUpdateMonitor *monitor, + return; + } + ++ /* To force reload of the Updates page, thus it reflects what ++ the update-monitor notifies about */ ++ gs_plugin_loader_emit_updates_changed (monitor->plugin_loader); ++ + monitor->last_notification_time_usec = g_get_real_time (); + + g_debug ("Notify about update: '%s'", title); +-- +GitLab + + +From 64585205437371c459d5de792d50af95e23ba346 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 15 Jun 2022 18:19:36 +0200 +Subject: [PATCH 10/10] update-monitor: Change when notifications are shown + +This handles the fact that offline updates can be installed either +all in once or none of them, which is reflected in the notification. +--- + src/gs-update-monitor.c | 34 ++++++++++++++-------------------- + 1 file changed, 14 insertions(+), 20 deletions(-) + +diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c +index 01e5869eb..292d2bc4b 100644 +--- a/src/gs-update-monitor.c ++++ b/src/gs-update-monitor.c +@@ -109,17 +109,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(WithAppData, with_app_data_free); + static void + check_updates_kind (GsAppList *apps, + gboolean *out_has_important, +- gboolean *out_any_important_downloaded, + gboolean *out_all_downloaded, + gboolean *out_any_downloaded) + { +- gboolean has_important, any_important_downloaded, all_downloaded, any_downloaded; ++ gboolean has_important, all_downloaded, any_downloaded; + guint ii, len; + GsApp *app; + + len = gs_app_list_length (apps); + has_important = FALSE; +- any_important_downloaded = FALSE; + all_downloaded = len > 0; + any_downloaded = FALSE; + +@@ -131,17 +129,13 @@ check_updates_kind (GsAppList *apps, + is_important = gs_app_get_update_urgency (app) == AS_URGENCY_KIND_CRITICAL; + has_important = has_important || is_important; + +- if (gs_app_is_downloaded (app)) { ++ if (gs_app_is_downloaded (app)) + any_downloaded = TRUE; +- if (is_important) +- any_important_downloaded = TRUE; +- } else { ++ else + all_downloaded = FALSE; +- } + } + + *out_has_important = has_important; +- *out_any_important_downloaded = any_important_downloaded; + *out_all_downloaded = all_downloaded; + *out_any_downloaded = any_downloaded; + } +@@ -193,14 +187,15 @@ should_download_updates (GsUpdateMonitor *monitor) + #endif + } + +-/* The days below are discussed at https://gitlab.gnome.org/GNOME/gnome-software/-/issues/947 */ ++/* The days below are discussed at https://gitlab.gnome.org/GNOME/gnome-software/-/issues/947 ++ and https://wiki.gnome.org/Design/Apps/Software/Updates#Tentative_Design */ + static gboolean + should_notify_about_pending_updates (GsUpdateMonitor *monitor, + GsAppList *apps, + const gchar **out_title, + const gchar **out_body) + { +- gboolean has_important = FALSE, any_important_downloaded = FALSE, all_downloaded = FALSE, any_downloaded = FALSE; ++ gboolean has_important = FALSE, all_downloaded = FALSE, any_downloaded = FALSE; + gboolean should_download, res = FALSE; + gint64 timestamp_days; + +@@ -210,7 +205,7 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, + } + + should_download = should_download_updates (monitor); +- check_updates_kind (apps, &has_important, &any_important_downloaded, &all_downloaded, &any_downloaded); ++ check_updates_kind (apps, &has_important, &all_downloaded, &any_downloaded); + + if (!gs_app_list_length (apps)) { + /* Notify only when the download is disabled and it's the 4th day or it's more than 7 days */ +@@ -221,7 +216,7 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, + } + } else if (has_important) { + if (timestamp_days >= 1) { +- if (any_important_downloaded) { ++ if (all_downloaded) { + *out_title = _("Critical Software Update Ready to Install"); + *out_body = _("An important software update is ready to be installed."); + res = TRUE; +@@ -231,24 +226,23 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, + res = TRUE; + } + } +- /* When automatic updates are on and there are things ready to be installed, then rather claim +- * about things to be installed, than things to be downloaded. */ +- } else if (all_downloaded || (any_downloaded && should_download)) { ++ } else if (all_downloaded) { + if (timestamp_days >= 3) { + *out_title = _("Software Updates Ready to Install"); + *out_body = _("Software updates are waiting and ready to be installed."); + res = TRUE; + } +- /* To not hide downloaded updates for 14 days when new updates were discovered meanwhile */ +- } else if (timestamp_days >= (any_downloaded ? 3 : 14)) { ++ /* To not hide downloaded updates for 14 days when new updates were discovered meanwhile. ++ Never show "Available to Download" when it's supposed to download the updates. */ ++ } else if (!should_download && timestamp_days >= 14) { + *out_title = _("Software Updates Available to Download"); + *out_body = _("Please download waiting software updates."); + res = TRUE; + } + +- g_debug ("%s: last_test_days:%" G_GINT64_FORMAT " n-apps:%u should_download:%d has_important:%d any_important_downloaded:%d " ++ g_debug ("%s: last_test_days:%" G_GINT64_FORMAT " n-apps:%u should_download:%d has_important:%d " + "all_downloaded:%d any_downloaded:%d res:%d%s%s%s%s", G_STRFUNC, +- timestamp_days, gs_app_list_length (apps), should_download, has_important, any_important_downloaded, ++ timestamp_days, gs_app_list_length (apps), should_download, has_important, + all_downloaded, any_downloaded, res, + res ? " reason:" : "", + res ? *out_title : "", +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index b1a88f5..da7f757 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.alpha -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -27,6 +27,12 @@ Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarbal Patch01: 0001-crash-with-broken-theme.patch Patch02: 0002-shell-setup-order.patch +# Fix bug that makes update impossible when "System Updates" present +# Fix issues with notifications and app not matching +# https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1816 +# https://pagure.io/fedora-workstation/issue/107 +# https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/1401 +Patch03: 1401.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -212,6 +218,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Thu Jul 07 2022 Adam Williamson - 43.alpha-2 +- Backport MR #1401 to fix issue #1816 and fedora-workstation #107 + * Fri Jul 01 2022 Milan Crha - 43.alpha-1 - Update to 43.alpha From 9ef98a7975c651ec6fc09f2bbc232caab39ccc79 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 07:03:42 +0000 Subject: [PATCH 052/155] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- gnome-software.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gnome-software.spec b/gnome-software.spec index da7f757..4ba8c34 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.alpha -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -218,6 +218,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 43.alpha-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Thu Jul 07 2022 Adam Williamson - 43.alpha-2 - Backport MR #1401 to fix issue #1816 and fedora-workstation #107 From c73577f732c4268c0c8489045ed86c4661169ab6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 5 Aug 2022 13:54:15 +0200 Subject: [PATCH 053/155] Update to 43.beta --- 0002-shell-setup-order.patch | 129 ------- 1401.patch | 630 ----------------------------------- gnome-software.spec | 19 +- sources | 2 +- 4 files changed, 9 insertions(+), 771 deletions(-) delete mode 100644 0002-shell-setup-order.patch delete mode 100644 1401.patch diff --git a/0002-shell-setup-order.patch b/0002-shell-setup-order.patch deleted file mode 100644 index 37da5c0..0000000 --- a/0002-shell-setup-order.patch +++ /dev/null @@ -1,129 +0,0 @@ -diff -up gnome-software-43.alpha/lib/gs-appstream.c.2 gnome-software-43.alpha/lib/gs-appstream.c ---- gnome-software-43.alpha/lib/gs-appstream.c.2 2022-06-30 20:03:37.000000000 +0200 -+++ gnome-software-43.alpha/lib/gs-appstream.c 2022-07-01 12:01:07.781026426 +0200 -@@ -1648,12 +1648,12 @@ gs_appstream_add_categories (XbSilo *sil - for (guint k = 0; k < groups->len; k++) { - const gchar *group = g_ptr_array_index (groups, k); - guint cnt = gs_appstream_count_component_for_groups (silo, group); -- for (guint l = 0; l < cnt; l++) { -- gs_category_increment_size (parent); -+ if (cnt > 0) { -+ gs_category_increment_size (parent, cnt); - if (children->len > 1) { - /* Parent category has multiple groups, so increment - * each group's size too */ -- gs_category_increment_size (cat); -+ gs_category_increment_size (cat, cnt); - } - } - } -diff -up gnome-software-43.alpha/lib/gs-category.c.2 gnome-software-43.alpha/lib/gs-category.c ---- gnome-software-43.alpha/lib/gs-category.c.2 2022-06-30 20:03:37.000000000 +0200 -+++ gnome-software-43.alpha/lib/gs-category.c 2022-07-01 12:01:07.781026426 +0200 -@@ -147,17 +147,19 @@ gs_category_set_size (GsCategory *catego - /** - * gs_category_increment_size: - * @category: a #GsCategory -+ * @value: how many to add - * -- * Adds one to the size count if an application is available -+ * Adds @value to the size count. - * - * Since: 3.22 - **/ - void --gs_category_increment_size (GsCategory *category) -+gs_category_increment_size (GsCategory *category, -+ guint value) - { - g_return_if_fail (GS_IS_CATEGORY (category)); - -- category->size++; -+ category->size += value; - g_object_notify_by_pspec (G_OBJECT (category), obj_props[PROP_SIZE]); - } - -diff -up gnome-software-43.alpha/lib/gs-category.h.2 gnome-software-43.alpha/lib/gs-category.h ---- gnome-software-43.alpha/lib/gs-category.h.2 2022-06-30 20:03:37.000000000 +0200 -+++ gnome-software-43.alpha/lib/gs-category.h 2022-07-01 12:01:07.781026426 +0200 -@@ -39,6 +39,7 @@ GsCategory *gs_category_find_child (GsC - GPtrArray *gs_category_get_children (GsCategory *category); - - guint gs_category_get_size (GsCategory *category); --void gs_category_increment_size (GsCategory *category); -+void gs_category_increment_size (GsCategory *category, -+ guint value); - - G_END_DECLS -diff -up gnome-software-43.alpha/src/gs-application.c.2 gnome-software-43.alpha/src/gs-application.c ---- gnome-software-43.alpha/src/gs-application.c.2 2022-06-30 20:03:37.000000000 +0200 -+++ gnome-software-43.alpha/src/gs-application.c 2022-07-01 12:02:05.799267693 +0200 -@@ -1036,12 +1036,9 @@ gs_application_startup (GApplication *ap - G_CALLBACK (gs_application_shell_loaded_cb), - app); - -- gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); - app->main_window = GTK_WINDOW (app->shell); - gtk_application_add_window (GTK_APPLICATION (app), app->main_window); - -- app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); -- - gs_application_update_software_sources_presence (application); - - /* Remove possibly obsolete notifications */ -@@ -1067,6 +1064,7 @@ startup_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) - { -+ GsApplication *app = GS_APPLICATION (user_data); - GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object); - g_autoptr(GError) local_error = NULL; - -@@ -1079,6 +1077,11 @@ startup_cb (GObject *source_object, - - /* show the priority of each plugin */ - gs_plugin_loader_dump_state (plugin_loader); -+ -+ /* Setup the shell only after the plugin loader finished its setup, -+ thus all plugins are loaded and ready for the jobs. */ -+ gs_shell_setup (app->shell, app->plugin_loader, app->cancellable); -+ app->update_monitor = gs_update_monitor_new (app, app->plugin_loader); - } - - static void -diff -up gnome-software-43.alpha/src/gs-shell.c.2 gnome-software-43.alpha/src/gs-shell.c ---- gnome-software-43.alpha/src/gs-shell.c.2 2022-06-30 20:03:37.000000000 +0200 -+++ gnome-software-43.alpha/src/gs-shell.c 2022-07-01 12:01:07.782026430 +0200 -@@ -109,6 +109,7 @@ struct _GsShell - GtkWidget *primary_menu; - GtkWidget *sub_page_header_title; - -+ gboolean active_after_setup; - gboolean is_narrow; - guint allocation_changed_cb_id; - -@@ -167,6 +168,12 @@ gs_shell_modal_dialog_present (GsShell * - void - gs_shell_activate (GsShell *shell) - { -+ /* Waiting for plugin loader to setup first */ -+ if (shell->plugin_loader == NULL) { -+ shell->active_after_setup = TRUE; -+ return; -+ } -+ - gtk_widget_show (GTK_WIDGET (shell)); - gtk_window_present (GTK_WINDOW (shell)); - } -@@ -2265,6 +2272,11 @@ gs_shell_setup (GsShell *shell, GsPlugin - if (g_settings_get_boolean (shell->settings, "first-run")) - g_settings_set_boolean (shell->settings, "first-run", FALSE); - } -+ -+ if (shell->active_after_setup) { -+ shell->active_after_setup = FALSE; -+ gs_shell_activate (shell); -+ } - } - - void diff --git a/1401.patch b/1401.patch deleted file mode 100644 index dfe1925..0000000 --- a/1401.patch +++ /dev/null @@ -1,630 +0,0 @@ -From 892acd197630fb3f52ddfac5fc73196ba6759318 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 17:47:11 +0200 -Subject: [PATCH 01/10] plugin-loader: Actively track count of running jobs - -This helps to avoid mistakes when hinting a job finished. ---- - lib/gs-plugin-loader.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index a7f86d5f2..e5c2a2c23 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -56,6 +56,7 @@ struct _GsPluginLoader - GsAppList *pending_apps; /* (nullable) (owned) */ - - GThreadPool *queued_ops_pool; -+ gint active_jobs; - - GSettings *settings; - -@@ -3911,6 +3912,19 @@ cancellable_data_free (CancellableData *data) - - G_DEFINE_AUTOPTR_CLEANUP_FUNC (CancellableData, cancellable_data_free) - -+static void -+plugin_loader_task_freed_cb (gpointer user_data, -+ GObject *freed_object) -+{ -+ g_autoptr(GsPluginLoader) plugin_loader = user_data; -+ if (g_atomic_int_dec_and_test (&plugin_loader->active_jobs)) { -+ /* if the plugin used updates-changed during its job, actually schedule -+ * the signal emission now */ -+ if (plugin_loader->updates_changed_cnt > 0) -+ gs_plugin_loader_updates_changed (plugin_loader); -+ } -+} -+ - static gboolean job_process_setup_complete_cb (GCancellable *cancellable, - gpointer user_data); - static void job_process_cb (GTask *task); -@@ -3977,6 +3991,10 @@ gs_plugin_loader_job_process_async (GsPluginLoader *plugin_loader, - g_task_set_name (task, task_name); - g_task_set_task_data (task, g_object_ref (plugin_job), (GDestroyNotify) g_object_unref); - -+ g_atomic_int_inc (&plugin_loader->active_jobs); -+ g_object_weak_ref (G_OBJECT (task), -+ plugin_loader_task_freed_cb, g_object_ref (plugin_loader)); -+ - /* Wait until the plugin has finished setting up. - * - * Do this using a #GCancellable. While we’re not using the #GCancellable --- -GitLab - - -From 89a3767bd0ad94d3f3d83f8c4ecbb2b79072f536 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 17:51:13 +0200 -Subject: [PATCH 02/10] plugin-loader: Remove obsolete - gs_plugin_loader_hint_job_finished() - -The function is not needed, since the plugin loader tracks count -of active jobs automatically now. ---- - lib/gs-plugin-job-refresh-metadata.c | 5 ----- - lib/gs-plugin-loader.c | 28 ---------------------------- - lib/gs-plugin-loader.h | 2 -- - 3 files changed, 35 deletions(-) - -diff --git a/lib/gs-plugin-job-refresh-metadata.c b/lib/gs-plugin-job-refresh-metadata.c -index a57b194bc..8d0b95b5d 100644 ---- a/lib/gs-plugin-job-refresh-metadata.c -+++ b/lib/gs-plugin-job-refresh-metadata.c -@@ -387,7 +387,6 @@ finish_op (GTask *task, - GError *error) - { - GsPluginJobRefreshMetadata *self = g_task_get_source_object (task); -- GsPluginLoader *plugin_loader = g_task_get_task_data (task); - g_autoptr(GError) error_owned = g_steal_pointer (&error); - g_autofree gchar *job_debug = NULL; - -@@ -408,10 +407,6 @@ finish_op (GTask *task, - progress_cb (self); - g_source_destroy (self->progress_source); - -- /* If any plugin emitted updates-changed, actually schedule it to be -- * emitted now (even if the overall operation failed). */ -- gs_plugin_loader_hint_job_finished (plugin_loader); -- - /* Get the results of the parallel ops. */ - if (self->saved_error != NULL) { - g_task_return_error (task, g_steal_pointer (&self->saved_error)); -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index e5c2a2c23..fc374256d 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -3676,9 +3676,6 @@ gs_plugin_loader_process_thread_cb (GTask *task, - /* sort these again as the refine may have added useful metadata */ - gs_plugin_loader_job_sorted_truncation_again (helper->plugin_job, list); - -- /* Hint that the job has finished. */ -- gs_plugin_loader_hint_job_finished (plugin_loader); -- - #ifdef HAVE_SYSPROF - if (plugin_loader->sysprof_writer != NULL) { - g_autofree gchar *sysprof_name = g_strconcat ("process-thread:", gs_plugin_action_to_string (action), NULL); -@@ -3849,9 +3846,6 @@ run_job_cb (GObject *source_object, - } - #endif /* HAVE_SYSPROF */ - -- /* Hint that the job has finished. */ -- gs_plugin_loader_hint_job_finished (plugin_loader); -- - /* FIXME: This will eventually go away when - * gs_plugin_loader_job_process_finish() is removed. */ - job_class = GS_PLUGIN_JOB_GET_CLASS (plugin_job); -@@ -4459,25 +4453,3 @@ gs_plugin_loader_get_category_manager (GsPluginLoader *plugin_loader) - - return plugin_loader->category_manager; - } -- --/** -- * gs_plugin_loader_hint_job_finished: -- * @plugin_loader: a #GsPluginLoader -- * -- * Hint to the @plugin_loader that the set of changes caused by the current -- * #GsPluginJob is likely to be finished. -- * -- * The @plugin_loader may emit queued-up signals as a result. -- * -- * Since: 42 -- */ --void --gs_plugin_loader_hint_job_finished (GsPluginLoader *plugin_loader) --{ -- g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader)); -- -- /* if the plugin used updates-changed during its job, actually schedule -- * the signal emission now */ -- if (plugin_loader->updates_changed_cnt > 0) -- gs_plugin_loader_updates_changed (plugin_loader); --} -diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h -index 0d2035bfd..bb2c7d8e6 100644 ---- a/lib/gs-plugin-loader.h -+++ b/lib/gs-plugin-loader.h -@@ -126,6 +126,4 @@ gboolean gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader, - void gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, - GsAppList *list); - --void gs_plugin_loader_hint_job_finished (GsPluginLoader *plugin_loader); -- - G_END_DECLS --- -GitLab - - -From 680726fa2fa5b7f39aa86da05f161604a132085f Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 17:55:31 +0200 -Subject: [PATCH 03/10] plugin-loader: Schedule 'updates-changed' signal when - received with no job running - -This helps to avoid a race condition when a plugin calls -updates-changed at the end of the job, but the job is -finished before the callback gets called in the main thread. ---- - lib/gs-plugin-loader.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index fc374256d..d728bfc5c 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -1774,12 +1774,6 @@ gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) - return FALSE; - } - --static void --gs_plugin_loader_job_actions_changed_cb (GsPlugin *plugin, GsPluginLoader *plugin_loader) --{ -- plugin_loader->updates_changed_cnt++; --} -- - static void - gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) - { -@@ -1791,6 +1785,20 @@ gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) - g_object_ref (plugin_loader)); - } - -+static void -+gs_plugin_loader_job_updates_changed_cb (GsPlugin *plugin, -+ GsPluginLoader *plugin_loader) -+{ -+ plugin_loader->updates_changed_cnt++; -+ -+ /* Schedule emit of updates changed when no job is active. -+ This helps to avoid a race condition when a plugin calls -+ updates-changed at the end of the job, but the job is -+ finished before the callback gets called in the main thread. */ -+ if (!g_atomic_int_get (&plugin_loader->active_jobs)) -+ gs_plugin_loader_updates_changed (plugin_loader); -+} -+ - static gboolean - gs_plugin_loader_reload_delay_cb (gpointer user_data) - { -@@ -1849,7 +1857,7 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader, - return; - } - g_signal_connect (plugin, "updates-changed", -- G_CALLBACK (gs_plugin_loader_job_actions_changed_cb), -+ G_CALLBACK (gs_plugin_loader_job_updates_changed_cb), - plugin_loader); - g_signal_connect (plugin, "reload", - G_CALLBACK (gs_plugin_loader_reload_cb), --- -GitLab - - -From 3c915f31197addf8becf9aa62a07dae35b440044 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 17:58:32 +0200 -Subject: [PATCH 04/10] plugin-loader: Change how updates-checked is scheduled - for emission - -This way the GSource can be removed without leaking the plugin loader. ---- - lib/gs-plugin-loader.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index d728bfc5c..9f64a3559 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -1760,7 +1760,7 @@ gs_plugin_loader_ask_untrusted_cb (GsPlugin *plugin, - } - - static gboolean --gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) -+gs_plugin_loader_job_updates_changed_delay_cb (gpointer user_data) - { - GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (user_data); - -@@ -1770,7 +1770,6 @@ gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data) - plugin_loader->updates_changed_id = 0; - plugin_loader->updates_changed_cnt = 0; - -- g_object_unref (plugin_loader); - return FALSE; - } - -@@ -1780,9 +1779,11 @@ gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader) - if (plugin_loader->updates_changed_id != 0) - return; - plugin_loader->updates_changed_id = -- g_timeout_add_seconds (GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY, -- gs_plugin_loader_job_actions_changed_delay_cb, -- g_object_ref (plugin_loader)); -+ g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, -+ GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY, -+ gs_plugin_loader_job_updates_changed_delay_cb, -+ g_object_ref (plugin_loader), -+ g_object_unref); - } - - static void --- -GitLab - - -From 2930c01ee97a10577fa2860bd8df1124cfb7128d Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:02:11 +0200 -Subject: [PATCH 05/10] plugin-loader: Add - gs_plugin_loader_emit_updates_changed() - -It will help to avoid delays with the GUI after changes in the updates. ---- - lib/gs-plugin-loader.c | 23 +++++++++++++++++++++++ - lib/gs-plugin-loader.h | 1 + - 2 files changed, 24 insertions(+) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index 9f64a3559..c0e711477 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -4462,3 +4462,26 @@ gs_plugin_loader_get_category_manager (GsPluginLoader *plugin_loader) - - return plugin_loader->category_manager; - } -+ -+/** -+ * gs_plugin_loader_emit_updates_changed: -+ * @self: a #GsPluginLoader -+ * -+ * Emits the #GsPluginLoader:updates-changed signal in the nearest -+ * idle in the main thread. -+ * -+ * Since: 43 -+ **/ -+void -+gs_plugin_loader_emit_updates_changed (GsPluginLoader *self) -+{ -+ g_return_if_fail (GS_IS_PLUGIN_LOADER (self)); -+ -+ if (self->updates_changed_id != 0) -+ g_source_remove (self->updates_changed_id); -+ -+ self->updates_changed_id = -+ g_idle_add_full (G_PRIORITY_HIGH_IDLE, -+ gs_plugin_loader_job_updates_changed_delay_cb, -+ g_object_ref (self), g_object_unref); -+} -diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h -index bb2c7d8e6..91c5f643c 100644 ---- a/lib/gs-plugin-loader.h -+++ b/lib/gs-plugin-loader.h -@@ -125,5 +125,6 @@ gboolean gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader, - - void gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, - GsAppList *list); -+void gs_plugin_loader_emit_updates_changed (GsPluginLoader *self); - - G_END_DECLS --- -GitLab - - -From edfbbfb0be112b76becc1f38c920cfd45a95885c Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:05:38 +0200 -Subject: [PATCH 06/10] gs-app: Add gs_app_is_downloaded() - -This avoid code duplication on two places. It also makes sure the places -agree on the way the app is/is-not downloaded is determined. ---- - lib/gs-app.c | 32 ++++++++++++++++++++++++++++++++ - lib/gs-app.h | 1 + - 2 files changed, 33 insertions(+) - -diff --git a/lib/gs-app.c b/lib/gs-app.c -index 29898765b..d7f8be279 100644 ---- a/lib/gs-app.c -+++ b/lib/gs-app.c -@@ -6656,3 +6656,35 @@ gs_app_set_has_translations (GsApp *app, - priv->has_translations = has_translations; - gs_app_queue_notify (app, obj_props[PROP_HAS_TRANSLATIONS]); - } -+ -+/** -+ * gs_app_is_downloaded: -+ * @app: a #GsApp -+ * -+ * Returns whether the @app is downloaded for updates or not, -+ * considering also its dependencies. -+ * -+ * Returns: %TRUE, when the @app is downloaded, %FALSE otherwise -+ * -+ * Since: 43 -+ **/ -+gboolean -+gs_app_is_downloaded (GsApp *app) -+{ -+ GsSizeType size_type; -+ guint64 size_bytes = 0; -+ -+ g_return_val_if_fail (GS_IS_APP (app), FALSE); -+ -+ if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_PROXY)) { -+ size_type = gs_app_get_size_download (app, &size_bytes); -+ if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) -+ return FALSE; -+ } -+ -+ size_type = gs_app_get_size_download_dependencies (app, &size_bytes); -+ if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) -+ return FALSE; -+ -+ return TRUE; -+} -diff --git a/lib/gs-app.h b/lib/gs-app.h -index d78503c3e..a053299f2 100644 ---- a/lib/gs-app.h -+++ b/lib/gs-app.h -@@ -516,5 +516,6 @@ void gs_app_set_relations (GsApp *app, - gboolean gs_app_get_has_translations (GsApp *app); - void gs_app_set_has_translations (GsApp *app, - gboolean has_translations); -+gboolean gs_app_is_downloaded (GsApp *app); - - G_END_DECLS --- -GitLab - - -From c6903fd6b74ddbde5db045ea67fc826824153210 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:15:04 +0200 -Subject: [PATCH 07/10] updates-section: Use gs_app_is_downloaded() - ---- - src/gs-updates-section.c | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c -index ca39e6fab..69e083984 100644 ---- a/src/gs-updates-section.c -+++ b/src/gs-updates-section.c -@@ -288,15 +288,7 @@ _all_offline_updates_downloaded (GsUpdatesSection *self) - /* use the download size to figure out what is downloaded and what not */ - for (guint i = 0; i < gs_app_list_length (self->list); i++) { - GsApp *app = gs_app_list_index (self->list, i); -- GsSizeType size_type; -- guint64 size_bytes; -- -- size_type = gs_app_get_size_download (app, &size_bytes); -- if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) -- return FALSE; -- -- size_type = gs_app_get_size_download_dependencies (app, &size_bytes); -- if (size_type != GS_SIZE_TYPE_VALID || size_bytes != 0) -+ if (!gs_app_is_downloaded (app)) - return FALSE; - } - --- -GitLab - - -From 972def24d2bc54b09fe57879efb4c30962858dc0 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:15:25 +0200 -Subject: [PATCH 08/10] update-monitor: Use gs_app_is_downloaded() - ---- - src/gs-update-monitor.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c -index 324ff4d3e..a2dc9bb92 100644 ---- a/src/gs-update-monitor.c -+++ b/src/gs-update-monitor.c -@@ -125,22 +125,18 @@ check_updates_kind (GsAppList *apps, - - for (ii = 0; ii < len && (!has_important || all_downloaded || !any_downloaded); ii++) { - gboolean is_important; -- guint64 size_download_bytes; - - app = gs_app_list_index (apps, ii); - - is_important = gs_app_get_update_urgency (app) == AS_URGENCY_KIND_CRITICAL; - has_important = has_important || is_important; - -- /* took from gs-updates-section.c: _all_offline_updates_downloaded(); -- the app is considered downloaded, when its download size is 0 */ -- if (gs_app_get_size_download (app, &size_download_bytes) != GS_SIZE_TYPE_VALID || -- size_download_bytes != 0) { -- all_downloaded = FALSE; -- } else { -+ if (gs_app_is_downloaded (app)) { - any_downloaded = TRUE; - if (is_important) - any_important_downloaded = TRUE; -+ } else { -+ all_downloaded = FALSE; - } - } - --- -GitLab - - -From 1aaa9617fc81651f17ed2f864bec35b958d67eed Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:17:18 +0200 -Subject: [PATCH 09/10] update-monitor: Force reload of the Updates page before - showing notification - -Thus it reflects what the update-monitor notifies about. ---- - src/gs-update-monitor.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c -index a2dc9bb92..01e5869eb 100644 ---- a/src/gs-update-monitor.c -+++ b/src/gs-update-monitor.c -@@ -288,6 +288,10 @@ notify_about_pending_updates (GsUpdateMonitor *monitor, - return; - } - -+ /* To force reload of the Updates page, thus it reflects what -+ the update-monitor notifies about */ -+ gs_plugin_loader_emit_updates_changed (monitor->plugin_loader); -+ - monitor->last_notification_time_usec = g_get_real_time (); - - g_debug ("Notify about update: '%s'", title); --- -GitLab - - -From 64585205437371c459d5de792d50af95e23ba346 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 15 Jun 2022 18:19:36 +0200 -Subject: [PATCH 10/10] update-monitor: Change when notifications are shown - -This handles the fact that offline updates can be installed either -all in once or none of them, which is reflected in the notification. ---- - src/gs-update-monitor.c | 34 ++++++++++++++-------------------- - 1 file changed, 14 insertions(+), 20 deletions(-) - -diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c -index 01e5869eb..292d2bc4b 100644 ---- a/src/gs-update-monitor.c -+++ b/src/gs-update-monitor.c -@@ -109,17 +109,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(WithAppData, with_app_data_free); - static void - check_updates_kind (GsAppList *apps, - gboolean *out_has_important, -- gboolean *out_any_important_downloaded, - gboolean *out_all_downloaded, - gboolean *out_any_downloaded) - { -- gboolean has_important, any_important_downloaded, all_downloaded, any_downloaded; -+ gboolean has_important, all_downloaded, any_downloaded; - guint ii, len; - GsApp *app; - - len = gs_app_list_length (apps); - has_important = FALSE; -- any_important_downloaded = FALSE; - all_downloaded = len > 0; - any_downloaded = FALSE; - -@@ -131,17 +129,13 @@ check_updates_kind (GsAppList *apps, - is_important = gs_app_get_update_urgency (app) == AS_URGENCY_KIND_CRITICAL; - has_important = has_important || is_important; - -- if (gs_app_is_downloaded (app)) { -+ if (gs_app_is_downloaded (app)) - any_downloaded = TRUE; -- if (is_important) -- any_important_downloaded = TRUE; -- } else { -+ else - all_downloaded = FALSE; -- } - } - - *out_has_important = has_important; -- *out_any_important_downloaded = any_important_downloaded; - *out_all_downloaded = all_downloaded; - *out_any_downloaded = any_downloaded; - } -@@ -193,14 +187,15 @@ should_download_updates (GsUpdateMonitor *monitor) - #endif - } - --/* The days below are discussed at https://gitlab.gnome.org/GNOME/gnome-software/-/issues/947 */ -+/* The days below are discussed at https://gitlab.gnome.org/GNOME/gnome-software/-/issues/947 -+ and https://wiki.gnome.org/Design/Apps/Software/Updates#Tentative_Design */ - static gboolean - should_notify_about_pending_updates (GsUpdateMonitor *monitor, - GsAppList *apps, - const gchar **out_title, - const gchar **out_body) - { -- gboolean has_important = FALSE, any_important_downloaded = FALSE, all_downloaded = FALSE, any_downloaded = FALSE; -+ gboolean has_important = FALSE, all_downloaded = FALSE, any_downloaded = FALSE; - gboolean should_download, res = FALSE; - gint64 timestamp_days; - -@@ -210,7 +205,7 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, - } - - should_download = should_download_updates (monitor); -- check_updates_kind (apps, &has_important, &any_important_downloaded, &all_downloaded, &any_downloaded); -+ check_updates_kind (apps, &has_important, &all_downloaded, &any_downloaded); - - if (!gs_app_list_length (apps)) { - /* Notify only when the download is disabled and it's the 4th day or it's more than 7 days */ -@@ -221,7 +216,7 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, - } - } else if (has_important) { - if (timestamp_days >= 1) { -- if (any_important_downloaded) { -+ if (all_downloaded) { - *out_title = _("Critical Software Update Ready to Install"); - *out_body = _("An important software update is ready to be installed."); - res = TRUE; -@@ -231,24 +226,23 @@ should_notify_about_pending_updates (GsUpdateMonitor *monitor, - res = TRUE; - } - } -- /* When automatic updates are on and there are things ready to be installed, then rather claim -- * about things to be installed, than things to be downloaded. */ -- } else if (all_downloaded || (any_downloaded && should_download)) { -+ } else if (all_downloaded) { - if (timestamp_days >= 3) { - *out_title = _("Software Updates Ready to Install"); - *out_body = _("Software updates are waiting and ready to be installed."); - res = TRUE; - } -- /* To not hide downloaded updates for 14 days when new updates were discovered meanwhile */ -- } else if (timestamp_days >= (any_downloaded ? 3 : 14)) { -+ /* To not hide downloaded updates for 14 days when new updates were discovered meanwhile. -+ Never show "Available to Download" when it's supposed to download the updates. */ -+ } else if (!should_download && timestamp_days >= 14) { - *out_title = _("Software Updates Available to Download"); - *out_body = _("Please download waiting software updates."); - res = TRUE; - } - -- g_debug ("%s: last_test_days:%" G_GINT64_FORMAT " n-apps:%u should_download:%d has_important:%d any_important_downloaded:%d " -+ g_debug ("%s: last_test_days:%" G_GINT64_FORMAT " n-apps:%u should_download:%d has_important:%d " - "all_downloaded:%d any_downloaded:%d res:%d%s%s%s%s", G_STRFUNC, -- timestamp_days, gs_app_list_length (apps), should_download, has_important, any_important_downloaded, -+ timestamp_days, gs_app_list_length (apps), should_download, has_important, - all_downloaded, any_downloaded, res, - res ? " reason:" : "", - res ? *out_title : "", --- -GitLab - diff --git a/gnome-software.spec b/gnome-software.spec index 4ba8c34..59d9ebe 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -17,8 +17,8 @@ %global __provides_exclude_from ^%{_libdir}/%{name}/plugins-%{gs_plugin_version}/.*\\.so.*$ Name: gnome-software -Version: 43.alpha -Release: 3%{?dist} +Version: 43.beta +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,13 +26,6 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch -Patch02: 0002-shell-setup-order.patch -# Fix bug that makes update impossible when "System Updates" present -# Fix issues with notifications and app not matching -# https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1816 -# https://pagure.io/fedora-workstation/issue/107 -# https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/1401 -Patch03: 1401.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -136,6 +129,9 @@ This package includes the rpm-ostree backend. # remove unneeded dpkg plugin rm %{buildroot}%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_dpkg.so +# not meant to be installed by the distros +rm %{buildroot}%{_datadir}/swcatalog/xml/org.gnome.Software.Curated.xml + # make the software center load faster desktop-file-edit %{buildroot}%{_datadir}/applications/org.gnome.Software.desktop \ --set-key=X-AppInstall-Package --set-value=%{name} @@ -166,7 +162,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg %{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg %{_datadir}/icons/hicolor/scalable/actions/app-remove-symbolic.svg -%{_datadir}/icons/hicolor/scalable/status/software-installed-symbolic.svg %{_datadir}/metainfo/org.gnome.Software.metainfo.xml %{_datadir}/metainfo/org.gnome.Software.Plugin.Epiphany.metainfo.xml %{_datadir}/metainfo/org.gnome.Software.Plugin.Flatpak.metainfo.xml @@ -195,7 +190,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %dir %{_datadir}/swcatalog %dir %{_datadir}/swcatalog/xml %{_datadir}/swcatalog/xml/gnome-pwa-list-foss.xml -%{_datadir}/swcatalog/xml/org.gnome.Software.Curated.xml %{_datadir}/swcatalog/xml/org.gnome.Software.Featured.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service %{_datadir}/dbus-1/services/org.gnome.Software.service @@ -218,6 +212,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Fri Aug 05 2022 Milan Crha - 43.beta-1 +- Update to 43.beta + * Thu Jul 21 2022 Fedora Release Engineering - 43.alpha-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 5bbe6b2..27a6c41 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-43.alpha.tar.xz) = 796b77e763f0ad0c8103b39563ce792b9354126762594addba38a993628f273938a27ed09b9d3c469fb9d11d7a86502960faf9c88914347ec5263e0f626dbb1e +SHA512 (gnome-software-43.beta.tar.xz) = 9dd2d1f3bebf4715dfbe4db636ca068ac53ae4d463d20f02421eb2990edc75e3b29b78436b8539027056042b6dda2ff55e9d6add1c5c9f8693899ce7a80065de From a0175cb9f497b5145d5d0b95ebb9830f637358e1 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Aug 2022 13:37:14 +0200 Subject: [PATCH 054/155] Add patch for install-queue (RH bug #2118265) --- 0002-install-queue.patch | 112 +++++++++++++++++++++++++++++++++++++++ gnome-software.spec | 6 ++- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 0002-install-queue.patch diff --git a/0002-install-queue.patch b/0002-install-queue.patch new file mode 100644 index 0000000..698d1d0 --- /dev/null +++ b/0002-install-queue.patch @@ -0,0 +1,112 @@ +From d9e28b8cb59c805f2df8954637f2056467ff1be3 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 10 Aug 2022 13:41:46 +0200 +Subject: [PATCH 1/2] packagekit: Allow install of apps in the "queued for + install" state + +Treat the "queued for install" state the same as if "available/updatable" +state is set. Without that trying to install anything using PackageKit +plugin leads to an "Unsupported" error. +--- + plugins/packagekit/gs-plugin-packagekit.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c +index 58d627276..85f941648 100644 +--- a/plugins/packagekit/gs-plugin-packagekit.c ++++ b/plugins/packagekit/gs-plugin-packagekit.c +@@ -519,6 +519,7 @@ gs_plugin_app_install (GsPlugin *plugin, + switch (gs_app_get_state (app)) { + case GS_APP_STATE_AVAILABLE: + case GS_APP_STATE_UPDATABLE: ++ case GS_APP_STATE_QUEUED_FOR_INSTALL: + source_ids = gs_app_get_source_ids (app); + if (source_ids->len == 0) { + g_set_error_literal (error, +-- +GitLab + + +From 71ce53a21373670f32b936194d46ab073df77a63 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 10 Aug 2022 14:24:51 +0200 +Subject: [PATCH 2/2] gs-plugin-loader: Add not removed from the install-queue + file + +The plugin loader has two places, which maintain the pending queue, +but they do not agree on the update of the install-queue file. Let +the functions be re-used, to avoid the problem. +--- + lib/gs-plugin-loader.c | 27 +++++++++++++++++---------- + 1 file changed, 17 insertions(+), 10 deletions(-) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index 073008d55..e3f48666a 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -88,6 +88,7 @@ struct _GsPluginLoader + + static void gs_plugin_loader_monitor_network (GsPluginLoader *plugin_loader); + static void add_app_to_install_queue (GsPluginLoader *plugin_loader, GsApp *app); ++static gboolean remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app); + static void gs_plugin_loader_process_in_thread_pool_cb (gpointer data, gpointer user_data); + static void gs_plugin_loader_status_changed_cb (GsPlugin *plugin, + GsApp *app, +@@ -1078,17 +1079,22 @@ gs_plugin_loader_pending_apps_add (GsPluginLoader *plugin_loader, + GsPluginLoaderHelper *helper) + { + GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); +- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); +- +- if (plugin_loader->pending_apps == NULL) +- plugin_loader->pending_apps = gs_app_list_new (); + + g_assert (gs_app_list_length (list) > 0); + for (guint i = 0; i < gs_app_list_length (list); i++) { + GsApp *app = gs_app_list_index (list, i); +- gs_app_list_add (plugin_loader->pending_apps, app); +- /* make sure the progress is properly initialized */ +- gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); ++ switch (gs_plugin_job_get_action (helper->plugin_job)) { ++ case GS_PLUGIN_ACTION_INSTALL: ++ add_app_to_install_queue (plugin_loader, app); ++ /* make sure the progress is properly initialized */ ++ gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); ++ break; ++ case GS_PLUGIN_ACTION_REMOVE: ++ remove_app_from_install_queue (plugin_loader, app); ++ break; ++ default: ++ break; ++ } + } + g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); + } +@@ -1098,13 +1104,11 @@ gs_plugin_loader_pending_apps_remove (GsPluginLoader *plugin_loader, + GsPluginLoaderHelper *helper) + { + GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); +- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); + + g_assert (gs_app_list_length (list) > 0); + for (guint i = 0; i < gs_app_list_length (list); i++) { + GsApp *app = gs_app_list_index (list, i); +- if (plugin_loader->pending_apps != NULL) +- gs_app_list_remove (plugin_loader->pending_apps, app); ++ remove_app_from_install_queue (plugin_loader, app); + + /* check the app is not still in an action helper */ + switch (gs_app_get_state (app)) { +@@ -1272,6 +1276,9 @@ remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app) + g_mutex_unlock (&plugin_loader->pending_apps_mutex); + + if (ret) { ++ if (gs_app_get_state (app) == GS_APP_STATE_QUEUED_FOR_INSTALL) ++ gs_app_set_state (app, GS_APP_STATE_UNKNOWN); ++ + id = g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); + g_source_set_name_by_id (id, "[gnome-software] emit_pending_apps_idle"); + save_install_queue (plugin_loader); +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 59d9ebe..e141c89 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.beta -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,6 +26,7 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 0002-install-queue.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -212,6 +213,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Mon Aug 15 2022 Milan Crha - 43.beta-2 +- Add patch for install-queue + * Fri Aug 05 2022 Milan Crha - 43.beta-1 - Update to 43.beta From 6a61ae4b2d97cf5a3905bd6da6efc88538a9087d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 17 Aug 2022 15:52:58 +0200 Subject: [PATCH 055/155] Resolves: #2119089 (No enough apps to show for the "Editor's Choice" section) --- gnome-software.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gnome-software.spec b/gnome-software.spec index e141c89..cd0dec2 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.beta -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -130,9 +130,6 @@ This package includes the rpm-ostree backend. # remove unneeded dpkg plugin rm %{buildroot}%{_libdir}/gnome-software/plugins-%{gs_plugin_version}/libgs_plugin_dpkg.so -# not meant to be installed by the distros -rm %{buildroot}%{_datadir}/swcatalog/xml/org.gnome.Software.Curated.xml - # make the software center load faster desktop-file-edit %{buildroot}%{_datadir}/applications/org.gnome.Software.desktop \ --set-key=X-AppInstall-Package --set-value=%{name} @@ -191,6 +188,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %dir %{_datadir}/swcatalog %dir %{_datadir}/swcatalog/xml %{_datadir}/swcatalog/xml/gnome-pwa-list-foss.xml +%{_datadir}/swcatalog/xml/org.gnome.Software.Curated.xml %{_datadir}/swcatalog/xml/org.gnome.Software.Featured.xml %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service %{_datadir}/dbus-1/services/org.gnome.Software.service @@ -213,6 +211,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Wed Aug 17 2022 Milan Crha - 43.beta-3 +- Resolves: #2119089 (No enough apps to show for the "Editor's Choice" section) + * Mon Aug 15 2022 Milan Crha - 43.beta-2 - Add patch for install-queue From f744223b09eef29afe8c6084e973bc4c99d43110 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 18 Aug 2022 07:37:04 +0200 Subject: [PATCH 056/155] Add rpminspect.yaml (settings for the RUNPATH test) --- rpminspect.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 rpminspect.yaml diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..ef70fcd --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,7 @@ +--- +runpath: + allowed_paths: + - /usr/lib/gnome-software + - /usr/lib/rpm-ostree + - /usr/lib64/gnome-software + - /usr/lib64/rpm-ostree From 17177232497d1c236a81f7d699853b5e2cb4f3b2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 2 Sep 2022 10:51:15 +0200 Subject: [PATCH 057/155] Update to 43.rc --- 0002-install-queue.patch | 112 --------------------------------------- gnome-software.spec | 13 +++-- sources | 2 +- 3 files changed, 9 insertions(+), 118 deletions(-) delete mode 100644 0002-install-queue.patch diff --git a/0002-install-queue.patch b/0002-install-queue.patch deleted file mode 100644 index 698d1d0..0000000 --- a/0002-install-queue.patch +++ /dev/null @@ -1,112 +0,0 @@ -From d9e28b8cb59c805f2df8954637f2056467ff1be3 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 10 Aug 2022 13:41:46 +0200 -Subject: [PATCH 1/2] packagekit: Allow install of apps in the "queued for - install" state - -Treat the "queued for install" state the same as if "available/updatable" -state is set. Without that trying to install anything using PackageKit -plugin leads to an "Unsupported" error. ---- - plugins/packagekit/gs-plugin-packagekit.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c -index 58d627276..85f941648 100644 ---- a/plugins/packagekit/gs-plugin-packagekit.c -+++ b/plugins/packagekit/gs-plugin-packagekit.c -@@ -519,6 +519,7 @@ gs_plugin_app_install (GsPlugin *plugin, - switch (gs_app_get_state (app)) { - case GS_APP_STATE_AVAILABLE: - case GS_APP_STATE_UPDATABLE: -+ case GS_APP_STATE_QUEUED_FOR_INSTALL: - source_ids = gs_app_get_source_ids (app); - if (source_ids->len == 0) { - g_set_error_literal (error, --- -GitLab - - -From 71ce53a21373670f32b936194d46ab073df77a63 Mon Sep 17 00:00:00 2001 -From: Milan Crha -Date: Wed, 10 Aug 2022 14:24:51 +0200 -Subject: [PATCH 2/2] gs-plugin-loader: Add not removed from the install-queue - file - -The plugin loader has two places, which maintain the pending queue, -but they do not agree on the update of the install-queue file. Let -the functions be re-used, to avoid the problem. ---- - lib/gs-plugin-loader.c | 27 +++++++++++++++++---------- - 1 file changed, 17 insertions(+), 10 deletions(-) - -diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c -index 073008d55..e3f48666a 100644 ---- a/lib/gs-plugin-loader.c -+++ b/lib/gs-plugin-loader.c -@@ -88,6 +88,7 @@ struct _GsPluginLoader - - static void gs_plugin_loader_monitor_network (GsPluginLoader *plugin_loader); - static void add_app_to_install_queue (GsPluginLoader *plugin_loader, GsApp *app); -+static gboolean remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app); - static void gs_plugin_loader_process_in_thread_pool_cb (gpointer data, gpointer user_data); - static void gs_plugin_loader_status_changed_cb (GsPlugin *plugin, - GsApp *app, -@@ -1078,17 +1079,22 @@ gs_plugin_loader_pending_apps_add (GsPluginLoader *plugin_loader, - GsPluginLoaderHelper *helper) - { - GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); -- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); -- -- if (plugin_loader->pending_apps == NULL) -- plugin_loader->pending_apps = gs_app_list_new (); - - g_assert (gs_app_list_length (list) > 0); - for (guint i = 0; i < gs_app_list_length (list); i++) { - GsApp *app = gs_app_list_index (list, i); -- gs_app_list_add (plugin_loader->pending_apps, app); -- /* make sure the progress is properly initialized */ -- gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); -+ switch (gs_plugin_job_get_action (helper->plugin_job)) { -+ case GS_PLUGIN_ACTION_INSTALL: -+ add_app_to_install_queue (plugin_loader, app); -+ /* make sure the progress is properly initialized */ -+ gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); -+ break; -+ case GS_PLUGIN_ACTION_REMOVE: -+ remove_app_from_install_queue (plugin_loader, app); -+ break; -+ default: -+ break; -+ } - } - g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); - } -@@ -1098,13 +1104,11 @@ gs_plugin_loader_pending_apps_remove (GsPluginLoader *plugin_loader, - GsPluginLoaderHelper *helper) - { - GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); -- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); - - g_assert (gs_app_list_length (list) > 0); - for (guint i = 0; i < gs_app_list_length (list); i++) { - GsApp *app = gs_app_list_index (list, i); -- if (plugin_loader->pending_apps != NULL) -- gs_app_list_remove (plugin_loader->pending_apps, app); -+ remove_app_from_install_queue (plugin_loader, app); - - /* check the app is not still in an action helper */ - switch (gs_app_get_state (app)) { -@@ -1272,6 +1276,9 @@ remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app) - g_mutex_unlock (&plugin_loader->pending_apps_mutex); - - if (ret) { -+ if (gs_app_get_state (app) == GS_APP_STATE_QUEUED_FOR_INSTALL) -+ gs_app_set_state (app, GS_APP_STATE_UNKNOWN); -+ - id = g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); - g_source_set_name_by_id (id, "[gnome-software] emit_pending_apps_idle"); - save_install_queue (plugin_loader); --- -GitLab - diff --git a/gnome-software.spec b/gnome-software.spec index cd0dec2..9545378 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -17,8 +17,8 @@ %global __provides_exclude_from ^%{_libdir}/%{name}/plugins-%{gs_plugin_version}/.*\\.so.*$ Name: gnome-software -Version: 43.beta -Release: 3%{?dist} +Version: 43.rc +Release: 1%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,7 +26,6 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch -Patch02: 0002-install-queue.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -56,7 +55,6 @@ BuildRequires: pkgconfig(polkit-gobject-1) BuildRequires: pkgconfig(rpm) BuildRequires: pkgconfig(rpm-ostree-1) BuildRequires: pkgconfig(sysprof-capture-4) -BuildRequires: pkgconfig(valgrind) BuildRequires: pkgconfig(xmlb) >= %{libxmlb_version} Requires: appstream-data @@ -154,7 +152,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %doc AUTHORS README.md %license COPYING %{_bindir}/gnome-software -%{_datadir}/applications/gnome-software-local-file.desktop +%{_datadir}/applications/gnome-software-local-file-flatpak.desktop +%{_datadir}/applications/gnome-software-local-file-fwupd.desktop +%{_datadir}/applications/gnome-software-local-file-packagekit.desktop %{_datadir}/applications/org.gnome.Software.desktop %{_mandir}/man1/gnome-software.1* %{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg @@ -211,6 +211,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Fri Sep 02 2022 Milan Crha - 43.rc-1 +- Update to 43.rc + * Wed Aug 17 2022 Milan Crha - 43.beta-3 - Resolves: #2119089 (No enough apps to show for the "Editor's Choice" section) diff --git a/sources b/sources index 27a6c41..edd91e5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gnome-software-43.beta.tar.xz) = 9dd2d1f3bebf4715dfbe4db636ca068ac53ae4d463d20f02421eb2990edc75e3b29b78436b8539027056042b6dda2ff55e9d6add1c5c9f8693899ce7a80065de +SHA512 (gnome-software-43.rc.tar.xz) = b843e30ad842500cbab19ce32566162961ce50d7ef2e4a9f7cdf969acb2ce074de6928dfa8c3813a1e89fb91868d7fc17daa6e9c36db7c45255e6e8b80552340 From 7e83c917c222d8507184dee6d938fcc3704671a5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 12 Sep 2022 09:02:05 +0200 Subject: [PATCH 058/155] 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 @@ + + +