]> git.ipfire.org Git - pakfire.git/commitdiff
CLI: Rename config to args
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Jan 2025 15:25:34 +0000 (15:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Jan 2025 15:25:34 +0000 (15:25 +0000)
We use the name config for too many things it was not very clear where
things were coming from. Hence this change.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
30 files changed:
src/cli/lib/build.c
src/cli/lib/clean.c
src/cli/lib/client-build.c
src/cli/lib/dist.c
src/cli/lib/image_create.c
src/cli/lib/info.c
src/cli/lib/install.c
src/cli/lib/lint.c
src/cli/lib/pakfire.c
src/cli/lib/pakfire.h
src/cli/lib/provides.c
src/cli/lib/remove.c
src/cli/lib/repo_compose.c
src/cli/lib/repo_create.c
src/cli/lib/repo_delete.c
src/cli/lib/repo_list.c
src/cli/lib/repo_show.c
src/cli/lib/repolist.c
src/cli/lib/requires.c
src/cli/lib/search.c
src/cli/lib/shell.c
src/cli/lib/snapshot_update.c
src/cli/lib/sync.c
src/cli/lib/update.c
src/cli/lib/upload_create.c
src/cli/lib/upload_delete.c
src/cli/lib/upload_list.c
src/cli/pakfire-builder.c
src/cli/pakfire-client.c
src/cli/pakfire.c

index 343d73fb197ee878802f209c69e0ad1ce059c9a5..274c79300d9642800c0df00f960f3501efaa1cc7 100644 (file)
@@ -34,7 +34,7 @@
 
 #define MAX_MAKEFILES 32
 
-struct config {
+struct cli_local_args {
        const char* distro;
        const char* id;
        const char* target;
@@ -72,42 +72,42 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_DISTRO:
-                       config->distro = arg;
+                       args->distro = arg;
                        break;
 
                case OPT_DISABLE_CCACHE:
-                       config->flags &= ~BUILD_ENABLE_CCACHE;
+                       args->flags &= ~BUILD_ENABLE_CCACHE;
                        break;
 
                case OPT_DISABLE_SNAPSHOT:
-                       config->flags &= ~BUILD_ENABLE_SNAPSHOT;
+                       args->flags &= ~BUILD_ENABLE_SNAPSHOT;
                        break;
 
                case OPT_DISABLE_TESTS:
-                       config->flags &= ~BUILD_ENABLE_TESTS;
+                       args->flags &= ~BUILD_ENABLE_TESTS;
                        break;
 
                case OPT_ID:
-                       config->id = arg;
+                       args->id = arg;
                        break;
 
                case OPT_NON_INTERACTIVE:
-                       config->flags &= ~BUILD_INTERACTIVE;
+                       args->flags &= ~BUILD_INTERACTIVE;
                        break;
 
                case OPT_TARGET:
-                       config->target = arg;
+                       args->target = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_makefiles >= MAX_MAKEFILES)
+                       if (args->num_makefiles >= MAX_MAKEFILES)
                                return -ENOBUFS;
 
-                       config->makefiles[config->num_makefiles++] = arg;
+                       args->makefiles[args->num_makefiles++] = arg;
                        break;
 
                default:
@@ -154,10 +154,8 @@ static void log_callback(void* data, int priority, const char* file, int line,
 }
 
 int cli_build(void* data, int argc, char* argv[]) {
-       struct cli_config* cli_config = data;
-       struct pakfire_build* build = NULL;
-       struct pakfire_config* c = NULL;
-       struct config config = {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {
                .distro = NULL,
                .id     = NULL,
                .target = NULL,
@@ -167,60 +165,62 @@ int cli_build(void* data, int argc, char* argv[]) {
                        BUILD_ENABLE_SNAPSHOT |
                        BUILD_ENABLE_TESTS,
        };
+       struct pakfire_config* config = NULL;
+       struct pakfire_build* build = NULL;
        int build_flags = 0;
        int r;
 
        // Parse the command line
-       r = cli_parse(options, NULL, NULL, NULL, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, NULL, NULL, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Replace the logger
-       pakfire_ctx_set_log_callback(cli_config->ctx, log_callback, NULL);
+       pakfire_ctx_set_log_callback(global_args->ctx, log_callback, NULL);
 
        // Use the snapshot?
-       if (config.flags & BUILD_ENABLE_SNAPSHOT)
+       if (local_args.flags & BUILD_ENABLE_SNAPSHOT)
                build_flags |= PAKFIRE_BUILD_ENABLE_SNAPSHOT;
 
        // Is the build interactive?
-       if (config.flags & BUILD_INTERACTIVE)
+       if (local_args.flags & BUILD_INTERACTIVE)
                build_flags |=  PAKFIRE_BUILD_INTERACTIVE;
 
        // Enable ccache?
-       if (!(config.flags & BUILD_ENABLE_CCACHE))
+       if (!(local_args.flags & BUILD_ENABLE_CCACHE))
                build_flags |= PAKFIRE_BUILD_DISABLE_CCACHE;
 
        // Enable tests?
-       if (!(config.flags & BUILD_ENABLE_TESTS))
+       if (!(local_args.flags & BUILD_ENABLE_TESTS))
                build_flags |= PAKFIRE_BUILD_DISABLE_TESTS;
 
        // Read distro configuration
-       r = cli_read_distro_config(&c, cli_config->ctx, config.distro);
+       r = cli_read_distro_config(&config, global_args->ctx, local_args.distro);
        if (r < 0)
                goto ERROR;
 
        // Setup the build environment
-       r = pakfire_build_create(&build, cli_config->ctx, c, cli_config->arch, config.id, build_flags);
+       r = pakfire_build_create(&build, global_args->ctx, config, global_args->arch, local_args.id, build_flags);
        if (r) {
                fprintf(stderr, "Could not setup the build environment: %m\n");
                goto ERROR;
        }
 
        // Set target
-       if (config.target) {
-               r = pakfire_build_set_target(build, config.target);
+       if (local_args.target) {
+               r = pakfire_build_set_target(build, local_args.target);
                if (r) {
-                       fprintf(stderr, "Could not set target directory %s: %m\n", config.target);
+                       fprintf(stderr, "Could not set target directory %s: %m\n", local_args.target);
                        goto ERROR;
                }
        }
 
        // Process all packages
-       for (unsigned int i = 0; i < config.num_makefiles; i++) {
+       for (unsigned int i = 0; i < local_args.num_makefiles; i++) {
                // Run the build
-               r = pakfire_build_exec(build, config.makefiles[i]);
+               r = pakfire_build_exec(build, local_args.makefiles[i]);
                if (r) {
-                       fprintf(stderr, "Could not build %s\n", config.makefiles[i]);
+                       fprintf(stderr, "Could not build %s\n", local_args.makefiles[i]);
                        goto ERROR;
                }
        }
@@ -228,8 +228,8 @@ int cli_build(void* data, int argc, char* argv[]) {
 ERROR:
        if (build)
                pakfire_build_unref(build);
-       if (c)
-               pakfire_config_unref(c);
+       if (config)
+               pakfire_config_unref(config);
 
        return r;
 }
index 232ae6be4bb5477535a75a567d394947e53e6e67..f95d33fdd35a31ec9d67a21824c1ab2cd81c4880 100644 (file)
@@ -28,18 +28,17 @@ static const char* doc = "Removes any temporary files required or left over by"
        " previous builds.";
 
 int cli_clean(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
        struct pakfire* pakfire = NULL;
        int r;
 
-       struct cli_config* config = data;
-
        // Parse the command line
        r = cli_parse(NULL, NULL, NULL, doc, NULL, 0, argc, argv, NULL);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
index e76b72075fd17042eb94f92a6b54be49b847689a..beb92c32ea99dcda74fa384a5f48b44e399cf39a 100644 (file)
@@ -35,7 +35,7 @@ static const char* doc = "Build packages remotely";
 #define MAX_PACKAGES  32
 #define MAX_MAKEFILES 32
 
-struct config {
+struct cli_local_args {
        const char* repo;
        int flags;
 
@@ -65,29 +65,29 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_ARCH:
-                       if (config->num_arches >= MAX_ARCHES)
+                       if (args->num_arches >= MAX_ARCHES)
                                return -ENOBUFS;
 
-                       config->arches[config->num_arches++] = arg;
+                       args->arches[args->num_arches++] = arg;
                        break;
 
                case OPT_DISABLE_TESTS:
-                       config->flags |= PAKFIRE_BUILD_DISABLE_TESTS;
+                       args->flags |= PAKFIRE_BUILD_DISABLE_TESTS;
                        break;
 
                case OPT_REPO:
-                       config->repo = arg;
+                       args->repo = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -98,55 +98,54 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_client_build(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
-       struct config config = {};
        char* upload = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Upload all packages
-       for (unsigned int i = 0; i < config.num_packages; i++) {
-               r = pakfire_buildservice_upload(service, config.packages[i], NULL, &upload);
+       for (unsigned int i = 0; i < local_args.num_packages; i++) {
+               r = pakfire_buildservice_upload(service, local_args.packages[i], NULL, &upload);
                if (r)
                        goto ERROR;
 
                // Store the upload ID
-               config.uploads[config.num_uploads++] = upload;
+               local_args.uploads[local_args.num_uploads++] = upload;
        }
 
        // No uploads
-       if (!config.num_uploads)
+       if (!local_args.num_uploads)
                goto ERROR;
 
        // Build all the things
-       for (unsigned int i = 0; i < config.num_uploads; i++) {
-               r = pakfire_buildservice_build(service, config.uploads[i], config.repo,
-                       config.arches, config.flags);
+       for (unsigned int i = 0; i < local_args.num_uploads; i++) {
+               r = pakfire_buildservice_build(service, local_args.uploads[i], local_args.repo,
+                       local_args.arches, local_args.flags);
                if (r)
                        goto ERROR;
 
                // Free the upload
-               free(config.uploads[i]);
-               config.uploads[i] = NULL;
+               free(local_args.uploads[i]);
+               local_args.uploads[i] = NULL;
        }
 
 ERROR:
        // Delete & free all uploads that could not be processed
-       for (unsigned int i = 0; i < config.num_uploads; i++) {
-               if (config.uploads[i]) {
-                       pakfire_buildservice_delete_upload(service, config.uploads[i]);
-                       free(config.uploads[i]);
+       for (unsigned int i = 0; i < local_args.num_uploads; i++) {
+               if (local_args.uploads[i]) {
+                       pakfire_buildservice_delete_upload(service, local_args.uploads[i]);
+                       free(local_args.uploads[i]);
                }
        }
        if (service)
index 4350354e016b341bf4cdb19af3ee9efdb6900af5..684d4349dfa0de33636126fa3eeb30b372e9f4a7 100644 (file)
@@ -33,7 +33,7 @@ static const char* doc = "Creates source packages from makefiles";
 
 #define MAX_MAKEFILES 32
 
-struct config {
+struct cli_local_args {
        const char* resultdir;
 
        // Makefiles
@@ -42,14 +42,14 @@ struct config {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_makefiles >= MAX_MAKEFILES)
+                       if (args->num_makefiles >= MAX_MAKEFILES)
                                return -ENOBUFS;
 
-                       config->makefiles[config->num_makefiles++] = arg;
+                       args->makefiles[args->num_makefiles++] = arg;
                        break;
 
                default:
@@ -60,34 +60,31 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_dist(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct config config = {
-               .resultdir = NULL,
-       };
        char cwd[PATH_MAX];
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Set result directory to PWD
-       if (!config.resultdir)
-               config.resultdir = getcwd(cwd, sizeof(cwd));
+       if (!local_args.resultdir)
+               local_args.resultdir = getcwd(cwd, sizeof(cwd));
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Process all packages
-       for (unsigned int i = 0; i < config.num_makefiles; i++) {
-               r = pakfire_dist(pakfire, config.makefiles[i], config.resultdir, NULL);
+       for (unsigned int i = 0; i < local_args.num_makefiles; i++) {
+               r = pakfire_dist(pakfire, local_args.makefiles[i], local_args.resultdir, NULL);
                if (r) {
-                       fprintf(stderr, "Could not dist %s\n", config.makefiles[i]);
+                       fprintf(stderr, "Could not dist %s\n", local_args.makefiles[i]);
                        goto ERROR;
                }
        }
index 202bd36685133fc82ce705050de7857701d901f2..d79292c143f45edcdf24c166432f3a275aaeab54 100644 (file)
@@ -28,7 +28,7 @@
 #include "image_create.h"
 #include "pakfire.h"
 
-struct config {
+struct cli_local_args {
        const char* distro;
        const char* type;
        const char* path;
@@ -48,19 +48,19 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_DISTRO:
-                       config->distro = arg;
+                       args->distro = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (!config->type)
-                               config->type = arg;
+                       if (!args->type)
+                               args->type = arg;
 
-                       else if (!config->path)
-                               config->path = arg;
+                       else if (!args->path)
+                               args->path = arg;
 
                        break;
 
@@ -72,49 +72,48 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_image_create(void* data, int argc, char* argv[]) {
-       struct cli_config* cli_config = data;
-       struct pakfire_config* c = NULL;
-       struct pakfire_build* build = NULL;
-       FILE* f = NULL;
-       int r;
-
-       struct config config = {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {
                .type = NULL,
                .path = NULL,
        };
+       struct pakfire_config* config = NULL;
+       struct pakfire_build* build = NULL;
+       FILE* f = NULL;
+       int r;
 
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Read the distro configuration
-       r = cli_read_distro_config(&c, cli_config->ctx, config.distro);
+       r = cli_read_distro_config(&config, global_args->ctx, local_args.distro);
        if (r < 0)
                goto ERROR;
 
-       f = fopen(config.path, "w");
+       f = fopen(local_args.path, "w");
        if (!f) {
-               fprintf(stderr, "Could not open %s: %m\n", config.path);
+               fprintf(stderr, "Could not open %s: %m\n", local_args.path);
                r = -errno;
                goto ERROR;
        }
 
        // Setup the build environment
-       r = pakfire_build_create(&build, cli_config->ctx, c, cli_config->arch, NULL, 0);
+       r = pakfire_build_create(&build, global_args->ctx, config, global_args->arch, NULL, 0);
        if (r)
                goto ERROR;
 
        // Create the image
-       r = pakfire_build_mkimage(build, config.type, f);
+       r = pakfire_build_mkimage(build, local_args.type, f);
        if (r)
                goto ERROR;
 
 ERROR:
        if (build)
                pakfire_build_unref(build);
-       if (c)
-               pakfire_config_unref(c);
+       if (config)
+               pakfire_config_unref(config);
        if (f)
                fclose(f);
 
index 311919a1aeb14652d18323fe8869836e7574e9f2..fc578cd309da1677862223616e8354f61bfca2ea 100644 (file)
@@ -35,7 +35,7 @@ static const char* doc = "Shows package information";
 
 #define MAX_PACKAGES 128
 
-struct config {
+struct cli_local_args {
        int dump_flags;
 
        // Packages
@@ -55,22 +55,22 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_DEVEL:
-                       config->dump_flags |= PAKFIRE_PKG_DUMP_LONG;
+                       args->dump_flags |= PAKFIRE_PKG_DUMP_LONG;
                        break;
 
                case OPT_FILELIST:
-                       config->dump_flags |= PAKFIRE_PKG_DUMP_FILELIST;
+                       args->dump_flags |= PAKFIRE_PKG_DUMP_FILELIST;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -81,39 +81,36 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_info(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        struct pakfire_packagelist* list = NULL;
-       struct config config = {
-               .dump_flags = 0,
-       };
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Allocate a new packagelist
-       r = pakfire_packagelist_create(&list, cli_config->ctx);
+       r = pakfire_packagelist_create(&list, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Perform search
-       for (unsigned int i = 0; i < config.num_packages; i++) {
-               r = pakfire_search(pakfire, config.packages[i], PAKFIRE_SEARCH_NAME_ONLY, list);
+       for (unsigned int i = 0; i < local_args.num_packages; i++) {
+               r = pakfire_search(pakfire, local_args.packages[i], PAKFIRE_SEARCH_NAME_ONLY, list);
                if (r)
                        goto ERROR;
        }
 
        // Dump the packagelist
-       r = cli_dump_packagelist(list, config.dump_flags);
+       r = cli_dump_packagelist(list, local_args.dump_flags);
 
 ERROR:
        if (list)
index 2502a31c15c84de5a270cb9dfe4298d0c0ee8914..eabe63559b9a26ee39dab211b36baebeb4b592e3 100644 (file)
@@ -33,7 +33,7 @@ static const char* doc = "Install packages";
 
 #define MAX_PACKAGES 128
 
-struct config {
+struct cli_local_args {
        int transaction_flags;
        int job_flags;
 
@@ -58,30 +58,30 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_BEST:
-                       config->job_flags |= PAKFIRE_JOB_BEST;
+                       args->job_flags |= PAKFIRE_JOB_BEST;
                        break;
 
                case OPT_ALLOW_DOWNGRADE:
-                       config->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_DOWNGRADE;
+                       args->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_DOWNGRADE;
                        break;
 
                case OPT_ALLOW_UNINSTALL:
-                       config->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_UNINSTALL;
+                       args->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_UNINSTALL;
                        break;
 
                case OPT_WITHOUT_RECOMMENDED:
-                       config->transaction_flags |= PAKFIRE_TRANSACTION_WITHOUT_RECOMMENDED;
+                       args->transaction_flags |= PAKFIRE_TRANSACTION_WITHOUT_RECOMMENDED;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -92,13 +92,13 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 static int __cli_install(struct pakfire_transaction* transaction, int argc, char* argv[], void* data) {
-       struct config* config = (struct config*)data;
+       struct cli_local_args* args = data;
        int r;
 
        // Add the remaining command line options as packages
-       for (unsigned int i = 0; i < config->num_packages; i++) {
+       for (unsigned int i = 0; i < args->num_packages; i++) {
                r = pakfire_transaction_request(transaction,
-                               PAKFIRE_JOB_INSTALL, config->packages[i], config->job_flags);
+                               PAKFIRE_JOB_INSTALL, args->packages[i], args->job_flags);
                if (r) {
                        fprintf(stderr, "Could not find '%s': %m\n", argv[i]);
                        return r;
@@ -109,23 +109,22 @@ static int __cli_install(struct pakfire_transaction* transaction, int argc, char
 }
 
 int cli_install(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, config.transaction_flags, __cli_install, &config);
+       r = cli_transaction(pakfire, argc, argv, local_args.transaction_flags, __cli_install, &local_args);
 
 ERROR:
        if (pakfire)
index bfa614bdce5f9a58b9704d64b83b3f3382ed3303..03b211e497b52472b6f4d2032c5d54bd17dd61aa 100644 (file)
@@ -36,21 +36,21 @@ static const char* doc = "Lint archives";
 
 #define MAX_ARCHIVES 128
 
-struct config {
+struct cli_local_args {
        // Archives
        char* archives[MAX_ARCHIVES];
        unsigned int num_archives;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_archives >= MAX_ARCHIVES)
+                       if (args->num_archives >= MAX_ARCHIVES)
                                return -ENOBUFS;
 
-                       config->archives[config->num_archives++] = arg;
+                       args->archives[args->num_archives++] = arg;
                        break;
 
                default:
@@ -111,26 +111,24 @@ ERROR:
 }
 
 int cli_lint(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
-       struct config config = {};
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Lint all archives
-       for (unsigned int i = 0; i < config.num_archives; i++) {
-               r = do_lint(pakfire, config.archives[i]);
+       for (unsigned int i = 0; i < local_args.num_archives; i++) {
+               r = do_lint(pakfire, local_args.archives[i]);
                if (r < 0)
                        goto ERROR;
        }
index 32e824d34d58335dcb0f33c6afb1c07c8eef7d9d..fccef1c148fff5b74d5af74faea7458dffb58d10 100644 (file)
@@ -43,45 +43,45 @@ static void cli_set_repo_enabled(struct pakfire* pakfire, const char* name, int
        pakfire_repo_unref(repo);
 }
 
-int cli_setup_pakfire(struct pakfire** pakfire, struct cli_config* config) {
-       struct pakfire_config* c = NULL;
+int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args) {
+       struct pakfire_config* config = NULL;
        struct pakfire* p = NULL;
        FILE* f = NULL;
        int r;
 
        // Create a new config object
-       r = pakfire_config_create(&c);
+       r = pakfire_config_create(&config);
        if (r < 0)
                goto ERROR;
 
        // Open the regular configuration
-       if (config->config) {
-               r = pakfire_config_read_path(c, config->config);
+       if (args->config) {
+               r = pakfire_config_read_path(config, args->config);
                if (r < 0)
                        goto ERROR;
        }
 
        // Initialize Pakfire
-       r = pakfire_create(&p, config->ctx, c, config->root, config->arch, config->flags);
+       r = pakfire_create(&p, args->ctx, config, args->root, args->arch, args->flags);
        if (r < 0) {
                fprintf(stderr, "Could not initialize Pakfire: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Enable repositories
-       for (unsigned int i = 0; i < config->num_enable_repos; i++)
-               cli_set_repo_enabled(p, config->enable_repos[i], 1);
+       for (unsigned int i = 0; i < args->num_enable_repos; i++)
+               cli_set_repo_enabled(p, args->enable_repos[i], 1);
 
        // Disable repositories
-       for (unsigned int i = 0; i < config->num_disable_repos; i++)
-               cli_set_repo_enabled(p, config->disable_repos[i], 0);
+       for (unsigned int i = 0; i < args->num_disable_repos; i++)
+               cli_set_repo_enabled(p, args->disable_repos[i], 0);
 
        // Return pointer
        *pakfire = p;
 
 ERROR:
-       if (c)
-               pakfire_config_unref(c);
+       if (config)
+               pakfire_config_unref(config);
        if (f)
                fclose(f);
 
index 669ff86ee3d97ffdd15380b9532bac4179fd389e..553b146bd4562557481ed969be483b23b5c68892 100644 (file)
@@ -26,7 +26,7 @@
 
 #define MAX_REPOS 16
 
-struct cli_config {
+struct cli_global_args {
        struct pakfire_ctx* ctx;
 
        const char* distro;
@@ -43,6 +43,6 @@ struct cli_config {
        unsigned int num_disable_repos;
 };
 
-int cli_setup_pakfire(struct pakfire** pakfire, struct cli_config* config);
+int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args);
 
 #endif /* PAKFIRE_CLI_PAKFIRE_H */
index 3fb2751d37cbf60d9946f663f135172c8e3f5516..475ba4f5ab9634186a1649baa7c04bd48bb1a0a5 100644 (file)
@@ -33,20 +33,20 @@ static const char* doc = "Search for packages that provide a certain pattern";
 
 #define MAX_PATTERNS 256
 
-struct config {
+struct cli_local_args {
        char* patterns[MAX_PATTERNS];
        unsigned int num_patterns;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_patterns >= MAX_PATTERNS)
+                       if (args->num_patterns >= MAX_PATTERNS)
                                return -ENOBUFS;
 
-                       config->patterns[config->num_patterns++] = arg;
+                       args->patterns[args->num_patterns++] = arg;
                        break;
 
                default:
@@ -57,32 +57,30 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_provides(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        struct pakfire_packagelist* list = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
-       struct config config = {};
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Allocate a new packagelist
-       r = pakfire_packagelist_create(&list, cli_config->ctx);
+       r = pakfire_packagelist_create(&list, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Perform search
-       for (unsigned int i = 0; i < config.num_patterns; i++) {
-               r = pakfire_whatprovides(pakfire, config.patterns[i], 0, list);
+       for (unsigned int i = 0; i < local_args.num_patterns; i++) {
+               r = pakfire_whatprovides(pakfire, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
index 7c654aa13b5c60021f69ea29d64ffba7c8e8cee2..a175cf5348d8105defe66f3a48328a9fbf1e8896 100644 (file)
@@ -33,7 +33,7 @@ static const char* doc = "Remove packages";
 
 #define MAX_PACKAGES 128
 
-struct config {
+struct cli_local_args {
        int job_flags;
 
        // Packages
@@ -51,18 +51,18 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_KEEP_DEPENDENCIES:
-                       config->job_flags |= PAKFIRE_JOB_KEEP_DEPS;
+                       args->job_flags |= PAKFIRE_JOB_KEEP_DEPS;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -73,12 +73,12 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 static int __cli_remove(struct pakfire_transaction* transaction, int argc, char* argv[], void* data) {
-       struct config* config = (struct config*)data;
+       struct cli_local_args* args = data;
        int r;
 
-       for (unsigned int i = 0; i < config->num_packages; i++) {
+       for (unsigned int i = 0; i < args->num_packages; i++) {
                r = pakfire_transaction_request(transaction,
-                               PAKFIRE_JOB_ERASE, config->packages[i], config->job_flags);
+                               PAKFIRE_JOB_ERASE, args->packages[i], args->job_flags);
                if (r) {
                        fprintf(stderr, "Could not find '%s': %m\n", argv[i]);
                        return r;
@@ -89,23 +89,22 @@ static int __cli_remove(struct pakfire_transaction* transaction, int argc, char*
 }
 
 int cli_remove(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, 0, __cli_remove, &config);
+       r = cli_transaction(pakfire, argc, argv, 0, __cli_remove, &local_args);
 
 ERROR:
        if (pakfire)
index 120b5ab9ceae197c17d2214761aeefd621f47427..3a87b41dd0006cc20c67652ac8b6006e5d8a7b71 100644 (file)
@@ -33,7 +33,7 @@ static const char* doc = "Create a new repository";
 
 #define MAX_PACKAGES 1024
 
-struct config {
+struct cli_local_args {
        const char* path;
        const char* key;
 
@@ -51,22 +51,22 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_KEY:
-                       config->key = arg;
+                       args->key = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (!config->path)
-                               config->path = arg;
+                       if (!args->path)
+                               args->path = arg;
 
-                       else if (config->num_packages >= MAX_PACKAGES)
+                       else if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
                        else
-                               config->packages[config->num_packages++] = arg;
+                               args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -102,36 +102,31 @@ static int cli_import_key(struct pakfire_key** key,
 }
 
 int cli_repo_compose(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        struct pakfire_key* key = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
-       struct config config = {
-               .path = NULL,
-               .key  = NULL,
-       };
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Read the key (if any)
-       if (config.key) {
-               r = cli_import_key(&key, cli_config->ctx, config.key);
+       if (local_args.key) {
+               r = cli_import_key(&key, global_args->ctx, local_args.key);
                if (r)
                        goto ERROR;
        }
 
        // Write the repository
-       r = pakfire_repo_compose(pakfire, config.path, key, (const char**)config.packages);
+       r = pakfire_repo_compose(pakfire, local_args.path, key, (const char**)local_args.packages);
 
 ERROR:
        if (key)
index f825f47bbadc51842cfe39298cb1b1f27113507f..ba270f5798c64bcee9a2f25771f94d0e706a0444 100644 (file)
@@ -33,7 +33,7 @@ static const char* args_doc = "DISTRO NAME [OPTIONS...]";
 
 static const char* doc = "Create a new repository";
 
-struct config {
+struct cli_local_args {
        const char* distro;
        const char* name;
        const char* description;
@@ -48,19 +48,19 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_DESCRIPTION:
-                       config->description = arg;
+                       args->description = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (!config->distro)
-                               config->distro = arg;
+                       if (!args->distro)
+                               args->distro = arg;
 
-                       else if (!config->name)
-                               config->name = arg;
+                       else if (!args->name)
+                               args->name = arg;
 
                        else
                                argp_usage(state);
@@ -74,26 +74,25 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_repo_create(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
        struct json_object* repo = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // List repos
        r = pakfire_buildservice_create_repo(service,
-               config.distro, config.name, config.description, &repo);
+                       local_args.distro, local_args.name, local_args.description, &repo);
        if (r)
                goto ERROR;
 
index 84a0ace4ce17d942cdaed1f11c096a2878c06094..3ad30425e47e725fb26c1437c0dde334dd8d38d1 100644 (file)
@@ -33,21 +33,21 @@ static const char* args_doc = "DISTRO NAME";
 
 static const char* doc = "Delete a repository";
 
-struct config {
+struct cli_local_args {
        const char* distro;
        const char* name;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (!config->distro)
-                               config->distro = arg;
+                       if (!args->distro)
+                               args->distro = arg;
 
-                       else if (!config->name)
-                               config->name = arg;
+                       else if (!args->name)
+                               args->name = arg;
 
                        else
                                argp_usage(state);
@@ -61,25 +61,24 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_repo_delete(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
        struct json_object* repo = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Delete the repository
-       r = pakfire_buildservice_delete_repo(service, config.distro, config.name);
+       r = pakfire_buildservice_delete_repo(service, local_args.distro, local_args.name);
        if (r)
                goto ERROR;
 
index a00c2bb79a4021287909401bb1899ac051d26b2a..f3b40e63541bbb4cae38985504077f5fff5944f6 100644 (file)
 
 static const char* doc = "Lists all repositories";
 
-struct config {
+struct cli_local_args {
        const char* distro;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (!config->distro)
-                               config->distro = arg;
+                       if (!args->distro)
+                               args->distro = arg;
 
                        else
                                argp_usage(state);
@@ -53,25 +53,24 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_repo_list(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
        struct json_object* repos = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, NULL, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, NULL, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // List repos
-       r = pakfire_buildservice_list_repos(service, config.distro, &repos);
+       r = pakfire_buildservice_list_repos(service, local_args.distro, &repos);
        if (r)
                goto ERROR;
 
index 9bdc7c7943bbf8bbebd629c7a5e5ca82874e58b6..e7794db382155a859b665c0049de3649829ba957 100644 (file)
 
 static const char* doc = "Lists all repositories";
 
-struct config {
+struct cli_local_args {
        const char* distro;
        const char* name;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (!config->distro)
-                               config->distro = arg;
+                       if (!args->distro)
+                               args->distro = arg;
 
-                       else if (!config->name)
-                               config->name = arg;
+                       else if (!args->name)
+                               args->name = arg;
 
                        else
                                argp_usage(state);
@@ -59,25 +59,24 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_repo_show(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
        struct json_object* repo = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, NULL, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, NULL, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // List repos
-       r = pakfire_buildservice_get_repo(service, config.distro, config.name, &repo);
+       r = pakfire_buildservice_get_repo(service, local_args.distro, local_args.name, &repo);
        if (r)
                goto ERROR;
 
index b2d9a689f158fa798e754eab27245543e6a84f6a..dc7b414b3aad19b0035a93cb72fc2f71e3789b33 100644 (file)
 static const char* doc = "List all available repositories";
 
 int cli_repolist(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
        struct pakfire* pakfire = NULL;
        struct pakfire_repolist* list = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
        r = cli_parse(NULL, NULL, NULL, doc, NULL, 0, argc, argv, NULL);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
index f9d349febdceab76a2c7360d4ea64b2bb6dad0ca..fce0195a65e3e9ed479828f399d2b8b0fdcae702 100644 (file)
@@ -33,20 +33,20 @@ static const char* doc = "Search for packages that requires a certain pattern";
 
 #define MAX_PATTERNS 256
 
-struct config {
+struct cli_local_args {
        char* patterns[MAX_PATTERNS];
        unsigned int num_patterns;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_patterns >= MAX_PATTERNS)
+                       if (args->num_patterns >= MAX_PATTERNS)
                                return -ENOBUFS;
 
-                       config->patterns[config->num_patterns++] = arg;
+                       args->patterns[args->num_patterns++] = arg;
                        break;
 
                default:
@@ -57,32 +57,30 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_requires(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        struct pakfire_packagelist* list = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
-       struct config config = {};
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Allocate a new packagelist
-       r = pakfire_packagelist_create(&list, cli_config->ctx);
+       r = pakfire_packagelist_create(&list, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Perform search
-       for (unsigned int i = 0; i < config.num_patterns; i++) {
-               r = pakfire_whatrequires(pakfire, config.patterns[i], 0, list);
+       for (unsigned int i = 0; i < local_args.num_patterns; i++) {
+               r = pakfire_whatrequires(pakfire, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
index 9aa7c986bdc245b1000599fbadd8a7b895745d92..0fa76a29e32df2465762ef0d636a2a4eebb29977 100644 (file)
@@ -33,20 +33,20 @@ static const char* doc = "Search for packages";
 
 #define MAX_PATTERNS 256
 
-struct config {
+struct cli_local_args {
        char* patterns[MAX_PATTERNS];
        unsigned int num_patterns;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_patterns >= MAX_PATTERNS)
+                       if (args->num_patterns >= MAX_PATTERNS)
                                return -ENOBUFS;
 
-                       config->patterns[config->num_patterns++] = arg;
+                       args->patterns[args->num_patterns++] = arg;
                        break;
 
                default:
@@ -57,32 +57,30 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_search(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
        struct pakfire_packagelist* list = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
-       struct config config = {};
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
        // Allocate a new packagelist
-       r = pakfire_packagelist_create(&list, cli_config->ctx);
+       r = pakfire_packagelist_create(&list, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Perform search
-       for (unsigned int i = 0; i < config.num_patterns; i++) {
-               r = pakfire_search(pakfire, config.patterns[i], 0, list);
+       for (unsigned int i = 0; i < local_args.num_patterns; i++) {
+               r = pakfire_search(pakfire, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
index 4f2d3c512c06f2b13d44e3dba95427f794085ea3..d3271bb3e458a1e28a5c046e0ac28ae8e5b33ccd 100644 (file)
@@ -31,7 +31,7 @@
 #define MAX_ARGS     128
 #define MAX_PACKAGES 128
 
-struct config {
+struct cli_local_args {
        const char* distro;
 
        enum {
@@ -64,29 +64,29 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_DISTRO:
-                       config->distro = arg;
+                       args->distro = arg;
                        break;
 
                case OPT_DISABLE_SNAPSHOT:
-                       config->flags &= ~SHELL_ENABLE_SNAPSHOT;
+                       args->flags &= ~SHELL_ENABLE_SNAPSHOT;
                        break;
 
                case OPT_INSTALL:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->argc >= MAX_ARGS)
+                       if (args->argc >= MAX_ARGS)
                                return -ENOBUFS;
 
-                       config->argv[config->argc++] = arg;
+                       args->argv[args->argc++] = arg;
                        break;
 
                default:
@@ -97,56 +97,55 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_shell(void* data, int argc, char* argv[]) {
-       struct cli_config* cli_config = data;
-       struct pakfire_config* c = NULL;
-       struct pakfire_build* build = NULL;
-       int build_flags = PAKFIRE_BUILD_INTERACTIVE;
-       int r;
-
-       struct config config = {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {
                .flags        = SHELL_ENABLE_SNAPSHOT,
                .argv         = {},
                .argc         = 0,
                .packages     = {},
                .num_packages = 0,
        };
+       struct pakfire_config* config = NULL;
+       struct pakfire_build* build = NULL;
+       int build_flags = PAKFIRE_BUILD_INTERACTIVE;
+       int r;
 
        // Parse the command line
-       r = cli_parse(options, NULL, NULL, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, NULL, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Enable snapshots?
-       if (config.flags & SHELL_ENABLE_SNAPSHOT)
+       if (local_args.flags & SHELL_ENABLE_SNAPSHOT)
                build_flags |= PAKFIRE_BUILD_ENABLE_SNAPSHOT;
 
        // Read distro configuration
-       r = cli_read_distro_config(&c, cli_config->ctx, config.distro);
+       r = cli_read_distro_config(&config, global_args->ctx, local_args.distro);
        if (r < 0)
                goto ERROR;
 
        // Setup the build environment
-       r = pakfire_build_create(&build, cli_config->ctx, c, cli_config->arch, NULL, build_flags);
+       r = pakfire_build_create(&build, global_args->ctx, config, global_args->arch, NULL, build_flags);
        if (r) {
                fprintf(stderr, "Could not setup the build environment: %m\n");
                goto ERROR;
        }
 
        // Install any additional packages
-       if (config.num_packages) {
-               r = pakfire_build_install(build, config.packages);
+       if (local_args.num_packages) {
+               r = pakfire_build_install(build, local_args.packages);
                if (r)
                        goto ERROR;
        }
 
        // Run the command
-       r = pakfire_build_shell(build, (config.argc) ? config.argv : NULL);
+       r = pakfire_build_shell(build, (local_args.argc) ? local_args.argv : NULL);
 
 ERROR:
        if (build)
                pakfire_build_unref(build);
-       if (c)
-               pakfire_config_unref(c);
+       if (config)
+               pakfire_config_unref(config);
 
        return r;
 }
index 2f5fa2e720a0850d0be3ab4da223273d9b25ae03..78ad89ac883c105d7d70123d0dd534e9236761b9 100644 (file)
 static const char* doc = "Update the snapshot";
 
 int cli_snapshot_update(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
        struct pakfire* pakfire = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
        r = cli_parse(NULL, NULL, NULL, doc, NULL, 0, argc, argv, NULL);
        if (r)
                goto ERROR;
 
        // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
index b5ea449df369d433e6e3efe7027bebc63cd6f527..b0dd77e86ecba14aaff5faeb44498215cb719575 100644 (file)
@@ -31,7 +31,7 @@ static const char* args_doc = "sync [OPTIONS...]";
 
 static const char* doc = "Synchronize packages";
 
-struct config {
+struct cli_local_args {
        int job_flags;
 };
 
@@ -45,11 +45,11 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_KEEP_ORPHANED:
-                       config->job_flags |= PAKFIRE_JOB_KEEP_ORPHANED;
+                       args->job_flags |= PAKFIRE_JOB_KEEP_ORPHANED;
                        break;
 
                default:
@@ -60,11 +60,11 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 static int __cli_sync(struct pakfire_transaction* transaction, int argc, char* argv[], void* data) {
-       struct config* config = (struct config*)data;
+       struct cli_local_args* args = data;
        int r;
 
        // Request sync
-       r = pakfire_transaction_request(transaction, PAKFIRE_JOB_SYNC, NULL, config->job_flags);
+       r = pakfire_transaction_request(transaction, PAKFIRE_JOB_SYNC, NULL, args->job_flags);
        if (r) {
                fprintf(stderr, "Could not request job: %m\n");
                return r;
@@ -74,23 +74,22 @@ static int __cli_sync(struct pakfire_transaction* transaction, int argc, char* a
 }
 
 int cli_sync(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, 0, __cli_sync, &config);
+       r = cli_transaction(pakfire, argc, argv, 0, __cli_sync, &local_args);
 
 ERROR:
        if (pakfire)
index b80ef2431ad9224c2911422a2cc58a2d255afbc9..074c3f97a9bb56588b509051e6b51e1bed74496d 100644 (file)
@@ -34,7 +34,7 @@ static const char* doc = "Update packages";
 #define MAX_EXCLUDES 128
 #define MAX_PACKAGES 128
 
-struct config {
+struct cli_local_args {
        int transaction_flags;
 
        // Excludes
@@ -59,29 +59,29 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case OPT_ALLOW_DOWNGRADE:
-                       config->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_DOWNGRADE;
+                       args->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_DOWNGRADE;
                        break;
 
                case OPT_ALLOW_UNINSTALL:
-                       config->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_UNINSTALL;
+                       args->transaction_flags |= PAKFIRE_TRANSACTION_ALLOW_UNINSTALL;
                        break;
 
                case 'x':
-                       if (config->num_excludes >= MAX_EXCLUDES)
+                       if (args->num_excludes >= MAX_EXCLUDES)
                                return -ENOBUFS;
 
-                       config->excludes[config->num_excludes++] = arg;
+                       args->excludes[args->num_excludes++] = arg;
                        break;
 
                case ARGP_KEY_ARG:
-                       if (config->num_packages >= MAX_PACKAGES)
+                       if (args->num_packages >= MAX_PACKAGES)
                                return -ENOBUFS;
 
-                       config->packages[config->num_packages++] = arg;
+                       args->packages[args->num_packages++] = arg;
                        break;
 
                default:
@@ -92,12 +92,12 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 static int __cli_update(struct pakfire_transaction* transaction, int argc, char* argv[], void* data) {
-       struct config* config = (struct config*)data;
+       struct cli_local_args* args = data;
        int r;
 
        // Exclude any packages
-       for (unsigned int i = 0; i < config->num_excludes; i++) {
-               r = pakfire_transaction_request(transaction, PAKFIRE_JOB_LOCK, config->excludes[i], 0);
+       for (unsigned int i = 0; i < args->num_excludes; i++) {
+               r = pakfire_transaction_request(transaction, PAKFIRE_JOB_LOCK, args->excludes[i], 0);
                if (r)
                        return r;
        }
@@ -105,9 +105,9 @@ static int __cli_update(struct pakfire_transaction* transaction, int argc, char*
        // Did the user pass any packages?
        if (argc) {
                // Add the remaining command line options as packages
-               for (unsigned int i = 0; i < config->num_packages; i++) {
+               for (unsigned int i = 0; i < args->num_packages; i++) {
                        r = pakfire_transaction_request(transaction,
-                               PAKFIRE_JOB_UPDATE, config->packages[i], 0);
+                                       PAKFIRE_JOB_UPDATE, args->packages[i], 0);
                        if (r) {
                                fprintf(stderr, "Could not find '%s': %m\n", argv[i]);
                                return r;
@@ -125,23 +125,22 @@ static int __cli_update(struct pakfire_transaction* transaction, int argc, char*
 }
 
 int cli_update(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(options, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, cli_config);
+       r = cli_setup_pakfire(&pakfire, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, config.transaction_flags, __cli_update, &config);
+       r = cli_transaction(pakfire, argc, argv, local_args.transaction_flags, __cli_update, &local_args);
 
 ERROR:
        if (pakfire)
index e0d3b4498dc4b6d6e35658fa8a2496b9c87302df..04a7cef5456a1eedeb33bb4574b6a56f3033ba87 100644 (file)
@@ -32,20 +32,20 @@ static const char* doc = "Uploads a file";
 
 #define MAX_FILES 32
 
-struct config {
+struct cli_local_args {
        const char* files[MAX_FILES];
        unsigned int num_files;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_files >= MAX_FILES)
+                       if (args->num_files >= MAX_FILES)
                                return -ENOBUFS;
 
-                       config->files[config->num_files++] = arg;
+                       args->files[args->num_files++] = arg;
                        break;
 
                default:
@@ -56,31 +56,30 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_upload_create(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
-       struct config config = {};
        char* uuid = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // List uploads
-       for (unsigned int i = 0; i < config.num_files; i++) {
-               r = pakfire_buildservice_upload(service, config.files[i], NULL, &uuid);
+       for (unsigned int i = 0; i < local_args.num_files; i++) {
+               r = pakfire_buildservice_upload(service, local_args.files[i], NULL, &uuid);
                if (r)
                        goto ERROR;
 
                if (uuid) {
-                       printf("Uploaded %s as %s\n", config.files[i], uuid);
+                       printf("Uploaded %s as %s\n", local_args.files[i], uuid);
                        free(uuid);
                }
        }
index eeb09191f15956158895a8fe78870c27ff0da200..b019ff2ce56b422d08d17641a64bfecb3760fc3d 100644 (file)
@@ -33,24 +33,24 @@ static const char* doc = "Deletes an uploaded file";
 
 #define MAX_UPLOADS 32
 
-struct config {
+struct cli_local_args {
        const char* uploads[MAX_UPLOADS];
        unsigned int num_uploads;
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct config* config = data;
+       struct cli_local_args* args = data;
 
        switch (key) {
                case ARGP_KEY_ARG:
-                       if (config->num_uploads >= MAX_UPLOADS)
+                       if (args->num_uploads >= MAX_UPLOADS)
                                return -ENOBUFS;
 
                        // Validate the UUID
                        if (!pakfire_uuid_is_valid(arg))
                                argp_error(state, "Invalid UUID");
 
-                       config->uploads[config->num_uploads++] = arg;
+                       args->uploads[args->num_uploads++] = arg;
                        break;
 
                default:
@@ -61,25 +61,24 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
 }
 
 int cli_upload_delete(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
+       struct cli_local_args local_args = {};
        struct pakfire_buildservice* service = NULL;
-       struct config config = {};
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
-       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &config);
+       r = cli_parse(NULL, NULL, args_doc, doc, parse, 0, argc, argv, &local_args);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
        // Delete uploads
-       for (unsigned int i = 0; i < config.num_uploads; i++) {
-               r = pakfire_buildservice_delete_upload(service, config.uploads[i]);
+       for (unsigned int i = 0; i < local_args.num_uploads; i++) {
+               r = pakfire_buildservice_delete_upload(service, local_args.uploads[i]);
                if (r)
                        goto ERROR;
        }
index c8e5697e40092e6dbb638fa6292bcc9fc49f3967..4ca7a7cedad248387897a43563bf8a7d47f8343e 100644 (file)
 static const char* doc = "Lists all uploads";
 
 int cli_upload_list(void* data, int argc, char* argv[]) {
+       struct cli_global_args* global_args = data;
        struct pakfire_buildservice* service = NULL;
        struct json_object* uploads = NULL;
        int r;
 
-       struct cli_config* cli_config = data;
-
        // Parse the command line
        r = cli_parse(NULL, NULL, NULL, doc, NULL, 0, argc, argv, NULL);
        if (r)
                goto ERROR;
 
        // Connect to the build service
-       r = pakfire_buildservice_create(&service, cli_config->ctx);
+       r = pakfire_buildservice_create(&service, global_args->ctx);
        if (r)
                goto ERROR;
 
index 6731d14cfaa853063991d91743fdf6de9f5bafc7..d0aa30303e81685e2a7941cd091fdba0ed74473e 100644 (file)
@@ -102,7 +102,7 @@ const char* args_doc =
        "snapshot [COMMAND...]";
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct cli_config* config = data;
+       struct cli_global_args* args = data;
 
        switch (key) {
                case OPT_ARCH:
@@ -110,31 +110,31 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
                        if (!pakfire_arch_is_supported_by_host(arg))
                                argp_failure(state, EXIT_FAILURE, 0, "Unsupported architecture: %s", arg);
 
-                       config->arch = arg;
+                       args->arch = arg;
                        break;
 
                case OPT_DEBUG:
-                       pakfire_ctx_set_log_level(config->ctx, LOG_DEBUG);
+                       pakfire_ctx_set_log_level(args->ctx, LOG_DEBUG);
                        break;
 
                case OPT_DISTRO:
-                       config->distro = arg;
+                       args->distro = arg;
                        break;
 
                // Enable/Disable Repositories
 
                case OPT_ENABLE_REPO:
-                       if (config->num_enable_repos >= MAX_REPOS)
+                       if (args->num_enable_repos >= MAX_REPOS)
                                return -ENOBUFS;
 
-                       config->enable_repos[config->num_enable_repos++] = arg;
+                       args->enable_repos[args->num_enable_repos++] = arg;
                        break;
 
                case OPT_DISABLE_REPO:
-                       if (config->num_disable_repos >= MAX_REPOS)
+                       if (args->num_disable_repos >= MAX_REPOS)
                                return -ENOBUFS;
 
-                       config->disable_repos[config->num_disable_repos++] = arg;
+                       args->disable_repos[args->num_disable_repos++] = arg;
                        break;
 
                default:
@@ -173,7 +173,7 @@ int main(int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       struct cli_config config = {
+       struct cli_global_args args = {
                .ctx      = ctx,
                .distro   = cli_get_default_distro(ctx),
                .arch     = NULL,
@@ -182,7 +182,7 @@ int main(int argc, char* argv[]) {
 
        // Parse the command line and run any commands
        r = cli_parse(options, commands, args_doc, NULL,
-               parse, CLI_REQUIRE_ROOT, argc, argv, &config);
+               parse, CLI_REQUIRE_ROOT, argc, argv, &args);
 
 ERROR:
        if (ctx)
index b0d957e8db2fa8686881a50f722a19ad48dc5fe3..3b99a0676ba69adce020789371cec9a86d49d5bd 100644 (file)
@@ -58,15 +58,15 @@ static struct argp_option options[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct cli_config* config = data;
+       struct cli_global_args* args = data;
 
        switch (key) {
                case OPT_DEBUG:
-                       pakfire_ctx_set_log_level(config->ctx, LOG_DEBUG);
+                       pakfire_ctx_set_log_level(args->ctx, LOG_DEBUG);
                        break;
 
                case OPT_DISTRO:
-                       config->distro = arg;
+                       args->distro = arg;
                        break;
 
                default:
@@ -88,14 +88,14 @@ int main(int argc, char* argv[]) {
        // Setup progress callback
        pakfire_ctx_set_progress_callback(ctx, cli_setup_progressbar, NULL);
 
-       struct cli_config config = {
+       struct cli_global_args args = {
                .ctx    = ctx,
                .distro = cli_get_default_distro(ctx),
        };
 
        // Parse the command line and run any commands
        r = cli_parse(options, commands, args_doc, doc,
-               parse, 0, argc, argv, &config);
+               parse, 0, argc, argv, &args);
 
 ERROR:
        if (ctx)
index 78e97f8a23ddd6958bb7e3d18d510b4c7a729456..d83737ea5779f9af48933a9315b5374ebdfb8b33 100644 (file)
@@ -89,43 +89,43 @@ static const struct command commands[] = {
 };
 
 static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
-       struct cli_config* config = data;
+       struct cli_global_args* args = data;
 
        switch (key) {
                case OPT_CONFIG:
-                       config->config = arg;
+                       args->config = arg;
                        break;
 
                case OPT_DEBUG:
-                       pakfire_ctx_set_log_level(config->ctx, LOG_DEBUG);
+                       pakfire_ctx_set_log_level(args->ctx, LOG_DEBUG);
                        break;
 
                case OPT_OFFLINE:
-                       pakfire_ctx_set_flag(config->ctx, PAKFIRE_CTX_OFFLINE);
+                       pakfire_ctx_set_flag(args->ctx, PAKFIRE_CTX_OFFLINE);
                        break;
 
                case OPT_ROOT:
-                       config->root = arg;
+                       args->root = arg;
                        break;
 
                case OPT_YES:
-                       pakfire_ctx_set_confirm_callback(config->ctx, cli_term_confirm_yes, NULL);
+                       pakfire_ctx_set_confirm_callback(args->ctx, cli_term_confirm_yes, NULL);
                        break;
 
                // Enable/Disable Repositories
 
                case OPT_ENABLE_REPO:
-                       if (config->num_enable_repos >= MAX_REPOS)
+                       if (args->num_enable_repos >= MAX_REPOS)
                                return -ENOBUFS;
 
-                       config->enable_repos[config->num_enable_repos++] = arg;
+                       args->enable_repos[args->num_enable_repos++] = arg;
                        break;
 
                case OPT_DISABLE_REPO:
-                       if (config->num_disable_repos >= MAX_REPOS)
+                       if (args->num_disable_repos >= MAX_REPOS)
                                return -ENOBUFS;
 
-                       config->disable_repos[config->num_disable_repos++] = arg;
+                       args->disable_repos[args->num_disable_repos++] = arg;
                        break;
 
                default:
@@ -154,7 +154,7 @@ int main(int argc, char* argv[]) {
        // Setup pick solution callback
        pakfire_ctx_set_pick_solution_callback(ctx, cli_term_pick_solution, NULL);
 
-       struct cli_config config = {
+       struct cli_global_args args = {
                .ctx      = ctx,
                // XXX hard-coded path
                .config   = "/etc/pakfire/general.conf",
@@ -166,7 +166,7 @@ int main(int argc, char* argv[]) {
 
        // Parse the command line and run any commands
        r = cli_parse(options, commands, args_doc, NULL, parse,
-               CLI_REQUIRE_ROOT, argc, argv, &config);
+               CLI_REQUIRE_ROOT, argc, argv, &args);
 
 ERROR:
        if (ctx)