From 659b02011ab39b25759955b7cb92788dbf4bcf59 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 12 Dec 2017 11:12:09 +0100 Subject: [PATCH] install: Support local paths/uris If the remote is a local path (absolute or relative starting with ./) then we convert this to a file: uri, which are now supported to install directly from a local repo. This is very useful when testing locally built apps. Closes: #1244 Approved by: alexlarsson --- app/flatpak-builtins-install.c | 11 ++++++++++- doc/flatpak-install.xml | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c index 505ec5e0..f7666f3b 100644 --- a/app/flatpak-builtins-install.c +++ b/app/flatpak-builtins-install.c @@ -463,6 +463,7 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro g_autoptr(GPtrArray) dirs = NULL; FlatpakDir *dir; const char *remote; + g_autofree char *remote_url = NULL; char **prefs = NULL; int i, n_prefs; g_autofree char *target_branch = NULL; @@ -497,7 +498,15 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro if (argc < 3) return usage_error (context, _("REMOTE and REF must be specified"), error); - remote = argv[1]; + if (g_path_is_absolute (argv[1]) || + g_str_has_prefix (argv[1], "./")) + { + g_autoptr(GFile) remote_file = g_file_new_for_commandline_arg (argv[1]); + remote_url = g_file_get_uri (remote_file); + remote = remote_url; + } + else + remote = argv[1]; prefs = &argv[2]; n_prefs = argc - 2; diff --git a/doc/flatpak-install.xml b/doc/flatpak-install.xml index 476194ee..1dc51805 100644 --- a/doc/flatpak-install.xml +++ b/doc/flatpak-install.xml @@ -74,6 +74,11 @@ the specified REMOTE, but you can limit this by using the --app or --runtime option, or by supplying the initial element in the REF. + + If REMOTE is a uri or a path (absolute or relative starting with ./) + to a local repository, then that repository will be used as the source, and a temporary remote + will be created for the lifetime of the REF. + The alternative form of the command (--from or --bundle allows you to