Update to 42.0
This commit is contained in:
parent
154dca4c08
commit
0db1b574e2
182
1282.patch
182
1282.patch
@ -1,182 +0,0 @@
|
|||||||
From edbeab87ce5aa48bd9fe49dd22acfcce2b8b0fc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
Date: Thu, 10 Mar 2022 13:20:58 +0000
|
|
||||||
Subject: [PATCH 1/3] =?UTF-8?q?gs-download-utils:=20Don=E2=80=99t=20use=20?=
|
|
||||||
=?UTF-8?q?ETag=20when=20writing=20local=20file?=
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
The ETag we care about for the download is the ETag returned by the
|
|
||||||
server, not the ETag of the local file. Passing the server’s ETag to the
|
|
||||||
local file operations may result in the local file not being written to,
|
|
||||||
with a “The file was externally modified” error.
|
|
||||||
|
|
||||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
|
|
||||||
Fixes: #1677
|
|
||||||
---
|
|
||||||
lib/gs-download-utils.c | 20 +++++++++++++++++---
|
|
||||||
1 file changed, 17 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c
|
|
||||||
index f3a64479b..a6d930587 100644
|
|
||||||
--- a/lib/gs-download-utils.c
|
|
||||||
+++ b/lib/gs-download-utils.c
|
|
||||||
@@ -134,6 +134,9 @@ static void download_progress (GTask *task);
|
|
||||||
* existing content of the output stream (if it’s a file, for example) will not
|
|
||||||
* be overwritten.
|
|
||||||
*
|
|
||||||
+ * Note that @last_etag must be the ETag value returned by the server last time
|
|
||||||
+ * the file was downloaded, not the local file ETag generated by GLib.
|
|
||||||
+ *
|
|
||||||
* If specified, @progress_callback will be called zero or more times until
|
|
||||||
* @callback is called, providing progress updates on the download.
|
|
||||||
*
|
|
||||||
@@ -644,9 +647,20 @@ gs_download_file_async (SoupSession *soup_session,
|
|
||||||
/* Query the old ETag if the file already exists. */
|
|
||||||
data->last_etag = gs_utils_get_file_etag (output_file, cancellable);
|
|
||||||
|
|
||||||
- /* Create the output file. */
|
|
||||||
+ /* Create the output file.
|
|
||||||
+ *
|
|
||||||
+ * Note that `data->last_etag` is *not* passed in here, as the ETag from
|
|
||||||
+ * the server and the file modification ETag that GLib uses are
|
|
||||||
+ * different things. For g_file_replace_async(), GLib always uses an
|
|
||||||
+ * ETag it generates internally based on the file mtime (see
|
|
||||||
+ * _g_local_file_info_create_etag()), which will never match what the
|
|
||||||
+ * server returns in its ETag header.
|
|
||||||
+ *
|
|
||||||
+ * This is fine, as we are using the ETag to avoid an unnecessary HTTP
|
|
||||||
+ * download if possible. We don’t care about tracking changes to the
|
|
||||||
+ * file on disk. */
|
|
||||||
g_file_replace_async (output_file,
|
|
||||||
- data->last_etag,
|
|
||||||
+ NULL, /* ETag */
|
|
||||||
FALSE, /* make_backup */
|
|
||||||
G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION,
|
|
||||||
io_priority,
|
|
||||||
@@ -699,7 +713,7 @@ download_file_cb (GObject *source_object,
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Update the ETag. */
|
|
||||||
+ /* Update the stored HTTP ETag. */
|
|
||||||
gs_utils_set_file_etag (data->output_file, new_etag, cancellable);
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
||||||
|
|
||||||
From 040e2dca3904d965450158dcdaeedfca12965682 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
Date: Thu, 10 Mar 2022 13:27:21 +0000
|
|
||||||
Subject: [PATCH 2/3] gs-utils: Add some debug messages for getting/setting
|
|
||||||
ETags
|
|
||||||
|
|
||||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
|
|
||||||
Helps: #1677
|
|
||||||
---
|
|
||||||
lib/gs-utils.c | 28 +++++++++++++++++++++++-----
|
|
||||||
1 file changed, 23 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/gs-utils.c b/lib/gs-utils.c
|
|
||||||
index 89349b1fe..6dc4d28a0 100644
|
|
||||||
--- a/lib/gs-utils.c
|
|
||||||
+++ b/lib/gs-utils.c
|
|
||||||
@@ -1509,14 +1509,18 @@ gs_utils_get_file_etag (GFile *file,
|
|
||||||
GCancellable *cancellable)
|
|
||||||
{
|
|
||||||
g_autoptr(GFileInfo) info = NULL;
|
|
||||||
+ g_autoptr(GError) local_error = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
|
||||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
|
|
||||||
|
|
||||||
- info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, NULL);
|
|
||||||
+ info = g_file_query_info (file, METADATA_ETAG_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, cancellable, &local_error);
|
|
||||||
|
|
||||||
- if (info == NULL)
|
|
||||||
+ if (info == NULL) {
|
|
||||||
+ g_debug ("Error getting attribute ‘%s’ for file ‘%s’: %s",
|
|
||||||
+ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message);
|
|
||||||
return NULL;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
return g_strdup (g_file_info_get_attribute_string (info, METADATA_ETAG_ATTRIBUTE));
|
|
||||||
}
|
|
||||||
@@ -1542,15 +1546,29 @@ gs_utils_set_file_etag (GFile *file,
|
|
||||||
const gchar *etag,
|
|
||||||
GCancellable *cancellable)
|
|
||||||
{
|
|
||||||
+ g_autoptr(GError) local_error = NULL;
|
|
||||||
+
|
|
||||||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
|
||||||
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
|
|
||||||
|
|
||||||
if (etag == NULL || *etag == '\0') {
|
|
||||||
- return g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID,
|
|
||||||
- NULL, G_FILE_QUERY_INFO_NONE, cancellable, NULL);
|
|
||||||
+ if (!g_file_set_attribute (file, METADATA_ETAG_ATTRIBUTE, G_FILE_ATTRIBUTE_TYPE_INVALID,
|
|
||||||
+ NULL, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) {
|
|
||||||
+ g_debug ("Error clearing attribute ‘%s’ on file ‘%s’: %s",
|
|
||||||
+ METADATA_ETAG_ATTRIBUTE, g_file_peek_path (file), local_error->message);
|
|
||||||
+ return FALSE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return TRUE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, &local_error)) {
|
|
||||||
+ g_debug ("Error setting attribute ‘%s’ to ‘%s’ on file ‘%s’: %s",
|
|
||||||
+ METADATA_ETAG_ATTRIBUTE, etag, g_file_peek_path (file), local_error->message);
|
|
||||||
+ return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- return g_file_set_attribute_string (file, METADATA_ETAG_ATTRIBUTE, etag, G_FILE_QUERY_INFO_NONE, cancellable, NULL);
|
|
||||||
+ return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
||||||
|
|
||||||
From c46d656c51938adb994b4597c766259bf1813fe5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
Date: Thu, 10 Mar 2022 13:27:50 +0000
|
|
||||||
Subject: [PATCH 3/3] gs-utils: Change ETag attribute namespace from metadata
|
|
||||||
to xattr
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
The xattr namespace is likely to be supported on all modern Linux
|
|
||||||
distributions for local files, and doesn’t require IPC with
|
|
||||||
`gvfsd-metadata`.
|
|
||||||
|
|
||||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
|
|
||||||
Helps: #1677
|
|
||||||
---
|
|
||||||
lib/gs-utils.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/lib/gs-utils.c b/lib/gs-utils.c
|
|
||||||
index 6dc4d28a0..b8eefe36e 100644
|
|
||||||
--- a/lib/gs-utils.c
|
|
||||||
+++ b/lib/gs-utils.c
|
|
||||||
@@ -1488,7 +1488,7 @@ gs_utils_get_file_size (const gchar *filename,
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
-#define METADATA_ETAG_ATTRIBUTE "metadata::etag"
|
|
||||||
+#define METADATA_ETAG_ATTRIBUTE "xattr::gnome-software::etag"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gs_utils_get_file_etag:
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
45
1285.patch
45
1285.patch
@ -1,45 +0,0 @@
|
|||||||
From 92da7c98217856785dfea518890fa25acd3a055e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
Date: Thu, 10 Mar 2022 14:25:05 +0000
|
|
||||||
Subject: [PATCH] =?UTF-8?q?gs-download-utils:=20Ignore=20cancellation=20er?=
|
|
||||||
=?UTF-8?q?rors=20when=20there=E2=80=99s=20a=20cache=20hit?=
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
In order to avoid overwriting an existing cache file when the server has
|
|
||||||
said it’s up to date, we cancel closing the output stream.
|
|
||||||
|
|
||||||
Avoid propagating that cancellation error up to the caller; to them, the
|
|
||||||
operation should seem like a success rather than returning
|
|
||||||
`G_IO_ERROR_CANCELLED`.
|
|
||||||
|
|
||||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
||||||
|
|
||||||
Fixes: #1679
|
|
||||||
---
|
|
||||||
lib/gs-download-utils.c | 8 +++++++-
|
|
||||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/lib/gs-download-utils.c b/lib/gs-download-utils.c
|
|
||||||
index f3a64479b..4ab15c098 100644
|
|
||||||
--- a/lib/gs-download-utils.c
|
|
||||||
+++ b/lib/gs-download-utils.c
|
|
||||||
@@ -467,7 +467,13 @@ close_stream_cb (GObject *source_object,
|
|
||||||
* overwrite errors set earlier in the operation. */
|
|
||||||
if (!g_output_stream_close_finish (G_OUTPUT_STREAM (source_object),
|
|
||||||
result, &local_error)) {
|
|
||||||
- if (data->error == NULL)
|
|
||||||
+ /* If we are aborting writing the output stream (perhaps
|
|
||||||
+ * because of a cache hit), don’t report the error at
|
|
||||||
+ * all. */
|
|
||||||
+ if (data->discard_output_stream &&
|
|
||||||
+ g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
||||||
+ g_clear_error (&local_error);
|
|
||||||
+ else if (data->error == NULL)
|
|
||||||
data->error = g_steal_pointer (&local_error);
|
|
||||||
else if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
||||||
g_debug ("Error closing output stream: %s", local_error->message);
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
|||||||
%global tarball_version %%(echo %{version} | tr '~' '.')
|
%global tarball_version %%(echo %{version} | tr '~' '.')
|
||||||
|
|
||||||
Name: gnome-software
|
Name: gnome-software
|
||||||
Version: 42~rc
|
Version: 42.0
|
||||||
Release: 2%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: A software center for GNOME
|
Summary: A software center for GNOME
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -21,8 +21,6 @@ URL: https://wiki.gnome.org/Apps/Software
|
|||||||
Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz
|
Source0: https://download.gnome.org/sources/gnome-software/42/%{name}-%{tarball_version}.tar.xz
|
||||||
|
|
||||||
Patch01: 0001-crash-with-broken-theme.patch
|
Patch01: 0001-crash-with-broken-theme.patch
|
||||||
Patch02: 1282.patch
|
|
||||||
Patch03: 1285.patch
|
|
||||||
|
|
||||||
BuildRequires: appstream-devel >= %{appstream_version}
|
BuildRequires: appstream-devel >= %{appstream_version}
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -200,6 +198,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
|||||||
%{_datadir}/gtk-doc/html/gnome-software
|
%{_datadir}/gtk-doc/html/gnome-software
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 18 2022 Milan Crha <mcrha@redhat.com> - 42.0-1
|
||||||
|
- Update to 42.0
|
||||||
|
|
||||||
* Thu Mar 10 2022 Milan Crha <mcrha@redhat.com> - 42.rc-2
|
* Thu Mar 10 2022 Milan Crha <mcrha@redhat.com> - 42.rc-2
|
||||||
- Add upstream patches for gs-download-utils (i#1677 and i#1679)
|
- Add upstream patches for gs-download-utils (i#1677 and i#1679)
|
||||||
|
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (gnome-software-42.rc.tar.xz) = cd9c465d73b8998c0ebc49d5e40fec22522e0f125cbce5ff59a7a13d779a3793ac57dfb606d9b918e0c198b6b6cd62657483dc8e83a77ed84966c5f44980f38b
|
SHA512 (gnome-software-42.0.tar.xz) = f630232d164d1a7adcf9a91133769c6fe4ce62cdaeccd49b991330682eeccfddc8f83c7326802aaabdb4fc537243c0fd19741c702f4d23d75ebd71e9abb3da92
|
||||||
|
Loading…
Reference in New Issue
Block a user