diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c
index 23a3b1c69..cae8a7fcb 100644
--- a/app/flatpak-builtins-install.c
+++ b/app/flatpak-builtins-install.c
@@ -40,6 +40,7 @@ static char **opt_gpg_file;
static char **opt_subpaths;
static gboolean opt_no_pull;
static gboolean opt_no_deploy;
+static gboolean opt_no_related;
static gboolean opt_runtime;
static gboolean opt_app;
static gboolean opt_bundle;
@@ -48,6 +49,7 @@ static GOptionEntry options[] = {
{ "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to install for", "ARCH" },
{ "no-pull", 0, 0, G_OPTION_ARG_NONE, &opt_no_pull, "Don't pull, only install from local cache", },
{ "no-deploy", 0, 0, G_OPTION_ARG_NONE, &opt_no_deploy, "Don't deploy, only download to local cache", },
+ { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, "Don't install related refs", },
{ "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Look for runtime with the specified name", },
{ "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, "Look for app with the specified name", },
{ "bundle", 0, 0, G_OPTION_ARG_NONE, &opt_bundle, "Install from local bundle file", },
@@ -144,6 +146,9 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
gboolean is_app;
g_autoptr(GFile) deploy_dir = NULL;
g_autoptr(GVariant) deploy_data = NULL;
+ g_autoptr(GPtrArray) related = NULL;
+ g_autoptr(GError) local_error = NULL;
+ int i;
context = g_option_context_new ("REPOSITORY NAME [BRANCH] - Install an application or runtime");
@@ -186,6 +191,49 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
cancellable, error))
return FALSE;
+ if (!opt_no_related)
+ {
+ g_autoptr(GError) local_error = NULL;
+
+ if (opt_no_pull)
+ related = flatpak_dir_find_local_related (dir, ref, repository, NULL, &local_error);
+ else
+ related = flatpak_dir_find_remote_related (dir, ref, repository, NULL, &local_error);
+ if (related == NULL)
+ {
+ g_printerr ("Warning: Problem looking for related refs: %s\n", local_error->message);
+ g_clear_error (&local_error);
+ }
+ else
+ {
+ for (i = 0; i < related->len; i++)
+ {
+ FlatpakRelated *rel = g_ptr_array_index (related, i);
+ g_auto(GStrv) parts = NULL;
+
+ if (!rel->download)
+ continue;
+
+ parts = g_strsplit (rel->ref, "/", 0);
+
+ g_print ("Installing related: %s\n", parts[1]);
+
+ if (!flatpak_dir_install_or_update (dir,
+ opt_no_pull,
+ opt_no_deploy,
+ rel->ref, repository,
+ (const char **)rel->subpaths,
+ NULL,
+ cancellable, &local_error))
+ {
+ g_printerr ("Warning: Failed to install related ref: %s\n",
+ rel->ref);
+ g_clear_error (&local_error);
+ }
+ }
+ }
+ }
+
return TRUE;
}
diff --git a/app/flatpak-builtins-uninstall.c b/app/flatpak-builtins-uninstall.c
index 636f11753..79d7a1046 100644
--- a/app/flatpak-builtins-uninstall.c
+++ b/app/flatpak-builtins-uninstall.c
@@ -34,12 +34,14 @@
static char *opt_arch;
static gboolean opt_keep_ref;
static gboolean opt_force_remove;
+static gboolean opt_no_related;
static gboolean opt_runtime;
static gboolean opt_app;
static GOptionEntry options[] = {
{ "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to uninstall", "ARCH" },
{ "keep-ref", 0, 0, G_OPTION_ARG_NONE, &opt_keep_ref, "Keep ref in local repository", NULL },
+ { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, "Don't uninstall related refs", },
{ "force-remove", 0, 0, G_OPTION_ARG_NONE, &opt_force_remove, "Remove files even if running", NULL },
{ "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Look for runtime with the specified name", },
{ "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, "Look for app with the specified name", },
@@ -56,6 +58,8 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
g_autofree char *ref = NULL;
gboolean is_app;
FlatpakHelperUninstallFlags flags = 0;
+ g_autoptr(GPtrArray) related = NULL;
+ int i;
context = g_option_context_new ("NAME [BRANCH] - Uninstall an application");
@@ -88,10 +92,47 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
if (opt_force_remove)
flags |= FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE;
+ if (!opt_no_related)
+ {
+ g_autoptr(GError) local_error = NULL;
+ g_autofree char *origin = NULL;
+
+ origin =flatpak_dir_get_origin (dir, ref, NULL, NULL);
+ if (origin)
+ {
+ related = flatpak_dir_find_local_related (dir, ref, origin,
+ NULL, &local_error);
+ if (related == NULL)
+ g_printerr ("Warning: Problem looking for related refs: %s\n",
+ local_error->message);
+ }
+ }
+
if (!flatpak_dir_uninstall (dir, ref, flags,
cancellable, error))
return FALSE;
+ if (related != NULL)
+ {
+ for (i = 0; i < related->len; i++)
+ {
+ FlatpakRelated *rel = g_ptr_array_index (related, i);
+ g_autoptr(GError) local_error = NULL;
+ g_auto(GStrv) parts = NULL;
+
+ if (!rel->delete)
+ continue;
+
+ parts = g_strsplit (rel->ref, "/", 0);
+ g_print ("Uninstalling related: %s\n", parts[1]);
+
+ if (!flatpak_dir_uninstall (dir, rel->ref, flags,
+ cancellable, &local_error))
+ g_printerr ("Warning: Failed to uninstall related ref: %s\n",
+ rel->ref);
+ }
+ }
+
return TRUE;
}
diff --git a/app/flatpak-builtins-update.c b/app/flatpak-builtins-update.c
index 4a91a4566..300b5e705 100644
--- a/app/flatpak-builtins-update.c
+++ b/app/flatpak-builtins-update.c
@@ -37,6 +37,7 @@ static char **opt_subpaths;
static gboolean opt_force_remove;
static gboolean opt_no_pull;
static gboolean opt_no_deploy;
+static gboolean opt_no_related;
static gboolean opt_runtime;
static gboolean opt_app;
static gboolean opt_appstream;
@@ -47,6 +48,7 @@ static GOptionEntry options[] = {
{ "force-remove", 0, 0, G_OPTION_ARG_NONE, &opt_force_remove, "Remove old files even if running", NULL },
{ "no-pull", 0, 0, G_OPTION_ARG_NONE, &opt_no_pull, "Don't pull, only update from local cache", },
{ "no-deploy", 0, 0, G_OPTION_ARG_NONE, &opt_no_deploy, "Don't deploy, only download to local cache", },
+ { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, "Don't update related refs", },
{ "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Look for runtime with the specified name", },
{ "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, "Look for app with the specified name", },
{ "appstream", 0, 0, G_OPTION_ARG_NONE, &opt_appstream, "Update appstream for remote", },
@@ -73,6 +75,8 @@ do_update (FlatpakDir * dir,
GError **error)
{
g_autofree char *repository = NULL;
+ g_autoptr(GPtrArray) related = NULL;
+ int i;
repository = flatpak_dir_get_origin (dir, ref, cancellable, error);
if (repository == NULL)
@@ -89,6 +93,53 @@ do_update (FlatpakDir * dir,
cancellable, error))
return FALSE;
+
+ if (!opt_no_related)
+ {
+ g_autoptr(GError) local_error = NULL;
+
+ if (opt_no_pull)
+ related = flatpak_dir_find_local_related (dir, ref, repository, NULL,
+ &local_error);
+ else
+ related = flatpak_dir_find_remote_related (dir, ref, repository, NULL,
+ &local_error);
+ if (related == NULL)
+ {
+ g_printerr ("Warning: Problem looking for related refs: %s\n",
+ local_error->message);
+ g_clear_error (&local_error);
+ }
+ else
+ {
+ for (i = 0; i < related->len; i++)
+ {
+ FlatpakRelated *rel = g_ptr_array_index (related, i);
+ g_autoptr(GError) local_error = NULL;
+ g_auto(GStrv) parts = NULL;
+
+ if (!rel->download)
+ continue;
+
+ parts = g_strsplit (rel->ref, "/", 0);
+
+ g_print ("Updating related: %s\n", parts[1]);
+
+ if (!flatpak_dir_install_or_update (dir,
+ opt_no_pull,
+ opt_no_deploy,
+ rel->ref, repository,
+ (const char **)rel->subpaths,
+ NULL,
+ cancellable, &local_error))
+ {
+ g_printerr ("Warning: Failed to update related ref: %s\n", rel->ref);
+ g_clear_error (&local_error);
+ }
+ }
+ }
+ }
+
return TRUE;
}
diff --git a/doc/flatpak-install.xml b/doc/flatpak-install.xml
index 6c689709b..9d2084660 100644
--- a/doc/flatpak-install.xml
+++ b/doc/flatpak-install.xml
@@ -157,6 +157,14 @@
+
+
+
+
+ Don't download related extensions, such as the locale data.
+
+
+
diff --git a/doc/flatpak-uninstall.xml b/doc/flatpak-uninstall.xml
index e2ec3be33..66f0d22ff 100644
--- a/doc/flatpak-uninstall.xml
+++ b/doc/flatpak-uninstall.xml
@@ -136,6 +136,14 @@
+
+
+
+
+ Don't uninstall related extensions, such as the locale data.
+
+
+
diff --git a/doc/flatpak-update.xml b/doc/flatpak-update.xml
index 5cb958bd7..79237d1e7 100644
--- a/doc/flatpak-update.xml
+++ b/doc/flatpak-update.xml
@@ -145,6 +145,14 @@
+
+
+
+
+ Don't download related extensions, such as the locale data.
+
+
+