diff --git a/src/app/main.c b/src/app/main.c index 6be70cf780..c6f3e7975e 100644 --- a/src/app/main.c +++ b/src/app/main.c @@ -35,19 +35,31 @@ static RpmOstreeCommand supported_commands[] = { #ifdef HAVE_COMPOSE_TOOLING - { "compose", rpmostree_builtin_compose }, + { "compose", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD | RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_compose }, #endif - { "cleanup", rpmostree_builtin_cleanup }, - { "db", rpmostree_builtin_db }, - { "deploy", rpmostree_builtin_deploy }, - { "rebase", rpmostree_builtin_rebase }, - { "rollback", rpmostree_builtin_rollback }, - { "status", rpmostree_builtin_status }, - { "upgrade", rpmostree_builtin_upgrade }, - { "reload", rpmostree_builtin_reload }, - { "initramfs", rpmostree_builtin_initramfs }, - { "install", rpmostree_builtin_pkg_add }, - { "uninstall", rpmostree_builtin_pkg_remove }, + { "cleanup", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_cleanup }, + { "db", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_builtin_db }, + { "deploy", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_deploy }, + { "rebase", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_rebase }, + { "rollback", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_rollback }, + { "status", 0, + rpmostree_builtin_status }, + { "upgrade", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_upgrade }, + { "reload", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_reload }, + { "initramfs", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_initramfs }, + { "install", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_pkg_add }, + { "uninstall", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_pkg_remove }, { NULL } }; @@ -56,19 +68,24 @@ static RpmOstreeCommand preview_commands[] = { }; static RpmOstreeCommand legacy_alias_commands[] = { - { "pkg-add", rpmostree_builtin_pkg_add }, - { "pkg-remove", rpmostree_builtin_pkg_remove }, + { "pkg-add", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_pkg_add }, + { "pkg-remove", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_pkg_remove }, { NULL } }; static RpmOstreeCommand experimental_commands[] = { - { "internals", rpmostree_builtin_internals }, - { "container", rpmostree_builtin_container }, + { "internals", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_builtin_internals }, + { "container", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_builtin_container }, { NULL } }; static RpmOstreeCommand hidden_commands[] = { - { "start-daemon", rpmostree_builtin_start_daemon }, + { "start-daemon", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD | RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_builtin_start_daemon }, { NULL } }; @@ -123,15 +140,15 @@ rpmostree_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, - RpmOstreeBuiltinFlags flags, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, RPMOSTreeSysroot **out_sysroot_proxy, GError **error) { - gboolean use_daemon; gboolean ret = FALSE; - - use_daemon = ((flags & RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD) == 0); + /* with --version there's no command, don't require a daemon for it */ + const RpmOstreeBuiltinFlags flags = invocation ? invocation->command->flags : RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD; + gboolean use_daemon = ((flags & RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD) == 0); if (main_entries != NULL) g_option_context_add_main_entries (context, main_entries, NULL); @@ -320,8 +337,7 @@ main (int argc, /* This will not return for some options (e.g. --version). */ (void) rpmostree_option_context_parse (context, NULL, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL); if (command_name == NULL) { local_error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, @@ -343,7 +359,9 @@ main (int argc, prgname = g_strdup_printf ("%s %s", g_get_prgname (), command_name); g_set_prgname (prgname); - exit_status = command->fn (argc, argv, cancellable, &local_error); + { RpmOstreeCommandInvocation invocation = { .command = command }; + exit_status = command->fn (argc, argv, &invocation, cancellable, &local_error); + } out: if (local_error != NULL) diff --git a/src/app/rpmostree-builtin-cleanup.c b/src/app/rpmostree-builtin-cleanup.c index da7185b469..8124a689f2 100644 --- a/src/app/rpmostree-builtin-cleanup.c +++ b/src/app/rpmostree-builtin-cleanup.c @@ -47,9 +47,10 @@ static GOptionEntry option_entries[] = { int rpmostree_builtin_cleanup (int argc, - char **argv, - GCancellable *cancellable, - GError **error) + char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, + GError **error) { int exit_status = EXIT_FAILURE; g_autoptr(GOptionContext) context = g_option_context_new ("- Clear cached/pending data"); @@ -61,7 +62,7 @@ rpmostree_builtin_cleanup (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-compose.c b/src/app/rpmostree-builtin-compose.c index ca0f463afe..34838fe827 100644 --- a/src/app/rpmostree-builtin-compose.c +++ b/src/app/rpmostree-builtin-compose.c @@ -29,8 +29,9 @@ #include static RpmOstreeCommand compose_subcommands[] = { - { "tree", rpmostree_compose_builtin_tree }, - { NULL, NULL } + { "tree", RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + rpmostree_compose_builtin_tree }, + { NULL, 0, NULL } }; static GOptionContext * @@ -58,7 +59,9 @@ compose_option_context_new_with_commands (void) } int -rpmostree_builtin_compose (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_builtin_compose (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { RpmOstreeCommand *subcommand; const char *subcommand_name = NULL; @@ -84,7 +87,7 @@ rpmostree_builtin_compose (int argc, char **argv, GCancellable *cancellable, GEr /* This will not return for some options (e.g. --version). */ (void) rpmostree_option_context_parse (context, NULL, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, NULL); @@ -109,7 +112,9 @@ rpmostree_builtin_compose (int argc, char **argv, GCancellable *cancellable, GEr prgname = g_strdup_printf ("%s %s", g_get_prgname (), subcommand_name); g_set_prgname (prgname); - exit_status = subcommand->fn (argc, argv, cancellable, error); + { RpmOstreeCommandInvocation sub_invocation = { .command = subcommand }; + exit_status = subcommand->fn (argc, argv, &sub_invocation, cancellable, error); + } out: return exit_status; diff --git a/src/app/rpmostree-builtin-container.c b/src/app/rpmostree-builtin-container.c index 42938bf542..caa2d80401 100644 --- a/src/app/rpmostree-builtin-container.c +++ b/src/app/rpmostree-builtin-container.c @@ -24,11 +24,14 @@ #include "rpmostree-rpm-util.h" static RpmOstreeCommand container_subcommands[] = { - { "init", rpmostree_container_builtin_init }, - { "assemble", rpmostree_container_builtin_assemble }, + { "init", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_container_builtin_init }, + { "assemble", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_container_builtin_assemble }, /* { "start", rpmostree_container_builtin_start }, */ - { "upgrade", rpmostree_container_builtin_upgrade }, - { NULL, NULL } + { "upgrade", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_container_builtin_upgrade }, + { NULL, 0, NULL } }; static GOptionContext * @@ -56,7 +59,7 @@ container_option_context_new_with_commands (void) } int -rpmostree_builtin_container (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_builtin_container (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { RpmOstreeCommand *subcommand; const char *subcommand_name = NULL; @@ -82,7 +85,7 @@ rpmostree_builtin_container (int argc, char **argv, GCancellable *cancellable, G /* This will not return for some options (e.g. --version). */ (void) rpmostree_option_context_parse (context, NULL, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, NULL); @@ -107,7 +110,9 @@ rpmostree_builtin_container (int argc, char **argv, GCancellable *cancellable, G prgname = g_strdup_printf ("%s %s", g_get_prgname (), subcommand_name); g_set_prgname (prgname); - exit_status = subcommand->fn (argc, argv, cancellable, error); + { RpmOstreeCommandInvocation sub_invocation = { .command = subcommand }; + exit_status = subcommand->fn (argc, argv, &sub_invocation, cancellable, error); + } out: return exit_status; diff --git a/src/app/rpmostree-builtin-db.c b/src/app/rpmostree-builtin-db.c index 9e084abd73..c6b088894a 100644 --- a/src/app/rpmostree-builtin-db.c +++ b/src/app/rpmostree-builtin-db.c @@ -24,10 +24,13 @@ #include "rpmostree-rpm-util.h" static RpmOstreeCommand rpm_subcommands[] = { - { "diff", rpmostree_db_builtin_diff }, - { "list", rpmostree_db_builtin_list }, - { "version", rpmostree_db_builtin_version }, - { NULL, NULL } + { "diff", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_db_builtin_diff }, + { "list", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_db_builtin_list }, + { "version", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_db_builtin_version }, + { NULL, 0, NULL } }; static char *opt_repo; @@ -65,6 +68,7 @@ gboolean rpmostree_db_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, + RpmOstreeCommandInvocation *invocation, OstreeRepo **out_repo, GCancellable *cancellable, GError **error) { @@ -79,7 +83,7 @@ rpmostree_db_option_context_parse (GOptionContext *context, if (!rpmostree_option_context_parse (context, main_entries, argc, argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, error)) @@ -120,7 +124,9 @@ rpmostree_db_option_context_parse (GOptionContext *context, } int -rpmostree_builtin_db (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_builtin_db (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { RpmOstreeCommand *subcommand; const char *subcommand_name = NULL; @@ -146,7 +152,7 @@ rpmostree_builtin_db (int argc, char **argv, GCancellable *cancellable, GError * /* This will not return for some options (e.g. --version). */ (void) rpmostree_option_context_parse (context, NULL, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, NULL); @@ -171,7 +177,9 @@ rpmostree_builtin_db (int argc, char **argv, GCancellable *cancellable, GError * prgname = g_strdup_printf ("%s %s", g_get_prgname (), subcommand_name); g_set_prgname (prgname); - exit_status = subcommand->fn (argc, argv, cancellable, error); + { RpmOstreeCommandInvocation sub_invocation = { .command = subcommand }; + exit_status = subcommand->fn (argc, argv, &sub_invocation, cancellable, error); + } out: return exit_status; diff --git a/src/app/rpmostree-builtin-deploy.c b/src/app/rpmostree-builtin-deploy.c index ea86ded354..cdd3db32f1 100644 --- a/src/app/rpmostree-builtin-deploy.c +++ b/src/app/rpmostree-builtin-deploy.c @@ -64,6 +64,7 @@ default_deployment_changed_cb (GObject *object, int rpmostree_builtin_deploy (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -81,7 +82,7 @@ rpmostree_builtin_deploy (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-initramfs.c b/src/app/rpmostree-builtin-initramfs.c index 835419c0bb..6640ff0142 100644 --- a/src/app/rpmostree-builtin-initramfs.c +++ b/src/app/rpmostree-builtin-initramfs.c @@ -56,6 +56,7 @@ get_args_variant (void) int rpmostree_builtin_initramfs (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -68,7 +69,7 @@ rpmostree_builtin_initramfs (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-internals.c b/src/app/rpmostree-builtin-internals.c index 6797e6fec9..6e626d8f39 100644 --- a/src/app/rpmostree-builtin-internals.c +++ b/src/app/rpmostree-builtin-internals.c @@ -24,8 +24,9 @@ #include "rpmostree-rpm-util.h" static RpmOstreeCommand internals_subcommands[] = { - { "unpack", rpmostree_internals_builtin_unpack }, - { NULL, NULL } + { "unpack", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + rpmostree_internals_builtin_unpack }, + { NULL, 0, NULL } }; /* @@ -59,7 +60,9 @@ internals_option_context_new_with_commands (void) } int -rpmostree_builtin_internals (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_builtin_internals (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { RpmOstreeCommand *subcommand; const char *subcommand_name = NULL; @@ -84,7 +87,7 @@ rpmostree_builtin_internals (int argc, char **argv, GCancellable *cancellable, G /* This will not return for some options (e.g. --version). */ (void) rpmostree_option_context_parse (context, NULL, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, NULL); @@ -109,7 +112,9 @@ rpmostree_builtin_internals (int argc, char **argv, GCancellable *cancellable, G prgname = g_strdup_printf ("%s %s", g_get_prgname (), subcommand_name); g_set_prgname (prgname); - exit_status = subcommand->fn (argc, argv, cancellable, error); + { RpmOstreeCommandInvocation sub_invocation = { .command = subcommand }; + exit_status = subcommand->fn (argc, argv, &sub_invocation, cancellable, error); + } out: return exit_status; diff --git a/src/app/rpmostree-builtin-rebase.c b/src/app/rpmostree-builtin-rebase.c index 72f97811c5..7507063402 100644 --- a/src/app/rpmostree-builtin-rebase.c +++ b/src/app/rpmostree-builtin-rebase.c @@ -59,6 +59,7 @@ get_args_variant (const char *revision) int rpmostree_builtin_rebase (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -77,7 +78,7 @@ rpmostree_builtin_rebase (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_NONE, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-reload.c b/src/app/rpmostree-builtin-reload.c index 83441ebb46..a95f9556ff 100644 --- a/src/app/rpmostree-builtin-reload.c +++ b/src/app/rpmostree-builtin-reload.c @@ -36,6 +36,7 @@ static GOptionEntry option_entries[] = { int rpmostree_builtin_reload (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -46,7 +47,7 @@ rpmostree_builtin_reload (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-rollback.c b/src/app/rpmostree-builtin-rollback.c index 1048e7b7a9..bb1d21663f 100644 --- a/src/app/rpmostree-builtin-rollback.c +++ b/src/app/rpmostree-builtin-rollback.c @@ -50,6 +50,7 @@ get_args_variant (void) int rpmostree_builtin_rollback (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -63,7 +64,7 @@ rpmostree_builtin_rollback (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-start-daemon.c b/src/app/rpmostree-builtin-start-daemon.c index 9bbcbd181e..8ddba4b57b 100644 --- a/src/app/rpmostree-builtin-start-daemon.c +++ b/src/app/rpmostree-builtin-start-daemon.c @@ -304,6 +304,7 @@ connect_to_peer (int fd, GError **error) int rpmostree_builtin_start_daemon (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { diff --git a/src/app/rpmostree-builtin-status.c b/src/app/rpmostree-builtin-status.c index f8684dd0bf..ca6b26a234 100644 --- a/src/app/rpmostree-builtin-status.c +++ b/src/app/rpmostree-builtin-status.c @@ -369,6 +369,7 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy, int rpmostree_builtin_status (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -381,7 +382,7 @@ rpmostree_builtin_status (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_NONE, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtin-upgrade.c b/src/app/rpmostree-builtin-upgrade.c index 3d95f95f3c..b2d3be6f22 100644 --- a/src/app/rpmostree-builtin-upgrade.c +++ b/src/app/rpmostree-builtin-upgrade.c @@ -65,6 +65,7 @@ get_args_variant (void) int rpmostree_builtin_upgrade (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -79,7 +80,7 @@ rpmostree_builtin_upgrade (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) diff --git a/src/app/rpmostree-builtins.h b/src/app/rpmostree-builtins.h index 123b267ec8..2756ae792e 100644 --- a/src/app/rpmostree-builtins.h +++ b/src/app/rpmostree-builtins.h @@ -35,12 +35,26 @@ typedef enum { RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT = 1 << 1, } RpmOstreeBuiltinFlags; -typedef struct { +typedef struct RpmOstreeCommand RpmOstreeCommand; +typedef struct RpmOstreeCommandInvocation RpmOstreeCommandInvocation; + +struct RpmOstreeCommand { const char *name; - int (*fn) (int argc, char **argv, GCancellable *cancellable, GError **error); -} RpmOstreeCommand; + RpmOstreeBuiltinFlags flags; + int (*fn) (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +}; + +/* Currently, this has just the command (which is mostly there for the + * name/flags), but in the future if we want to add something new we won't need + * to touch every prototype. + */ +struct RpmOstreeCommandInvocation { + RpmOstreeCommand *command; +}; -#define BUILTINPROTO(name) gboolean rpmostree_builtin_ ## name (int argc, char **argv, GCancellable *cancellable, GError **error) +#define BUILTINPROTO(name) gboolean rpmostree_builtin_ ## name (int argc, char **argv, \ + RpmOstreeCommandInvocation *invocation, \ + GCancellable *cancellable, GError **error) BUILTINPROTO(compose); BUILTINPROTO(upgrade); @@ -67,7 +81,7 @@ gboolean rpmostree_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, - RpmOstreeBuiltinFlags flags, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, RPMOSTreeSysroot **out_sysroot_proxy, GError **error); diff --git a/src/app/rpmostree-compose-builtin-tree.c b/src/app/rpmostree-compose-builtin-tree.c index 31accdaf20..31bb120bfe 100644 --- a/src/app/rpmostree-compose-builtin-tree.c +++ b/src/app/rpmostree-compose-builtin-tree.c @@ -595,6 +595,7 @@ process_touch_if_changed (GError **error) int rpmostree_compose_builtin_tree (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -630,7 +631,7 @@ rpmostree_compose_builtin_tree (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD | RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, NULL, error)) diff --git a/src/app/rpmostree-compose-builtins.h b/src/app/rpmostree-compose-builtins.h index c7b8646e2c..171227dd75 100644 --- a/src/app/rpmostree-compose-builtins.h +++ b/src/app/rpmostree-compose-builtins.h @@ -26,7 +26,7 @@ G_BEGIN_DECLS -gboolean rpmostree_compose_builtin_tree (int argc, char **argv, GCancellable *cancellable, GError **error); +gboolean rpmostree_compose_builtin_tree (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); G_END_DECLS diff --git a/src/app/rpmostree-container-builtins.c b/src/app/rpmostree-container-builtins.c index a5fceba06a..1fe26098d5 100644 --- a/src/app/rpmostree-container-builtins.c +++ b/src/app/rpmostree-container-builtins.c @@ -141,6 +141,7 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(ROContainerContext, roc_context_deinit) int rpmostree_container_builtin_init (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -154,7 +155,7 @@ rpmostree_container_builtin_init (int argc, if (!rpmostree_option_context_parse (context, init_option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, error)) @@ -227,6 +228,7 @@ symlink_at_replace (const char *oldpath, int rpmostree_container_builtin_assemble (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -245,7 +247,7 @@ rpmostree_container_builtin_assemble (int argc, if (!rpmostree_option_context_parse (context, assemble_option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, error)) @@ -407,7 +409,9 @@ parse_app_version (const char *name, } gboolean -rpmostree_container_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_container_builtin_upgrade (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { int exit_status = EXIT_FAILURE; g_autoptr(GOptionContext) context = g_option_context_new ("NAME"); @@ -429,7 +433,7 @@ rpmostree_container_builtin_upgrade (int argc, char **argv, GCancellable *cancel if (!rpmostree_option_context_parse (context, assemble_option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, error)) diff --git a/src/app/rpmostree-container-builtins.h b/src/app/rpmostree-container-builtins.h index b6cc7dd4d4..a7c0f2f1c9 100644 --- a/src/app/rpmostree-container-builtins.h +++ b/src/app/rpmostree-container-builtins.h @@ -26,10 +26,10 @@ G_BEGIN_DECLS -gboolean rpmostree_container_builtin_init (int argc, char **argv, GCancellable *cancellable, GError **error); -gboolean rpmostree_container_builtin_assemble (int argc, char **argv, GCancellable *cancellable, GError **error); -/* gboolean rpmostree_container_builtin_start (int argc, char **argv, GCancellable *cancellable, GError **error); */ -gboolean rpmostree_container_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GError **error); +gboolean rpmostree_container_builtin_init (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +gboolean rpmostree_container_builtin_assemble (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +/* gboolean rpmostree_container_builtin_start (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); */ +gboolean rpmostree_container_builtin_upgrade (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); G_END_DECLS diff --git a/src/app/rpmostree-db-builtin-diff.c b/src/app/rpmostree-db-builtin-diff.c index e607bb245a..9d25278f3e 100644 --- a/src/app/rpmostree-db-builtin-diff.c +++ b/src/app/rpmostree-db-builtin-diff.c @@ -34,7 +34,9 @@ static GOptionEntry option_entries[] = { }; int -rpmostree_db_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_db_builtin_diff (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { int exit_status = EXIT_FAILURE; g_autoptr(GOptionContext) context = NULL; @@ -44,7 +46,7 @@ rpmostree_db_builtin_diff (int argc, char **argv, GCancellable *cancellable, GEr context = g_option_context_new ("COMMIT COMMIT - Show package changes between two commits"); - if (!rpmostree_db_option_context_parse (context, option_entries, &argc, &argv, &repo, + if (!rpmostree_db_option_context_parse (context, option_entries, &argc, &argv, invocation, &repo, cancellable, error)) goto out; diff --git a/src/app/rpmostree-db-builtin-list.c b/src/app/rpmostree-db-builtin-list.c index fc1262222b..f9129e3b61 100644 --- a/src/app/rpmostree-db-builtin-list.c +++ b/src/app/rpmostree-db-builtin-list.c @@ -85,7 +85,9 @@ _builtin_db_list (OstreeRepo *repo, } int -rpmostree_db_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_db_builtin_list (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { int exit_status = EXIT_FAILURE; g_autoptr(GOptionContext) context = NULL; @@ -96,8 +98,8 @@ rpmostree_db_builtin_list (int argc, char **argv, GCancellable *cancellable, GEr context = g_option_context_new ("[PREFIX-PKGNAME...] COMMIT... - List packages within commits"); - if (!rpmostree_db_option_context_parse (context, option_entries, &argc, &argv, &repo, - cancellable, error)) + if (!rpmostree_db_option_context_parse (context, option_entries, &argc, &argv, invocation, + &repo, cancellable, error)) goto out; /* Iterate over all arguments. When we see the first argument which diff --git a/src/app/rpmostree-db-builtin-version.c b/src/app/rpmostree-db-builtin-version.c index 03e5c2aa67..3c8067b769 100644 --- a/src/app/rpmostree-db-builtin-version.c +++ b/src/app/rpmostree-db-builtin-version.c @@ -90,7 +90,9 @@ _builtin_db_version (OstreeRepo *repo, GPtrArray *revs, } int -rpmostree_db_builtin_version (int argc, char **argv, GCancellable *cancellable, GError **error) +rpmostree_db_builtin_version (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) { int exit_status = EXIT_FAILURE; g_autoptr(GOptionContext) context = NULL; @@ -100,7 +102,7 @@ rpmostree_db_builtin_version (int argc, char **argv, GCancellable *cancellable, context = g_option_context_new ("COMMIT... - Show rpmdb version of packages within the commits"); - if (!rpmostree_db_option_context_parse (context, db_version_entries, &argc, &argv, &repo, + if (!rpmostree_db_option_context_parse (context, db_version_entries, &argc, &argv, invocation, &repo, cancellable, error)) goto out; diff --git a/src/app/rpmostree-db-builtins.h b/src/app/rpmostree-db-builtins.h index 703c088655..68db029f5a 100644 --- a/src/app/rpmostree-db-builtins.h +++ b/src/app/rpmostree-db-builtins.h @@ -26,13 +26,14 @@ G_BEGIN_DECLS -gboolean rpmostree_db_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **error); -gboolean rpmostree_db_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error); -gboolean rpmostree_db_builtin_version (int argc, char **argv, GCancellable *cancellable, GError **error); +gboolean rpmostree_db_builtin_diff (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +gboolean rpmostree_db_builtin_list (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +gboolean rpmostree_db_builtin_version (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); gboolean rpmostree_db_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, + RpmOstreeCommandInvocation *invocation, OstreeRepo **out_repo, GCancellable *cancellable, GError **error); diff --git a/src/app/rpmostree-internals-builtin-unpack.c b/src/app/rpmostree-internals-builtin-unpack.c index 0b034b03d6..25cd097767 100644 --- a/src/app/rpmostree-internals-builtin-unpack.c +++ b/src/app/rpmostree-internals-builtin-unpack.c @@ -53,6 +53,7 @@ static GOptionEntry option_entries[] = { int rpmostree_internals_builtin_unpack (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -68,7 +69,7 @@ rpmostree_internals_builtin_unpack (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, + invocation, cancellable, NULL, error)) diff --git a/src/app/rpmostree-internals-builtins.h b/src/app/rpmostree-internals-builtins.h index 506f73123f..95f3280325 100644 --- a/src/app/rpmostree-internals-builtins.h +++ b/src/app/rpmostree-internals-builtins.h @@ -26,8 +26,8 @@ G_BEGIN_DECLS -gboolean rpmostree_internals_builtin_unpack (int argc, char **argv, GCancellable *cancellable, GError **error); -gboolean rpmostree_internals_builtin_start_daemon (int argc, char **argv, GCancellable *cancellable, GError **error); +gboolean rpmostree_internals_builtin_unpack (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +gboolean rpmostree_internals_builtin_start_daemon (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); G_END_DECLS diff --git a/src/app/rpmostree-pkg-builtins.c b/src/app/rpmostree-pkg-builtins.c index 330ddc2a9f..2c64009117 100644 --- a/src/app/rpmostree-pkg-builtins.c +++ b/src/app/rpmostree-pkg-builtins.c @@ -132,6 +132,7 @@ pkg_change (RPMOSTreeSysroot *sysroot_proxy, int rpmostree_builtin_pkg_add (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -145,7 +146,7 @@ rpmostree_builtin_pkg_add (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error)) @@ -197,6 +198,7 @@ rpmostree_builtin_pkg_add (int argc, int rpmostree_builtin_pkg_remove (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error) { @@ -209,7 +211,7 @@ rpmostree_builtin_pkg_remove (int argc, if (!rpmostree_option_context_parse (context, option_entries, &argc, &argv, - RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT, + invocation, cancellable, &sysroot_proxy, error))