diff options
author | Alexander Larsson <alexl@redhat.com> | 2017-12-12 11:12:09 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-14 09:27:22 +0000 |
commit | 659b02011ab39b25759955b7cb92788dbf4bcf59 (patch) | |
tree | 7d9da2f310bff383c059e2f33a47e37b0cfbd97c | |
parent | 6e17756db64bf1bdf00f98c92af3775a0792fdf1 (diff) | |
download | flatpak-659b02011ab39b25759955b7cb92788dbf4bcf59.tar.gz |
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
-rw-r--r-- | app/flatpak-builtins-install.c | 11 | ||||
-rw-r--r-- | doc/flatpak-install.xml | 5 |
2 files changed, 15 insertions, 1 deletions
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 @@ -75,6 +75,11 @@ --runtime option, or by supplying the initial element in the REF. </para> <para> + If <arg choice="plain">REMOTE</arg> 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 <arg choice="plain">REF</arg>. + </para> + <para> The alternative form of the command (<arg>--from</arg> or <arg>--bundle</arg> allows you to install directly from a source such as a .flatpak |