Manually copy summary for update and appdata too

tingping/wmclass
Alexander Larsson 2017-06-19 15:01:19 +02:00
parent 00802cc710
commit 67ffd9a0b6
1 changed files with 46 additions and 0 deletions

View File

@ -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));
}