Add OstreeAdminBuiltinFlags for admin commands

Only OSTREE_ADMIN_BUILTIN_FLAG_NONE so far; does nothing.
This commit is contained in:
Matthew Barnes 2015-02-22 15:41:02 -05:00 committed by Colin Walters
parent 6b16aba5f9
commit e48ea0ba05
17 changed files with 51 additions and 15 deletions

View File

@ -43,7 +43,9 @@ ot_admin_builtin_cleanup (int argc, char **argv, GCancellable *cancellable, GErr
context = g_option_context_new ("Delete untagged deployments and repository objects");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -66,7 +66,9 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc < 2)

View File

@ -55,7 +55,9 @@ ot_admin_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError
g_option_context_add_main_entries (context, options, NULL);
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -48,7 +48,9 @@ ot_admin_builtin_init_fs (int argc, char **argv, GCancellable *cancellable, GErr
context = g_option_context_new ("PATH - Initialize a root filesystem");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc < 2)

View File

@ -116,7 +116,9 @@ ot_admin_builtin_instutil (int argc, char **argv, GCancellable *cancellable, GEr
context = ostree_admin_instutil_option_context_new_with_commands ();
/* This will not return for some options (e.g. --version). */
if (ostree_admin_option_context_parse (context, NULL, &argc, &argv, NULL, cancellable, error))
if (ostree_admin_option_context_parse (context, NULL, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
NULL, cancellable, error))
{
if (subcommand_name == NULL)
{

View File

@ -46,7 +46,9 @@ ot_admin_builtin_os_init (int argc, char **argv, GCancellable *cancellable, GErr
context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_ensure_initialized (sysroot, cancellable, error))

View File

@ -55,7 +55,9 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G
context = g_option_context_new ("REMOTENAME URL [BRANCH]");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc < 3)

View File

@ -62,7 +62,9 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro
context = g_option_context_new ("List deployments");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -68,7 +68,9 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
context = g_option_context_new ("REF - Construct new tree from current origin and deploy it, if it changed");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc < 2)

View File

@ -46,7 +46,9 @@ ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GEr
context = g_option_context_new ("INDEX - Delete deployment INDEX");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc < 2)

View File

@ -67,7 +67,9 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr
context = g_option_context_new ("Construct new tree from current origin and deploy it, if it changed");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -47,7 +47,9 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, GCancellable *c
context = g_option_context_new ("[BOOTVERSION] - generate GRUB2 configuration from given BLS entries");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (argc >= 2)

View File

@ -194,7 +194,9 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, GCancel
context = g_option_context_new ("[SUBPATH PREFIX] - relabel all or part of a deployment");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -56,7 +56,9 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, GCancellable *cancel
context = g_option_context_new ("ARGS - set new kernel command line arguments");
if (!ostree_admin_option_context_parse (context, options, &argc, &argv, &sysroot, cancellable, error))
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
&sysroot, cancellable, error))
goto out;
if (!ostree_sysroot_load (sysroot, cancellable, error))

View File

@ -130,7 +130,9 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError *
context = ostree_admin_option_context_new_with_commands ();
/* This will not return for some options (e.g. --version). */
if (ostree_admin_option_context_parse (context, NULL, &argc, &argv, NULL, cancellable, error))
if (ostree_admin_option_context_parse (context, NULL, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE,
NULL, cancellable, error))
{
if (subcommand_name == NULL)
{

View File

@ -308,6 +308,7 @@ ostree_admin_option_context_parse (GOptionContext *context,
const GOptionEntry *main_entries,
int *argc,
char ***argv,
OstreeAdminBuiltinFlags flags,
OstreeSysroot **out_sysroot,
GCancellable *cancellable,
GError **error)

View File

@ -30,6 +30,10 @@ typedef enum {
OSTREE_BUILTIN_FLAG_NO_CHECK = 1 << 1
} OstreeBuiltinFlags;
typedef enum {
OSTREE_ADMIN_BUILTIN_FLAG_NONE = 0,
} OstreeAdminBuiltinFlags;
typedef struct {
const char *name;
gboolean (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error);
@ -49,6 +53,7 @@ gboolean ostree_option_context_parse (GOptionContext *context,
gboolean ostree_admin_option_context_parse (GOptionContext *context,
const GOptionEntry *main_entries,
int *argc, char ***argv,
OstreeAdminBuiltinFlags flags,
OstreeSysroot **out_sysroot,
GCancellable *cancellable, GError **error);