From f9c11a8b550bbd090492f3f7224bc7df2c8be5ba Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 28 Sep 2016 18:52:17 +0200 Subject: [PATCH] Make "flatpak update --appstream" update for all branches This fixes https://github.com/flatpak/flatpak/issues/331 --- app/flatpak-builtins-update.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/app/flatpak-builtins-update.c b/app/flatpak-builtins-update.c index 07c81e04..0cfd9552 100644 --- a/app/flatpak-builtins-update.c +++ b/app/flatpak-builtins-update.c @@ -63,9 +63,32 @@ update_appstream (FlatpakDir *dir, const char *remote, GCancellable *cancellable { gboolean changed; - if (!flatpak_dir_update_appstream (dir, remote, opt_arch, &changed, - NULL, cancellable, error)) - return FALSE; + if (remote == NULL) + { + g_auto(GStrv) remotes = NULL; + int i; + + remotes = flatpak_dir_list_remotes (dir, cancellable, error); + if (remotes == NULL) + return FALSE; + + for (i = 0; remotes[i] != NULL; i++) + { + if (flatpak_dir_get_remote_disabled (dir, remotes[i])) + continue; + + g_print (_("Updating appstream for remote %s\n"), remotes[i]); + if (!flatpak_dir_update_appstream (dir, remotes[i], opt_arch, &changed, + NULL, cancellable, error)) + return FALSE; + } + } + else + { + if (!flatpak_dir_update_appstream (dir, remote, opt_arch, &changed, + NULL, cancellable, error)) + return FALSE; + } return TRUE; }