From 122d8ac6032e942f632d10ada11f30d0207df4d3 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 12 May 2020 20:25:53 +0200 Subject: [PATCH] Backport various rpm-ostree backend fixes --- ...issing-locking-when-creating-DnfCont.patch | 27 +++++ ...ctly-mark-layered-local-packages-as-.patch | 64 +++++++++++ ...up-the-progress-info-required-for-th.patch | 106 ++++++++++++++++++ gnome-software.spec | 9 +- 4 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 0001-rpm-ostree-Add-missing-locking-when-creating-DnfCont.patch create mode 100644 0002-rpm-ostree-Correctly-mark-layered-local-packages-as-.patch create mode 100644 0003-rpm-ostree-Hook-up-the-progress-info-required-for-th.patch diff --git a/0001-rpm-ostree-Add-missing-locking-when-creating-DnfCont.patch b/0001-rpm-ostree-Add-missing-locking-when-creating-DnfCont.patch new file mode 100644 index 0000000..7729d39 --- /dev/null +++ b/0001-rpm-ostree-Add-missing-locking-when-creating-DnfCont.patch @@ -0,0 +1,27 @@ +From 33c980fb6fc0b0ad8206ffd39cf789447831518a Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Tue, 12 May 2020 10:18:43 +0200 +Subject: [PATCH 1/3] rpm-ostree: Add missing locking when creating DnfContext + +Fixes https://gitlab.gnome.org/GNOME/gnome-software/issues/983 +--- + plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +index 3811f935..f2c33484 100644 +--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c ++++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +@@ -657,6 +657,9 @@ gs_plugin_refresh (GsPlugin *plugin, + GError **error) + { + GsPluginData *priv = gs_plugin_get_data (plugin); ++ g_autoptr(GMutexLocker) locker = NULL; ++ ++ locker = g_mutex_locker_new (&priv->mutex); + + if (!ensure_rpmostree_dnf_context (plugin, cancellable, error)) + return FALSE; +-- +2.26.2 + diff --git a/0002-rpm-ostree-Correctly-mark-layered-local-packages-as-.patch b/0002-rpm-ostree-Correctly-mark-layered-local-packages-as-.patch new file mode 100644 index 0000000..5efd58f --- /dev/null +++ b/0002-rpm-ostree-Correctly-mark-layered-local-packages-as-.patch @@ -0,0 +1,64 @@ +From 1d74bd249459f5a6768ce0642538f2ff395543c8 Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Tue, 12 May 2020 15:13:41 +0200 +Subject: [PATCH 2/3] rpm-ostree: Correctly mark layered local packages as + removable + +Fixes https://gitlab.gnome.org/GNOME/gnome-software/issues/984 +--- + plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +index f2c33484..e3824df1 100644 +--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c ++++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +@@ -1251,6 +1251,7 @@ static gboolean + resolve_installed_packages_app (GsPlugin *plugin, + GPtrArray *pkglist, + gchar **layered_packages, ++ gchar **layered_local_packages, + GsApp *app) + { + for (guint i = 0; i < pkglist->len; i++) { +@@ -1260,7 +1261,9 @@ resolve_installed_packages_app (GsPlugin *plugin, + if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) + gs_app_set_state (app, AS_APP_STATE_INSTALLED); + if (g_strv_contains ((const gchar * const *) layered_packages, +- rpm_ostree_package_get_name (pkg))) { ++ rpm_ostree_package_get_name (pkg)) || ++ g_strv_contains ((const gchar * const *) layered_local_packages, ++ rpm_ostree_package_get_nevra (pkg))) { + /* layered packages can always be removed */ + gs_app_remove_quirk (app, GS_APP_QUIRK_COMPULSORY); + } else { +@@ -1389,6 +1392,7 @@ gs_plugin_refine (GsPlugin *plugin, + g_autoptr(GPtrArray) pkglist = NULL; + g_autoptr(GVariant) default_deployment = NULL; + g_auto(GStrv) layered_packages = NULL; ++ g_auto(GStrv) layered_local_packages = NULL; + g_autofree gchar *checksum = NULL; + + locker = g_mutex_locker_new (&priv->mutex); +@@ -1403,6 +1407,9 @@ gs_plugin_refine (GsPlugin *plugin, + g_assert (g_variant_lookup (default_deployment, + "packages", "^as", + &layered_packages)); ++ g_assert (g_variant_lookup (default_deployment, ++ "requested-local-packages", "^as", ++ &layered_local_packages)); + g_assert (g_variant_lookup (default_deployment, + "checksum", "s", + &checksum)); +@@ -1442,7 +1449,7 @@ gs_plugin_refine (GsPlugin *plugin, + continue; + + /* first try to resolve from installed packages */ +- found = resolve_installed_packages_app (plugin, pkglist, layered_packages, app); ++ found = resolve_installed_packages_app (plugin, pkglist, layered_packages, layered_local_packages, app); + + /* if we didn't find anything, try resolving from available packages */ + if (!found && priv->dnf_context != NULL) +-- +2.26.2 + diff --git a/0003-rpm-ostree-Hook-up-the-progress-info-required-for-th.patch b/0003-rpm-ostree-Hook-up-the-progress-info-required-for-th.patch new file mode 100644 index 0000000..42a7781 --- /dev/null +++ b/0003-rpm-ostree-Hook-up-the-progress-info-required-for-th.patch @@ -0,0 +1,106 @@ +From 73c6118c15cdcbc33828dc2b470f2e652f4a64ac Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Tue, 12 May 2020 16:53:20 +0200 +Subject: [PATCH 3/3] rpm-ostree: Hook up the progress info required for the + loading page + +--- + plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 34 ++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +index e3824df1..96531759 100644 +--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c ++++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c +@@ -255,8 +255,9 @@ transaction_progress_new (void) + static void + transaction_progress_free (TransactionProgress *self) + { +- g_main_loop_unref (self->loop); ++ g_clear_object (&self->plugin); + g_clear_error (&self->error); ++ g_main_loop_unref (self->loop); + g_clear_object (&self->app); + g_slice_free (TransactionProgress, self); + } +@@ -281,11 +282,30 @@ on_transaction_progress (GDBusProxy *proxy, + if (g_strcmp0 (signal_name, "PercentProgress") == 0) { + const gchar *message = NULL; + guint32 percentage; ++ + g_variant_get_child (parameters, 0, "&s", &message); + g_variant_get_child (parameters, 1, "u", &percentage); + g_debug ("PercentProgress: %u, %s\n", percentage, message); ++ + if (tp->app != NULL) + gs_app_set_progress (tp->app, (guint) percentage); ++ ++ if (tp->app != NULL && tp->plugin != NULL) { ++ GsPluginStatus plugin_status; ++ ++ switch (gs_app_get_state (tp->app)) { ++ case AS_APP_STATE_INSTALLING: ++ plugin_status = GS_PLUGIN_STATUS_INSTALLING; ++ break; ++ case AS_APP_STATE_REMOVING: ++ plugin_status = GS_PLUGIN_STATUS_REMOVING; ++ break; ++ default: ++ plugin_status = GS_PLUGIN_STATUS_DOWNLOADING; ++ break; ++ } ++ gs_plugin_status_update (tp->plugin, tp->app, plugin_status); ++ } + } else if (g_strcmp0 (signal_name, "Finished") == 0) { + if (tp->error == NULL) { + g_autofree gchar *error_message = NULL; +@@ -603,6 +623,7 @@ ensure_rpmostree_dnf_context (GsPlugin *plugin, GCancellable *cancellable, GErro + { + GsPluginData *priv = gs_plugin_get_data (plugin); + g_autofree gchar *transaction_address = NULL; ++ g_autoptr(GsApp) progress_app = gs_app_new (gs_plugin_get_name (plugin)); + g_autoptr(DnfContext) context = dnf_context_new (); + g_autoptr(DnfState) state = dnf_state_new (); + g_autoptr(GVariant) options = NULL; +@@ -611,6 +632,9 @@ ensure_rpmostree_dnf_context (GsPlugin *plugin, GCancellable *cancellable, GErro + if (priv->dnf_context != NULL) + return TRUE; + ++ tp->app = g_object_ref (progress_app); ++ tp->plugin = g_object_ref (plugin); ++ + dnf_context_set_repo_dir (context, "/etc/yum.repos.d"); + dnf_context_set_cache_dir (context, RPMOSTREE_CORE_CACHEDIR RPMOSTREE_DIR_CACHE_REPOMD); + dnf_context_set_solv_dir (context, RPMOSTREE_CORE_CACHEDIR RPMOSTREE_DIR_CACHE_SOLV); +@@ -669,9 +693,13 @@ gs_plugin_refresh (GsPlugin *plugin, + + { + g_autofree gchar *transaction_address = NULL; ++ g_autoptr(GsApp) progress_app = gs_app_new (gs_plugin_get_name (plugin)); + g_autoptr(GVariant) options = NULL; + g_autoptr(TransactionProgress) tp = transaction_progress_new (); + ++ tp->app = g_object_ref (progress_app); ++ tp->plugin = g_object_ref (plugin); ++ + options = make_rpmostree_options_variant (FALSE, /* reboot */ + FALSE, /* allow-downgrade */ + FALSE, /* cache-only */ +@@ -703,10 +731,14 @@ gs_plugin_refresh (GsPlugin *plugin, + + { + g_autofree gchar *transaction_address = NULL; ++ g_autoptr(GsApp) progress_app = gs_app_new (gs_plugin_get_name (plugin)); + g_autoptr(GVariant) options = NULL; + GVariantDict dict; + g_autoptr(TransactionProgress) tp = transaction_progress_new (); + ++ tp->app = g_object_ref (progress_app); ++ tp->plugin = g_object_ref (plugin); ++ + g_variant_dict_init (&dict, NULL); + g_variant_dict_insert (&dict, "mode", "s", "check"); + options = g_variant_ref_sink (g_variant_dict_end (&dict)); +-- +2.26.2 + diff --git a/gnome-software.spec b/gnome-software.spec index f2e55b7..347044c 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -12,13 +12,17 @@ Name: gnome-software Version: 3.36.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/3.36/%{name}-%{version}.tar.xz +Patch1: 0001-rpm-ostree-Add-missing-locking-when-creating-DnfCont.patch +Patch2: 0002-rpm-ostree-Correctly-mark-layered-local-packages-as-.patch +Patch3: 0003-rpm-ostree-Hook-up-the-progress-info-required-for-th.patch + BuildRequires: gcc BuildRequires: gettext BuildRequires: libxslt @@ -203,6 +207,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software %changelog +* Tue May 12 2020 Kalev Lember - 3.36.0-2 +- Backport various rpm-ostree backend fixes + * Wed Mar 11 2020 Kalev Lember - 3.36.0-1 - Update to 3.36.0