!5 Upgrade to 3.38.2

From: @weijin-deng
Reviewed-by: @dwl301
Signed-off-by: @dwl301
This commit is contained in:
openeuler-ci-bot 2021-07-01 02:32:10 +00:00 committed by Gitee
commit b4a64787d7
6 changed files with 302 additions and 618 deletions

View File

@ -0,0 +1,271 @@
From b3a50ee2d6b93980d1808599ba003e9afc4feae5 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Mon, 14 Sep 2020 12:07:30 +0200
Subject: [PATCH] Revert "packagekit: Avoid 600000 allocations when comparing
package IDs"
This broke packagekit updates.
https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1061
https://bodhi.fedoraproject.org/updates/FEDORA-2020-7f57486c95#comment-1621958
This reverts commit 955570e4a5d737a9a4f85860fd7e483158e130c4.
---
.../packagekit/gs-plugin-packagekit-refine.c | 12 +-
.../gs-plugin-packagekit-url-to-app.c | 6 +-
plugins/packagekit/packagekit-common.c | 149 ++++++------------
plugins/packagekit/packagekit-common.h | 3 +-
4 files changed, 54 insertions(+), 116 deletions(-)
diff --git a/plugins/packagekit/gs-plugin-packagekit-refine.c b/plugins/packagekit/gs-plugin-packagekit-refine.c
index 68f7eb6..97c70dd 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refine.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refine.c
@@ -345,7 +345,6 @@ gs_plugin_packagekit_refine_details2 (GsPlugin *plugin,
g_autoptr(GPtrArray) array = NULL;
g_autoptr(GPtrArray) package_ids = NULL;
g_autoptr(PkResults) results = NULL;
- g_autoptr(GHashTable) details_collection = NULL;
package_ids = g_ptr_array_new_with_free_func (g_free);
for (i = 0; i < gs_app_list_length (list); i++) {
@@ -375,17 +374,11 @@ gs_plugin_packagekit_refine_details2 (GsPlugin *plugin,
return FALSE;
}
- /* get the results and copy them into a hash table for fast lookups:
- * there are typically 400 to 700 elements in @array, and 100 to 200
- * elements in @list, each with 1 or 2 source IDs to look up (but
- * sometimes 200) */
- array = pk_results_get_details_array (results);
- details_collection = gs_plugin_packagekit_details_array_to_hash (array);
-
/* set the update details for the update */
+ array = pk_results_get_details_array (results);
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
- gs_plugin_packagekit_refine_details_app (plugin, details_collection, app);
+ gs_plugin_packagekit_refine_details_app (plugin, array, app);
}
return TRUE;
diff --git a/plugins/packagekit/gs-plugin-packagekit-url-to-app.c b/plugins/packagekit/gs-plugin-packagekit-url-to-app.c
index 0418920..7f566c7 100644
--- a/plugins/packagekit/gs-plugin-packagekit-url-to-app.c
+++ b/plugins/packagekit/gs-plugin-packagekit-url-to-app.c
@@ -106,15 +106,11 @@ gs_plugin_url_to_app (GsPlugin *plugin,
details = pk_results_get_details_array (results);
if (packages->len >= 1) {
- g_autoptr(GHashTable) details_collection = NULL;
-
if (gs_app_get_local_file (app) != NULL)
return TRUE;
- details_collection = gs_plugin_packagekit_details_array_to_hash (details);
-
gs_plugin_packagekit_resolve_packages_app (plugin, packages, app);
- gs_plugin_packagekit_refine_details_app (plugin, details_collection, app);
+ gs_plugin_packagekit_refine_details_app (plugin, details, app);
gs_app_list_add (list, app);
} else {
diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c
index ed77b34..6914dde 100644
--- a/plugins/packagekit/packagekit-common.c
+++ b/plugins/packagekit/packagekit-common.c
@@ -388,127 +388,78 @@ gs_plugin_packagekit_set_metadata_from_package (GsPlugin *plugin,
pk_package_get_summary (package));
}
-/* Hash functions which compare PkPackageIds on NAME, VERSION and ARCH, but not DATA.
- * This is because some backends do not append the origin.
+/*
+ * gs_pk_compare_ids:
*
- * Borrowing some implementation details from pk-package-id.c, a package
- * ID is a semicolon-separated list of NAME;[VERSION];[ARCH];[DATA],
- * so a comparison which ignores DATA is just a strncmp() up to and
- * including the final semicolon.
- *
- * Doing it this way means zero allocations, which allows the hash and
- * equality functions to be fast. This is important when dealing with
- * large refine() package lists.
- *
- * The hash and equality functions assume that the IDs they are passed are
- * valid. */
-static guint
-package_id_hash (gconstpointer key)
-{
- const gchar *package_id = key;
- gchar *no_data;
- gsize i, last_semicolon = 0;
-
- /* find the last semicolon, which starts the DATA section */
- for (i = 0; package_id[i] != '\0'; i++) {
- if (package_id[i] == ';')
- last_semicolon = i;
- }
-
- /* exit early if the DATA section was empty */
- if (last_semicolon + 1 == i)
- return g_str_hash (package_id);
-
- /* extract up to (and including) the last semicolon into a local string */
- no_data = g_alloca (last_semicolon + 2);
- memcpy (no_data, package_id, last_semicolon + 1);
- no_data[last_semicolon + 1] = '\0';
-
- return g_str_hash (no_data);
-}
-
+ * Do not compare the repo. Some backends do not append the origin.
+ */
static gboolean
-package_id_equal (gconstpointer a,
- gconstpointer b)
+gs_pk_compare_ids (const gchar *package_id1, const gchar *package_id2)
{
- const gchar *package_id_a = a;
- const gchar *package_id_b = b;
- gsize i, n_semicolons = 0;
-
- /* compare up to and including the last semicolon */
- for (i = 0; package_id_a[i] != '\0' && package_id_b[i] != '\0'; i++) {
- if (package_id_a[i] != package_id_b[i])
- return FALSE;
- if (package_id_a[i] == ';')
- n_semicolons++;
- if (n_semicolons == 4)
- return TRUE;
- }
-
- return package_id_a[i] == package_id_b[i];
-}
-
-GHashTable *
-gs_plugin_packagekit_details_array_to_hash (GPtrArray *array)
-{
- g_autoptr(GHashTable) details_collection = NULL;
-
- details_collection = g_hash_table_new_full (package_id_hash, package_id_equal,
- NULL, NULL);
-
- for (gsize i = 0; i < array->len; i++) {
- PkDetails *details = g_ptr_array_index (array, i);
- g_hash_table_insert (details_collection,
- pk_details_get_package_id (details),
- details);
- }
-
- return g_steal_pointer (&details_collection);
+ gboolean ret;
+ g_auto(GStrv) split1 = NULL;
+ g_auto(GStrv) split2 = NULL;
+
+ split1 = pk_package_id_split (package_id1);
+ if (split1 == NULL)
+ return FALSE;
+ split2 = pk_package_id_split (package_id2);
+ if (split2 == NULL)
+ return FALSE;
+ ret = (g_strcmp0 (split1[PK_PACKAGE_ID_NAME],
+ split2[PK_PACKAGE_ID_NAME]) == 0 &&
+ g_strcmp0 (split1[PK_PACKAGE_ID_VERSION],
+ split2[PK_PACKAGE_ID_VERSION]) == 0 &&
+ g_strcmp0 (split1[PK_PACKAGE_ID_ARCH],
+ split2[PK_PACKAGE_ID_ARCH]) == 0);
+ return ret;
}
void
gs_plugin_packagekit_refine_details_app (GsPlugin *plugin,
- GHashTable *details_collection,
+ GPtrArray *array,
GsApp *app)
{
GPtrArray *source_ids;
PkDetails *details;
const gchar *package_id;
+ guint i;
guint j;
guint64 size = 0;
- /* @source_ids can have as many as 200 elements (google-noto); typically
- * it has 1 or 2
- *
- * @details_collection is typically a large list of apps in the
- * repository, on the order of 400 or 700 apps */
source_ids = gs_app_get_source_ids (app);
for (j = 0; j < source_ids->len; j++) {
package_id = g_ptr_array_index (source_ids, j);
- details = g_hash_table_lookup (details_collection, package_id);
- if (details == NULL)
- continue;
-
- if (gs_app_get_license (app) == NULL) {
- g_autofree gchar *license_spdx = NULL;
- license_spdx = as_utils_license_to_spdx (pk_details_get_license (details));
- if (license_spdx != NULL) {
- gs_app_set_license (app,
- GS_APP_QUALITY_LOWEST,
- license_spdx);
+ for (i = 0; i < array->len; i++) {
+ /* right package? */
+ details = g_ptr_array_index (array, i);
+ if (!gs_pk_compare_ids (package_id,
+ pk_details_get_package_id (details))) {
+ continue;
}
+ if (gs_app_get_license (app) == NULL) {
+ g_autofree gchar *license_spdx = NULL;
+ license_spdx = as_utils_license_to_spdx (pk_details_get_license (details));
+ if (license_spdx != NULL) {
+ gs_app_set_license (app,
+ GS_APP_QUALITY_LOWEST,
+ license_spdx);
+ }
+ }
+ if (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE) == NULL) {
+ gs_app_set_url (app,
+ AS_URL_KIND_HOMEPAGE,
+ pk_details_get_url (details));
+ }
+ if (gs_app_get_description (app) == NULL) {
+ gs_app_set_description (app,
+ GS_APP_QUALITY_LOWEST,
+ pk_details_get_description (details));
+ }
+ size += pk_details_get_size (details);
+ break;
+
}
- if (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE) == NULL) {
- gs_app_set_url (app,
- AS_URL_KIND_HOMEPAGE,
- pk_details_get_url (details));
- }
- if (gs_app_get_description (app) == NULL) {
- gs_app_set_description (app,
- GS_APP_QUALITY_LOWEST,
- pk_details_get_description (details));
- }
- size += pk_details_get_size (details);
}
/* the size is the size of all sources */
diff --git a/plugins/packagekit/packagekit-common.h b/plugins/packagekit/packagekit-common.h
index 9f52368..0742ea3 100644
--- a/plugins/packagekit/packagekit-common.h
+++ b/plugins/packagekit/packagekit-common.h
@@ -30,9 +30,8 @@ void gs_plugin_packagekit_resolve_packages_app (GsPlugin *plugin,
void gs_plugin_packagekit_set_metadata_from_package (GsPlugin *plugin,
GsApp *app,
PkPackage *package);
-GHashTable * gs_plugin_packagekit_details_array_to_hash (GPtrArray *array);
void gs_plugin_packagekit_refine_details_app (GsPlugin *plugin,
- GHashTable *details_collection,
+ GPtrArray *array,
GsApp *app);
void gs_plugin_packagekit_set_packaging_format (GsPlugin *plugin,
GsApp *app);

View File

@ -1,123 +0,0 @@
From ece9a68becd6441d238f23acd2a1b156243fa7b6 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 7 May 2019 08:22:53 +0200
Subject: [PATCH] packagekit: Fix progress marshalling for upgrade_download and
refresh
The new GsPackageKitHelper class introduced in mega-commit 37103e6 only
handled progress marshalling when downloading a list of packages, but
not when the PK transaction is one big monolithic operation that only
has a single GsApp associated, such as when downloading all of the
distro upgrades, or when refreshing the cache.
This commit adds a way to explicitly add a GsApp to GsPackageKitHelper
to use for marshalling progress in these cases.
---
plugins/packagekit/gs-packagekit-helper.c | 13 ++++++++++++-
plugins/packagekit/gs-packagekit-helper.h | 3 +++
plugins/packagekit/gs-plugin-packagekit-refresh.c | 2 +-
plugins/packagekit/gs-plugin-packagekit-upgrade.c | 2 +-
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/plugins/packagekit/gs-packagekit-helper.c b/plugins/packagekit/gs-packagekit-helper.c
index a292e0068..39c026c3e 100644
--- a/plugins/packagekit/gs-packagekit-helper.c
+++ b/plugins/packagekit/gs-packagekit-helper.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2016-2018 Richard Hughes <richard@hughsie.com>
+ * Copyright (C) 2019 Kalev Lember <klember@redhat.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -29,6 +30,7 @@
struct _GsPackagekitHelper {
GObject parent_instance;
GHashTable *apps;
+ GsApp *progress_app;
GsPlugin *plugin;
};
@@ -43,7 +45,9 @@ gs_packagekit_helper_cb (PkProgress *progress, PkProgressType type, gpointer use
GsApp *app = NULL;
/* optional */
- if (package_id != NULL)
+ if (self->progress_app != NULL)
+ app = self->progress_app;
+ else if (package_id != NULL)
app = gs_packagekit_helper_get_app_by_id (self, package_id);
if (type == PK_PROGRESS_TYPE_STATUS) {
@@ -79,6 +83,12 @@ gs_packagekit_helper_add_app (GsPackagekitHelper *self, GsApp *app)
}
}
+void
+gs_packagekit_helper_set_progress_app (GsPackagekitHelper *self, GsApp *progress_app)
+{
+ g_set_object (&self->progress_app, progress_app);
+}
+
GsPlugin *
gs_packagekit_helper_get_plugin (GsPackagekitHelper *self)
{
@@ -104,6 +114,7 @@ gs_packagekit_helper_finalize (GObject *object)
self = GS_PACKAGEKIT_HELPER (object);
g_object_unref (self->plugin);
+ g_clear_object (&self->progress_app);
g_hash_table_unref (self->apps);
G_OBJECT_CLASS (gs_packagekit_helper_parent_class)->finalize (object);
diff --git a/plugins/packagekit/gs-packagekit-helper.h b/plugins/packagekit/gs-packagekit-helper.h
index 3b5263c0a..b18b8229b 100644
--- a/plugins/packagekit/gs-packagekit-helper.h
+++ b/plugins/packagekit/gs-packagekit-helper.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2016-2018 Richard Hughes <richard@hughsie.com>
+ * Copyright (C) 2019 Kalev Lember <klember@redhat.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -36,6 +37,8 @@ GsPackagekitHelper *gs_packagekit_helper_new (GsPlugin *plugin);
GsPlugin *gs_packagekit_helper_get_plugin (GsPackagekitHelper *self);
void gs_packagekit_helper_add_app (GsPackagekitHelper *self,
GsApp *app);
+void gs_packagekit_helper_set_progress_app (GsPackagekitHelper *self,
+ GsApp *progress_app);
GsApp *gs_packagekit_helper_get_app_by_id (GsPackagekitHelper *progress,
const gchar *package_id);
void gs_packagekit_helper_cb (PkProgress *progress,
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index ff893daaf..a8093de2c 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -156,7 +156,7 @@ gs_plugin_refresh (GsPlugin *plugin,
/* refresh the metadata */
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
- gs_packagekit_helper_add_app (helper, app_dl);
+ gs_packagekit_helper_set_progress_app (helper, app_dl);
results = pk_client_refresh_cache (PK_CLIENT (priv->task),
FALSE /* force */,
cancellable,
diff --git a/plugins/packagekit/gs-plugin-packagekit-upgrade.c b/plugins/packagekit/gs-plugin-packagekit-upgrade.c
index 63175bec3..38de93d55 100644
--- a/plugins/packagekit/gs-plugin-packagekit-upgrade.c
+++ b/plugins/packagekit/gs-plugin-packagekit-upgrade.c
@@ -77,7 +77,7 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
/* ask PK to download enough packages to upgrade the system */
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- gs_packagekit_helper_add_app (helper, app);
+ gs_packagekit_helper_set_progress_app (helper, app);
results = pk_task_upgrade_system_sync (priv->task,
gs_app_get_version (app),
PK_UPGRADE_KIND_ENUM_COMPLETE,
--
2.21.0

View File

@ -1,473 +0,0 @@
From 0a1e76d866379ce6115aacd2cdee75db15bebab0 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 15 Jan 2019 23:48:33 +0100
Subject: [PATCH 1/3] shell: Improve the error message when whole update
operation fails
In case the whole updates operation fails and we don't have the data
which app failed, show 'Unable to install updates' error instead of
'Unable to update "(null)"'.
Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/480
---
src/gs-shell.c | 120 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 87 insertions(+), 33 deletions(-)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 6f1cda816..7c2f86d81 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1355,23 +1355,34 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
g_autofree gchar *str_origin = NULL;
g_autoptr(GString) str = g_string_new (NULL);
- str_app = gs_shell_get_title_from_app (app);
switch (error->code) {
case GS_PLUGIN_ERROR_DOWNLOAD_FAILED:
- if (origin != NULL) {
+ if (app != NULL && origin != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
str_origin = gs_shell_get_title_from_origin (origin);
/* TRANSLATORS: failure text for the in-app notification,
* where the first %s is the app name (e.g. "GIMP") and
* the second %s is the origin, e.g. "Fedora" or
* "Fedora Project [fedoraproject.org]" */
- g_string_append_printf (str, _("Unable to update %s from %s"),
+ g_string_append_printf (str, _("Unable to update %s from %s as download failed"),
str_app, str_origin);
buttons = TRUE;
- } else {
+ } else if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
g_string_append_printf (str, _("Unable to update %s as download failed"),
str_app);
+ } else if (origin != NULL) {
+ str_origin = gs_shell_get_title_from_origin (origin);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the origin, e.g. "Fedora" or
+ * "Fedora Project [fedoraproject.org]" */
+ g_string_append_printf (str, _("Unable to install updates from %s as download failed"),
+ str_origin);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates as download failed"));
}
break;
case GS_PLUGIN_ERROR_NO_NETWORK:
@@ -1382,49 +1393,92 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
buttons |= GS_SHELL_EVENT_BUTTON_NETWORK_SETTINGS;
break;
case GS_PLUGIN_ERROR_NO_SPACE:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "GIMP") */
- g_string_append_printf (str, _("Unable to update %s: "
- "not enough disk space"),
- str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "not enough disk space"),
+ str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates: "
+ "not enough disk space"));
+ }
buttons |= GS_SHELL_EVENT_BUTTON_NO_SPACE;
break;
case GS_PLUGIN_ERROR_AUTH_REQUIRED:
case GS_PLUGIN_ERROR_PIN_REQUIRED:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "GIMP") */
- g_string_append_printf (str, _("Unable to update %s: "
- "authentication was required"),
- str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "authentication was required"),
+ str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates: "
+ "authentication was required"));
+ }
break;
case GS_PLUGIN_ERROR_AUTH_INVALID:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "GIMP") */
- g_string_append_printf (str, _("Unable to update %s: "
- "authentication was invalid"),
- str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "authentication was invalid"),
+ str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates: "
+ "authentication was invalid"));
+ }
break;
case GS_PLUGIN_ERROR_NO_SECURITY:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "GIMP") */
- g_string_append_printf (str, _("Unable to update %s: "
- "you do not have permission to "
- "update software"),
- str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "you do not have permission to "
+ "update software"),
+ str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates: "
+ "you do not have permission to "
+ "update software"));
+ }
break;
case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "Dell XPS 13") */
- g_string_append_printf (str, _("Unable to update %s: "
- "AC power is required"),
- str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "Dell XPS 13") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "AC power is required"),
+ str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "Dell XPS 13") */
+ g_string_append_printf (str, _("Unable to install updates: "
+ "AC power is required"));
+ }
break;
case GS_PLUGIN_ERROR_CANCELLED:
break;
default:
- /* TRANSLATORS: failure text for the in-app notification,
- * where the %s is the application name (e.g. "GIMP") */
- g_string_append_printf (str, _("Unable to update %s"), str_app);
+ if (app != NULL) {
+ str_app = gs_shell_get_title_from_app (app);
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to update %s"), str_app);
+ } else {
+ /* TRANSLATORS: failure text for the in-app notification */
+ g_string_append_printf (str, _("Unable to install updates"));
+ }
break;
}
if (str->len == 0)
--
2.21.0
From af764483533ac1afc42a5c0f1c6b76c43be1d24d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 15 Jan 2019 23:49:50 +0100
Subject: [PATCH 2/3] shell: Add details for a system upgrade error
Make the "internet access was required" error look the same as the rest
of the system upgrade errors, showing which distro version we were
trying to upgrade to.
---
src/gs-shell.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 7c2f86d81..7c97740fa 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1534,10 +1534,12 @@ gs_shell_show_event_upgrade (GsShell *shell, GsPluginEvent *event)
}
break;
case GS_PLUGIN_ERROR_NO_NETWORK:
- /* TRANSLATORS: failure text for the in-app notification */
- g_string_append (str, _("Unable to upgrade: "
- "internet access was required but "
- "wasnt available"));
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the distro name (e.g. "Fedora 25") */
+ g_string_append_printf (str, _("Unable to upgrade to %s: "
+ "internet access was required but "
+ "wasnt available"),
+ str_app);
buttons |= GS_SHELL_EVENT_BUTTON_NETWORK_SETTINGS;
break;
case GS_PLUGIN_ERROR_NO_SPACE:
--
2.21.0
From 0d3c47f69e7f6452412a0a3e6704106eefc0c658 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 15 Jan 2019 23:55:22 +0100
Subject: [PATCH 3/3] shell: Improve the logic when to show detailed error
messages
Make sure we never have "Sorry, something went wrong" without actual
details what went wrong.
---
src/gs-shell.c | 64 +++++++++++---------------------------------------
1 file changed, 14 insertions(+), 50 deletions(-)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 7c97740fa..3eea95028 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -990,16 +990,6 @@ gs_shell_get_title_from_app (GsApp *app)
return g_strdup_printf (_("“%s”"), gs_app_get_id (app));
}
-static gboolean
-gs_shell_show_detailed_error (GsShell *shell, const GError *error)
-{
- if (error->code == GS_PLUGIN_ERROR_FAILED)
- return TRUE;
- if (error->code == GS_PLUGIN_ERROR_DOWNLOAD_FAILED)
- return TRUE;
- return FALSE;
-}
-
static gchar *
get_first_line (const gchar *str)
{
@@ -1055,6 +1045,7 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification */
g_string_append (str, _("Unable to download updates"));
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
case GS_PLUGIN_ERROR_NO_NETWORK:
/* TRANSLATORS: failure text for the in-app notification */
@@ -1106,6 +1097,7 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification */
g_string_append (str, _("Unable to get list of updates"));
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1121,10 +1113,6 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1173,15 +1161,12 @@ gs_shell_show_event_purchase (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
g_string_append_printf (str, _("Unable to purchase %s"), str_app);
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
return FALSE;
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, GS_SHELL_EVENT_BUTTON_NONE);
return TRUE;
@@ -1218,6 +1203,7 @@ gs_shell_show_event_install (GsShell *shell, GsPluginEvent *event)
"as download failed"),
str_app);
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
case GS_PLUGIN_ERROR_NOT_SUPPORTED:
if (origin != NULL) {
@@ -1319,6 +1305,7 @@ gs_shell_show_event_install (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
g_string_append_printf (str, _("Unable to install %s"), str_app);
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1334,10 +1321,6 @@ gs_shell_show_event_install (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1384,6 +1367,7 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification */
g_string_append_printf (str, _("Unable to install updates as download failed"));
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
case GS_PLUGIN_ERROR_NO_NETWORK:
/* TRANSLATORS: failure text for the in-app notification */
@@ -1479,6 +1463,7 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification */
g_string_append_printf (str, _("Unable to install updates"));
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1494,10 +1479,6 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1532,6 +1513,7 @@ gs_shell_show_event_upgrade (GsShell *shell, GsPluginEvent *event)
"as download failed"),
str_app);
}
+ gs_shell_append_detailed_error (shell, str, error);
break;
case GS_PLUGIN_ERROR_NO_NETWORK:
/* TRANSLATORS: failure text for the in-app notification,
@@ -1585,6 +1567,7 @@ gs_shell_show_event_upgrade (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the distro name (e.g. "Fedora 25") */
g_string_append_printf (str, _("Unable to upgrade to %s"), str_app);
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1600,10 +1583,6 @@ gs_shell_show_event_upgrade (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1658,6 +1637,7 @@ gs_shell_show_event_remove (GsShell *shell, GsPluginEvent *event)
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
g_string_append_printf (str, _("Unable to remove %s"), str_app);
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1673,10 +1653,6 @@ gs_shell_show_event_remove (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1722,6 +1698,7 @@ gs_shell_show_event_launch (GsShell *shell, GsPluginEvent *event)
return FALSE;
/* TRANSLATORS: we failed to get a proper error code */
g_string_append (str, _("Sorry, something went wrong"));
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1737,10 +1714,6 @@ gs_shell_show_event_launch (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1776,15 +1749,12 @@ gs_shell_show_event_file_to_app (GsShell *shell, GsPluginEvent *event)
return FALSE;
/* TRANSLATORS: we failed to get a proper error code */
g_string_append (str, _("Sorry, something went wrong"));
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
return FALSE;
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1820,15 +1790,12 @@ gs_shell_show_event_url_to_app (GsShell *shell, GsPluginEvent *event)
return FALSE;
/* TRANSLATORS: we failed to get a proper error code */
g_string_append (str, _("Sorry, something went wrong"));
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
return FALSE;
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- g_string_append_printf (str, "\n%s", error->message);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
@@ -1890,6 +1857,7 @@ gs_shell_show_event_fallback (GsShell *shell, GsPluginEvent *event)
return FALSE;
/* TRANSLATORS: we failed to get a proper error code */
g_string_append (str, _("Sorry, something went wrong"));
+ gs_shell_append_detailed_error (shell, str, error);
break;
}
if (str->len == 0)
@@ -1905,10 +1873,6 @@ gs_shell_show_event_fallback (GsShell *shell, GsPluginEvent *event)
}
}
- /* add extra debugging for debug builds */
- if (gs_shell_show_detailed_error (shell, error))
- gs_shell_append_detailed_error (shell, str, error);
-
/* show in-app notification */
gs_shell_show_event_app_notify (shell, str->str, buttons);
return TRUE;
--
2.21.0

Binary file not shown.

Binary file not shown.

View File

@ -1,23 +1,24 @@
Name: gnome-software
Version: 3.30.6
Release: 7
Version: 3.38.2
Release: 1
Summary: GNOME software Store
License: GPLv2+
URL: https://wiki.gnome.org/Apps/Software
Source0: https://download.gnome.org/sources/gnome-software/3.30/gnome-software-%{version}.tar.xz
Patch0001: gnome-software-3-30-error-message-fixes.patch
Patch0002: 0001-packagekit-Fix-progress-marshalling-for-upgrade_down.patch
Source0: https://download.gnome.org/sources/gnome-software/3.38/gnome-software-%{version}.tar.xz
Patch0001: 0001-Revert-packagekit-Avoid-600000-allocations-when-comp.patch
BuildRequires: gettext libxslt docbook-style-xsl desktop-file-utils
BuildRequires: fwupd-devel >= 1.0.7 glib2-devel >= 2.56.0 gnome-desktop3-devel
BuildRequires: gsettings-desktop-schemas-devel >= 3.12.0
BuildRequires: fwupd-devel >= 1.0.3 glib2-devel >= 2.61.1 gnome-desktop3-devel
BuildRequires: gsettings-desktop-schemas-devel >= 3.12.0 gnome-online-accounts-devel
BuildRequires: gspell-devel gtk3-devel >= 3.22.4 gtk-doc json-glib-devel >= 1.2.0
BuildRequires: libappstream-glib-devel >= 0.7.14-3 libsoup-devel meson
BuildRequires: PackageKit-glib-devel >= 1.1.1 polkit-devel libsecret-devel
BuildRequires: flatpak-devel >= 0.9.4 ostree-devel rpm-ostree-devel
BuildRequires: libgudev1-devel valgrind-devel liboauth-devel snapd-glib-devel >= 1.42
BuildRequires: libappstream-glib-devel >= 0.7.14-3 libdnf-devel libsoup-devel meson
BuildRequires: PackageKit-glib-devel >= 1.1.1 polkit-devel libxmlb-devel >= 0.1.7
BuildRequires: flatpak-devel >= 1.5.1 ostree-devel rpm-ostree-devel
BuildRequires: libgudev1-devel valgrind-devel rpm-devel sysprof-devel
BuildRequires: gcc gcc-c++
Requires: appstream-data epiphany-runtime
Requires: flatpak >= 0.9.4 flatpak-libs >= 0.9.4 fwupd >= 1.0.7 glib2 >= 2.56.0
Requires: flatpak >= 1.5.1 flatpak-libs >= 1.5.1 fwupd >= 1.0.3 glib2 >= 2.61.0
Requires: gnome-desktop3 >= 3.18.0 gnome-menus gsettings-desktop-schemas >= 3.12.0
Requires: gtk3 >= 3.22.4 json-glib >= 1.2.0 iso-codes libappstream-glib >= 0.7.14-3
Requires: librsvg2 libsoup >= 2.52.0 PackageKit >= 1.1.1 snapd-login-service
@ -49,8 +50,8 @@ Editor is used to design banners for GNOME Software.
%autosetup -n gnome-software-%{version} -p1
%build
%meson -Dsnap=true -Dgudev=true -Dpackagekit=true -Dexternal_appstream=false -Drpm_ostree=true \
-Dtests=false -Dubuntuone=false -Dubuntu_reviews=false
%meson -Dsnap=false -Dgudev=true -Dpackagekit=true -Dexternal_appstream=false -Drpm_ostree=false \
-Dtests=false -Dmalcontent=false
%meson_build
%install
@ -59,6 +60,8 @@ desktop-file-edit %{buildroot}%{_datadir}/applications/org.gnome.Software.deskto
--set-key=X-AppInstall-Package --set-value=gnome-software
install -d %{buildroot}%{_datadir}/gnome-software/backgrounds
%delete_la_and_a
%find_lang %name --with-gnome
%check
@ -70,12 +73,12 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_datadir}/applications/gnome-software-local-file.desktop
%{_datadir}/applications/org.gnome.Software.desktop
%dir %{_datadir}/gnome-software
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*
%{_datadir}/gnome-software/backgrounds/
%{_datadir}/gnome-software/{*.png,featured-*.svg,featured-*.jpg}
%{_datadir}/metainfo/*.xml
%dir %{_libdir}/gs-plugins-12
%{_libdir}/gs-plugins-12/*.so
%dir %{_libdir}/gs-plugins-13
%{_libdir}/gs-plugins-13/*.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
@ -83,8 +86,8 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_datadir}/gnome-shell/search-providers/org.gnome.Software-search-provider.ini
%{_datadir}/glib-2.0/schemas/org.gnome.software.gschema.xml
%{_libexecdir}/{gnome-software-cmd,gnome-software-restarter}
%{_libdir}/gs-plugins-12/libgs_plugin_snap.so
%{_datadir}/metainfo/org.gnome.Software.Plugin.Snap.metainfo.xml
#%{_libdir}/gs-plugins-12/libgs_plugin_snap.so
#%{_datadir}/metainfo/org.gnome.Software.Plugin.Snap.metainfo.xml
%files devel
%{_libdir}/pkgconfig/gnome-software.pc
@ -93,14 +96,20 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_datadir}/gtk-doc/html/gnome-software
%files help
%{_mandir}/man1/gnome-software-editor.1*
#%{_mandir}/man1/gnome-software-editor.1*
%{_mandir}/man1/gnome-software.1.gz
%files editor
%{_bindir}/gnome-software-editor
%{_datadir}/applications/org.gnome.Software.Editor.desktop
#%{_bindir}/gnome-software-editor
#%{_datadir}/applications/org.gnome.Software.Editor.desktop
%changelog
* Fri Jun 18 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.2-1
- Upgrade to 3.38.2
- Delete all two patches that existed in this version
- Add 0001-Revert-packagekit-Avoid-600000-allocations-when-comp.patch
- Temporarily disabled snap and rpm_ostree option
* Tue May 18 2021 lin.zhang <lin.zhang@turbolinux.com.cn> - 3.30.6-7
- add BuildRequires gcc gcc-c++