Compare commits

..

14 commits

Author SHA1 Message Date
Kalev Lember
9b1bd01402 Update artwork for F33 Final upgrades 2020-10-16 11:25:44 +02:00
Kalev Lember
20e756d6f4 Add artwork for F33 Beta upgrades 2020-09-09 11:13:39 +02:00
Kalev Lember
69b0aa6dec Add final F32 artwork 2020-04-23 14:45:22 +02:00
Kalev Lember
0a801ec139 Use black text on F32 distro upgrade background image 2020-04-03 19:07:37 +02:00
Kalev Lember
96de893fed Show correct button for distro upgrades 2020-03-06 11:24:33 +01:00
Kalev Lember
49b34dc5e9 Backport one more rpm-ostree distro upgrade fix 2020-03-06 11:20:46 +01:00
Kalev Lember
8907933e33 Fix various issues with rpm-ostree distro upgrades 2020-03-06 11:20:13 +01:00
Kalev Lember
a46849c7a0 Add artwork for F32 Beta upgrades 2020-03-06 11:18:11 +01:00
Richard Hughes
bcf7d2f7f5 Update to 3.34.2 2019-11-25 10:16:02 +00:00
Kalev Lember
778f8afc33 Backport patches to fix a crash in gs_flatpak_get_installation
https://bugzilla.redhat.com/show_bug.cgi?id=1762689
2019-10-18 13:59:19 +02:00
Kalev Lember
2042db16f2 Update renamed appstream ids for GNOME 3.34 2019-10-14 20:03:14 +02:00
Richard Hughes
2c178a1a44 Simpler patch 2019-10-11 19:38:45 +01:00
Richard Hughes
6788827f4d Backport a better patch 2019-10-11 16:30:22 +01:00
Richard Hughes
fe804139e3 Backport a patch to correct the applications shown in the installed list 2019-10-10 09:37:37 +01:00
16 changed files with 1279 additions and 7721 deletions

113
.gitignore vendored
View file

@ -1,2 +1,111 @@
/gnome-software-*.tar.xz
/gnome-software-*-build
/gnome-software-0.1.tar.xz
/gnome-software-3.9.1.tar.xz
/gnome-software-3.9.2.tar.xz
/gnome-software-3.9.3.tar.xz
/fedora-20.xml.gz
/fedora-20-icons.tar.gz
/gnome-software-3.10.0.tar.xz
/gnome-software-3.11.1.tar.xz
/fedora-20-codecs.xml
/web-apps.xml
/gnome-software-3.11.2.tar.xz
/gnome-software-3.11.3.tar.xz
/gnome-software-3.11.4.tar.xz
/fedora-rawhide-icons.tar.gz
/fedora-rawhide.xml.gz
/gnome-software-3.11.5.tar.xz
/gnome-software-3.11.90.tar.xz
/gnome-software-3.11.91.tar.xz
/gnome-software-3.11.92.tar.xz
/gnome-software-3.12.0.tar.xz
/gnome-software-3.12.1.tar.xz
/gnome-software-3.13.1.tar.xz
/fedora-21-icons.tar.gz
/fedora-21.xml.gz
/gnome-software-3.13.2.tar.xz
/gnome-software-3.13.3-7491627.tar.xz
/gnome-software-3.13.3.tar.xz
/gnome-software-3.13.4.tar.xz
/gnome-software-3.13.5-5c89189.tar.xz
/gnome-software-3.13.90.tar.xz
/gnome-software-3.13.91.tar.xz
/gnome-software-3.13.92.tar.xz
/gnome-software-3.14.0.tar.xz
/gnome-software-3.14.1.tar.xz
/gnome-software-3.14.2.tar.xz
/gnome-software-3.15.2.tar.xz
/gnome-software-3.15.4.tar.xz
/gnome-software-3.15.90.tar.xz
/gnome-software-3.15.91.tar.xz
/gnome-software-3.15.92.tar.xz
/gnome-software-3.16.0.tar.xz
/gnome-software-3.16.1.tar.xz
/gnome-software-3.16.2.tar.xz
/gnome-software-3.17.1.tar.xz
/gnome-software-3.17.2.tar.xz
/gnome-software-3.17.3.tar.xz
/gnome-software-3.17.90.tar.xz
/gnome-software-3.17.91.tar.xz
/gnome-software-3.17.92.tar.xz
/gnome-software-3.18.0.tar.xz
/gnome-software-3.18.1.tar.xz
/gnome-software-3.18.2.tar.xz
/gnome-software-3.18.3.tar.xz
/gnome-software-3.19.4.tar.xz
/gnome-software-3.19.90.tar.xz
/gnome-software-3.19.91.tar.xz
/gnome-software-3.19.92.tar.xz
/gnome-software-3.20.0.tar.xz
/gnome-software-3.20.1.tar.xz
/gnome-software-3.20.2.tar.xz
/gnome-software-3.21.1.tar.xz
/gnome-software-3.21.2.tar.xz
/gnome-software-3.21.4.tar.xz
/gnome-software-3.21.90.tar.xz
/gnome-software-3.21.91.tar.xz
/gnome-software-3.21.92.tar.xz
/gnome-software-3.22.0.tar.xz
/gnome-software-3.22.1.tar.xz
/gnome-software-3.22.2.tar.xz
/gnome-software-3.23.2.tar.xz
/gnome-software-3.23.3.tar.xz
/gnome-software-3.23.90.tar.xz
/gnome-software-3.23.91.tar.xz
/gnome-software-3.23.92.tar.xz
/gnome-software-3.24.0.tar.xz
/gnome-software-3.24.1.tar.xz
/gnome-software-3.24.2.tar.xz
/gnome-software-3.24.3.tar.xz
/gnome-software-3.25.3.tar.xz
/gnome-software-3.25.4.tar.xz
/gnome-software-3.25.90.tar.xz
/gnome-software-3.25.91.tar.xz
/gnome-software-3.26.0.tar.xz
/gnome-software-3.26.1.tar.xz
/gnome-software-3.26.2.tar.xz
/gnome-software-3.27.2.tar.xz
/gnome-software-3.27.3.tar.xz
/gnome-software-3.27.4.tar.xz
/gnome-software-3.27.90.tar.xz
/gnome-software-3.27.92.tar.xz
/gnome-software-3.28.0.tar.xz
/gnome-software-3.28.1.tar.xz
/gnome-software-3.29.1.tar.xz
/gnome-software-3.29.92.tar.xz
/gnome-software-3.30.0.tar.xz
/gnome-software-3.30.1.tar.xz
/gnome-software-3.30.2.tar.xz
/gnome-software-3.31.1.tar.xz
/gnome-software-3.31.2.tar.xz
/gnome-software-3.31.90.tar.xz
/gnome-software-3.31.92.tar.xz
/gnome-software-3.32.0.tar.xz
/gnome-software-3.32.1.tar.xz
/gnome-software-3.32.2.tar.xz
/gnome-software-3.32.3.tar.xz
/gnome-software-3.32.4.tar.xz
/gnome-software-3.34.0.tar.xz
/gnome-software-3.34.1.tar.xz
/gnome-software-3.34.2.tar.xz
/f32.png
/f33.png

View file

@ -0,0 +1,29 @@
From 9f6ada1d9caf72c77da75aa860643a4ac20796d2 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Thu, 23 Apr 2020 14:37:21 +0200
Subject: [PATCH] Fine-tune F32 upgrade banner position and font
As per discussion with jimmac on #fedora-design.
---
.../gs-plugin-fedora-pkgdb-collections.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index 5862bae5..0de24161 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -298,9 +298,9 @@ _create_upgrade_from_info (GsPlugin *plugin, PkgdbItem *item)
background = _get_upgrade_css_background (item->version);
if (background != NULL) {
css = g_strdup_printf ("background: %s;"
- "background-position: center;"
+ "background-position: top;"
"background-size: cover;"
- "color: black;",
+ "color: white; text-shadow: 0 2px 2px rgba(0,0,0,0.5);",
background);
gs_app_set_metadata (app, "GnomeSoftware::UpgradeBanner-css", css);
}
--
2.26.0

View file

@ -0,0 +1,53 @@
From d683ff504a176d9aa0e9ca3b833ddb33ba17645a Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 3 Apr 2020 15:46:50 +0200
Subject: [PATCH 1/2] Use black font for Fedora distro upgrades
This makes the text more legible on light backgrounds (such as the F32
distro upgrade background).
Fixes https://gitlab.gnome.org/GNOME/gnome-software/issues/956
---
.../gs-plugin-fedora-pkgdb-collections.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index e41bbc88..5862bae5 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -229,8 +229,7 @@ _get_upgrade_css_background (guint version)
if (g_file_test (filename2, G_FILE_TEST_EXISTS))
return g_strdup_printf ("url('%s')", filename2);
- /* fall back to solid colour */
- return g_strdup_printf ("#151E65");
+ return NULL;
}
static gint
@@ -295,13 +294,16 @@ _create_upgrade_from_info (GsPlugin *plugin, PkgdbItem *item)
item->version);
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url);
- /* use a fancy background */
+ /* use a fancy background if possible */
background = _get_upgrade_css_background (item->version);
- css = g_strdup_printf ("background: %s;"
- "background-position: center;"
- "background-size: cover;",
- background);
- gs_app_set_metadata (app, "GnomeSoftware::UpgradeBanner-css", css);
+ if (background != NULL) {
+ css = g_strdup_printf ("background: %s;"
+ "background-position: center;"
+ "background-size: cover;"
+ "color: black;",
+ background);
+ gs_app_set_metadata (app, "GnomeSoftware::UpgradeBanner-css", css);
+ }
/* save in the cache */
gs_plugin_cache_add (plugin, cache_key, app);
--
2.25.2

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
From 1b0f83e1f6d6be12c3d645e28af38e30eb7fa77e Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 8 Jan 2020 14:57:40 +0100
Subject: [PATCH 1/3] rpm-ostree: Avoid downgrade error when doing distro
upgrade
Pass 'allow-downgrade' to rpm-ostree to avoid erroring out when doing a
distro upgrade from a chronologically newer Fedora compose (but older
distro version) to a chronologically older, but newer distro version.
---
plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index 8b0578a78..8e8da6f7a 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2017-2019 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2017-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -1412,7 +1412,7 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
gs_app_get_version (app));
options = make_rpmostree_options_variant (FALSE, /* reboot */
- FALSE, /* allow-downgrade */
+ TRUE, /* allow-downgrade */
FALSE, /* cache-only */
TRUE, /* download-only */
FALSE, /* skip-purge */
--
2.21.1

View file

@ -0,0 +1,51 @@
From 0c72aabd518632f5ad7f0851d3ea2d7c32eecc9a Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 31 Jan 2020 14:21:20 +0100
Subject: [PATCH] rpm-ostree: Don't error out when distro upgrade ref is
already deployed
---
plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index 0ceb4d2d..3811f935 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -982,7 +982,14 @@ gs_plugin_app_upgrade_trigger (GsPlugin *plugin,
cancellable,
error)) {
gs_rpmostree_error_convert (error);
- return FALSE;
+
+ if (g_strrstr ((*error)->message, "Old and new refs are equal")) {
+ /* don't error out if the correct tree is already deployed */
+ g_debug ("ignoring rpm-ostree error: %s", (*error)->message);
+ g_clear_error (error);
+ } else {
+ return FALSE;
+ }
}
/* success */
@@ -1504,8 +1511,15 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
cancellable,
error)) {
gs_rpmostree_error_convert (error);
- gs_app_set_state_recover (app);
- return FALSE;
+
+ if (g_strrstr ((*error)->message, "Old and new refs are equal")) {
+ /* don't error out if the correct tree is already deployed */
+ g_debug ("ignoring rpm-ostree error: %s", (*error)->message);
+ g_clear_error (error);
+ } else {
+ gs_app_set_state_recover (app);
+ return FALSE;
+ }
}
/* state is known */
--
2.24.1

View file

@ -0,0 +1,49 @@
From 8b8f38fad7983e8ce30bb0b569cd42f18f524a90 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Mon, 2 Mar 2020 15:37:52 +0100
Subject: [PATCH] upgrade banner: Show the correct button when NEEDS_REBOOT
quirk is set
The logic here is that all distro upgrades need a reboot to *use* it,
but only some need a reboot to *deploy* it. We use the
GS_APP_QUIRK_NEEDS_REBOOT to denote distro upgrades that need to reboot
to deploy it, e.g. PackageKit distro upgrades or rpm-ostree rebases.
---
src/gs-upgrade-banner.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c
index 51b369f5..8abe1d43 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -57,20 +57,19 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
name_bold = g_strdup_printf ("<b>%s</b>", gs_app_get_name (priv->app));
version_bold = g_strdup_printf ("<b>%s</b>", gs_app_get_version (priv->app));
- /* Show the right button text. Distributions which are based on OSTree
- * dont need a post-reboot installation step. */
+ /* Distributions that need to reboot to deploy the upgrade show the "Install" button */
if (gs_app_has_quirk (priv->app, GS_APP_QUIRK_NEEDS_REBOOT)) {
- gtk_button_set_label (GTK_BUTTON (priv->button_upgrades_install),
- _("_Restart Now"));
- gtk_label_set_text (GTK_LABEL (priv->label_upgrades_warning),
- _("Updates will be applied when the "
- "computer is restarted."));
- } else {
gtk_button_set_label (GTK_BUTTON (priv->button_upgrades_install),
_("_Install"));
gtk_label_set_text (GTK_LABEL (priv->label_upgrades_warning),
_("It is recommended that you back up your "
"data and files before upgrading."));
+ } else {
+ gtk_button_set_label (GTK_BUTTON (priv->button_upgrades_install),
+ _("_Restart Now"));
+ gtk_label_set_text (GTK_LABEL (priv->label_upgrades_warning),
+ _("Updates will be applied when the "
+ "computer is restarted."));
}
/* Refresh the title. Normally a distro upgrade state goes from
--
2.24.1

View file

@ -0,0 +1,43 @@
From b4309196a15b1b59b7cc095b7d8ab8f5b2424e06 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 3 Apr 2020 16:00:12 +0200
Subject: [PATCH 2/2] Add distro upgrade css for the HC theme
Just copy the regular css over so that the banner doesn't look
completely off.
---
src/gtk-style-hc.css | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/gtk-style-hc.css b/src/gtk-style-hc.css
index 959823e6..1006649e 100644
--- a/src/gtk-style-hc.css
+++ b/src/gtk-style-hc.css
@@ -222,6 +222,24 @@ button.star, .button.star {
padding: 16px;
}
+.upgrade-banner {
+ background-color: #1c5288;
+ padding: 0px;
+ border-radius: 4px;
+ border: 1px solid darker(@theme_bg_color);
+ color: @theme_selected_fg_color;
+}
+
+.upgrade-buttons {
+ padding: 18px;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+}
+
+.upgrade-progressbar {
+ box-shadow: none
+}
+
.eol-box {
background-color: @theme_selected_bg_color;
border: 1px solid shade(@theme_selected_bg_color, 0.8);
--
2.25.2

View file

@ -1,686 +0,0 @@
From 0c79d9fb08a348a45a18f15427c945a63b44982e Mon Sep 17 00:00:00 2001
Date: Mon, 24 Nov 2025 16:06:51 +0100
Subject: [PATCH 1/3] flatpak: Fix XbSilo lifetime in
gs_flatpak_refine_wildcard()
The function uses pre-cached data in the hash tables, consisting of XbNode-s
from an XbSilo. The nodes are referenced, but the silos the node belongs to
is not referenced (by the XbNode).
This change keeps the XbSilo alive as long as it's needed for the nodes
in the pre-cached data. It also does not call gs_flatpak_ref_silo() multiple
times for the same GsFlatpak instance, which could invalidate the XbNode-s
in the pre-cached data when a change in the silo or in the installation
had been received while the function was still processing the apps.
Related downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2416542
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/2900
---
plugins/flatpak/gs-flatpak.c | 18 ++++++++---
plugins/flatpak/gs-flatpak.h | 4 +++
plugins/flatpak/gs-plugin-flatpak.c | 49 ++++++++++++++++++++---------
3 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index b409475c7..a40ab54fb 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -3748,16 +3748,19 @@ gboolean
gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
GsAppList *list, GsPluginRefineRequireFlags require_flags,
gboolean interactive,
+ XbSilo **inout_silo,
+ gchar **inout_silo_filename,
+ GHashTable **inout_installed_by_desktopid,
GHashTable **inout_components_by_id,
GHashTable **inout_components_by_bundle,
GCancellable *cancellable, GError **error)
{
const gchar *id;
GPtrArray* components = NULL;
+ XbSilo *silo;
+ GHashTable *silo_installed_by_desktopid;
+ const gchar *silo_filename;
g_autoptr(GError) error_local = NULL;
- g_autoptr(XbSilo) silo = NULL;
- g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
- g_autofree gchar *silo_filename = NULL;
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
@@ -3766,10 +3769,15 @@ gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
if (id == NULL)
return TRUE;
- silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
- if (silo == NULL)
+ if (*inout_silo == NULL)
+ *inout_silo = gs_flatpak_ref_silo (self, interactive, inout_silo_filename, inout_installed_by_desktopid, cancellable, error);
+ if (*inout_silo == NULL)
return FALSE;
+ silo = *inout_silo;
+ silo_filename = *inout_silo_filename;
+ silo_installed_by_desktopid = *inout_installed_by_desktopid;
+
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardQuerySilo, "Flatpak (query silo)", NULL);
if (*inout_components_by_id != NULL) {
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
index 66ff59967..34e1416b5 100644
--- a/plugins/flatpak/gs-flatpak.h
+++ b/plugins/flatpak/gs-flatpak.h
@@ -11,6 +11,7 @@
#include <gnome-software.h>
#include <flatpak.h>
+#include <xmlb.h>
G_BEGIN_DECLS
@@ -108,6 +109,9 @@ gboolean gs_flatpak_refine_wildcard (GsFlatpak *self,
GsAppList *list,
GsPluginRefineRequireFlags require_flags,
gboolean interactive,
+ XbSilo **inout_silo,
+ gchar **inout_silo_filename,
+ GHashTable **inout_installed_by_desktopid,
GHashTable **inout_components_by_id,
GHashTable **inout_components_by_bundle,
GCancellable *cancellable,
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 3d0503d46..f5d4a1d67 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -667,12 +667,29 @@ gs_plugin_flatpak_refine_app (GsPluginFlatpak *self,
return gs_flatpak_refine_app (flatpak, app, require_flags, interactive, FALSE, event_callback, event_user_data, cancellable, error);
}
+typedef struct {
+ XbSilo *silo;
+ gchar *silo_filename;
+ GHashTable *installed_by_desktopid;
+ GHashTable *components_by_id;
+ GHashTable *components_by_bundle;
+} RefineInstallationData;
+
static void
-unref_nonnull_hash_table (gpointer ptr)
+refine_installation_data_free (gpointer ptr)
{
- GHashTable *hash_table = ptr;
- if (hash_table != NULL)
- g_hash_table_unref (hash_table);
+ RefineInstallationData *data = ptr;
+
+ if (data == NULL)
+ return;
+
+ g_clear_pointer (&data->silo_filename, g_free);
+ g_clear_pointer (&data->installed_by_desktopid, g_hash_table_unref);
+ g_clear_pointer (&data->components_by_id, g_hash_table_unref);
+ g_clear_pointer (&data->components_by_bundle, g_hash_table_unref);
+ /* free the silo as the last, just in case, because the data from it is in the above hash tables */
+ g_clear_object (&data->silo);
+ g_free (data);
}
static gboolean
@@ -761,8 +778,7 @@ refine_thread_cb (GTask *task,
gboolean interactive = (data->job_flags & GS_PLUGIN_REFINE_FLAGS_INTERACTIVE) != 0;
GsPluginEventCallback event_callback = data->event_callback;
void *event_user_data = data->event_user_data;
- g_autoptr(GPtrArray) array_components_by_id = NULL; /* (element-type GHashTable) */
- g_autoptr(GPtrArray) array_components_by_bundle = NULL; /* (element-type GHashTable) */
+ g_autoptr(GPtrArray) installation_data = NULL; /* (element-type RefineInstallationData) */
g_autoptr(GsAppList) app_list = NULL;
g_autoptr(GError) local_error = NULL;
@@ -783,10 +799,9 @@ refine_thread_cb (GTask *task,
* (e.g. inserting an app in the list on every call results in
* an infinite loop) */
app_list = gs_app_list_copy (list);
- array_components_by_id = g_ptr_array_new_full (self->installations->len, unref_nonnull_hash_table);
- g_ptr_array_set_size (array_components_by_id, self->installations->len);
- array_components_by_bundle = g_ptr_array_new_full (self->installations->len, unref_nonnull_hash_table);
- g_ptr_array_set_size (array_components_by_bundle, self->installations->len);
+
+ installation_data = g_ptr_array_new_full (self->installations->len, refine_installation_data_free);
+ g_ptr_array_set_size (installation_data, self->installations->len);
for (guint j = 0; j < gs_app_list_length (app_list); j++) {
GsApp *app = gs_app_list_index (app_list, j);
@@ -796,16 +811,20 @@ refine_thread_cb (GTask *task,
for (guint i = 0; i < self->installations->len; i++) {
GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
- GHashTable *components_by_id = array_components_by_id->pdata[i];
- GHashTable *components_by_bundle = array_components_by_bundle->pdata[i];
+ RefineInstallationData *inst_data = g_ptr_array_index (installation_data, i);
+
+ if (inst_data == NULL) {
+ inst_data = g_new0 (RefineInstallationData, 1);
+ installation_data->pdata[i] = inst_data;
+ }
- if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &components_by_id, &components_by_bundle,
+ if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &inst_data->silo,
+ &inst_data->silo_filename, &inst_data->installed_by_desktopid,
+ &inst_data->components_by_id, &inst_data->components_by_bundle,
cancellable, &local_error)) {
g_task_return_error (task, g_steal_pointer (&local_error));
return;
}
- array_components_by_id->pdata[i] = components_by_id;
- array_components_by_bundle->pdata[i] = components_by_bundle;
}
}
--
GitLab
From 546c6ee17b5959d2a696a6cb346a1f8b94aba303 Mon Sep 17 00:00:00 2001
Date: Wed, 7 Jan 2026 18:37:52 +0100
Subject: [PATCH 2/3] flatpak: Simplify wildcard app lookup function
By flipping the order of traversing app and installation the code
can be simplified to not have too many in/out arguments.
Suggested by Philip Withnall
---
plugins/flatpak/gs-flatpak.c | 251 ++++++++++++++--------------
plugins/flatpak/gs-flatpak.h | 9 +-
plugins/flatpak/gs-plugin-flatpak.c | 61 +------
3 files changed, 130 insertions(+), 191 deletions(-)
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a40ab54fb..782b0bb48 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -3745,167 +3745,158 @@ gs_flatpak_refine_app (GsFlatpak *self,
}
gboolean
-gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
- GsAppList *list, GsPluginRefineRequireFlags require_flags,
- gboolean interactive,
- XbSilo **inout_silo,
- gchar **inout_silo_filename,
- GHashTable **inout_installed_by_desktopid,
- GHashTable **inout_components_by_id,
- GHashTable **inout_components_by_bundle,
- GCancellable *cancellable, GError **error)
+gs_flatpak_refine_wildcards (GsFlatpak *self,
+ GPtrArray *wildcard_apps,
+ GsAppList *list,
+ GsPluginRefineRequireFlags require_flags,
+ gboolean interactive,
+ GCancellable *cancellable,
+ GError **error)
{
- const gchar *id;
- GPtrArray* components = NULL;
- XbSilo *silo;
- GHashTable *silo_installed_by_desktopid;
- const gchar *silo_filename;
g_autoptr(GError) error_local = NULL;
+ g_autoptr(XbSilo) silo = NULL;
+ g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
+ g_autoptr(GHashTable) components_by_id = NULL;
+ g_autoptr(GHashTable) components_by_bundle = NULL;
+ g_autoptr(GPtrArray) components_with_id = NULL;
+ g_autoptr(GPtrArray) bundles = NULL;
+ g_autofree gchar *silo_filename = NULL;
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
- /* not enough info to find */
- id = gs_app_get_id (app);
- if (id == NULL)
- return TRUE;
-
- if (*inout_silo == NULL)
- *inout_silo = gs_flatpak_ref_silo (self, interactive, inout_silo_filename, inout_installed_by_desktopid, cancellable, error);
- if (*inout_silo == NULL)
+ silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
+ if (silo == NULL)
return FALSE;
- silo = *inout_silo;
- silo_filename = *inout_silo_filename;
- silo_installed_by_desktopid = *inout_installed_by_desktopid;
-
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardQuerySilo, "Flatpak (query silo)", NULL);
- if (*inout_components_by_id != NULL) {
- components = g_hash_table_lookup (*inout_components_by_id, gs_app_get_id (app));
- } else {
- g_autoptr(GPtrArray) components_with_id = NULL;
- *inout_components_by_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_ptr_array_unref);
- components_with_id = xb_silo_query (silo, "components/component/id", 0, &error_local);
- if (components_with_id == NULL) {
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
- return TRUE;
- g_propagate_error (error, g_steal_pointer (&error_local));
- return FALSE;
+ components_by_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_ptr_array_unref);
+ components_with_id = xb_silo_query (silo, "components/component/id", 0, &error_local);
+ if (components_with_id == NULL) {
+ if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+ return TRUE;
+ g_propagate_error (error, g_steal_pointer (&error_local));
+ return FALSE;
+ }
+
+ for (guint i = 0; i < components_with_id->len; i++) {
+ XbNode *node = g_ptr_array_index (components_with_id, i);
+ XbNode *comp_node = xb_node_get_parent (node);
+ const gchar *comp_id = xb_node_get_text (node);
+ GPtrArray *comps = g_hash_table_lookup (components_by_id, comp_id);
+ if (comps == NULL) {
+ comps = g_ptr_array_new_with_free_func (g_object_unref);
+ g_hash_table_insert (components_by_id, g_strdup (comp_id), comps);
}
- for (guint i = 0; i < components_with_id->len; i++) {
- XbNode *node = g_ptr_array_index (components_with_id, i);
- XbNode *comp_node = xb_node_get_parent (node);
- const gchar *comp_id = xb_node_get_text (node);
- GPtrArray *comps = g_hash_table_lookup (*inout_components_by_id, comp_id);
- if (comps == NULL) {
- comps = g_ptr_array_new_with_free_func (g_object_unref);
- g_hash_table_insert (*inout_components_by_id, g_strdup (comp_id), comps);
+ g_ptr_array_add (comps, comp_node);
+ }
+
+ components_by_bundle = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ bundles = xb_silo_query (silo, "/components/component/bundle[@type='flatpak']", 0, NULL);
+ for (guint b = 0; bundles != NULL && b < bundles->len; b++) {
+ XbNode *bundle_node = g_ptr_array_index (bundles, b);
+ g_autoptr(XbNode) component_node = xb_node_get_parent (bundle_node);
+ g_autoptr(XbNode) components_node = xb_node_get_parent (component_node);
+ const gchar *origin = xb_node_get_attr (components_node, "origin");
+ if (origin != NULL) {
+ const gchar *bundle = xb_node_get_text (bundle_node);
+ if (bundle != NULL) {
+ g_autofree gchar *key = g_strconcat (origin, "\n", bundle, NULL);
+ g_hash_table_insert (components_by_bundle, g_steal_pointer (&key), g_steal_pointer (&component_node));
}
- g_ptr_array_add (comps, comp_node);
- if (components == NULL && g_strcmp0 (id, comp_id) == 0)
- components = comps;
}
}
GS_PROFILER_END_SCOPED (FlatpakRefineWildcardQuerySilo);
- if (components == NULL)
- return TRUE;
-
gs_flatpak_ensure_remote_title (self, interactive, cancellable);
- if (*inout_components_by_bundle == NULL) {
- g_autoptr(GPtrArray) bundles = NULL;
-
- *inout_components_by_bundle = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- bundles = xb_silo_query (silo, "/components/component/bundle[@type='flatpak']", 0, NULL);
- for (guint b = 0; bundles != NULL && b < bundles->len; b++) {
- XbNode *bundle_node = g_ptr_array_index (bundles, b);
- g_autoptr(XbNode) component_node = xb_node_get_parent (bundle_node);
- g_autoptr(XbNode) components_node = xb_node_get_parent (component_node);
- const gchar *origin = xb_node_get_attr (components_node, "origin");
- if (origin != NULL) {
- const gchar *bundle = xb_node_get_text (bundle_node);
- if (bundle != NULL) {
- g_autofree gchar *key = g_strconcat (origin, "\n", bundle, NULL);
- g_hash_table_insert (*inout_components_by_bundle, g_steal_pointer (&key), g_steal_pointer (&component_node));
- }
- }
- }
- }
+ for (guint j = 0; j < wildcard_apps->len; j++) {
+ GsApp *app = g_ptr_array_index (wildcard_apps, j);
+ GPtrArray *components = NULL;
+ const gchar *id;
+ /* not enough info to find */
+ id = gs_app_get_id (app);
+ if (id == NULL)
+ continue;
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardGenerateApps, "Flatpak (create app)", NULL);
- for (guint i = 0; i < components->len; i++) {
- XbNode *component = g_ptr_array_index (components, i);
- g_autoptr(GsApp) new = NULL;
+ components = g_hash_table_lookup (components_by_id, id);
+ if (components == NULL)
+ continue;
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardCreateAppstreamApp, "Flatpak (create Appstream app)", NULL);
- new = gs_appstream_create_app (self->plugin, silo, component, silo_filename ? silo_filename : "",
- self->scope, error);
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardCreateAppstreamApp);
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardGenerateApps, "Flatpak (create app)", NULL);
+ for (guint i = 0; i < components->len; i++) {
+ XbNode *component = g_ptr_array_index (components, i);
+ g_autoptr(GsApp) new = NULL;
- if (new == NULL)
- return FALSE;
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardCreateAppstreamApp, "Flatpak (create Appstream app)", NULL);
+ new = gs_appstream_create_app (self->plugin, silo, component, silo_filename ? silo_filename : "",
+ self->scope, error);
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardCreateAppstreamApp);
- gs_flatpak_claim_app (self, new);
-
- /* The appstream plugin did not find the component in the plugin's cache,
- thus read the required info from the 'bundle' element. */
- if (gs_flatpak_app_get_ref_name (new) == NULL ||
- gs_flatpak_app_get_ref_arch (new) == NULL) {
- const gchar *xref_str = NULL;
- g_autoptr(XbNode) child = NULL;
- g_autoptr(XbNode) next = NULL;
- for (child = xb_node_get_child (component); child != NULL && xref_str == NULL;
- g_object_unref (child), child = g_steal_pointer (&next)) {
- next = xb_node_get_next (child);
- if (g_strcmp0 (xb_node_get_element (child), "bundle") == 0 &&
- g_strcmp0 (xb_node_get_attr (child, "type"), "flatpak") == 0) {
- xref_str = xb_node_get_text (child);
- break;
+ if (new == NULL)
+ return FALSE;
+
+ gs_flatpak_claim_app (self, new);
+
+ /* The appstream plugin did not find the component in the plugin's cache,
+ thus read the required info from the 'bundle' element. */
+ if (gs_flatpak_app_get_ref_name (new) == NULL ||
+ gs_flatpak_app_get_ref_arch (new) == NULL) {
+ const gchar *xref_str = NULL;
+ g_autoptr(XbNode) child = NULL;
+ g_autoptr(XbNode) next = NULL;
+ for (child = xb_node_get_child (component); child != NULL && xref_str == NULL;
+ g_object_unref (child), child = g_steal_pointer (&next)) {
+ next = xb_node_get_next (child);
+ if (g_strcmp0 (xb_node_get_element (child), "bundle") == 0 &&
+ g_strcmp0 (xb_node_get_attr (child, "type"), "flatpak") == 0) {
+ xref_str = xb_node_get_text (child);
+ break;
+ }
}
- }
- if (xref_str != NULL) {
- g_auto(GStrv) split = NULL;
-
- /* get the kind/name/arch/branch */
- split = g_strsplit (xref_str, "/", -1);
- if (g_strv_length (split) == 4) {
- const gchar *comp_type = xb_node_get_attr (component, "type");
- AsComponentKind kind = as_component_kind_from_string (comp_type);
- if (kind != AS_COMPONENT_KIND_UNKNOWN)
- gs_app_set_kind (new, kind);
- else if (g_ascii_strcasecmp (split[0], "app") == 0)
- gs_app_set_kind (new, AS_COMPONENT_KIND_DESKTOP_APP);
- else if (g_ascii_strcasecmp (split[0], "runtime") == 0)
- gs_flatpak_set_runtime_kind_from_id (new);
- gs_flatpak_app_set_ref_name (new, split[1]);
- gs_flatpak_app_set_ref_arch (new, split[2]);
- gs_app_set_branch (new, split[3]);
- gs_app_set_metadata (new, "GnomeSoftware::packagename-value", xref_str);
+ if (xref_str != NULL) {
+ g_auto(GStrv) split = NULL;
+
+ /* get the kind/name/arch/branch */
+ split = g_strsplit (xref_str, "/", -1);
+ if (g_strv_length (split) == 4) {
+ const gchar *comp_type = xb_node_get_attr (component, "type");
+ AsComponentKind kind = as_component_kind_from_string (comp_type);
+ if (kind != AS_COMPONENT_KIND_UNKNOWN)
+ gs_app_set_kind (new, kind);
+ else if (g_ascii_strcasecmp (split[0], "app") == 0)
+ gs_app_set_kind (new, AS_COMPONENT_KIND_DESKTOP_APP);
+ else if (g_ascii_strcasecmp (split[0], "runtime") == 0)
+ gs_flatpak_set_runtime_kind_from_id (new);
+ gs_flatpak_app_set_ref_name (new, split[1]);
+ gs_flatpak_app_set_ref_arch (new, split[2]);
+ gs_app_set_branch (new, split[3]);
+ gs_app_set_metadata (new, "GnomeSoftware::packagename-value", xref_str);
+ }
}
}
- }
- if (gs_flatpak_app_get_ref_name (new) == NULL ||
- gs_flatpak_app_get_ref_arch (new) == NULL) {
- g_debug ("Failed to get ref info for '%s' from wildcard '%s', skipping it...", gs_app_get_id (new), id);
- } else {
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardRefineNewApp, "Flatpak (refine new app)", NULL);
- if (!gs_flatpak_refine_app_internal (self, new, require_flags, interactive, FALSE, *inout_components_by_bundle,
- silo, silo_filename, silo_installed_by_desktopid, cancellable, error))
- return FALSE;
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardRefineNewApp);
+ if (gs_flatpak_app_get_ref_name (new) == NULL ||
+ gs_flatpak_app_get_ref_arch (new) == NULL) {
+ g_debug ("Failed to get ref info for '%s' from wildcard '%s', skipping it...", gs_app_get_id (new), id);
+ } else {
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardRefineNewApp, "Flatpak (refine new app)", NULL);
+ if (!gs_flatpak_refine_app_internal (self, new, require_flags, interactive, FALSE, components_by_bundle,
+ silo, silo_filename, silo_installed_by_desktopid, cancellable, error))
+ return FALSE;
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardRefineNewApp);
- GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardSubsumeMetadata, "Flatpak (subsume metadata)", NULL);
- gs_app_subsume_metadata (new, app);
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardSubsumeMetadata);
+ GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcardSubsumeMetadata, "Flatpak (subsume metadata)", NULL);
+ gs_app_subsume_metadata (new, app);
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardSubsumeMetadata);
- gs_app_list_add (list, new);
+ gs_app_list_add (list, new);
+ }
}
+ GS_PROFILER_END_SCOPED (FlatpakRefineWildcardGenerateApps);
}
- GS_PROFILER_END_SCOPED (FlatpakRefineWildcardGenerateApps);
GS_PROFILER_END_SCOPED (FlatpakRefineWildcard);
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
index 34e1416b5..1f7d35a8f 100644
--- a/plugins/flatpak/gs-flatpak.h
+++ b/plugins/flatpak/gs-flatpak.h
@@ -104,16 +104,11 @@ gboolean gs_flatpak_refine_app_state (GsFlatpak *self,
void *event_user_data,
GCancellable *cancellable,
GError **error);
-gboolean gs_flatpak_refine_wildcard (GsFlatpak *self,
- GsApp *app,
+gboolean gs_flatpak_refine_wildcards (GsFlatpak *self,
+ GPtrArray *wildcard_apps,
GsAppList *list,
GsPluginRefineRequireFlags require_flags,
gboolean interactive,
- XbSilo **inout_silo,
- gchar **inout_silo_filename,
- GHashTable **inout_installed_by_desktopid,
- GHashTable **inout_components_by_id,
- GHashTable **inout_components_by_bundle,
GCancellable *cancellable,
GError **error);
gboolean gs_flatpak_launch (GsFlatpak *self,
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index f5d4a1d67..c06b1fb5f 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -667,31 +667,6 @@ gs_plugin_flatpak_refine_app (GsPluginFlatpak *self,
return gs_flatpak_refine_app (flatpak, app, require_flags, interactive, FALSE, event_callback, event_user_data, cancellable, error);
}
-typedef struct {
- XbSilo *silo;
- gchar *silo_filename;
- GHashTable *installed_by_desktopid;
- GHashTable *components_by_id;
- GHashTable *components_by_bundle;
-} RefineInstallationData;
-
-static void
-refine_installation_data_free (gpointer ptr)
-{
- RefineInstallationData *data = ptr;
-
- if (data == NULL)
- return;
-
- g_clear_pointer (&data->silo_filename, g_free);
- g_clear_pointer (&data->installed_by_desktopid, g_hash_table_unref);
- g_clear_pointer (&data->components_by_id, g_hash_table_unref);
- g_clear_pointer (&data->components_by_bundle, g_hash_table_unref);
- /* free the silo as the last, just in case, because the data from it is in the above hash tables */
- g_clear_object (&data->silo);
- g_free (data);
-}
-
static gboolean
refine_app (GsPluginFlatpak *self,
GsApp *app,
@@ -778,8 +753,7 @@ refine_thread_cb (GTask *task,
gboolean interactive = (data->job_flags & GS_PLUGIN_REFINE_FLAGS_INTERACTIVE) != 0;
GsPluginEventCallback event_callback = data->event_callback;
void *event_user_data = data->event_user_data;
- g_autoptr(GPtrArray) installation_data = NULL; /* (element-type RefineInstallationData) */
- g_autoptr(GsAppList) app_list = NULL;
+ g_autoptr(GPtrArray) wildcard_apps = g_ptr_array_new_with_free_func (g_object_unref); /* (element-type GsApp) (owned) */
g_autoptr(GError) local_error = NULL;
assert_in_worker (self);
@@ -790,38 +764,17 @@ refine_thread_cb (GTask *task,
g_task_return_error (task, g_steal_pointer (&local_error));
return;
}
- }
-
- /* Refine wildcards.
- *
- * Use a copy of the list for the loop because a function called
- * on the plugin may affect the list which can lead to problems
- * (e.g. inserting an app in the list on every call results in
- * an infinite loop) */
- app_list = gs_app_list_copy (list);
-
- installation_data = g_ptr_array_new_full (self->installations->len, refine_installation_data_free);
- g_ptr_array_set_size (installation_data, self->installations->len);
-
- for (guint j = 0; j < gs_app_list_length (app_list); j++) {
- GsApp *app = gs_app_list_index (app_list, j);
- if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD))
- continue;
+ if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD) && gs_app_get_id (app) != NULL)
+ g_ptr_array_add (wildcard_apps, g_object_ref (app));
+ }
+ /* Refine wildcards. */
+ if (wildcard_apps->len > 0) {
for (guint i = 0; i < self->installations->len; i++) {
GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
- RefineInstallationData *inst_data = g_ptr_array_index (installation_data, i);
-
- if (inst_data == NULL) {
- inst_data = g_new0 (RefineInstallationData, 1);
- installation_data->pdata[i] = inst_data;
- }
- if (!gs_flatpak_refine_wildcard (flatpak, app, list, require_flags, interactive, &inst_data->silo,
- &inst_data->silo_filename, &inst_data->installed_by_desktopid,
- &inst_data->components_by_id, &inst_data->components_by_bundle,
- cancellable, &local_error)) {
+ if (!gs_flatpak_refine_wildcards (flatpak, wildcard_apps, list, require_flags, interactive, cancellable, &local_error)) {
g_task_return_error (task, g_steal_pointer (&local_error));
return;
}
--
GitLab
From 8472d717356a801e6c0171156738ea48480fa695 Mon Sep 17 00:00:00 2001
Date: Wed, 7 Jan 2026 18:45:47 +0100
Subject: [PATCH 3/3] flatpak: Hold silo lock when refining wildcard apps
The refine can take a long time, thus hold the silo lock to not have
it invalidated from another thread. Object reference is not enough
for the XbSilo, it breaks as soon as the underlying file changes.
---
plugins/flatpak/gs-flatpak.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 782b0bb48..c5437125d 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -59,7 +59,7 @@ struct _GsFlatpak {
AsComponentScope scope;
GsPlugin *plugin;
XbSilo *silo;
- GMutex silo_lock;
+ GRecMutex silo_lock;
gchar *silo_filename;
GHashTable *silo_installed_by_desktopid;
gint silo_change_stamp;
@@ -1187,11 +1187,11 @@ gs_flatpak_ref_silo (GsFlatpak *self,
g_autoptr(GFile) file = NULL;
g_autoptr(GPtrArray) xremotes = NULL;
g_autoptr(GPtrArray) desktop_paths = NULL;
- g_autoptr(GMutexLocker) locker = NULL;
+ g_autoptr(GRecMutexLocker) locker = NULL;
g_autoptr(XbBuilder) builder = NULL;
g_autoptr(GMainContext) old_thread_default = NULL;
- locker = g_mutex_locker_new (&self->silo_lock);
+ locker = g_rec_mutex_locker_new (&self->silo_lock);
/* everything is okay */
if (self->silo != NULL && xb_silo_is_valid (self->silo) &&
g_atomic_int_get (&self->silo_change_stamp_current) == g_atomic_int_get (&self->silo_change_stamp)) {
@@ -3754,6 +3754,7 @@ gs_flatpak_refine_wildcards (GsFlatpak *self,
GError **error)
{
g_autoptr(GError) error_local = NULL;
+ g_autoptr(GRecMutexLocker) silo_locker = NULL;
g_autoptr(XbSilo) silo = NULL;
g_autoptr(GHashTable) silo_installed_by_desktopid = NULL;
g_autoptr(GHashTable) components_by_id = NULL;
@@ -3764,6 +3765,11 @@ gs_flatpak_refine_wildcards (GsFlatpak *self,
GS_PROFILER_BEGIN_SCOPED (FlatpakRefineWildcard, "Flatpak (refine wildcard)", NULL);
+ /* the refine can take a long time, thus hold the silo lock to not have
+ it invalidated from another thread; object reference is not enough
+ for the XbSilo, it breaks as soon as the underlying file changes */
+ silo_locker = g_rec_mutex_locker_new (&self->silo_lock);
+
silo = gs_flatpak_ref_silo (self, interactive, &silo_filename, &silo_installed_by_desktopid, cancellable, error);
if (silo == NULL)
return FALSE;
@@ -4810,7 +4816,7 @@ gs_flatpak_finalize (GObject *object)
g_object_unref (self->plugin);
g_hash_table_unref (self->broken_remotes);
g_mutex_clear (&self->broken_remotes_mutex);
- g_mutex_clear (&self->silo_lock);
+ g_rec_mutex_clear (&self->silo_lock);
g_hash_table_unref (self->app_silos);
g_mutex_clear (&self->app_silos_mutex);
g_clear_pointer (&self->remote_title, g_hash_table_unref);
@@ -4831,7 +4837,7 @@ gs_flatpak_init (GsFlatpak *self)
{
/* XbSilo needs external locking as we destroy the silo and build a new
* one when something changes */
- g_mutex_init (&self->silo_lock);
+ g_rec_mutex_init (&self->silo_lock);
g_mutex_init (&self->installed_refs_mutex);
self->installed_refs = NULL;
--
GitLab

View file

@ -0,0 +1,88 @@
From 2669a70169402abf86253f42f7d2d9bd13e5d070 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Thu, 9 Jan 2020 14:54:18 +0100
Subject: [PATCH 2/3] rpm-ostree: Hook up distro upgrade triggering
We were correctly downloading distro upgrades, but never deploying the
new version.
Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/857
---
plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 61 +++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index 8e8da6f7a..cccc7f5e0 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -928,6 +928,67 @@ gs_plugin_update_app (GsPlugin *plugin,
return TRUE;
}
+gboolean
+gs_plugin_app_upgrade_trigger (GsPlugin *plugin,
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ const char *packages[] = { NULL };
+ g_autofree gchar *new_refspec = NULL;
+ g_autofree gchar *transaction_address = NULL;
+ g_autoptr(GVariant) options = NULL;
+ g_autoptr(TransactionProgress) tp = transaction_progress_new ();
+
+ /* only process this app if was created by this plugin */
+ if (g_strcmp0 (gs_app_get_management_plugin (app), gs_plugin_get_name (plugin)) != 0)
+ return TRUE;
+
+ /* check is distro-upgrade */
+ if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE)
+ return TRUE;
+
+ /* construct new refspec based on the distro version we're upgrading to */
+ new_refspec = g_strdup_printf ("ostree://fedora/%s/x86_64/silverblue",
+ gs_app_get_version (app));
+
+ /* trigger the upgrade */
+ options = make_rpmostree_options_variant (FALSE, /* reboot */
+ TRUE, /* allow-downgrade */
+ TRUE, /* cache-only */
+ FALSE, /* download-only */
+ FALSE, /* skip-purge */
+ FALSE, /* no-pull-base */
+ FALSE, /* dry-run */
+ FALSE); /* no-overrides */
+
+ if (!gs_rpmostree_os_call_rebase_sync (priv->os_proxy,
+ options,
+ new_refspec,
+ packages,
+ NULL /* fd list */,
+ &transaction_address,
+ NULL /* fd list out */,
+ cancellable,
+ error)) {
+ gs_rpmostree_error_convert (error);
+ return FALSE;
+ }
+
+ if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
+ transaction_address,
+ tp,
+ cancellable,
+ error)) {
+ gs_rpmostree_error_convert (error);
+ return FALSE;
+ }
+
+ /* success */
+ return TRUE;
+}
+
static gboolean
gs_plugin_repo_enable (GsPlugin *plugin,
GsApp *app,
--
2.21.1

View file

@ -0,0 +1,26 @@
From 3f8fa5c87c414391b295769db7bb622c44a2916d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Mon, 27 Jan 2020 23:15:55 +0100
Subject: [PATCH 3/3] rpm-ostree: Show progress when downloading distro
upgrades
---
plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index cccc7f5e0..0ceb4d2d6 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -1482,6 +1482,8 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
FALSE); /* no-overrides */
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+ tp->app = g_object_ref (app);
+
if (!gs_rpmostree_os_call_rebase_sync (priv->os_proxy,
options,
new_refspec,
--
2.21.1

View file

@ -1 +0,0 @@
checkout-gs-dnf5

View file

@ -1,35 +0,0 @@
#!/bin/bash
if [ ! -d checkout-gs-dnf5 ]; then
git clone --branch main https://gitlab.gnome.org/mcrha/gnome-software.git checkout-gs-dnf5 && \
cd checkout-gs-dnf5 && \
git checkout -b wip/dnf5daemon origin/wip/dnf5daemon && \
cd - >/dev/null
if [ "$?" != "0" ]; then
echo "Failed to clone dnf5-plugin repository" 1>&2
exit 1;
fi
fi
PATCH_PATH=../0001-dnf5-plugin.patch
cd checkout-gs-dnf5 && \
echo "Updating gs-dnf5 git 'main' repository" && \
git checkout main && \
git pull --rebase && \
echo "Updating gs-dnf5 git 'dnf5-pugin' repository" && \
git checkout wip/dnf5daemon && \
git pull --rebase && \
echo -n "at " >../${PATCH_PATH} && \
git log HEAD | head -n 5 | grep -E "commit|Date" >>../${PATCH_PATH} && \
echo "" >>../${PATCH_PATH} && \
git diff main >>../${PATCH_PATH} && \
cd - >/dev/null
if [ "$?" = "0" ]; then
echo "Patch '${PATCH_PATH}' updated"
else
echo "Failed to update patch '${PATCH_PATH}'" 1>&2
exit 1
fi

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
---
runpath:
allowed_paths:
- /usr/lib/gnome-software
- /usr/lib/rpm-ostree
- /usr/lib64/gnome-software
- /usr/lib64/rpm-ostree

View file

@ -1 +1,3 @@
SHA512 (gnome-software-49.3.tar.xz) = 0414ea55ad3b83bcd50514985e3d2026207801c040934805bb26d162e88f0619a9d70aa6ba324a29acfab02573490b928c83594b54f57ec2a8ad00e6c127f657
SHA512 (gnome-software-3.34.2.tar.xz) = 4deb09530fbeeadd54e69d03ef4cecaef47c6766bce0ec5230bb090d27e54664577a227416933b6ec4780249f4565e51202a25517fba5dd040fd895bd3a26397
SHA512 (f32.png) = 2adc08c5f4ca95f3fbf970bb77d4fda12ea4935d8bff707381d867d9ae90cf35b118444681dffb49229810d7c72f346d3f524d5bd7867d88c71b3ce8c04e1e05
SHA512 (f33.png) = 371b492d89f245c28f8ee56e154bcfdb4af0a5416323faab08cad0632993e82512301676ef21e26fce371c7d0af3c53b6a2c3539f43f5a6fa5fdc9f6911f6ad7