forked from Mirrors/flatpak-builder
app: Support --no-pull and --no-deploy in the install and update commands
This adds general support for the local app branch to be further ahead of the active deployement, including showing this in list-app and list-runtime commands.tingping/wmclass
parent
dd210ed6cc
commit
b9b9ad9ccc
|
@ -36,9 +36,13 @@
|
|||
|
||||
static char *opt_arch;
|
||||
static char **opt_gpg_file;
|
||||
static gboolean opt_no_pull;
|
||||
static gboolean opt_no_deploy;
|
||||
|
||||
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", },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -135,25 +139,31 @@ xdg_app_builtin_install_runtime (int argc, char **argv, GCancellable *cancellabl
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!opt_no_pull)
|
||||
{
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!opt_no_deploy)
|
||||
{
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!g_file_make_directory_with_parents (deploy_base, cancellable, error))
|
||||
goto out;
|
||||
created_deploy_base = TRUE;
|
||||
if (!g_file_make_directory_with_parents (deploy_base, cancellable, error))
|
||||
goto out;
|
||||
created_deploy_base = TRUE;
|
||||
|
||||
if (!xdg_app_dir_set_origin (dir, ref, repository, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_set_origin (dir, ref, repository, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_deploy (dir, ref, NULL, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_deploy (dir, ref, NULL, cancellable, error))
|
||||
goto out;
|
||||
|
||||
glnx_release_lock_file (&lock);
|
||||
glnx_release_lock_file (&lock);
|
||||
}
|
||||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
|
@ -207,31 +217,37 @@ xdg_app_builtin_install_app (int argc, char **argv, GCancellable *cancellable, G
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!opt_no_pull)
|
||||
{
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!opt_no_deploy)
|
||||
{
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!g_file_make_directory_with_parents (deploy_base, cancellable, error))
|
||||
goto out;
|
||||
created_deploy_base = TRUE;
|
||||
if (!g_file_make_directory_with_parents (deploy_base, cancellable, error))
|
||||
goto out;
|
||||
created_deploy_base = TRUE;
|
||||
|
||||
if (!xdg_app_dir_set_origin (dir, ref, repository, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_set_origin (dir, ref, repository, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_deploy (dir, ref, NULL, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_deploy (dir, ref, NULL, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_make_current_ref (dir, ref, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_make_current_ref (dir, ref, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_update_exports (dir, app, cancellable, error))
|
||||
goto out;
|
||||
if (!xdg_app_dir_update_exports (dir, app, cancellable, error))
|
||||
goto out;
|
||||
|
||||
glnx_release_lock_file (&lock);
|
||||
glnx_release_lock_file (&lock);
|
||||
}
|
||||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
|
|
|
@ -55,25 +55,33 @@ print_installed_refs (const char *kind, gboolean print_system, gboolean print_us
|
|||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
|
||||
dir = xdg_app_dir_get (TRUE);
|
||||
if (!xdg_app_dir_list_refs (dir, kind, &user, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (xdg_app_dir_ensure_repo (dir, cancellable, NULL))
|
||||
{
|
||||
if (!xdg_app_dir_list_refs (dir, kind, &user, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
user = g_new0 (char *, 1);
|
||||
|
||||
if (print_system)
|
||||
{
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
|
||||
dir = xdg_app_dir_get (FALSE);
|
||||
if (!xdg_app_dir_list_refs (dir, kind, &system, cancellable, error))
|
||||
return FALSE;
|
||||
if (xdg_app_dir_ensure_repo (dir, cancellable, NULL))
|
||||
{
|
||||
if (!xdg_app_dir_list_refs (dir, kind, &system, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
system = g_new0 (char *, 1);
|
||||
|
||||
XdgAppTablePrinter *printer = xdg_app_table_printer_new ();
|
||||
|
||||
if (user == NULL)
|
||||
user = g_new0 (char *, 1);
|
||||
if (system == NULL)
|
||||
system = g_new0 (char *, 1);
|
||||
|
||||
for (s = 0, u = 0; system[s] != NULL || user[u] != NULL; )
|
||||
{
|
||||
char *ref, *partial_ref;
|
||||
|
@ -81,6 +89,7 @@ print_installed_refs (const char *kind, gboolean print_system, gboolean print_us
|
|||
g_autofree char *repo = NULL;
|
||||
gboolean is_user;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (system[s] == NULL)
|
||||
is_user = TRUE;
|
||||
|
@ -105,12 +114,31 @@ print_installed_refs (const char *kind, gboolean print_system, gboolean print_us
|
|||
if (opt_show_details)
|
||||
{
|
||||
g_autofree char *active = xdg_app_dir_read_active (dir, ref, NULL);
|
||||
g_autofree char *latest = NULL;
|
||||
|
||||
if (ostree_repo_resolve_rev (xdg_app_dir_get_repo (dir),
|
||||
ref,
|
||||
FALSE,
|
||||
&latest,
|
||||
NULL))
|
||||
{
|
||||
if (strcmp (active, latest) == 0)
|
||||
{
|
||||
g_free (latest);
|
||||
latest = g_strdup ("-");
|
||||
}
|
||||
else
|
||||
latest[MIN(strlen(latest), 12)] = 0;
|
||||
}
|
||||
else
|
||||
latest = g_strdup ("?");
|
||||
|
||||
xdg_app_table_printer_add_column (printer, partial_ref);
|
||||
xdg_app_table_printer_add_column (printer, repo);
|
||||
|
||||
active[MIN(strlen(active), 12)] = 0;
|
||||
xdg_app_table_printer_add_column (printer, active);
|
||||
xdg_app_table_printer_add_column (printer, latest);
|
||||
|
||||
xdg_app_table_printer_add_column (printer, ""); /* Options */
|
||||
|
||||
|
|
|
@ -34,11 +34,15 @@
|
|||
static char *opt_arch;
|
||||
static char *opt_commit;
|
||||
static gboolean opt_force_remove;
|
||||
static gboolean opt_no_pull;
|
||||
static gboolean opt_no_deploy;
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{ "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to update for", "ARCH" },
|
||||
{ "commit", 0, 0, G_OPTION_ARG_STRING, &opt_commit, "Commit to deploy", "COMMIT" },
|
||||
{ "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", },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -74,18 +78,24 @@ xdg_app_builtin_update_runtime (int argc, char **argv, GCancellable *cancellable
|
|||
if (repository == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!opt_no_pull)
|
||||
{
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!opt_no_deploy)
|
||||
{
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_deploy_update (dir, ref, opt_commit, &was_updated, cancellable, error))
|
||||
return FALSE;
|
||||
if (!xdg_app_dir_deploy_update (dir, ref, opt_commit, &was_updated, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
glnx_release_lock_file (&lock);
|
||||
glnx_release_lock_file (&lock);
|
||||
}
|
||||
|
||||
if (was_updated)
|
||||
{
|
||||
|
@ -130,16 +140,22 @@ xdg_app_builtin_update_app (int argc, char **argv, GCancellable *cancellable, GE
|
|||
if (repository == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!opt_no_pull)
|
||||
{
|
||||
if (!xdg_app_dir_pull (dir, repository, ref, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!opt_no_deploy)
|
||||
{
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_deploy_update (dir, ref, opt_commit, &was_updated, cancellable, error))
|
||||
return FALSE;
|
||||
if (!xdg_app_dir_deploy_update (dir, ref, opt_commit, &was_updated, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (was_updated)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,22 @@
|
|||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-deploy</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Download the latest version, but don't deploy it.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-pull</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Don't download the latest version, deploy it whatever is locally availiable.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>--verbose</option></term>
|
||||
|
|
|
@ -99,6 +99,22 @@
|
|||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-deploy</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Download the latest version, but don't deploy it.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-pull</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Don't download the latest version, deploy it whatever is locally availiable.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>--verbose</option></term>
|
||||
|
|
|
@ -112,6 +112,22 @@
|
|||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-deploy</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Download the latest version, but don't deploy it.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-pull</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Don't download the latest version, deploy it whatever is locally availiable.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>--verbose</option></term>
|
||||
|
|
|
@ -115,6 +115,22 @@
|
|||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-deploy</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Download the latest version, but don't deploy it.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--no-pull</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Don't download the latest version, deploy it whatever is locally availiable.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>--verbose</option></term>
|
||||
|
|
Loading…
Reference in New Issue