diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2018-07-09 14:28:01 +0200 |
---|---|---|
committer | Alexander Larsson <alexander.larsson@gmail.com> | 2018-07-10 19:25:39 +0200 |
commit | b35144a691da398586e0b29b0639c700d01df060 (patch) | |
tree | dd23c1958cfcbbe3ed8144d51dbcb5396f451890 | |
parent | f16caf23afa46c81a6404286a3147c9da73c3341 (diff) | |
download | flatpak-b35144a691da398586e0b29b0639c700d01df060.tar.gz |
create-usb: Avoid invalidating the summary file
Since the create-usb command doesn't run as root (and if it did GNOME
Software wouldn't be able to call out to it), it can't update the
summary file in the source repo if the system installation is being
used. So the user is expected to run `ostree summary -u` before using
create-usb. But if the create-usb command then updates the appstream
data and repo metadata refs, the summary will no longer point to the
latest commits on those refs. As a short term fix, avoid updating the
appstream data and repo metadata, and mention in the manpage that the
user should do so. The better solution, not requiring any manual steps
on the user's part, will require a fix for
https://github.com/ostreedev/ostree/issues/1664.
-rw-r--r-- | app/flatpak-builtins-create-usb.c | 20 | ||||
-rw-r--r-- | doc/flatpak-create-usb.xml | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/app/flatpak-builtins-create-usb.c b/app/flatpak-builtins-create-usb.c index e2039fb9..583d9e23 100644 --- a/app/flatpak-builtins-create-usb.c +++ b/app/flatpak-builtins-create-usb.c @@ -633,33 +633,39 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE g_autoptr(OstreeCollectionRef) metadata_collection_ref = NULL; g_autoptr(OstreeCollectionRef) appstream_collection_ref = NULL; g_autoptr(OstreeCollectionRef) appstream2_collection_ref = NULL; - g_autoptr(FlatpakRemoteState) state = NULL; g_autoptr(GError) local_error = NULL; - g_autoptr(GPtrArray) dirs = NULL; g_autofree char *appstream_ref = NULL; g_autofree char *appstream2_ref = NULL; const char **remote_arches; - /* First try to update the repo metadata by creating a FlatpakRemoteState, - * but don't fail on error because we want this to work offline. */ + /* FIXME: Uncomment this to try to update the repo metadata after fixing + * https://github.com/ostreedev/ostree/issues/1664 so the summary doesn't + * get out of date. This is done by creating a FlatpakRemoteState, but + * don't fail on error because we want this to work offline. + g_autoptr(FlatpakRemoteState) state = NULL; state = flatpak_dir_get_remote_state_optional (dir, remote_name, cancellable, &local_error); if (state == NULL) { g_printerr (_("Warning: Couldn't update repo metadata for remote ‘%s’: %s\n"), remote_name, local_error->message); g_clear_error (&local_error); - } + } */ /* Add the ostree-metadata ref to the list */ metadata_collection_ref = ostree_collection_ref_new (collection_id, OSTREE_REPO_METADATA_REF); g_hash_table_insert (all_refs, g_steal_pointer (&metadata_collection_ref), commit_and_subpaths_new (NULL, NULL)); + /* Add whatever appstream data is available for each arch */ remote_arches = g_hash_table_lookup (remote_arch_map, remote_name); for (const char **iter = remote_arches; iter != NULL && *iter != NULL; ++iter) { - /* Try to update the appstream data */ const char *current_arch = *iter; + + /* FIXME: Uncomment this to try to update the appstream data after + * fixing https://github.com/ostreedev/ostree/issues/1664 so the + * summary doesn't become incorrect + g_autoptr(GPtrArray) dirs = NULL; dirs = g_ptr_array_new (); g_ptr_array_add (dirs, dir); if (!update_appstream (dirs, remote_name, current_arch, 0, TRUE, cancellable, &local_error)) @@ -667,7 +673,7 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE g_printerr (_("Warning: Couldn't update appstream data for remote ‘%s’ arch ‘%s’: %s\n"), remote_name, current_arch, local_error->message); g_clear_error (&local_error); - } + } */ /* Copy the appstream data if it exists. It's optional because without it * the USB will still be useful to the flatpak CLI even if GNOME Software diff --git a/doc/flatpak-create-usb.xml b/doc/flatpak-create-usb.xml index 7c469fdf..2ea91684 100644 --- a/doc/flatpak-create-usb.xml +++ b/doc/flatpak-create-usb.xml @@ -71,7 +71,9 @@ <para> This command relies on the summary file in the source repo, so you may want to run <command>ostree summary -u</command> before running - this command. + this command. Since appstream data is copied to the USB when it's + available, you might also want to run <command>flatpak update --appstream</command> + before updating the summary file. </para> <para> By default <command>flatpak create-usb</command> uses <filename>.ostree/repo</filename>, |