Backport various OCI fixes from upstream

This commit is contained in:
Kalev Lember 2020-09-11 16:54:54 +02:00
parent df2fd06ece
commit 6b8a0a5ed0
4 changed files with 109 additions and 1 deletions

26
3845.patch Normal file
View File

@ -0,0 +1,26 @@
From 7ad549b89dfbfb67fd1cbbf6cafdd996e4722246 Mon Sep 17 00:00:00 2001
From: "Owen W. Taylor" <otaylor@fishsoup.net>
Date: Wed, 9 Sep 2020 16:14:57 -0400
Subject: [PATCH] OCI: extract appstream data for runtimes
Runtimes also have appstream data - with description, license information,
and so forth, so we should extract the appstream data from the index
for refs that start with runtime/ as well.
---
common/flatpak-oci-registry.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/flatpak-oci-registry.c b/common/flatpak-oci-registry.c
index cf501a5eb..0f7471129 100644
--- a/common/flatpak-oci-registry.c
+++ b/common/flatpak-oci-registry.c
@@ -3120,7 +3120,8 @@ add_image_to_appstream (SoupSession *soup_session,
return;
ref_parts = g_strsplit (ref, "/", -1);
- if (g_strv_length (ref_parts) != 4 || strcmp (ref_parts[0], "app") != 0)
+ if (g_strv_length (ref_parts) != 4 ||
+ (strcmp (ref_parts[0], "app") != 0 && strcmp (ref_parts[0], "runtime") != 0))
return;
id = ref_parts[1];

43
3849.patch Normal file
View File

@ -0,0 +1,43 @@
From 834c8d4524062349e36920ebefbd1c50b14a6c25 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Fri, 11 Sep 2020 16:24:23 +0200
Subject: [PATCH] Don't loop authentincating if updating to the current version
In case we need to authenticate for updates (in my test case i was
doing an OCI downgrade) we might need to download a commit object (or
in the OCI case a manifest json), so it did a request_required_tokens(),
but that noticed during the flatpak_transaction_normalize_ops() call
that the partial resolve to a particular commit actually was the
same as the local installed commit and marked op->skip = TRUE.
However, when we got back to resolving the op again we didn't actually
look at the skip, so it kept looping wanting (but never doing) auth.
The fix is to just directly resolve ops marked as skipped.
---
common/flatpak-transaction.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c
index 410df8e54..9f9da23bd 100644
--- a/common/flatpak-transaction.c
+++ b/common/flatpak-transaction.c
@@ -2765,6 +2765,18 @@ resolve_ops (FlatpakTransaction *self,
if (op->resolved)
continue;
+ if (op->skip)
+ {
+ /* We're not yet resolved, but marked skip anyway, this can happen if during
+ * request_required_tokens() we were normalized away even though not fully resolved.
+ * For example we got the checksum but need to auth to get the commit, but the
+ * checksum we got was the version already installed.
+ */
+ g_assert (op->resolved_commit != NULL);
+ mark_op_resolved (op, op->resolved_commit, NULL, NULL, NULL);
+ continue;
+ }
+
if (op->kind == FLATPAK_TRANSACTION_OPERATION_UNINSTALL)
{
/* We resolve to the deployed metadata, because we need it to uninstall related ops */

32
3850.patch Normal file
View File

@ -0,0 +1,32 @@
From 6cf80f4703e57a819c6adc94b5a98b7c3e4c57d2 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Fri, 11 Sep 2020 16:47:05 +0200
Subject: [PATCH] OCI: Fix progress reporting
Somewhere during the progress reporting cleanup we lost the progress
for OCI pulls, this puts it back.
---
common/flatpak-progress.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/flatpak-progress.c b/common/flatpak-progress.c
index e3b8338c5..a83bcf816 100644
--- a/common/flatpak-progress.c
+++ b/common/flatpak-progress.c
@@ -428,6 +428,7 @@ flatpak_progress_update_oci_pull (FlatpakProgress *self,
if (self == NULL)
return;
+ self->requested = n_layers; /* Need to set this to trigger start of progress reporting, see update_status_progress_and_estimating() */
self->outstanding_fetches = n_layers - pulled_layers;
self->fetched_delta_parts = pulled_layers;
self->total_delta_parts = n_layers;
@@ -438,6 +439,8 @@ flatpak_progress_update_oci_pull (FlatpakProgress *self,
self->total_delta_part_usize = total_size;
self->total_delta_superblocks = 0;
update_status_progress_and_estimating (self);
+
+ self->callback (self->status, self->progress, self->estimating, self->user_data);
}
guint32

View File

@ -3,7 +3,7 @@
Name: flatpak
Version: 1.8.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Application deployment framework for desktop apps
License: LGPLv2+
@ -11,6 +11,10 @@ URL: http://flatpak.org/
Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/%{name}-%{version}.tar.xz
# Add Fedora flatpak repositories
Source1: flatpak-add-fedora-repos.service
# Various OCI fixes backported from upstream
Patch0: 3845.patch
Patch1: 3849.patch
Patch2: 3850.patch
BuildRequires: pkgconfig(appstream-glib)
BuildRequires: pkgconfig(dconf)
@ -266,6 +270,9 @@ fi
%changelog
* Fri Sep 11 2020 Kalev Lember <klember@redhat.com> - 1.8.2-2
- Backport various OCI fixes from upstream
* Fri Aug 21 2020 Kalev Lember <klember@redhat.com> - 1.8.2-1
- Update to 1.8.2