From 67ffd9a0b6f2f76de8aa08e6eb00505e48c48cbd Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 19 Jun 2017 15:01:19 +0200 Subject: [PATCH] Manually copy summary for update and appdata too --- common/flatpak-dir.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 42fd1293a..75cfdf49c 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -1735,16 +1735,39 @@ flatpak_dir_update_appstream (FlatpakDir *self, } else { + g_autoptr(GBytes) summary_copy = NULL; + g_autoptr(GBytes) summary_sig_copy = NULL; + g_autoptr(GFile) summary_file = NULL; + g_autoptr(GFile) summary_sig_file = NULL; + g_autoptr(OstreeRepo) child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, NULL, error); if (child_repo == NULL) return FALSE; + if (!flatpak_dir_remote_fetch_summary (self, remote, + &summary_copy, &summary_sig_copy, + cancellable, error)) + return FALSE; if (!flatpak_dir_pull (self, remote, branch, NULL, NULL, child_repo, FLATPAK_PULL_FLAGS_NONE, OSTREE_REPO_PULL_FLAGS_MIRROR, progress, cancellable, error)) return FALSE; + summary_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary"); + if (!g_file_replace_contents (summary_file, + g_bytes_get_data (summary_copy, NULL), + g_bytes_get_size (summary_copy), + NULL, FALSE, 0, NULL, cancellable, NULL)) + return FALSE; + + summary_sig_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary.sig"); + if (!g_file_replace_contents (summary_sig_file, + g_bytes_get_data (summary_sig_copy, NULL), + g_bytes_get_size (summary_sig_copy), + NULL, FALSE, 0, NULL, cancellable, NULL)) + return FALSE; + if (!ostree_repo_resolve_rev (child_repo, branch, TRUE, &new_checksum, error)) return FALSE; @@ -5618,11 +5641,20 @@ flatpak_dir_update (FlatpakDir *self, /* We're pulling from a remote source, we do the network mirroring pull as a user and hand back the resulting data to the system-helper, that trusts us due to the GPG signatures in the repo */ + g_autoptr(GBytes) summary_copy = NULL; + g_autoptr(GBytes) summary_sig_copy = NULL; + g_autoptr(GFile) summary_file = NULL; + g_autoptr(GFile) summary_sig_file = NULL; child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, commit, error); if (child_repo == NULL) return FALSE; + if (!flatpak_dir_remote_fetch_summary (self, remote_name, + &summary_copy, &summary_sig_copy, + cancellable, error)) + return FALSE; + flatpak_flags |= FLATPAK_PULL_FLAGS_SIDELOAD_EXTRA_DATA; if (!flatpak_dir_pull (self, remote_name, ref, commit, subpaths, child_repo, @@ -5630,6 +5662,20 @@ flatpak_dir_update (FlatpakDir *self, progress, cancellable, error)) return FALSE; + summary_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary"); + if (!g_file_replace_contents (summary_file, + g_bytes_get_data (summary_copy, NULL), + g_bytes_get_size (summary_copy), + NULL, FALSE, 0, NULL, cancellable, NULL)) + return FALSE; + + summary_sig_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary.sig"); + if (!g_file_replace_contents (summary_sig_file, + g_bytes_get_data (summary_sig_copy, NULL), + g_bytes_get_size (summary_sig_copy), + NULL, FALSE, 0, NULL, cancellable, NULL)) + return FALSE; + child_repo_path = g_file_get_path (ostree_repo_get_path (child_repo)); }