diff options
author | Alexander Larsson <alexl@redhat.com> | 2016-04-07 20:35:32 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2016-04-07 20:36:53 +0200 |
commit | 3cc45ccf137d0b0eeba81af041d816b0cbfb6fc7 (patch) | |
tree | a6d1d6c7a0399d051c43a2766df12a4771aef9f4 /app | |
parent | 545a6996983870107c22f24ca51923692e2b3d9a (diff) | |
download | xdg-app-3cc45ccf137d0b0eeba81af041d816b0cbfb6fc7.tar.gz |
Add support for subpath limited installs
This allows you to install e.g. org.freedesktop.Platform.Locale
but only the /sv subdir, and replaces using separate branches for
each locale.
Diffstat (limited to 'app')
-rw-r--r-- | app/xdg-app-builtins-install.c | 8 | ||||
-rw-r--r-- | app/xdg-app-builtins-update.c | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/app/xdg-app-builtins-install.c b/app/xdg-app-builtins-install.c index 73ec2bc..e8634a6 100644 --- a/app/xdg-app-builtins-install.c +++ b/app/xdg-app-builtins-install.c @@ -36,6 +36,7 @@ static char *opt_arch; static char **opt_gpg_file; +static char **opt_subpaths; static gboolean opt_no_pull; static gboolean opt_no_deploy; static gboolean opt_runtime; @@ -50,6 +51,7 @@ static GOptionEntry options[] = { { "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", }, { "gpg-file", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_file, "Check bundle signatures with GPG key from FILE (- for stdin)", "FILE" }, + { "subpath", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_subpaths, "Only install this subpath", "path" }, { NULL } }; @@ -286,7 +288,7 @@ xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro if (!opt_no_pull) { - if (!xdg_app_dir_pull (dir, repository, ref, NULL, + if (!xdg_app_dir_pull (dir, repository, ref, opt_subpaths, NULL, cancellable, error)) return FALSE; } @@ -306,6 +308,10 @@ xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro if (!xdg_app_dir_set_origin (dir, ref, repository, cancellable, error)) goto out; + if (!xdg_app_dir_set_subpaths (dir, ref, (const char **)opt_subpaths, + cancellable, error)) + goto out; + if (!xdg_app_dir_deploy (dir, ref, NULL, cancellable, error)) goto out; diff --git a/app/xdg-app-builtins-update.c b/app/xdg-app-builtins-update.c index 5903973..15a1475 100644 --- a/app/xdg-app-builtins-update.c +++ b/app/xdg-app-builtins-update.c @@ -33,6 +33,7 @@ static char *opt_arch; static char *opt_commit; +static char **opt_subpaths; static gboolean opt_force_remove; static gboolean opt_no_pull; static gboolean opt_no_deploy; @@ -49,6 +50,7 @@ static GOptionEntry options[] = { { "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", }, + { "subpath", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_subpaths, "Only update this subpath", "path" }, { NULL } }; @@ -75,6 +77,7 @@ do_update (XdgAppDir* dir, { g_autofree char *ref = NULL; g_autofree char *repository = NULL; + g_auto(GStrv) subpaths = NULL; gboolean was_updated = FALSE; gboolean is_app; g_auto(GLnxLockFile) lock = GLNX_LOCK_FILE_INIT; @@ -92,10 +95,14 @@ do_update (XdgAppDir* dir, if (repository == NULL) return FALSE; + subpaths = xdg_app_dir_get_subpaths (dir, ref, cancellable, error); + if (subpaths == NULL) + return FALSE; + if (!opt_no_pull) { - if (!xdg_app_dir_pull (dir, repository, ref, NULL, - cancellable, error)) + if (!xdg_app_dir_pull (dir, repository, ref, opt_subpaths ? opt_subpaths : subpaths, + NULL, cancellable, error)) return FALSE; } |