]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Rename the main class to root
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 12:11:55 +0000 (12:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 12:11:55 +0000 (12:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
104 files changed:
src/cli/lib/build.c
src/cli/lib/check.c
src/cli/lib/check.h
src/cli/lib/clean.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/repolist.c
src/cli/lib/requires.c
src/cli/lib/search.c
src/cli/lib/snapshot_update.c
src/cli/lib/sync.c
src/cli/lib/terminal.c
src/cli/lib/terminal.h
src/cli/lib/transaction.c
src/cli/lib/transaction.h
src/cli/lib/update.c
src/cli/pakfire-builder.c
src/pakfire/archive.c
src/pakfire/archive.h
src/pakfire/archive_writer.c
src/pakfire/archive_writer.h
src/pakfire/build.c
src/pakfire/build.h
src/pakfire/ctx.c
src/pakfire/ctx.h
src/pakfire/db.c
src/pakfire/db.h
src/pakfire/deps.c
src/pakfire/deps.h
src/pakfire/dist.c
src/pakfire/dist.h
src/pakfire/file.c
src/pakfire/file.h
src/pakfire/filelist.c
src/pakfire/filelist.h
src/pakfire/jail.c
src/pakfire/jail.h
src/pakfire/job.c
src/pakfire/linter.c
src/pakfire/linter.h
src/pakfire/mount.c
src/pakfire/mount.h
src/pakfire/oci.c
src/pakfire/oci.h
src/pakfire/package.c
src/pakfire/package.h
src/pakfire/packagelist.c
src/pakfire/packagelist.h
src/pakfire/packager.c
src/pakfire/packager.h
src/pakfire/pakfire.c
src/pakfire/pakfire.h
src/pakfire/parser.c
src/pakfire/parser.h
src/pakfire/parser/grammar.y
src/pakfire/problem.c
src/pakfire/problem.h
src/pakfire/pwd.c
src/pakfire/pwd.h
src/pakfire/repo.c
src/pakfire/repo.h
src/pakfire/scriptlet.c
src/pakfire/scriptlet.h
src/pakfire/snapshot.c
src/pakfire/snapshot.h
src/pakfire/solution.c
src/pakfire/solution.h
src/pakfire/stripper.c
src/pakfire/stripper.h
src/pakfire/transaction.c
src/pakfire/transaction.h
src/pakfire/util.c
src/pakfire/util.h
src/python/archive.c
src/python/ctx.c
src/python/package.c
src/python/pakfire.c
src/python/pakfire.h
src/python/repo.c
src/python/transaction.c
tests/libpakfire/archive.c
tests/libpakfire/cgroup.c
tests/libpakfire/db.c
tests/libpakfire/deps.c
tests/libpakfire/file.c
tests/libpakfire/jail.c
tests/libpakfire/main.c
tests/libpakfire/makefile.c
tests/libpakfire/package.c
tests/libpakfire/packager.c
tests/libpakfire/parser.c
tests/libpakfire/repo.c
tests/libpakfire/util.c
tests/parser/test.c
tests/testsuite.c
tests/testsuite.h

index 869b5fb2d054633953c0f4ce7c1c28076cd7d70f..18cf15ce98ebf88bcd98d427661b6a35b72b156b 100644 (file)
@@ -162,7 +162,7 @@ static void log_callback(void* data, int priority, const char* file, int line,
                free(buffer);
 }
 
-static int result_callback(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int result_callback(pakfire_ctx* ctx, pakfire_root* root,
                pakfire_build* build, pakfire_archive* archive, void* data) {
        const struct cli_local_args* local_args = data;
        pakfire_package* pkg = NULL;
@@ -179,7 +179,7 @@ static int result_callback(pakfire_ctx* ctx, struct pakfire* pakfire,
        const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
 
        // Fetch the local repository & import the archive
-       local = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
+       local = pakfire_root_get_repo(root, PAKFIRE_REPO_LOCAL);
        if (local) {
                r = pakfire_repo_import_archive(local, archive, NULL);
                if (r < 0) {
index 3b83d43793db1e5a2b0e8d1e24444e1c7ea57573..db531a71c7447e8b42f4d3f2913d9172c8ed34e9 100644 (file)
@@ -22,6 +22,6 @@
 
 #include "check.h"
 
-int cli_check(struct pakfire* pakfire, int argc, char* argv[]) {
-       return pakfire_check(pakfire, 0);
+int cli_check(pakfire_root* root, int argc, char* argv[]) {
+       return pakfire_root_check(root, 0);
 }
index 81dfd013e4944bbfb8bda9ee6fa38293e4106baf..8b03ad2b7a80b83921afa57a88c5516d8e3e97d1 100644 (file)
@@ -23,6 +23,6 @@
 
 #include <pakfire/pakfire.h>
 
-int cli_check(struct pakfire* pakfire, int argc, char* argv[]);
+int cli_check(pakfire_root* root, int argc, char* argv[]);
 
 #endif /* PAKFIRE_CLI_CHECK_H */
index f95d33fdd35a31ec9d67a21824c1ab2cd81c4880..3a0e9f9cf6b95b362ddd2a35f37ea08fdcd2a282 100644 (file)
@@ -29,7 +29,7 @@ static const char* doc = "Removes any temporary files required or left over by"
 
 int cli_clean(void* data, int argc, char* argv[]) {
        struct cli_global_args* global_args = data;
-       struct pakfire* pakfire = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -37,17 +37,17 @@ int cli_clean(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
        // Clean!
-       r = pakfire_clean(pakfire, 0);
+       r = pakfire_root_clean(root, 0);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 9d95e9ddb4f6da5ec2773c4edb1ca57775e06a1b..cc6a19907b38c0c95c2dde528ad82d01b019c6c9 100644 (file)
@@ -60,14 +60,14 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int do_dist(struct pakfire* pakfire, const char* makefile, const char* resultdir) {
+static int do_dist(pakfire_root* root, const char* makefile, const char* resultdir) {
        pakfire_archive* archive = NULL;
        const char* filename = NULL;
        char path[PATH_MAX];
        int r;
 
        // Create the archive
-       r = pakfire_dist(pakfire, makefile, &archive);
+       r = pakfire_dist(root, makefile, &archive);
        if (r < 0)
                goto ERROR;
 
@@ -99,7 +99,7 @@ ERROR:
 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;
+       pakfire_root* root = NULL;
        char cwd[PATH_MAX];
        int r;
 
@@ -112,14 +112,14 @@ int cli_dist(void* data, int argc, char* argv[]) {
        if (!local_args.resultdir)
                local_args.resultdir = getcwd(cwd, sizeof(cwd));
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
        // Process all packages
        for (unsigned int i = 0; i < local_args.num_makefiles; i++) {
-               r = do_dist(pakfire, local_args.makefiles[i], local_args.resultdir);
+               r = do_dist(root, local_args.makefiles[i], local_args.resultdir);
                if (r < 0) {
                        fprintf(stderr, "Could not dist %s: %s\n", local_args.makefiles[i], strerror(-r));
                        goto ERROR;
@@ -127,8 +127,8 @@ int cli_dist(void* data, int argc, char* argv[]) {
        }
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 8ab48d7f46ff077af487e0afeddc02fbf2fe907e..79fbb6f24771007ee8f5546764cd2bad457ed851 100644 (file)
@@ -68,7 +68,7 @@ int cli_image_create(void* data, int argc, char* argv[]) {
        struct cli_global_args* global_args = data;
        struct cli_local_args local_args = {};
        pakfire_build* build = NULL;
-       struct pakfire* pakfire = NULL;
+       pakfire_root* root = NULL;
        FILE* f = NULL;
        int r;
 
@@ -86,18 +86,18 @@ int cli_image_create(void* data, int argc, char* argv[]) {
 
        // Handle OCI images separately
        if (pakfire_string_equals(local_args.type, "oci")) {
-               // Setup Pakfire
-               r = cli_setup_pakfire(&pakfire, global_args);
+               // Setup root
+               r = cli_setup_root(&root, global_args);
                if (r < 0)
                        goto ERROR;
 
                // Install everything
-               r = pakfire_install(pakfire, packages);
+               r = pakfire_root_install(root, packages);
                if (r < 0)
                        goto ERROR;
 
                // Create the image
-               r = pakfire_oci_mkimage(pakfire, f);
+               r = pakfire_oci_mkimage(root, f);
                if (r < 0)
                        goto ERROR;
 
@@ -117,8 +117,8 @@ int cli_image_create(void* data, int argc, char* argv[]) {
 ERROR:
        if (build)
                pakfire_build_unref(build);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
        if (f)
                fclose(f);
 
index 6d25aa82adeafacba69104be3d145c42fe0fbdc0..a100c0f2ff1aa0f331c573b54edbee3636b09145 100644 (file)
@@ -83,8 +83,8 @@ 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;
        pakfire_packagelist* list = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -92,8 +92,8 @@ int cli_info(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
@@ -104,7 +104,7 @@ int cli_info(void* data, int argc, char* argv[]) {
 
        // Perform search
        for (unsigned int i = 0; i < local_args.num_packages; i++) {
-               r = pakfire_search(pakfire, local_args.packages[i], PAKFIRE_SEARCH_NAME_ONLY, list);
+               r = pakfire_root_search(root, local_args.packages[i], PAKFIRE_ROOT_SEARCH_NAME_ONLY, list);
                if (r)
                        goto ERROR;
        }
@@ -115,8 +115,8 @@ int cli_info(void* data, int argc, char* argv[]) {
 ERROR:
        if (list)
                pakfire_packagelist_unref(list);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 285c515dd56e01938c5db5d937c78b477ec178fe..4ae5cb2e35b1166a07bed04dcc6e8a0187d3f057 100644 (file)
@@ -111,7 +111,7 @@ static int __cli_install(pakfire_transaction* transaction, int argc, char* argv[
 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -119,16 +119,16 @@ int cli_install(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, local_args.transaction_flags, __cli_install, &local_args);
+       r = cli_transaction(root, argc, argv, local_args.transaction_flags, __cli_install, &local_args);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index e2ed50e2f9641496e4cabe0960bc00091e1e1c6c..b4fce922fd865ad4bae660a928835fa2ddc0ce76 100644 (file)
@@ -85,12 +85,12 @@ static int cli_linter_result(pakfire_ctx* ctx, pakfire_archive* archive,
        return 0;
 }
 
-static int do_lint(struct pakfire* pakfire, const char* path) {
+static int do_lint(pakfire_root* root, const char* path) {
        pakfire_archive* archive = NULL;
        int r;
 
        // Open the archive
-       r = pakfire_archive_open(&archive, pakfire, path);
+       r = pakfire_archive_open(&archive, root, path);
        if (r < 0) {
                fprintf(stderr, "Could not open %s: %s\n", path, strerror(-r));
                goto ERROR;
@@ -113,7 +113,7 @@ 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -121,21 +121,21 @@ int cli_lint(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
        // Lint all archives
        for (unsigned int i = 0; i < local_args.num_archives; i++) {
-               r = do_lint(pakfire, local_args.archives[i]);
+               r = do_lint(root, local_args.archives[i]);
                if (r < 0)
                        goto ERROR;
        }
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index bd98bd2d72b2d4d78baf84005a62648682849a0d..2dac8f413ad70d2c42ff933059d2bf1d94444865 100644 (file)
 #include "config.h"
 #include "pakfire.h"
 
-static void cli_set_repo_enabled(struct pakfire* pakfire, const char* name, int enabled) {
+static void cli_set_repo_enabled(pakfire_root* root, const char* name, int enabled) {
        pakfire_repo* repo = NULL;
 
        // Find the repository
-       repo = pakfire_get_repo(pakfire, name);
+       repo = pakfire_root_get_repo(root, name);
 
        // Ignore if the repository could not be found
        if (!repo)
@@ -79,9 +79,9 @@ ERROR:
        return r;
 }
 
-int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args) {
+int cli_setup_root(pakfire_root** root, struct cli_global_args* args) {
        pakfire_config* config = NULL;
-       struct pakfire* p = NULL;
+       pakfire_root* p = NULL;
        int r;
 
        // Setup the configuration
@@ -89,8 +89,8 @@ int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args) {
        if (r < 0)
                goto ERROR;
 
-       // Initialize Pakfire
-       r = pakfire_create(&p, args->ctx, config, args->root, args->arch, args->flags);
+       // Initialize root
+       r = pakfire_root_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;
@@ -105,7 +105,7 @@ int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args) {
                cli_set_repo_enabled(p, args->disable_repos[i], 0);
 
        // Return pointer
-       *pakfire = p;
+       *root = p;
 
 ERROR:
        if (config)
index 24f4e9a7cdd1b959eea53a330a87934749593810..d642d94c2ce4f31dc0f88d92b157d78d3112c7ab 100644 (file)
@@ -47,7 +47,7 @@ struct cli_global_args {
 };
 
 int cli_setup_config(pakfire_config** config, struct cli_global_args* args);
-int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args);
+int cli_setup_root(pakfire_root** root, struct cli_global_args* args);
 int cli_setup_build(pakfire_build** build, struct cli_global_args* args, int flags);
 int cli_setup_client(pakfire_client** client, struct cli_global_args* args);
 int cli_run_client(struct cli_global_args* args, pakfire_client_ready_callback callback, void* data);
index cb654cb06c968aaa7197a655df632da84e7f0700..c1529c5bf7eb662fd0e4b84e8b1946d9fbdb9c14 100644 (file)
@@ -59,8 +59,8 @@ 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;
        pakfire_packagelist* list = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -68,8 +68,8 @@ int cli_provides(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
@@ -80,7 +80,7 @@ int cli_provides(void* data, int argc, char* argv[]) {
 
        // Perform search
        for (unsigned int i = 0; i < local_args.num_patterns; i++) {
-               r = pakfire_whatprovides(pakfire, local_args.patterns[i], 0, list);
+               r = pakfire_root_whatprovides(root, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
@@ -91,8 +91,8 @@ int cli_provides(void* data, int argc, char* argv[]) {
 ERROR:
        if (list)
                pakfire_packagelist_unref(list);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 8a3bef335b84279b3ac07ae5bcd5bae85774fb54..bae7d53754d0e4f97bc6bdb4473a7e4cec0d7e93 100644 (file)
@@ -91,7 +91,7 @@ static int __cli_remove(pakfire_transaction* transaction, int argc, char* argv[]
 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -99,16 +99,16 @@ int cli_remove(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, 0, __cli_remove, &local_args);
+       r = cli_transaction(root, argc, argv, 0, __cli_remove, &local_args);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index b39a5890c70cb7f376e48b5e0c5bd48c6459ea44..0af6e2bc5aa030468a7648685b72c0d735b95023 100644 (file)
@@ -104,7 +104,7 @@ static int cli_import_key(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;
+       pakfire_root* root = NULL;
        pakfire_key* key = NULL;
        int r;
 
@@ -113,8 +113,8 @@ int cli_repo_compose(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
@@ -126,13 +126,13 @@ int cli_repo_compose(void* data, int argc, char* argv[]) {
        }
 
        // Write the repository
-       r = pakfire_repo_compose(pakfire, local_args.path, key, (const char**)local_args.packages);
+       r = pakfire_repo_compose(root, local_args.path, key, (const char**)local_args.packages);
 
 ERROR:
        if (key)
                pakfire_key_unref(key);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 8298219440de5def9b36afe90bfc33f12f74f2b3..987a15838c199b03f53263aeacfba2ec8919b04d 100644 (file)
@@ -32,8 +32,8 @@ 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;
        pakfire_repolist* list = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -41,13 +41,13 @@ int cli_repolist(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
        // Fetch all repositories
-       list = pakfire_get_repos(pakfire);
+       list = pakfire_root_get_repos(root);
        if (!list) {
                r = -errno;
                goto ERROR;
@@ -59,8 +59,8 @@ int cli_repolist(void* data, int argc, char* argv[]) {
 ERROR:
        if (list)
                pakfire_repolist_unref(list);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 80aae265678c19f6251055f55c05d7d8b21111ae..d5554043e69c3ec3a0a0269e05a6894744775ca8 100644 (file)
@@ -59,8 +59,8 @@ 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;
        pakfire_packagelist* list = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -68,8 +68,8 @@ int cli_requires(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
@@ -80,7 +80,7 @@ int cli_requires(void* data, int argc, char* argv[]) {
 
        // Perform search
        for (unsigned int i = 0; i < local_args.num_patterns; i++) {
-               r = pakfire_whatrequires(pakfire, local_args.patterns[i], 0, list);
+               r = pakfire_root_whatrequires(root, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
@@ -91,8 +91,8 @@ int cli_requires(void* data, int argc, char* argv[]) {
 ERROR:
        if (list)
                pakfire_packagelist_unref(list);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 61aaf613676ac41b07433f84ccc3aa189e33d211..3ef77b9018f233e541ec39ae817e04bd97f2bcc2 100644 (file)
@@ -59,8 +59,8 @@ 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;
        pakfire_packagelist* list = NULL;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -68,8 +68,8 @@ int cli_search(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
@@ -80,7 +80,7 @@ int cli_search(void* data, int argc, char* argv[]) {
 
        // Perform search
        for (unsigned int i = 0; i < local_args.num_patterns; i++) {
-               r = pakfire_search(pakfire, local_args.patterns[i], 0, list);
+               r = pakfire_root_search(root, local_args.patterns[i], 0, list);
                if (r)
                        goto ERROR;
        }
@@ -91,8 +91,8 @@ int cli_search(void* data, int argc, char* argv[]) {
 ERROR:
        if (list)
                pakfire_packagelist_unref(list);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 78ad89ac883c105d7d70123d0dd534e9236761b9..d6cebb59c297120f65372f2f7983cfb45dee4e45 100644 (file)
@@ -30,7 +30,7 @@ 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -38,17 +38,17 @@ int cli_snapshot_update(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
        // Make a new snapshot
-       r = pakfire_update_snapshot(pakfire);
+       r = pakfire_root_update_snapshot(root);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 3703dc56b46f05cd755777528a50d51d412ecff8..bf3a1ebd410781cbe3c1ceb05a9628700f224540 100644 (file)
@@ -76,7 +76,7 @@ static int __cli_sync(pakfire_transaction* transaction, int argc, char* argv[],
 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -84,16 +84,16 @@ int cli_sync(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, 0, __cli_sync, &local_args);
+       r = cli_transaction(root, argc, argv, 0, __cli_sync, &local_args);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index d9bfd0b27beeb7f42359366cc39395a7669bc6c7..a940547211476ea026366c7583117615d0a85e1f 100644 (file)
@@ -85,7 +85,7 @@ int cli_term_is_interactive(void) {
        return isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) && isatty(STDERR_FILENO);
 }
 
-int cli_term_confirm(pakfire_ctx* ctx, struct pakfire* pakfire,
+int cli_term_confirm(pakfire_ctx* ctx, pakfire_root* root,
                void* data, const char* message, const char* question) {
        char* line = NULL;
        size_t length = 0;
@@ -140,7 +140,7 @@ END:
        return r;
 }
 
-int cli_term_confirm_yes(pakfire_ctx* ctx, struct pakfire* pakfire,
+int cli_term_confirm_yes(pakfire_ctx* ctx, pakfire_root* root,
                void* data, const char* message, const char* question) {
        return 0;
 }
@@ -256,7 +256,7 @@ static pakfire_solution* cli_term_find_solution(
        return selected_solution;
 }
 
-int cli_term_pick_solution(pakfire_ctx* ctx, struct pakfire* pakfire, void* data,
+int cli_term_pick_solution(pakfire_ctx* ctx, pakfire_root* root, void* data,
                pakfire_transaction* transaction) {
        pakfire_problem** problems = NULL;
        pakfire_solution* solution = NULL;
index 56ce1dc58f54dbfb1be0927202a2e5f3d462191f..6957a9c1a516f9bc952a0d4f24b10f2cf322887d 100644 (file)
@@ -29,12 +29,12 @@ int cli_term_get_dimensions(int* rows, int* cols);
 
 int cli_term_is_interactive(void);
 
-int cli_term_confirm(pakfire_ctx* ctx, struct pakfire* pakfire,
+int cli_term_confirm(pakfire_ctx* ctx, pakfire_root* root,
        void* data, const char* message, const char* question);
-int cli_term_confirm_yes(pakfire_ctx* ctx, struct pakfire* pakfire,
+int cli_term_confirm_yes(pakfire_ctx* ctx, pakfire_root* root,
        void* data, const char* message, const char* question);
 
-int cli_term_pick_solution(pakfire_ctx* ctx, struct pakfire* pakfire,
+int cli_term_pick_solution(pakfire_ctx* ctx, pakfire_root* root,
        void* data, pakfire_transaction* transaction);
 
 #endif /* PAKFIRE_CLI_TERMINAL_H */
index ab5fa7bebda51b3303061ce6f7e73f8f2649a9f2..47200bfe726cee452fee9c170f4d817a1c396725 100644 (file)
 
        The transaction is then solved and executed.
 */
-int cli_transaction(struct pakfire* pakfire, int argc, char* argv[], int flags,
+int cli_transaction(pakfire_root* root, int argc, char* argv[], int flags,
                cli_transaction_callback callback, void* data) {
        pakfire_transaction* transaction = NULL;
        char* problems = NULL;
        int r;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, pakfire, flags);
+       r = pakfire_transaction_create(&transaction, root, flags);
        if (r) {
                fprintf(stderr, "Could not setup the transaction\n");
                goto ERROR;
index 6e57b9d6acf41b92fc27a8a84a6b89d27f247ca0..59f6fe2b36982ef6c0b08670d5a972c27494d1ae 100644 (file)
@@ -27,7 +27,7 @@
 typedef int (*cli_transaction_callback)
        (pakfire_transaction* transaction, int argc, char* argv[], void* data);
 
-int cli_transaction(struct pakfire* pakfire, int argc, char* argv[], int flags,
+int cli_transaction(pakfire_root* root, int argc, char* argv[], int flags,
        cli_transaction_callback callback, void* data);
 
 #endif /* PAKFIRE_CLI_TRANSACTION_H */
index 2b23565ef4b9196b0bb9ba6e19ee27489b8e9ab7..9b7e3ceadbe0d186bbf0dbc4c4ac6a4e97e2cf96 100644 (file)
@@ -127,7 +127,7 @@ static int __cli_update(pakfire_transaction* transaction, int argc, char* argv[]
 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;
+       pakfire_root* root = NULL;
        int r;
 
        // Parse the command line
@@ -135,16 +135,16 @@ int cli_update(void* data, int argc, char* argv[]) {
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = cli_setup_pakfire(&pakfire, global_args);
+       // Setup root
+       r = cli_setup_root(&root, global_args);
        if (r)
                goto ERROR;
 
-       r = cli_transaction(pakfire, argc, argv, local_args.transaction_flags, __cli_update, &local_args);
+       r = cli_transaction(root, argc, argv, local_args.transaction_flags, __cli_update, &local_args);
 
 ERROR:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
index 199f3b2d91dfaea3e5b43ed07bf27028bcc14231..9691e1ae87e28aeafe77a432ec8a45a448f7d0de 100644 (file)
@@ -144,7 +144,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int cli_confirm(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int cli_confirm(pakfire_ctx* ctx, pakfire_root* root,
                void* data, const char* message, const char* question) {
        // Just print the message
        if (message)
@@ -180,7 +180,7 @@ int main(int argc, char* argv[]) {
                .ctx      = ctx,
                .distro   = cli_get_default_distro(ctx),
                .arch     = NULL,
-               .flags    = PAKFIRE_FLAGS_BUILD,
+               .flags    = PAKFIRE_ROOT_FLAGS_BUILD,
        };
 
        // Parse the command line and run any commands
index 3eaeb234367e0a3e80748ab64080090478207dae..ccef485fa66acd106f39460d156241124ae883bb 100644 (file)
@@ -67,7 +67,7 @@
 
 struct pakfire_archive {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        char path[PATH_MAX];
@@ -428,8 +428,8 @@ static void pakfire_archive_free(pakfire_archive* archive) {
                pakfire_package_unref(archive->package);
        if (archive->metadata)
                json_object_put(archive->metadata);
-       if (archive->pakfire)
-               pakfire_unref(archive->pakfire);
+       if (archive->root)
+               pakfire_root_unref(archive->root);
        if (archive->ctx)
                pakfire_ctx_unref(archive->ctx);
        free(archive);
@@ -694,8 +694,7 @@ static int pakfire_archive_read_metadata(pakfire_archive* archive) {
        return 0;
 }
 
-int pakfire_archive_open(pakfire_archive** archive,
-               struct pakfire* pakfire, const char* path) {
+int pakfire_archive_open(pakfire_archive** archive, pakfire_root* root, const char* path) {
        pakfire_archive* a = NULL;
        int r;
 
@@ -705,10 +704,10 @@ int pakfire_archive_open(pakfire_archive** archive,
                return -errno;
 
        // Store a reference to the context
-       a->ctx = pakfire_get_ctx(pakfire);
+       a->ctx = pakfire_root_get_ctx(root);
 
        // Store a reference to pakfire
-       a->pakfire = pakfire_ref(pakfire);
+       a->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        a->nrefs = 1;
@@ -1210,7 +1209,7 @@ static int pakfire_archive_extract_one(pakfire_archive* archive,
        }
 
        // Generate a file object
-       r = pakfire_file_create_from_archive_entry(&file, archive->pakfire, entry);
+       r = pakfire_file_create_from_archive_entry(&file, archive->root, entry);
        if (r < 0)
                goto ERROR;
 
@@ -1332,7 +1331,7 @@ static int __pakfire_archive_extract(pakfire_archive* archive,
                goto ERROR;
 
        // Setup the writer
-       writer = pakfire_get_disk_writer(archive->pakfire);
+       writer = pakfire_root_get_disk_writer(archive->root);
        if (!writer) {
                r = -errno;
                goto ERROR;
@@ -1360,13 +1359,13 @@ static int __pakfire_archive_extract(pakfire_archive* archive,
 
        // Set prefix for source packages
        } else if (pakfire_package_is_source(pkg)) {
-               r = pakfire_path(archive->pakfire, prefix, "/usr/src/packages/%s", nevra);
+               r = pakfire_root_path(archive->root, prefix, "/usr/src/packages/%s", nevra);
                if (r < 0)
                        goto ERROR;
 
        // Otherwise extract relative to the pakfire root
        } else {
-               r = pakfire_path(archive->pakfire, prefix, "%s", "/");
+               r = pakfire_root_path(archive->root, prefix, "%s", "/");
                if (r < 0)
                        goto ERROR;
        }
@@ -1446,7 +1445,7 @@ static int __pakfire_archive_load_filelist(pakfire_archive* archive,
        int r;
 
        // Generate a file object
-       r = pakfire_file_create_from_archive_entry(&file, archive->pakfire, entry);
+       r = pakfire_file_create_from_archive_entry(&file, archive->root, entry);
        if (r < 0)
                goto ERROR;
 
@@ -1467,7 +1466,7 @@ static int pakfire_archive_load_filelist(pakfire_archive* self) {
        int r;
 
        // Create a new filelist
-       r = pakfire_filelist_create(&filelist, self->pakfire);
+       r = pakfire_filelist_create(&filelist, self->root);
        if (r < 0)
                goto ERROR;
 
@@ -1598,7 +1597,7 @@ static int pakfire_archive_make_package_from_json(pakfire_archive* archive,
        const char* arch = pakfire_archive_metadata_get(archive, "arch", NULL);
 
        // Create a new package object
-       r = pakfire_package_create(&pkg, archive->pakfire, repo, name, evr, arch);
+       r = pakfire_package_create(&pkg, archive->root, repo, name, evr, arch);
        if (r)
                return r;
 
@@ -1875,7 +1874,7 @@ int pakfire_archive_make_package(pakfire_archive* archive,
 
        // Use dummy repo if no repository was passed
        if (!repo) {
-               dummy = pakfire_get_repo(archive->pakfire, PAKFIRE_REPO_DUMMY);
+               dummy = pakfire_root_get_repo(archive->root, PAKFIRE_REPO_DUMMY);
                if (!dummy)
                        return 1;
 
@@ -1959,7 +1958,7 @@ static int pakfire_archive_handle_systemd_sysusers(pakfire_archive* archive,
        };
 
        // Create a new jail
-       r = pakfire_jail_create(&jail, archive->pakfire);
+       r = pakfire_jail_create(&jail, archive->root);
        if (r)
                goto ERROR;
 
@@ -1987,7 +1986,7 @@ int pakfire_archive_lint(pakfire_archive* archive,
        int r;
 
        // Create a new linter
-       r = pakfire_linter_create(&linter, archive->pakfire, archive);
+       r = pakfire_linter_create(&linter, archive->root, archive);
        if (r < 0)
                goto ERROR;
 
index 17decc218083abcbffab432c1c9ccf59b732a0dd..694a4be91dce489ab01c3262711b60e33c2b1edd 100644 (file)
@@ -36,7 +36,7 @@ typedef struct pakfire_archive pakfire_archive;
 #include <pakfire/repo.h>
 #include <pakfire/scriptlet.h>
 
-int pakfire_archive_open(pakfire_archive** archive, struct pakfire* pakfire, const char* path);
+int pakfire_archive_open(pakfire_archive** archive, pakfire_root* root, const char* path);
 pakfire_archive* pakfire_archive_ref(pakfire_archive* archive);
 pakfire_archive* pakfire_archive_unref(pakfire_archive* archive);
 
index a9685d19b361aa6425956021989ed77b22635a2f..428ef6320e4b296b9d8e3af919c7554105a67372 100644 (file)
@@ -41,8 +41,8 @@ struct pakfire_archive_writer {
        pakfire_ctx* ctx;
        int nrefs;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 
        // Time Created
        time_t time_created;
@@ -264,15 +264,15 @@ static void pakfire_archive_writer_free(pakfire_archive_writer* self) {
                pakfire_progress_unref(self->progress);
        if (self->archive)
                archive_write_free(self->archive);
-       if (self->pakfire)
-               pakfire_unref(self->pakfire);
+       if (self->root)
+               pakfire_root_unref(self->root);
        if (self->ctx)
                pakfire_ctx_unref(self->ctx);
        free(self);
 }
 
 int pakfire_archive_writer_create(pakfire_archive_writer** writer,
-               struct pakfire* pakfire, pakfire_archive_writer_format format, FILE* f) {
+               pakfire_root* root, pakfire_archive_writer_format format, FILE* f) {
        pakfire_archive_writer* self = NULL;
        int r;
 
@@ -282,10 +282,10 @@ int pakfire_archive_writer_create(pakfire_archive_writer** writer,
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        self->nrefs = 1;
@@ -556,7 +556,7 @@ int pakfire_archive_writer_write_everything(
        int r;
 
        // Create a new filelist
-       r = pakfire_filelist_create(&files, self->pakfire);
+       r = pakfire_filelist_create(&files, self->root);
        if (r < 0)
                goto ERROR;
 
index 8d25c25a84f2aa6986448cb0c0ca174eb4187e2e..29f17153b26893148ac4bcea1d53bcce8d09011a 100644 (file)
@@ -41,7 +41,7 @@ typedef enum pakfire_archive_writer_formats {
 } pakfire_archive_writer_format;
 
 int pakfire_archive_writer_create(pakfire_archive_writer** writer,
-               struct pakfire* pakfire, pakfire_archive_writer_format format, FILE* f);
+               pakfire_root* root, pakfire_archive_writer_format format, FILE* f);
 
 pakfire_archive_writer* pakfire_archive_writer_ref(pakfire_archive_writer* self);
 pakfire_archive_writer* pakfire_archive_writer_unref(pakfire_archive_writer* self);
index 6477b92404e88b97177417f648d8fa5cdd66119f..20c5f0c86d71d47015558a72a88f02f71028bb34 100644 (file)
@@ -68,7 +68,7 @@ static const char* PAKFIRE_BUILD_PACKAGES[] = {
 
 struct pakfire_build {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        // Flags
@@ -167,8 +167,7 @@ static int pakfire_build_output_callback(pakfire_ctx* ctx, void* data,
        return 0;
 }
 
-static int __pakfire_build_setup_repo(struct pakfire* pakfire,
-               pakfire_repo* repo, void* p) {
+static int __pakfire_build_setup_repo(pakfire_root* root, pakfire_repo* repo, void* p) {
        char path[PATH_MAX];
        FILE* f = NULL;
        int r;
@@ -188,7 +187,7 @@ static int __pakfire_build_setup_repo(struct pakfire* pakfire,
        DEBUG(build->ctx, "Exporting repository configuration for '%s'\n", name);
 
        // Make path for configuration file
-       r = pakfire_path(build->pakfire, path, PAKFIRE_CONFIG_DIR "/repos/%s.repo", name);
+       r = pakfire_root_path(root, path, PAKFIRE_CONFIG_DIR "/repos/%s.repo", name);
        if (r) {
                ERROR(build->ctx, "Could not make repository configuration path for %s: %m\n", name);
                goto ERROR;
@@ -240,7 +239,7 @@ ERROR:
        a pakfire instance running inside the chroot.
 */
 static int pakfire_build_enable_repos(pakfire_build* build) {
-       return pakfire_repo_walk(build->pakfire, __pakfire_build_setup_repo, build);
+       return pakfire_root_repo_walk(build->root, __pakfire_build_setup_repo, build);
 }
 
 static int pakfire_build_read_script(pakfire_build* build,
@@ -810,7 +809,7 @@ static int pakfire_build_find_perl_deps(pakfire_build* build,
                return 0;
 
        // Create a new filelist
-       r = pakfire_filelist_create(&perlfiles, build->pakfire);
+       r = pakfire_filelist_create(&perlfiles, build->root);
        if (r < 0)
                goto ERROR;
 
@@ -971,7 +970,7 @@ static int pakfire_build_package_add_files(pakfire_build* build,
                goto ERROR;
 
        // Allocate a new filelist
-       r = pakfire_filelist_create(&filelist, build->pakfire);
+       r = pakfire_filelist_create(&filelist, build->root);
        if (r)
                goto ERROR;
 
@@ -1088,7 +1087,7 @@ static int pakfire_build_process_scriptlet_dep(pakfire_ctx* ctx, void* data,
 
                        // Otherwise, we will have to resolve the command
                        } else {
-                               r = pakfire_which(deps->build->pakfire, path, command);
+                               r = pakfire_which(deps->build->root, path, command);
                                if (r < 0)
                                        return r;
 
@@ -1230,7 +1229,7 @@ static int pakfire_build_package(pakfire_build* build, pakfire_parser* makefile,
        DEBUG(build->ctx, "  buildroot = %s\n", buildroot);
 
        // Fetch build architecture
-       const char* arch = pakfire_get_arch(build->pakfire);
+       const char* arch = pakfire_root_get_arch(build->root);
        if (!arch)
                goto ERROR;
 
@@ -1274,7 +1273,7 @@ static int pakfire_build_package(pakfire_build* build, pakfire_parser* makefile,
                goto ERROR;
 
        // Create a packager
-       r = pakfire_packager_create(&packager, build->pakfire, pkg);
+       r = pakfire_packager_create(&packager, build->root, pkg);
        if (r)
                goto ERROR;
 
@@ -1458,7 +1457,7 @@ static int pakfire_build_post_process_files(pakfire_build* build,
        int r;
 
        // Create a filelist with objects that need to be removed
-       r = pakfire_filelist_create(&removees, build->pakfire);
+       r = pakfire_filelist_create(&removees, build->root);
        if (r)
                goto ERROR;
 
@@ -1651,7 +1650,7 @@ static int pakfire_build_run_post_build_checks(pakfire_build* build) {
        int r;
 
        // Create a filelist of all files in the build
-       r = pakfire_filelist_create(&filelist, build->pakfire);
+       r = pakfire_filelist_create(&filelist, build->root);
        if (r) {
                ERROR(build->ctx, "Could not create filelist: %m\n");
                goto ERROR;
@@ -1731,7 +1730,7 @@ static int pakfire_build_strip(pakfire_build* build) {
        int r;
 
        // Create a new stripper
-       r = pakfire_stripper_create(&stripper, build->pakfire, build->jail, build->buildroot);
+       r = pakfire_stripper_create(&stripper, build->root, build->jail, build->buildroot);
        if (r < 0)
                goto ERROR;
 
@@ -1770,8 +1769,8 @@ static void pakfire_build_free(pakfire_build* build) {
        if (*build->buildroot)
                pakfire_rmtree(build->buildroot, 0);
 
-       if (build->pakfire)
-               pakfire_unref(build->pakfire);
+       if (build->root)
+               pakfire_root_unref(build->root);
        if (build->ctx)
                pakfire_ctx_unref(build->ctx);
        free(build);
@@ -1836,7 +1835,7 @@ static int pakfire_build_setup_cgroup(pakfire_build* build) {
        }
 
        // Fetch config
-       config = pakfire_get_config(build->pakfire);
+       config = pakfire_root_get_config(build->root);
        if (!config)
                goto ERROR;
 
@@ -1904,7 +1903,7 @@ static int pakfire_build_setup_jail(pakfire_build* build) {
        int r;
 
        // Create a new jail
-       r = pakfire_jail_create(&build->jail, build->pakfire);
+       r = pakfire_jail_create(&build->jail, build->root);
        if (r) {
                ERROR(build->ctx, "Could not create jail for build %s: %m\n", build->_id);
                return r;
@@ -1970,7 +1969,7 @@ static int pakfire_build_setup_ccache(pakfire_build* build) {
        }
 
        // Set a default path
-       r = pakfire_cache_path(build->pakfire, build->ccache_path, "%s", "ccache");
+       r = pakfire_root_cache_path(build->root, build->ccache_path, "%s", "ccache");
        if (r)
                return r;
 
@@ -1999,7 +1998,7 @@ static int pakfire_build_setup_repo(pakfire_build* build) {
        int r;
 
        // Create a new repository
-       r = pakfire_repo_create(&build->repo, build->pakfire, PAKFIRE_REPO_RESULT);
+       r = pakfire_repo_create(&build->repo, build->root, PAKFIRE_REPO_RESULT);
        if (r) {
                ERROR(build->ctx, "Could not create repository %s: %m", PAKFIRE_REPO_RESULT);
                return r;
@@ -2037,21 +2036,21 @@ static int pakfire_build_set_time_start(pakfire_build* build) {
        return r;
 }
 
-static int pakfire_build_setup_pakfire(
+static int pakfire_build_setup_root(
                pakfire_build* build, pakfire_config* config, const char* arch) {
-       int flags = PAKFIRE_FLAGS_BUILD;
+       int flags = PAKFIRE_ROOT_FLAGS_BUILD;
        int r;
 
        // Is this a local build?
        if (build->flags & PAKFIRE_BUILD_LOCAL)
-               flags |= PAKFIRE_FLAGS_BUILD_LOCAL | PAKFIRE_USE_TMPFS;
+               flags |= PAKFIRE_ROOT_FLAGS_BUILD_LOCAL | PAKFIRE_ROOT_USE_TMPFS;
 
        // Enable snapshot?
        if (build->flags & PAKFIRE_BUILD_ENABLE_SNAPSHOT)
-               flags |= PAKFIRE_USE_SNAPSHOT;
+               flags |= PAKFIRE_ROOT_USE_SNAPSHOT;
 
-       // Create a new Pakfire instance
-       r = pakfire_create(&build->pakfire, build->ctx, config, NULL, arch, flags);
+       // Create a new root
+       r = pakfire_root_create(&build->root, build->ctx, config, NULL, arch, flags);
        if (r < 0)
                return r;
 
@@ -2118,8 +2117,8 @@ int pakfire_build_create(pakfire_build** build, pakfire_ctx* ctx,
        if (r)
                goto ERROR;
 
-       // Setup Pakfire
-       r = pakfire_build_setup_pakfire(b, config, arch);
+       // Setup root
+       r = pakfire_build_setup_root(b, config, arch);
        if (r < 0)
                goto ERROR;
 
@@ -2200,12 +2199,12 @@ static int pakfire_build_read_makefile(pakfire_build* build,
        const char* name  = pakfire_package_get_string(package, PAKFIRE_PKG_NAME);
 
        // Compose path to makefile
-       r = pakfire_path(build->pakfire, path, "/usr/src/packages/%s/%s.nm", nevra, name);
+       r = pakfire_root_path(build->root, path, "/usr/src/packages/%s/%s.nm", nevra, name);
        if (r < 0)
                return 1;
 
        // Read makefile
-       r = pakfire_read_makefile(parser, build->pakfire, path, &error);
+       r = pakfire_read_makefile(parser, build->root, path, &error);
        if (r) {
                if (error) {
                        ERROR(build->ctx, "Could not parse makefile %s: %s\n", path,
@@ -2307,7 +2306,7 @@ static int pakfire_build_check_unpackaged_files(pakfire_build* build) {
        int r;
 
        // Create a new filelist
-       r = pakfire_filelist_create(&filelist, build->pakfire);
+       r = pakfire_filelist_create(&filelist, build->root);
        if (r)
                goto ERROR;
 
@@ -2348,7 +2347,7 @@ static int pakfire_build_install_test(pakfire_build* build) {
        int r;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, build->pakfire,
+       r = pakfire_transaction_create(&transaction, build->root,
                        PAKFIRE_TRANSACTION_ALLOW_UNINSTALL);
        if (r < 0)
                goto ERROR;
@@ -2408,7 +2407,7 @@ static int pakfire_build_init(pakfire_build* build,
        int r;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, build->pakfire,
+       r = pakfire_transaction_create(&transaction, build->root,
                        PAKFIRE_TRANSACTION_ALLOW_DOWNGRADE|PAKFIRE_TRANSACTION_ALLOW_UNINSTALL);
        if (r)
                goto ERROR;
@@ -2500,7 +2499,7 @@ static int __pakfire_build_result(pakfire_ctx* ctx, pakfire_package* pkg,
        int r;
 
        // Call the callback
-       r = result->callback(ctx, build->pakfire, build, archive, result->data);
+       r = result->callback(ctx, build->root, build, archive, result->data);
        if (r) {
                ERROR(ctx, "Result callback returned %d\n", r);
                return r;
@@ -2518,10 +2517,10 @@ int pakfire_build_exec(pakfire_build* build, const char* path,
        int r;
 
        // Fetch architecture
-       const char* arch = pakfire_get_arch(build->pakfire);
+       const char* arch = pakfire_root_get_arch(build->root);
 
        // Open the source package
-       r = pakfire_commandline_add(build->pakfire, path, &package);
+       r = pakfire_root_commandline_add(build->root, path, &package);
        if (r)
                goto ERROR;
 
@@ -2629,7 +2628,7 @@ static int pakfire_build_mkimage_install_deps(pakfire_build* build,
                goto ERROR;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, build->pakfire, 0);
+       r = pakfire_transaction_create(&transaction, build->root, 0);
        if (r) {
                ERROR(build->ctx, "Could not create transaction: %m\n");
                goto ERROR;
@@ -2671,7 +2670,7 @@ static int pakfire_build_collect_packages(pakfire_build* build, const char* path
        int r;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, build->pakfire, 0);
+       r = pakfire_transaction_create(&transaction, build->root, 0);
        if (r) {
                ERROR(build->ctx, "Could not create transaction: %m\n");
                goto ERROR;
@@ -2751,9 +2750,8 @@ int pakfire_build_mkimage(pakfire_build* build,
                return -EINVAL;
 
        // Create a path inside the build environment
-       r = pakfire_path(build->pakfire, path, "%s",
-               PAKFIRE_TMP_DIR "/pakfire-image.XXXXXX");
-       if (r)
+       r = pakfire_root_path(build->root, path, "%s", PAKFIRE_TMP_DIR "/pakfire-image.XXXXXX");
+       if (r < 0)
                goto ERROR;
 
        // Allocate a temporary file
@@ -2765,8 +2763,7 @@ int pakfire_build_mkimage(pakfire_build* build,
        }
 
        // Create a path for all packages
-       r = pakfire_path(build->pakfire, packagesdir, "%s",
-               PAKFIRE_TMP_DIR "/pakfire-packages.XXXXXX");
+       r = pakfire_root_path(build->root, packagesdir, "%s", PAKFIRE_TMP_DIR "/pakfire-packages.XXXXXX");
        if (r)
                goto ERROR;
 
@@ -2791,8 +2788,8 @@ int pakfire_build_mkimage(pakfire_build* build,
 
        const char* args[] = {
                type,
-               pakfire_relpath(build->pakfire, path),
-               pakfire_relpath(build->pakfire, packagesdir),
+               pakfire_root_relpath(build->root, path),
+               pakfire_root_relpath(build->root, packagesdir),
                NULL,
        };
 
@@ -2820,14 +2817,14 @@ ERROR:
        return r;
 }
 
-int pakfire_build_clean(struct pakfire* pakfire, int flags) {
+int pakfire_build_clean(pakfire_root* root, int flags) {
        pakfire_repo* local = NULL;
        int r = 0;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Fetch local repository
-       local = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
+       local = pakfire_root_get_repo(root, PAKFIRE_REPO_LOCAL);
        if (!local) {
                ERROR(ctx, "Could not find repository %s: %m\n", PAKFIRE_REPO_LOCAL);
                goto ERROR;
index 03f17126a178f427eb7f7fc62cbcc317a7d5aa2e..fdeca1d12bfe3a9c6bda2fa6d0cc8eb9ba5407ef 100644 (file)
@@ -35,7 +35,7 @@ enum pakfire_build_flags {
        PAKFIRE_BUILD_LOCAL            = (1 << 4),
 };
 
-typedef int (*pakfire_build_result_callback)(pakfire_ctx* ctx, struct pakfire* pakfire,
+typedef int (*pakfire_build_result_callback)(pakfire_ctx* ctx, pakfire_root* root,
        pakfire_build* build, pakfire_archive* archive, void* data);
 
 int pakfire_build_create(pakfire_build** build, pakfire_ctx* ctx,
@@ -54,6 +54,6 @@ int pakfire_build_exec(pakfire_build* build, const char* path,
 int pakfire_build_mkimage(pakfire_build* build,
        const char* type, FILE* f);
 
-int pakfire_build_clean(struct pakfire* pakfire, int flags);
+int pakfire_build_clean(pakfire_root* root, int flags);
 
 #endif /* PAKFIRE_BUILD_H */
index e6681d1cfa580bc400ccb83e122d3883ff10a1c9..ab039fc1d7fcabbfe86fdee7b4546bb7567f72f2 100644 (file)
@@ -145,7 +145,7 @@ static int pakfire_ctx_setup_logging(pakfire_ctx* self) {
 }
 
 static int pakfire_ctx_default_confirm_callback(pakfire_ctx* self,
-               struct pakfire* pakfire, void* data, const char* message, const char* question) {
+               pakfire_root* root, void* data, const char* message, const char* question) {
        // Just log the message
        INFO(self, "%s\n", message);
 
@@ -345,13 +345,13 @@ void pakfire_ctx_set_confirm_callback(pakfire_ctx* self,
        self->confirm.data     = data;
 }
 
-int pakfire_ctx_confirm(pakfire_ctx* self, struct pakfire* pakfire,
+int pakfire_ctx_confirm(pakfire_ctx* self, pakfire_root* root,
                const char* message, const char* question) {
        // Run callback
        if (!self->confirm.callback)
                return 0;
 
-       return self->confirm.callback(self, pakfire, self->confirm.data, message, question);
+       return self->confirm.callback(self, root, self->confirm.data, message, question);
 }
 
 // Progress
@@ -377,12 +377,12 @@ void pakfire_ctx_set_pick_solution_callback(pakfire_ctx* self,
        self->pick_solution.data     = data;
 }
 
-int pakfire_ctx_pick_solution(pakfire_ctx* self, struct pakfire* pakfire,
+int pakfire_ctx_pick_solution(pakfire_ctx* self, pakfire_root* root,
                pakfire_transaction* transaction) {
        if (!self->pick_solution.callback)
                return 1;
 
-       return self->pick_solution.callback(self, pakfire, self->pick_solution.data, transaction);
+       return self->pick_solution.callback(self, root, self->pick_solution.data, transaction);
 }
 
 // Event Loop
index e4c9b71087aaf758e3dab58d486073932b830a4b..161f1e0f055ce577145f1dd3007682a3fef50e13 100644 (file)
@@ -64,7 +64,7 @@ int pakfire_ctx_set_cache_path(pakfire_ctx* self, const char* path);
 
 // Confirm
 
-typedef int (*pakfire_confirm_callback)(pakfire_ctx* self, struct pakfire* pakfire,
+typedef int (*pakfire_confirm_callback)(pakfire_ctx* self, pakfire_root* root,
        void* data, const char* message, const char* question);
 
 void pakfire_ctx_set_confirm_callback(pakfire_ctx* self,
@@ -81,7 +81,7 @@ void pakfire_ctx_set_progress_callback(pakfire_ctx* self,
 // Pick Solution
 
 typedef int (*pakfire_pick_solution_callback)(pakfire_ctx* self,
-       struct pakfire* pakfire, void* data, pakfire_transaction* transaction);
+       pakfire_root* root, void* data, pakfire_transaction* transaction);
 
 void pakfire_ctx_set_pick_solution_callback(pakfire_ctx* self,
        pakfire_pick_solution_callback callback, void* data);
@@ -96,7 +96,7 @@ void pakfire_ctx_log(pakfire_ctx* self, int level, const char* file, int line,
 
 // Confirm
 
-int pakfire_ctx_confirm(pakfire_ctx* self, struct pakfire* pakfire,
+int pakfire_ctx_confirm(pakfire_ctx* self, pakfire_root* root,
        const char* message, const char* question);
 
 // Progress
@@ -105,7 +105,7 @@ int pakfire_ctx_setup_progress(pakfire_ctx* self, pakfire_progress* progress);
 
 // Pick Solution
 
-int pakfire_ctx_pick_solution(pakfire_ctx* self, struct pakfire* pakfire,
+int pakfire_ctx_pick_solution(pakfire_ctx* self, pakfire_root* root,
        pakfire_transaction* transaction);
 
 // Event Loop
index 361e4255e328ae2410f3df881046ecf393d4722d..8bcb90b8eb689004b463718752c0eb6dd55d3a62 100644 (file)
@@ -48,7 +48,7 @@
 
 struct pakfire_db {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        char path[PATH_MAX];
@@ -375,8 +375,8 @@ static void pakfire_db_free(pakfire_db* db) {
                }
        }
 
-       if (db->pakfire)
-               pakfire_unref(db->pakfire);
+       if (db->root)
+               pakfire_root_unref(db->root);
        if (db->ctx)
                pakfire_ctx_unref(db->ctx);
        free(db);
@@ -520,7 +520,7 @@ static int pakfire_db_create_schema(pakfire_db* db) {
        if (r)
                return 1;
 
-       const char* arch = pakfire_get_effective_arch(db->pakfire);
+       const char* arch = pakfire_root_get_effective_arch(db->root);
 
        // Set architecture
        r = pakfire_db_set_string(db, "arch", arch);
@@ -607,7 +607,7 @@ static int pakfire_db_check_arch(pakfire_db* db) {
        }
 
        // Fetch the running architecture
-       arch = pakfire_get_effective_arch(db->pakfire);
+       arch = pakfire_root_get_effective_arch(db->root);
        if (!arch) {
                r = -EINVAL;
                goto ERROR;
@@ -685,7 +685,7 @@ static int pakfire_db_setup(pakfire_db* db) {
        return 0;
 }
 
-int pakfire_db_open(pakfire_db** db, struct pakfire* pakfire, int flags) {
+int pakfire_db_open(pakfire_db** db, pakfire_root* root, int flags) {
        pakfire_db* self = NULL;
        int sqlite3_flags = 0;
        int r;
@@ -696,10 +696,10 @@ int pakfire_db_open(pakfire_db** db, struct pakfire* pakfire, int flags) {
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        self->nrefs = 1;
@@ -714,7 +714,7 @@ int pakfire_db_open(pakfire_db** db, struct pakfire* pakfire, int flags) {
        }
 
        // Make the filename
-       r = pakfire_path(self->pakfire, self->path, "%s", DATABASE_PATH);
+       r = pakfire_root_path(self->root, self->path, "%s", DATABASE_PATH);
        if (r < 0)
                goto ERROR;
 
@@ -907,8 +907,8 @@ ssize_t pakfire_db_packages(pakfire_db* db) {
        return packages;
 }
 
-static void pakfire_db_add_userinstalled(struct pakfire* pakfire, const char* name) {
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+static void pakfire_db_add_userinstalled(pakfire_root* root, const char* name) {
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        // Convert name to ID
        Id id = pool_str2id(pool, name, 1);
@@ -1852,7 +1852,7 @@ static int pakfire_db_load_package(pakfire_db* db, pakfire_repo* repo, sqlite3_s
        }
 
        // Create package
-       r = pakfire_package_create(&pkg, db->pakfire, repo, name, evr, arch);
+       r = pakfire_package_create(&pkg, db->root, repo, name, evr, arch);
        if (r) {
                ERROR(db->ctx, "Could not create package '%s-%s.%s': %m\n", name, evr, arch);
                goto ERROR;
@@ -1980,7 +1980,7 @@ static int pakfire_db_load_package(pakfire_db* db, pakfire_repo* repo, sqlite3_s
        // installed by user?
        int userinstalled = sqlite3_column_int(stmt, 18);
        if (userinstalled)
-               pakfire_db_add_userinstalled(db->pakfire, name);
+               pakfire_db_add_userinstalled(db->root, name);
 
        // Files
        const char* files = (const char*)sqlite3_column_text(stmt, 19);
@@ -2011,7 +2011,7 @@ static int pakfire_db_load_package(pakfire_db* db, pakfire_repo* repo, sqlite3_s
        for (const struct dependency* deps = dependencies; deps->field; deps++) {
                const char* relations = (const char*)sqlite3_column_text(stmt, deps->field);
                if (relations) {
-                       r = pakfire_str2deps(db->pakfire, pkg, deps->key, relations);
+                       r = pakfire_str2deps(db->root, pkg, deps->key, relations);
                        if (r)
                                goto ERROR;
                }
@@ -2231,7 +2231,7 @@ static int pakfire_db_load_file(pakfire_db* db, pakfire_filelist* filelist,
        }
 
        // Create a new file object
-       r = pakfire_file_create(&file, db->pakfire, path);
+       r = pakfire_file_create(&file, db->root, path);
        if (r < 0)
                goto ERROR;
 
@@ -2372,7 +2372,7 @@ int pakfire_db_filelist(pakfire_db* db, pakfire_filelist** filelist) {
        }
 
        // Create a new filelist
-       r = pakfire_filelist_create(&list, db->pakfire);
+       r = pakfire_filelist_create(&list, db->root);
        if (r)
                goto ERROR;
 
@@ -2434,7 +2434,7 @@ int pakfire_db_package_filelist(pakfire_db* db, pakfire_filelist** filelist,
        }
 
        // Create a new filelist
-       r = pakfire_filelist_create(&fl, db->pakfire);
+       r = pakfire_filelist_create(&fl, db->root);
        if (r) {
                ERROR(db->ctx, "Could not create filelist: %m\n");
                goto ERROR;
index 0c1de8a06c7fbe8fdbb500f20f4eca6ebaff4d79..31475f868f246a0231ccf0486fcf15178948642c 100644 (file)
@@ -36,7 +36,7 @@ enum {
        PAKFIRE_DB_READWRITE = (1 << 0),
 };
 
-int pakfire_db_open(pakfire_db** db, struct pakfire* pakfire, int flags);
+int pakfire_db_open(pakfire_db** db, pakfire_root* root, int flags);
 
 pakfire_db* pakfire_db_ref(pakfire_db* db);
 pakfire_db* pakfire_db_unref(pakfire_db* db);
index 40667794c8a80b65b83c499b51e34bad83760eae..352b79774cbbb127b4d373bf65a9a7dd3fbb00a2 100644 (file)
@@ -80,8 +80,8 @@ int pakfire_static_version_compare(const char* evr1, const char* evr2) {
        return pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE);
 }
 
-const char* pakfire_dep2str(struct pakfire* pakfire, Id id) {
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+const char* pakfire_dep2str(pakfire_root* root, Id id) {
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        return pool_dep2str(pool, id);
 }
@@ -136,13 +136,13 @@ END:
 /*
        This function parses any namespaced dependencies
 */
-static Id pakfire_parse_namespace(struct pakfire* pakfire, const char* s) {
+static Id pakfire_parse_namespace(pakfire_root* root, const char* s) {
        const char* p = strchr(s, '(');
        if (!p)
                return 0;
 
        // Fetch the pool
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        // Store the namespace ID
        Id namespace = pool_strn2id(pool, s, p - s, 1);
@@ -161,7 +161,7 @@ static Id pakfire_parse_namespace(struct pakfire* pakfire, const char* s) {
 /*
        This function parses a simple dependency like "foo = 1.2.3"
 */
-static Id pakfire_parse_dep(struct pakfire* pakfire, const char** s) {
+static Id pakfire_parse_dep(pakfire_root* root, const char** s) {
        Id id = ID_NULL;
 
        if (!s) {
@@ -177,7 +177,7 @@ static Id pakfire_parse_dep(struct pakfire* pakfire, const char** s) {
                return ID_NULL;
 
        // Fetch the pool
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        // Consume any leading space
        while (isspace(*p))
@@ -188,7 +188,7 @@ static Id pakfire_parse_dep(struct pakfire* pakfire, const char** s) {
 
        // Add name to pool
        if (pakfire_string_startswith(n, "pakfire(") || pakfire_string_startswith(n, "arch(")) {
-               id = pakfire_parse_namespace(pakfire, n);
+               id = pakfire_parse_namespace(root, n);
        } else {
                id = pool_strn2id(pool, n, l, 1);
        }
@@ -243,7 +243,7 @@ static Id pakfire_parse_dep(struct pakfire* pakfire, const char** s) {
 /*
        This function parses any rich dependencies
 */
-static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int flags) {
+static Id pakfire_parse_rich_dep(pakfire_root* root, const char** dep, int flags) {
        const char* p = *dep;
        Id id;
 
@@ -258,7 +258,7 @@ static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int
        switch (*p) {
                // A new rich dependency
                case '(':
-                       id = pakfire_parse_rich_dep(pakfire, &p, 0);
+                       id = pakfire_parse_rich_dep(root, &p, 0);
                        if (!id)
                                return id;
                        break;
@@ -269,7 +269,7 @@ static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int
 
                // Parse a regular dependency
                default:
-                       id = pakfire_parse_dep(pakfire, &p);
+                       id = pakfire_parse_dep(root, &p);
                        if (!id)
                                return id;
                        break;
@@ -302,14 +302,14 @@ static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int
                return ID_NULL;
 
        // Parse the next bit
-       Id evr = pakfire_parse_rich_dep(pakfire, &p, flags);
+       Id evr = pakfire_parse_rich_dep(root, &p, flags);
 
        // Abort if there was a problem
        if (!evr)
                return ID_NULL;
 
        // Fetch pool
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        // Store until where we have parsed the string
        *dep = p;
@@ -318,7 +318,7 @@ static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int
        return pool_rel2id(pool, id, evr, flags, 1);
 }
 
-Id pakfire_str2dep(struct pakfire* pakfire, const char* dep) {
+Id pakfire_str2dep(pakfire_root* root, const char* dep) {
        Id id = ID_NULL;
 
        // Invalid input
@@ -337,9 +337,9 @@ Id pakfire_str2dep(struct pakfire* pakfire, const char* dep) {
 
        // Parse any rich dependencies
        if (*s == '(')
-               id = pakfire_parse_rich_dep(pakfire, &s, 0);
+               id = pakfire_parse_rich_dep(root, &s, 0);
        else
-               id = pakfire_parse_dep(pakfire, &s);
+               id = pakfire_parse_dep(root, &s);
 
        // Return nothing if we could not parse the entire string
        if (id && *s)
@@ -348,7 +348,7 @@ Id pakfire_str2dep(struct pakfire* pakfire, const char* dep) {
        return id;
 }
 
-int pakfire_str2deps(struct pakfire* pakfire, pakfire_package* pkg,
+int pakfire_str2deps(pakfire_root* root, pakfire_package* pkg,
                const enum pakfire_package_key key, const char* deps) {
        char* p = NULL;
        int r = 0;
index d52b244bfcdf444aa88e319e00b108b8eb8cbb14..ffaf7c758d5fbb4807b1c14d7ba0fc8a7eb95718 100644 (file)
@@ -31,10 +31,10 @@ extern const struct pakfire_dep {
 
 int pakfire_static_version_compare(const char* evr1, const char* evr2);
 
-const char* pakfire_dep2str(struct pakfire* pakfire, Id id);
-Id pakfire_str2dep(struct pakfire* pakfire, const char* s);
+const char* pakfire_dep2str(pakfire_root* root, Id id);
+Id pakfire_str2dep(pakfire_root* root, const char* s);
 
-int pakfire_str2deps(struct pakfire* pakfire, pakfire_package* pkg,
+int pakfire_str2deps(pakfire_root* root, pakfire_package* pkg,
        const enum pakfire_package_key key, const char* deps);
 
 #endif /* PAKFIRE_DEPENDENCIES_H */
index 6ab714106508802072db0933b10474e3b7323604..bfbaf56171bbb8895405c59112e084b8e77b7d90 100644 (file)
@@ -56,7 +56,7 @@ static const char* pakfire_dist_excludes[] = {
        NULL,
 };
 
-static int pakfire_makefile_set_defaults(struct pakfire* pakfire,
+static int pakfire_makefile_set_defaults(pakfire_root* root,
                pakfire_parser* parser, const char* path) {
        char dirname[PATH_MAX];
        char buffer[1024];
@@ -72,7 +72,7 @@ static int pakfire_makefile_set_defaults(struct pakfire* pakfire,
        pakfire_parser_set(parser, NULL, "vendor", "%{DISTRO_VENDOR}", 0);
 
        // Set arch
-       const char* arch = pakfire_get_arch(pakfire);
+       const char* arch = pakfire_root_get_arch(root);
        if (arch) {
                r = pakfire_parser_set(parser, NULL, "arch", arch, 0);
                if (r)
@@ -80,32 +80,32 @@ static int pakfire_makefile_set_defaults(struct pakfire* pakfire,
        }
 
        // Set DISTRO_NAME
-       const char* name = pakfire_get_distro_name(pakfire);
+       const char* name = pakfire_root_get_distro_name(root);
        if (name)
                pakfire_parser_set(parser, NULL, "DISTRO_NAME", name, 0);
 
        // Set DISTRO_SNAME
-       const char* id = pakfire_get_distro_id(pakfire);
+       const char* id = pakfire_root_get_distro_id(root);
        if (id)
                pakfire_parser_set(parser, NULL, "DISTRO_SNAME", name, 0);
 
        // Set DISTRO_RELEASE
-       const char* version_id = pakfire_get_distro_version_id(pakfire);
+       const char* version_id = pakfire_root_get_distro_version_id(root);
        if (version_id)
                pakfire_parser_set(parser, NULL, "DISTRO_RELEASE", version_id, 0);
 
        // Set DISTRO_DISTTAG
-       const char* tag = pakfire_get_distro_tag(pakfire);
+       const char* tag = pakfire_root_get_distro_tag(root);
        if (tag)
                pakfire_parser_set(parser, NULL, "DISTRO_DISTTAG", tag, 0);
 
        // Set DISTRO_VENDOR
-       const char* vendor = pakfire_get_distro_vendor(pakfire);
+       const char* vendor = pakfire_root_get_distro_vendor(root);
        if (vendor)
                pakfire_parser_set(parser, NULL, "DISTRO_VENDOR", vendor, 0);
 
        // Set DISTRO_ARCH
-       const char* effective_arch = pakfire_get_effective_arch(pakfire);
+       const char* effective_arch = pakfire_root_get_effective_arch(root);
        if (effective_arch) {
                pakfire_parser_set(parser, NULL, "DISTRO_ARCH", effective_arch, 0);
 
@@ -132,10 +132,10 @@ static int pakfire_makefile_set_defaults(struct pakfire* pakfire,
                return r;
 
        if (*dirname) {
-               const char* root = pakfire_get_path(pakfire);
+               const char* p = pakfire_root_get_path(root);
 
                pakfire_parser_set(parser, NULL, "BASEDIR",
-                       pakfire_path_relpath(root, dirname), 0);
+                       pakfire_path_relpath(p, dirname), 0);
        }
 
        long processors_online = sysconf(_SC_NPROCESSORS_ONLN);
@@ -149,20 +149,20 @@ static int pakfire_makefile_set_defaults(struct pakfire* pakfire,
        return 0;
 }
 
-int pakfire_read_makefile(pakfire_parser** parser, struct pakfire* pakfire,
+int pakfire_read_makefile(pakfire_parser** parser, pakfire_root* root,
                const char* path, pakfire_parser_error** error) {
        int r;
 
        // Fetch context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Create a new parser
-       r = pakfire_parser_create(parser, pakfire, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS);
+       r = pakfire_parser_create(parser, root, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS);
        if (r < 0)
                goto ERROR;
 
        // Set defaults
-       r = pakfire_makefile_set_defaults(pakfire, *parser, path);
+       r = pakfire_makefile_set_defaults(root, *parser, path);
        if (r < 0)
                goto ERROR;
 
@@ -230,7 +230,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_dist_get_mirrorlist(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int pakfire_dist_get_mirrorlist(pakfire_ctx* ctx, pakfire_root* root,
                pakfire_parser* makefile, pakfire_mirrorlist** list) {
        pakfire_mirrorlist* m = NULL;
        pakfire_mirror* mirror = NULL;
@@ -324,7 +324,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_dist_add_source(struct pakfire* pakfire, pakfire_packager* packager,
+static int pakfire_dist_add_source(pakfire_root* root, pakfire_packager* packager,
                pakfire_package* pkg, pakfire_ctx* ctx,
                pakfire_mirrorlist* mirrorlist, const char* filename) {
        char archive_path[PATH_MAX];
@@ -334,7 +334,7 @@ static int pakfire_dist_add_source(struct pakfire* pakfire, pakfire_packager* pa
        const char* name = pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME);
 
        // Compose path
-       r = pakfire_cache_path(pakfire, cache_path, "sources/%s/%s", name, filename);
+       r = pakfire_root_cache_path(root, cache_path, "sources/%s/%s", name, filename);
        if (r)
                return r;
 
@@ -351,7 +351,7 @@ static int pakfire_dist_add_source(struct pakfire* pakfire, pakfire_packager* pa
        return pakfire_packager_add(packager, cache_path, archive_path);
 }
 
-static int pakfire_dist_add_sources(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int pakfire_dist_add_sources(pakfire_ctx* ctx, pakfire_root* root,
                pakfire_packager* packager, pakfire_package* pkg, pakfire_parser* makefile) {
        pakfire_mirrorlist* mirrorlist = NULL;
        char* sources = NULL;
@@ -366,7 +366,7 @@ static int pakfire_dist_add_sources(pakfire_ctx* ctx, struct pakfire* pakfire,
                return 0;
 
        // Fetch the mirrorlist
-       r = pakfire_dist_get_mirrorlist(ctx, pakfire, makefile, &mirrorlist);
+       r = pakfire_dist_get_mirrorlist(ctx, root, makefile, &mirrorlist);
        if (r)
                goto ERROR;
 
@@ -376,7 +376,7 @@ static int pakfire_dist_add_sources(pakfire_ctx* ctx, struct pakfire* pakfire,
        while (source) {
                DEBUG(ctx, "Adding source file %s\n", source);
 
-               r = pakfire_dist_add_source(pakfire, packager, pkg, ctx, mirrorlist, source);
+               r = pakfire_dist_add_source(root, packager, pkg, ctx, mirrorlist, source);
                if (r) {
                        ERROR(ctx, "Could not add '%s' to package: %m\n", source);
                        goto ERROR;
@@ -412,28 +412,28 @@ static int __pakfire_dist_find_root(char* root, const size_t length, const char*
        return __pakfire_path_dirname(root, length, p);
 }
 
-static int pakfire_dist_add_files(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int pakfire_dist_add_files(pakfire_ctx* ctx, pakfire_root* root,
                pakfire_packager* packager, const char* file) {
        pakfire_filelist* filelist = NULL;
-       char root[PATH_MAX];
+       char path[PATH_MAX];
        int r;
 
        // Find the package directory
-       r = pakfire_dist_find_root(root, file);
+       r = pakfire_dist_find_root(path, file);
        if (r) {
                ERROR(ctx, "Could not find package root directory: %s\n", strerror(r));
                return r;
        }
 
-       DEBUG(ctx, "Adding all files in '%s' to package...\n", root);
+       DEBUG(ctx, "Adding all files in '%s' to package...\n", path);
 
        // Create a new filelist
-       r = pakfire_filelist_create(&filelist, pakfire);
+       r = pakfire_filelist_create(&filelist, root);
        if (r)
                goto ERROR;
 
        // Scan for any files
-       r = pakfire_filelist_scan(filelist, root, NULL, pakfire_dist_excludes,
+       r = pakfire_filelist_scan(filelist, path, NULL, pakfire_dist_excludes,
                PAKFIRE_FILELIST_NO_DIRECTORIES);
        if (r)
                goto ERROR;
@@ -450,8 +450,7 @@ ERROR:
        return r;
 }
 
-int pakfire_dist(struct pakfire* pakfire,
-               const char* path, pakfire_archive** archive) {
+int pakfire_dist(pakfire_root* root, const char* path, pakfire_archive** archive) {
        pakfire_packager* packager = NULL;
        pakfire_package* pkg = NULL;
        pakfire_parser* makefile = NULL;
@@ -460,10 +459,10 @@ int pakfire_dist(struct pakfire* pakfire,
        int r;
 
        // Fetch context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Load makefile
-       r = pakfire_read_makefile(&makefile, pakfire, path, &error);
+       r = pakfire_read_makefile(&makefile, root, path, &error);
        if (r < 0) {
                if (error)
                        pakfire_parser_error_unref(error);
@@ -486,17 +485,17 @@ int pakfire_dist(struct pakfire* pakfire,
                goto ERROR;
 
        // Create a packager
-       r = pakfire_packager_create(&packager, pakfire, pkg);
+       r = pakfire_packager_create(&packager, root, pkg);
        if (r)
                goto ERROR;
 
        // Add all files in the directory
-       r = pakfire_dist_add_files(ctx, pakfire, packager, path);
+       r = pakfire_dist_add_files(ctx, root, packager, path);
        if (r)
                goto ERROR;
 
        // Add all source files (which might need to be downloaded)
-       r = pakfire_dist_add_sources(ctx, pakfire, packager, pkg, makefile);
+       r = pakfire_dist_add_sources(ctx, root, packager, pkg, makefile);
        if (r)
                goto ERROR;
 
index 4b2c19ac86eeed7f8ec89e67d8c9e773c3b814c9..8946f1cd2e27ffadc595935a8aae58d4b62f2a2a 100644 (file)
 #include <pakfire/pakfire.h>
 #include <pakfire/parser.h>
 
-int pakfire_dist(struct pakfire* pakfire,
-       const char* path, pakfire_archive** archive);
+int pakfire_dist(pakfire_root* root, const char* path, pakfire_archive** archive);
 
-int pakfire_read_makefile(pakfire_parser** parser, struct pakfire* pakfire,
+int pakfire_read_makefile(pakfire_parser** parser, pakfire_root* root,
        const char* path, pakfire_parser_error** error);
 
 #endif /* PAKFIRE_DIST_H */
index 445b07883bf5367bad4c878444ea2e7bcda71c7a..5cce44660f919ecf4967e64a9895b3149ea526cb 100644 (file)
@@ -62,7 +62,7 @@ enum pakfire_file_verification_status {
 
 struct pakfire_file {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        // Use the libarchive entry to store common attributes
@@ -377,8 +377,7 @@ ERROR:
        return r;
 }
 
-int pakfire_file_create(pakfire_file** file,
-               struct pakfire* pakfire, const char* path) {
+int pakfire_file_create(pakfire_file** file, pakfire_root* root, const char* path) {
        pakfire_file* f = NULL;
        int r = 0;
 
@@ -388,10 +387,10 @@ int pakfire_file_create(pakfire_file** file,
                return -errno;
 
        // Store a reference to the context
-       f->ctx = pakfire_get_ctx(pakfire);
+       f->ctx = pakfire_root_get_ctx(root);
 
-       // Store reference to Pakfire
-       f->pakfire = pakfire_ref(pakfire);
+       // Store reference to the root
+       f->root = pakfire_root_ref(root);
 
        // Initialize reference counter
        f->nrefs = 1;
@@ -453,12 +452,12 @@ ERROR:
        return r;
 }
 
-int pakfire_file_create_from_archive_entry(pakfire_file** file, struct pakfire* pakfire,
+int pakfire_file_create_from_archive_entry(pakfire_file** file, pakfire_root* root,
                struct archive_entry* entry) {
        pakfire_file* f = NULL;
        int r;
 
-       r = pakfire_file_create(&f, pakfire, NULL);
+       r = pakfire_file_create(&f, root, NULL);
        if (r < 0)
                goto ERROR;
 
@@ -565,8 +564,8 @@ static void pakfire_file_free(pakfire_file* file) {
                cap_free(file->caps);
        if (file->entry)
                archive_entry_free(file->entry);
-       if (file->pakfire)
-               pakfire_unref(file->pakfire);
+       if (file->root)
+               pakfire_root_unref(file->root);
        if (file->ctx)
                pakfire_ctx_unref(file->ctx);
        free(file);
@@ -807,9 +806,9 @@ int pakfire_file_set_path(pakfire_file* file, const char* path) {
        archive_entry_set_pathname(file->entry, buffer);
 
        // Store the absolute path only when not in stub mode
-       if (!pakfire_has_flag(file->pakfire, PAKFIRE_FLAGS_STUB)) {
+       if (!pakfire_root_has_flag(file->root, PAKFIRE_ROOT_FLAGS_STUB)) {
                // Make the absolute path
-               r = pakfire_path(file->pakfire, buffer, "%s", buffer);
+               r = pakfire_root_path(file->root, buffer, "%s", buffer);
                if (r < 0)
                        return r;
 
@@ -1034,7 +1033,7 @@ int pakfire_file_open(pakfire_file* file, int flags) {
 
        // Fix the path if we have entered the jail
        if (pakfire_ctx_has_flag(file->ctx, PAKFIRE_CTX_IN_JAIL)) {
-               path = pakfire_relpath(file->pakfire, path);
+               path = pakfire_root_relpath(file->root, path);
                if (!path)
                        return -EBADF;
        }
@@ -1534,8 +1533,8 @@ static int pakfire_file_verify_size(pakfire_file* file, const struct stat* st) {
 static int pakfire_file_verify_ownership(pakfire_file* file, const struct stat* st) {
        // Fetch UID/GID
 #if 0
-       const uid_t uid = pakfire_unmap_id(file->pakfire, st->st_uid);
-       const gid_t gid = pakfire_unmap_id(file->pakfire, st->st_gid);
+       const uid_t uid = pakfire_unmap_id(file->root, st->st_uid);
+       const gid_t gid = pakfire_unmap_id(file->root, st->st_gid);
 #else
        const uid_t uid = st->st_uid;
        const gid_t gid = st->st_gid;
@@ -1545,8 +1544,8 @@ static int pakfire_file_verify_ownership(pakfire_file* file, const struct stat*
        const char* gname = pakfire_file_get_gname(file);
 
        // Fetch owner & group
-       struct passwd* owner = pakfire_getpwnam(file->pakfire, uname);
-       struct group*  group = pakfire_getgrnam(file->pakfire, gname);
+       struct passwd* owner = pakfire_getpwnam(file->root, uname);
+       struct group*  group = pakfire_getgrnam(file->root, gname);
 
        // Check if owner matches
        if (!owner || owner->pw_uid != uid) {
@@ -1854,7 +1853,7 @@ int pakfire_file_fix_interpreter(pakfire_file* file) {
                                DEBUG(file->ctx, "%s: Found command %s (%s)\n", path, interpreter, args);
 
                                // Find the real path
-                               r = pakfire_which(file->pakfire, command, interpreter);
+                               r = pakfire_which(file->root, command, interpreter);
                                if (r < 0) {
                                        ERROR(file->ctx, "%s: Could not resolve %s: %m\n", path, interpreter);
                                        goto ERROR;
index 82a6a34fa4a51b8e0e54ad5db714289ec097efa2..207c443558bc621d444576fd319073f7ff191801 100644 (file)
@@ -39,7 +39,7 @@ enum pakfire_file_flags {
        PAKFIRE_FILE_CONFIG               = (1 << 0),
 };
 
-int pakfire_file_create(pakfire_file** file, struct pakfire* pakfire, const char* path);
+int pakfire_file_create(pakfire_file** file, pakfire_root* root, const char* path);
 
 pakfire_file* pakfire_file_ref(pakfire_file* file);
 pakfire_file* pakfire_file_unref(pakfire_file* file);
@@ -132,8 +132,8 @@ int pakfire_file_has_payload(pakfire_file* file);
 
 int pakfire_file_write_fcaps(pakfire_file* file, struct vfs_cap_data* cap_data);
 
-int pakfire_file_create_from_archive_entry(pakfire_file** file, struct pakfire* pakfire,
-       struct archive_entry* entry);
+int pakfire_file_create_from_archive_entry(pakfire_file** file,
+       pakfire_root* root, struct archive_entry* entry);
 struct archive_entry* pakfire_file_archive_entry(pakfire_file* file, const enum pakfire_hash_type hashes);
 
 enum pakfire_file_dump_flags {
index 90cad5543b3cb6a764fdd6c19bdd0f4d2b458e99..6bb8b366b5f2edc3d37738ec30f33fd3789e6e91 100644 (file)
 
 struct pakfire_filelist {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        pakfire_file** files;
        unsigned int num_files;
 };
 
-int pakfire_filelist_create(pakfire_filelist** list, struct pakfire* pakfire) {
+int pakfire_filelist_create(pakfire_filelist** list, pakfire_root* root) {
        pakfire_filelist* l = NULL;
 
        // Allocate a new object
@@ -53,10 +53,10 @@ int pakfire_filelist_create(pakfire_filelist** list, struct pakfire* pakfire) {
                return -errno;
 
        // Store a reference to the context
-       l->ctx = pakfire_get_ctx(pakfire);
+       l->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       l->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       l->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        l->nrefs = 1;
@@ -69,8 +69,8 @@ int pakfire_filelist_create(pakfire_filelist** list, struct pakfire* pakfire) {
 
 static void pakfire_filelist_free(pakfire_filelist* list) {
        pakfire_filelist_clear(list);
-       if (list->pakfire)
-               pakfire_unref(list->pakfire);
+       if (list->root)
+               pakfire_root_unref(list->root);
        if (list->ctx)
                pakfire_ctx_unref(list->ctx);
        free(list);
@@ -366,7 +366,7 @@ int pakfire_filelist_scan(pakfire_filelist* list, const char* root,
        }
 
        // Create a new disk reader
-       reader = pakfire_get_disk_reader(list->pakfire);
+       reader = pakfire_root_get_disk_reader(list->root);
        if (!reader)
                goto ERROR;
 
@@ -410,7 +410,7 @@ int pakfire_filelist_scan(pakfire_filelist* list, const char* root,
                }
 
                // Create file
-               r = pakfire_file_create_from_archive_entry(&file, list->pakfire, entry);
+               r = pakfire_file_create_from_archive_entry(&file, list->root, entry);
                if (r)
                        goto ERROR;
 
index ca090868add019d564988bfb956495995432d4be..89c045a8e39b1cfeda0921e1ea69c57fedd1b4ef 100644 (file)
@@ -29,7 +29,7 @@ typedef struct pakfire_filelist pakfire_filelist;
 #include <pakfire/file.h>
 #include <pakfire/pakfire.h>
 
-int pakfire_filelist_create(pakfire_filelist** list, struct pakfire* pakfire);
+int pakfire_filelist_create(pakfire_filelist** list, pakfire_root* root);
 
 pakfire_filelist* pakfire_filelist_ref(pakfire_filelist* list);
 pakfire_filelist* pakfire_filelist_unref(pakfire_filelist* list);
index 2ac7bfa088b10c0791c634cea9ecb4bf2c84ae2d..2196f1ef3580017367161ad2b9b4468bc6a514e7 100644 (file)
@@ -91,7 +91,7 @@ typedef struct pakfire_jail_mountpoint {
 
 struct pakfire_jail {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        // A unique ID for each jail
@@ -187,8 +187,8 @@ static int pakfire_jail_exec_has_flag(
 static void pakfire_jail_free(pakfire_jail* jail) {
        if (jail->cgroup)
                pakfire_cgroup_unref(jail->cgroup);
-       if (jail->pakfire)
-               pakfire_unref(jail->pakfire);
+       if (jail->root)
+               pakfire_root_unref(jail->root);
        if (jail->env)
                pakfire_env_unref(jail->env);
        if (jail->ctx)
@@ -203,7 +203,7 @@ static const char* pakfire_jail_uuid(pakfire_jail* jail) {
        return jail->__uuid;
 }
 
-int pakfire_jail_create(pakfire_jail** jail, struct pakfire* pakfire) {
+int pakfire_jail_create(pakfire_jail** jail, pakfire_root* root) {
        pakfire_jail* self = NULL;
        int r;
 
@@ -213,10 +213,10 @@ int pakfire_jail_create(pakfire_jail** jail, struct pakfire* pakfire) {
                return -errno;
 
        // Reference context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Reference Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize reference counter
        self->nrefs = 1;
@@ -237,7 +237,7 @@ int pakfire_jail_create(pakfire_jail** jail, struct pakfire* pakfire) {
        }
 
        // Fetch the architecture
-       const char* arch = pakfire_get_effective_arch(pakfire);
+       const char* arch = pakfire_root_get_effective_arch(root);
 
        // Enable all CPU features that CPU has to offer
        if (!pakfire_arch_is_supported_by_host(arch)) {
@@ -252,7 +252,7 @@ int pakfire_jail_create(pakfire_jail** jail, struct pakfire* pakfire) {
                goto ERROR;
 
        // Disable systemctl to talk to systemd
-       if (!pakfire_on_root(self->pakfire)) {
+       if (!pakfire_root_on_root(self->root)) {
                r = pakfire_env_set(self->env, "SYSTEMD_OFFLINE", "1");
                if (r < 0)
                        goto ERROR;
@@ -867,7 +867,7 @@ static int pakfire_jail_mount_networking(pakfire_jail* jail) {
 
        // Bind-mount all paths read-only
        for (const char** path = paths; *path; path++) {
-               r = pakfire_bind(jail->ctx, jail->pakfire, *path, NULL, MS_RDONLY);
+               r = pakfire_bind(jail->ctx, jail->root, *path, NULL, MS_RDONLY);
                if (r) {
                        switch (errno) {
                                // Ignore if we don't have permission
@@ -897,17 +897,17 @@ static int pakfire_jail_mount(pakfire_jail* jail, pakfire_jail_exec* ctx) {
                flags |= PAKFIRE_MOUNT_LOOP_DEVICES;
 
        // Mount all default stuff
-       r = pakfire_mount_all(jail->ctx, jail->pakfire, PAKFIRE_MNTNS_OUTER, flags);
+       r = pakfire_mount_all(jail->ctx, jail->root, PAKFIRE_MNTNS_OUTER, flags);
        if (r)
                return r;
 
        // Populate /dev
-       r = pakfire_populate_dev(jail->ctx, jail->pakfire, flags);
+       r = pakfire_populate_dev(jail->ctx, jail->root, flags);
        if (r)
                return r;
 
        // Mount the interpreter (if needed)
-       r = pakfire_mount_interpreter(jail->ctx, jail->pakfire);
+       r = pakfire_mount_interpreter(jail->ctx, jail->root);
        if (r)
                return r;
 
@@ -924,7 +924,7 @@ static int pakfire_jail_mount(pakfire_jail* jail, pakfire_jail_exec* ctx) {
                mp = &jail->mountpoints[i];
 
                // Mount it
-               r = pakfire_bind(jail->ctx, jail->pakfire, mp->source, mp->target, mp->flags);
+               r = pakfire_bind(jail->ctx, jail->root, mp->source, mp->target, mp->flags);
                if (r)
                        return r;
        }
@@ -1013,10 +1013,10 @@ static int pakfire_jail_setup_uid_mapping(pakfire_jail* jail, pid_t pid) {
                return r;
 
        // Fetch UID
-       const uid_t uid = pakfire_uid(jail->pakfire);
+       const uid_t uid = pakfire_root_uid(jail->root);
 
        // Fetch SUBUID
-       const struct pakfire_subid* subuid = pakfire_subuid(jail->pakfire);
+       const struct pakfire_subid* subuid = pakfire_root_subuid(jail->root);
        if (!subuid)
                return 1;
 
@@ -1048,10 +1048,10 @@ static int pakfire_jail_setup_gid_mapping(pakfire_jail* jail, pid_t pid) {
        int r;
 
        // Fetch GID
-       const gid_t gid = pakfire_gid(jail->pakfire);
+       const gid_t gid = pakfire_root_gid(jail->root);
 
        // Fetch SUBGID
-       const struct pakfire_subid* subgid = pakfire_subgid(jail->pakfire);
+       const struct pakfire_subid* subgid = pakfire_root_subgid(jail->root);
        if (!subgid)
                return 1;
 
@@ -1535,12 +1535,12 @@ static int pakfire_jail_child(pakfire_jail* jail, pakfire_jail_exec* ctx) {
        }
 
        // Mount all default stuff
-       r = pakfire_mount_all(jail->ctx, jail->pakfire, PAKFIRE_MNTNS_INNER, 0);
+       r = pakfire_mount_all(jail->ctx, jail->root, PAKFIRE_MNTNS_INNER, 0);
        if (r)
                return 126;
 
-       const char* root = pakfire_get_path(jail->pakfire);
-       const char* arch = pakfire_get_effective_arch(jail->pakfire);
+       const char* path = pakfire_root_get_path(jail->root);
+       const char* arch = pakfire_root_get_effective_arch(jail->root);
 
        // Change mount propagation to slave to receive anything from the parent namespace
        r = pakfire_mount_change_propagation(jail->ctx, "/", MS_SLAVE);
@@ -1548,24 +1548,24 @@ static int pakfire_jail_child(pakfire_jail* jail, pakfire_jail_exec* ctx) {
                return r;
 
        // Make root a mountpoint in the new mount namespace
-       r = pakfire_mount_make_mounpoint(jail->ctx, root);
+       r = pakfire_mount_make_mounpoint(jail->ctx, path);
        if (r)
                return r;
 
        // Change mount propagation to private
-       r = pakfire_mount_change_propagation(jail->ctx, root, MS_PRIVATE);
+       r = pakfire_mount_change_propagation(jail->ctx, path, MS_PRIVATE);
        if (r)
                return r;
 
        // Change root (unless root is /)
-       if (!pakfire_on_root(jail->pakfire)) {
+       if (!pakfire_root_on_root(jail->root)) {
                // Mount everything
                r = pakfire_jail_mount(jail, ctx);
                if (r)
                        return r;
 
                // chroot()
-               r = pakfire_jail_switch_root(jail, root);
+               r = pakfire_jail_switch_root(jail, path);
                if (r)
                        return r;
        }
@@ -2090,7 +2090,7 @@ int pakfire_jail_execute_script(pakfire_jail* jail,
        FILE* f = NULL;
        int r;
 
-       const char* root = pakfire_get_path(jail->pakfire);
+       const char* root = pakfire_root_get_path(jail->root);
 
        // Write the scriptlet to disk
        r = pakfire_path_append(path, root, PAKFIRE_TMP_DIR "/pakfire-script.XXXXXX");
@@ -2163,13 +2163,13 @@ ERROR:
        A convenience function that creates a new jail, runs the given command and destroys
        the jail again.
 */
-int pakfire_jail_run(struct pakfire* pakfire, const char* argv[], pakfire_env* env,
+int pakfire_jail_run(pakfire_root* root, const char* argv[], pakfire_env* env,
                int flags, char** output, size_t* output_length) {
        pakfire_jail* jail = NULL;
        int r;
 
        // Create a new jail
-       r = pakfire_jail_create(&jail, pakfire);
+       r = pakfire_jail_create(&jail, root);
        if (r)
                goto ERROR;
 
@@ -2183,13 +2183,13 @@ ERROR:
        return r;
 }
 
-int pakfire_jail_run_script(struct pakfire* pakfire, const char* script, const size_t length,
+int pakfire_jail_run_script(pakfire_root* root, const char* script, const size_t length,
                const char* argv[], pakfire_env* env, int flags) {
        pakfire_jail* jail = NULL;
        int r;
 
        // Create a new jail
-       r = pakfire_jail_create(&jail, pakfire);
+       r = pakfire_jail_create(&jail, root);
        if (r)
                goto ERROR;
 
@@ -2254,14 +2254,14 @@ ERROR:
        return r;
 }
 
-static int pakfire_jail_run_if_possible(struct pakfire* pakfire, const char** argv) {
+static int pakfire_jail_run_if_possible(pakfire_root* root, const char** argv) {
        char path[PATH_MAX];
        int r;
 
        // Fetch the context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
-       r = pakfire_path(pakfire, path, "%s", *argv);
+       r = pakfire_root_path(root, path, "%s", *argv);
        if (r)
                goto ERROR;
 
@@ -2272,7 +2272,7 @@ static int pakfire_jail_run_if_possible(struct pakfire* pakfire, const char** ar
                goto ERROR;
        }
 
-       r = pakfire_jail_run(pakfire, argv, NULL, 0, NULL, NULL);
+       r = pakfire_jail_run(root, argv, NULL, 0, NULL, NULL);
 
 ERROR:
        if (ctx)
@@ -2281,23 +2281,23 @@ ERROR:
        return r;
 }
 
-int pakfire_jail_ldconfig(struct pakfire* pakfire) {
+int pakfire_jail_ldconfig(pakfire_root* root) {
        const char* argv[] = {
                "/sbin/ldconfig",
                NULL,
        };
 
-       return pakfire_jail_run_if_possible(pakfire, argv);
+       return pakfire_jail_run_if_possible(root, argv);
 }
 
-int pakfire_jail_run_systemd_tmpfiles(struct pakfire* pakfire) {
+int pakfire_jail_run_systemd_tmpfiles(pakfire_root* root) {
        const char* argv[] = {
                "/usr/bin/systemd-tmpfiles",
                "--create",
                NULL,
        };
 
-       return pakfire_jail_run_if_possible(pakfire, argv);
+       return pakfire_jail_run_if_possible(root, argv);
 }
 
 ssize_t pakfire_jail_send_buffer(pakfire_ctx* ctx,
index 4ad35b318dc4baf6ebacb5feccc45b5e8c0f3e23..6ddf1db87ea1b1d7b8dadc54efc774919cbc58a8 100644 (file)
@@ -40,7 +40,7 @@ enum pakfire_jail_output_stream {
 typedef int (*pakfire_jail_output_callback)(pakfire_ctx* ctx, void* data,
        const enum pakfire_jail_output_stream stream, const char* line, size_t length);
 
-int pakfire_jail_create(pakfire_jail** jail, struct pakfire* pakfire);
+int pakfire_jail_create(pakfire_jail** jail, pakfire_root* root);
 
 pakfire_jail* pakfire_jail_ref(pakfire_jail* jail);
 pakfire_jail* pakfire_jail_unref(pakfire_jail* jail);
@@ -82,9 +82,9 @@ int pakfire_jail_communicate(
        pakfire_jail_output_callback output_callback, void* output_data);
 
 // Convenience functions
-int pakfire_jail_run(struct pakfire* pakfire,
+int pakfire_jail_run(pakfire_root* root,
        const char* argv[], pakfire_env* env, int flags, char** output, size_t* output_length);
-int pakfire_jail_run_script(struct pakfire* pakfire,
+int pakfire_jail_run_script(pakfire_root* root,
        const char* script, const size_t length, const char* argv[], pakfire_env* env, int flags);
 
 int pakfire_jail_execute_script(pakfire_jail* jail,
@@ -93,8 +93,8 @@ int pakfire_jail_execute_script(pakfire_jail* jail,
        pakfire_jail_output_callback output_callback, void* output_data);
 
 int pakfire_jail_shell(pakfire_jail* jail, pakfire_env* env);
-int pakfire_jail_ldconfig(struct pakfire* pakfire);
-int pakfire_jail_run_systemd_tmpfiles(struct pakfire* pakfire);
+int pakfire_jail_ldconfig(pakfire_root* root);
+int pakfire_jail_run_systemd_tmpfiles(pakfire_root* root);
 
 // Streaming functions
 struct pakfire_input_buffer {
index 438443448e726e18dc410d2c553e744e018fe81f..1e2d8f30f23beb4aac1b195ce079fa6227f92fde 100644 (file)
@@ -406,7 +406,7 @@ static int pakfire_job_logfile_uploaded(pakfire_client* client,
        return pakfire_job_upload_packages(self);
 }
 
-static int pakfire_job_result(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int pakfire_job_result(pakfire_ctx* ctx, pakfire_root* root,
                pakfire_build* build, pakfire_archive* archive, void* data) {
        pakfire_job* self = data;
        pakfire_package* pkg = NULL;
index 8fde6d45c352683e0f1431b72d0d70ea8538db04..e7b0bc6600bd7df782182b5558fe034a4938034c 100644 (file)
@@ -56,8 +56,8 @@ struct pakfire_linter {
        pakfire_ctx* ctx;
        int nrefs;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 
        // Archive
        pakfire_archive* archive;
@@ -169,7 +169,7 @@ ERROR:
 }
 
 int pakfire_linter_create(pakfire_linter** linter,
-               struct pakfire* pakfire, pakfire_archive* archive) {
+               pakfire_root* root, pakfire_archive* archive) {
        pakfire_linter* l = NULL;
        int r;
 
@@ -179,10 +179,10 @@ int pakfire_linter_create(pakfire_linter** linter,
                return -errno;
 
        // Reference the context
-       l->ctx = pakfire_get_ctx(pakfire);
+       l->ctx = pakfire_root_get_ctx(root);
 
-       // Reference Pakfire
-       l->pakfire = pakfire_ref(pakfire);
+       // Reference the root
+       l->root = pakfire_root_ref(root);
 
        // Initialize reference counter
        l->nrefs = 1;
@@ -202,7 +202,7 @@ int pakfire_linter_create(pakfire_linter** linter,
        }
 
        // Create a filelist
-       r = pakfire_filelist_create(&l->filelist, l->pakfire);
+       r = pakfire_filelist_create(&l->filelist, l->root);
        if (r < 0)
                goto ERROR;
 
@@ -235,8 +235,8 @@ static void pakfire_linter_free(pakfire_linter* linter) {
                pakfire_archive_unref(linter->archive);
        if (linter->pkg)
                pakfire_package_unref(linter->pkg);
-       if (linter->pakfire)
-               pakfire_unref(linter->pakfire);
+       if (linter->root)
+               pakfire_root_unref(linter->root);
        if (linter->ctx)
                pakfire_ctx_unref(linter->ctx);
        free(linter);
@@ -485,7 +485,7 @@ static int pakfire_linter_lint_file(pakfire_archive* archive,
        int r;
 
        // Fetch a file object
-       r = pakfire_file_create_from_archive_entry(&file, linter->pakfire, e);
+       r = pakfire_file_create_from_archive_entry(&file, linter->root, e);
        if (r < 0)
                goto ERROR;
 
index e1f85a981d8ff6af416c8268f5a4c1a64e63982a..50edd07bd9a9939783ad4b2a8ea9de5a6a53b832 100644 (file)
@@ -39,7 +39,7 @@ typedef int (*pakfire_linter_result_callback)(pakfire_ctx* ctx,
 typedef struct pakfire_linter pakfire_linter;
 
 int pakfire_linter_create(pakfire_linter** linter,
-       struct pakfire* pakfire, pakfire_archive* archive);
+       pakfire_root* root, pakfire_archive* archive);
 
 pakfire_linter* pakfire_linter_ref(pakfire_linter* linter);
 pakfire_linter* pakfire_linter_unref(pakfire_linter* linter);
index ddfa502fa05eb9f5c915b34f4bf4b1e25feac76a..f2bdc2ff91b7428432cbe8573603bf054ff172b1 100644 (file)
@@ -341,7 +341,7 @@ int pakfire_mount_list(pakfire_ctx* ctx) {
        return pakfire_parse_file("/proc/self/mounts", __pakfire_mount_list, ctx);
 }
 
-int pakfire_populate_dev(pakfire_ctx* ctx, struct pakfire* pakfire, int flags) {
+int pakfire_populate_dev(pakfire_ctx* ctx, pakfire_root* root, int flags) {
        char path[PATH_MAX];
 
        // Create device nodes
@@ -352,7 +352,7 @@ int pakfire_populate_dev(pakfire_ctx* ctx, struct pakfire* pakfire, int flags) {
                if (devnode->flags && !(flags & devnode->flags))
                        continue;
 
-               int r = pakfire_path(pakfire, path, "%s", devnode->path);
+               int r = pakfire_root_path(root, path, "%s", devnode->path);
                if (r)
                        return r;
 
@@ -392,7 +392,7 @@ MOUNT:
        for (const struct pakfire_symlink* s = symlinks; s->target; s++) {
                DEBUG(ctx, "Creating symlink %s -> %s\n", s->path, s->target);
 
-               int r = pakfire_path(pakfire, path, "%s", s->path);
+               int r = pakfire_root_path(root, path, "%s", s->path);
                if (r)
                        return r;
 
@@ -406,11 +406,11 @@ MOUNT:
        return 0;
 }
 
-int pakfire_mount_interpreter(pakfire_ctx* ctx, struct pakfire* pakfire) {
+int pakfire_mount_interpreter(pakfire_ctx* ctx, pakfire_root* root) {
        char target[PATH_MAX];
 
        // Fetch the target architecture
-       const char* arch = pakfire_get_effective_arch(pakfire);
+       const char* arch = pakfire_root_get_effective_arch(root);
 
        // Can we emulate this architecture?
        char* interpreter = pakfire_arch_find_interpreter(arch);
@@ -422,7 +422,7 @@ int pakfire_mount_interpreter(pakfire_ctx* ctx, struct pakfire* pakfire) {
        DEBUG(ctx, "Mounting interpreter %s for %s\n", interpreter, arch);
 
        // Where to mount this?
-       int r = pakfire_path(pakfire, target, "%s", interpreter);
+       int r = pakfire_root_path(root, target, "%s", interpreter);
        if (r)
                return r;
 
@@ -444,22 +444,22 @@ int pakfire_mount_interpreter(pakfire_ctx* ctx, struct pakfire* pakfire) {
        return r;
 }
 
-int pakfire_mount_all(pakfire_ctx* ctx, struct pakfire* pakfire, pakfire_mntns_t ns, int flags) {
+int pakfire_mount_all(pakfire_ctx* ctx, pakfire_root* root, pakfire_mntns_t ns, int flags) {
        char target[PATH_MAX];
        int r;
 
-       const char* root = "/";
+       const char* path = "/";
 
        // Fetch Pakfire's root directory
        if (ns == PAKFIRE_MNTNS_OUTER)
-               root = pakfire_get_path(pakfire);
+               path = pakfire_root_get_path(root);
 
        for (const struct pakfire_mountpoint* mp = mountpoints; mp->source; mp++) {
                if (!(mp->ns & ns))
                        continue;
 
                // Figure out where to mount
-               r = pakfire_path_append(target, root, mp->target);
+               r = pakfire_path_append(target, path, mp->target);
                if (r)
                        return r;
 
@@ -481,7 +481,7 @@ int pakfire_mount_all(pakfire_ctx* ctx, struct pakfire* pakfire, pakfire_mntns_t
        return 0;
 }
 
-int pakfire_bind(pakfire_ctx* ctx, struct pakfire* pakfire,
+int pakfire_bind(pakfire_ctx* ctx, pakfire_root* root,
                const char* src, const char* dst, int flags) {
        struct stat st;
        char mountpoint[PATH_MAX];
@@ -489,7 +489,7 @@ int pakfire_bind(pakfire_ctx* ctx, struct pakfire* pakfire,
        if (!dst)
                dst = src;
 
-       int r = pakfire_path(pakfire, mountpoint, "%s", dst);
+       int r = pakfire_root_path(root, mountpoint, "%s", dst);
        if (r)
                return r;
 
index fc5db114cd4c10e20dd23c678d1584af45ebdcf2..81bf570397a97877aaab7d0296f0b516962ccfde 100644 (file)
@@ -33,20 +33,20 @@ int pakfire_mount_change_propagation(pakfire_ctx* ctx, const char* path, int pro
 
 int pakfire_mount_make_mounpoint(pakfire_ctx* ctx, const char* path);
 
-int pakfire_bind(pakfire_ctx* ctx, struct pakfire* pakfire,
+int pakfire_bind(pakfire_ctx* ctx, pakfire_root* root,
        const char* src, const char* dst, int flags);
 
 int pakfire_mount_list(pakfire_ctx* ctx);
 
-int pakfire_populate_dev(pakfire_ctx* ctx, struct pakfire* pakfire, int flags);
+int pakfire_populate_dev(pakfire_ctx* ctx, pakfire_root* root, int flags);
 
-int pakfire_mount_interpreter(pakfire_ctx* ctx, struct pakfire* pakfire);
+int pakfire_mount_interpreter(pakfire_ctx* ctx, pakfire_root* root);
 
 enum pakfire_mount_flags {
        PAKFIRE_MOUNT_LOOP_DEVICES = (1 << 0),
 };
 
-int pakfire_mount_all(pakfire_ctx* ctx, struct pakfire* pakfire,
+int pakfire_mount_all(pakfire_ctx* ctx, pakfire_root* root,
        pakfire_mntns_t ns, int flags);
 
 #endif /* PAKFIRE_MOUNT_H */
index b950c5284629ca733924d373308759235c6d752d..f7a8cef362dd2bd3a5b2ec449f4866594e5914bf 100644 (file)
@@ -43,8 +43,8 @@ struct pakfire_oci_writer {
        // Context
        pakfire_ctx* ctx;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 
        // Image writer
        pakfire_archive_writer* image;
@@ -58,8 +58,8 @@ struct pakfire_oci_writer {
        json_object* manifests;
 };
 
-static const char* pakfire_oci_arch(struct pakfire* pakfire) {
-       const char* arch = pakfire_get_arch(pakfire);
+static const char* pakfire_oci_arch(pakfire_root* root) {
+       const char* arch = pakfire_root_get_arch(root);
 
        // aarch64
        if (pakfire_string_equals(arch, "aarch64"))
@@ -219,7 +219,7 @@ static int pakfire_oci_writer_write_config(struct pakfire_oci_writer* self) {
                goto ERROR;
 
        // Add author
-       const char* vendor = pakfire_get_distro_vendor(self->pakfire);
+       const char* vendor = pakfire_root_get_distro_vendor(self->root);
        if (vendor) {
                r = pakfire_json_add_string(o, "author", vendor);
                if (r < 0)
@@ -232,7 +232,7 @@ static int pakfire_oci_writer_write_config(struct pakfire_oci_writer* self) {
                goto ERROR;
 
        // Fetch OS version
-       const char* version_id = pakfire_get_distro_version_id(self->pakfire);
+       const char* version_id = pakfire_root_get_distro_version_id(self->root);
 
        // Add OS version
        if (version_id) {
@@ -242,7 +242,7 @@ static int pakfire_oci_writer_write_config(struct pakfire_oci_writer* self) {
        }
 
        // Fetch arch
-       const char* arch = pakfire_oci_arch(self->pakfire);
+       const char* arch = pakfire_oci_arch(self->root);
 
        // Add arch
        r = pakfire_json_add_string(o, "architecture", arch);
@@ -387,7 +387,7 @@ static int pakfire_oci_writer_write_manifest(struct pakfire_oci_writer* self) {
                goto ERROR;
 
        // Fetch architecture
-       const char* arch = pakfire_oci_arch(self->pakfire);
+       const char* arch = pakfire_oci_arch(self->root);
 
        // Add architecture
        r = pakfire_json_add_string(platform, "architecture", arch);
@@ -430,7 +430,7 @@ static int pakfire_oci_writer_make_layer(struct pakfire_oci_writer* self) {
        int r;
 
        // Fetch the pakfire root
-       const char* root = pakfire_get_path(self->pakfire);
+       const char* root = pakfire_root_get_path(self->root);
 
        // Make a new temporary file
        f = pakfire_mktemp(path, 0);
@@ -444,7 +444,7 @@ static int pakfire_oci_writer_make_layer(struct pakfire_oci_writer* self) {
        unlink(path);
 
        // Make a new archive writer
-       r = pakfire_archive_writer_create(&layer, self->pakfire, PAKFIRE_FORMAT_OCI_LAYER, f);
+       r = pakfire_archive_writer_create(&layer, self->root, PAKFIRE_FORMAT_OCI_LAYER, f);
        if (r < 0)
                goto ERROR;
 
@@ -555,10 +555,10 @@ ERROR:
        return r;
 }
 
-int pakfire_oci_mkimage(struct pakfire* pakfire, FILE* f) {
+int pakfire_oci_mkimage(pakfire_root* root, FILE* f) {
        struct pakfire_oci_writer writer = {
-               .ctx     = pakfire_get_ctx(pakfire),
-               .pakfire = pakfire,
+               .ctx  = pakfire_root_get_ctx(root),
+               .root = root,
        };
        int r;
 
@@ -582,7 +582,7 @@ int pakfire_oci_mkimage(struct pakfire* pakfire, FILE* f) {
        }
 
        // Make a new archive writer
-       r = pakfire_archive_writer_create(&writer.image, pakfire, PAKFIRE_FORMAT_OCI, f);
+       r = pakfire_archive_writer_create(&writer.image, root, PAKFIRE_FORMAT_OCI, f);
        if (r < 0)
                goto ERROR;
 
index 27da510170a4b52270fe5ab6fd30991855d8e485..93762232a97e26bd5552951717256d949c1d2add 100644 (file)
@@ -25,6 +25,6 @@
 
 #include <pakfire/pakfire.h>
 
-int pakfire_oci_mkimage(struct pakfire* pakfire, FILE* f);
+int pakfire_oci_mkimage(pakfire_root* root, FILE* f);
 
 #endif /* PAKFIRE_OCI_H */
index a30066b977ff1e80c0fadd9f681fcd21b7133d02..73d24a33c8e725bdf35ea92e13a1b14240a09d99 100644 (file)
@@ -57,7 +57,7 @@
 
 struct pakfire_package {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        // Reference to this package in the SOLV pool
@@ -79,7 +79,7 @@ struct pakfire_package {
 };
 
 static Solvable* get_solvable(pakfire_package* pkg) {
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
 
        return pool_id2solvable(pool, pkg->id);
 }
@@ -168,7 +168,7 @@ static int pakfire_package_add_self_provides(pakfire_package* pkg) {
 }
 
 int pakfire_package_create_from_solvable(pakfire_package** package,
-               struct pakfire* pakfire, pakfire_repo* repo, Id id) {
+               pakfire_root* root, pakfire_repo* repo, Id id) {
        pakfire_package* pkg = NULL;
 
        // Allocate some memory
@@ -177,10 +177,10 @@ int pakfire_package_create_from_solvable(pakfire_package** package,
                return -errno;
 
        // Store a reference to the context
-       pkg->ctx = pakfire_get_ctx(pakfire);
+       pkg->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       pkg->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       pkg->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        pkg->nrefs = 1;
@@ -198,9 +198,8 @@ int pakfire_package_create_from_solvable(pakfire_package** package,
        return 0;
 }
 
-int pakfire_package_create(pakfire_package** package,
-               struct pakfire* pakfire, pakfire_repo* repo,
-               const char* name, const char* evr, const char* arch) {
+int pakfire_package_create(pakfire_package** package, pakfire_root* root,
+               pakfire_repo* repo, const char* name, const char* evr, const char* arch) {
        pakfire_repo* dummy = NULL;
        int r;
 
@@ -212,7 +211,7 @@ int pakfire_package_create(pakfire_package** package,
 
        // Default to dummy repository
        if (!repo) {
-               dummy = pakfire_get_repo(pakfire, PAKFIRE_REPO_DUMMY);
+               dummy = pakfire_root_get_repo(root, PAKFIRE_REPO_DUMMY);
                if (!dummy) {
                        errno = ENOENT;
                        return 1;
@@ -222,7 +221,7 @@ int pakfire_package_create(pakfire_package** package,
        }
 
        // Fetch the context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Allocate a new solvable
        Id id = pakfire_repo_add_solvable(repo);
@@ -233,7 +232,7 @@ int pakfire_package_create(pakfire_package** package,
        }
 
        // Create a new package object
-       r = pakfire_package_create_from_solvable(package, pakfire, repo, id);
+       r = pakfire_package_create_from_solvable(package, root, repo, id);
        if (r)
                goto ERROR;
 
@@ -281,8 +280,8 @@ static void pakfire_package_free(pakfire_package* pkg) {
                pcre2_code_free(pkg->filters.provides);
        if (pkg->repo)
                pakfire_repo_unref(pkg->repo);
-       if (pkg->pakfire)
-               pakfire_unref(pkg->pakfire);
+       if (pkg->root)
+               pakfire_root_unref(pkg->root);
        if (pkg->ctx)
                pakfire_ctx_unref(pkg->ctx);
        free(pkg);
@@ -328,7 +327,7 @@ int pakfire_package_eq(pakfire_package* pkg1, pakfire_package* pkg2) {
 }
 
 int pakfire_package_cmp(pakfire_package* pkg1, pakfire_package* pkg2) {
-       Pool* pool = pakfire_get_solv_pool(pkg1->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg1->root);
 
        Solvable* s1 = get_solvable(pkg1);
        Solvable* s2 = get_solvable(pkg2);
@@ -368,7 +367,7 @@ int pakfire_package_cmp(pakfire_package* pkg1, pakfire_package* pkg2) {
 }
 
 int pakfire_package_evr_cmp(pakfire_package* pkg1, pakfire_package* pkg2) {
-       Pool* pool = pakfire_get_solv_pool(pkg1->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg1->root);
 
        Solvable* s1 = get_solvable(pkg1);
        Solvable* s2 = get_solvable(pkg2);
@@ -560,7 +559,7 @@ static int pakfire_package_make_cache_path(pakfire_package* pkg) {
                return 1;
        }
 
-       return pakfire_cache_path(pkg->pakfire, pkg->cache_path, "%s/%s", uuid, filename);
+       return pakfire_root_cache_path(pkg->root, pkg->cache_path, "%s/%s", uuid, filename);
 }
 
 void pakfire_package_unset(pakfire_package* pkg,
@@ -711,7 +710,7 @@ char** pakfire_package_get_strings(
 
        pakfire_package_internalize_repo(pkg);
 
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
        Solvable* s = get_solvable(pkg);
 
        switch (key) {
@@ -826,7 +825,7 @@ const char* pakfire_package_get_string(
 
        pakfire_package_internalize_repo(pkg);
 
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
        Solvable* s = get_solvable(pkg);
 
        switch (key) {
@@ -978,7 +977,7 @@ int pakfire_package_set_string(
        Id id = ID_NULL;
        int r;
 
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
        Solvable* s = get_solvable(pkg);
 
        switch (key) {
@@ -1147,7 +1146,7 @@ int pakfire_package_add_string(pakfire_package* pkg,
        Id key_id = ID_NULL;
        Id value_id = ID_NULL;
 
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
        Solvable* s = get_solvable(pkg);
 
        switch (key) {
@@ -1427,7 +1426,7 @@ int pakfire_package_is_available(pakfire_package* self) {
 }
 
 int pakfire_package_is_installed(pakfire_package* pkg) {
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
        Solvable* s = get_solvable(pkg);
 
        return pool->installed == s->repo;
@@ -1500,7 +1499,7 @@ char** pakfire_package_get_deps(pakfire_package* pkg,
                goto ERROR;
 
        for (int i = 0; i < q.count; i++) {
-               dep = pakfire_dep2str(pkg->pakfire, q.elements[i]);
+               dep = pakfire_dep2str(pkg->root, q.elements[i]);
                if (!dep)
                        goto ERROR;
 
@@ -1667,7 +1666,7 @@ int pakfire_package_add_dep(pakfire_package* pkg,
        }
 
        // Parse the dependency
-       Id id = pakfire_str2dep(pkg->pakfire, buffer);
+       Id id = pakfire_str2dep(pkg->root, buffer);
        if (!id) {
                ERROR(pkg->ctx, "Could not add dependency '%s' to %s\n",
                        buffer, pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA));
@@ -1693,15 +1692,15 @@ int pakfire_package_get_reverse_requires(pakfire_package* pkg,
                goto ERROR;
 
        // Get the pool ready
-       pakfire_pool_internalize(pkg->pakfire);
+       pakfire_root_pool_internalize(pkg->root);
 
-       Pool* pool = pakfire_get_solv_pool(pkg->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(pkg->root);
 
        // Search for any matches
        pool_whatmatchessolvable(pool, SOLVABLE_REQUIRES, pkg->id, &matches, 0);
 
        // Import the result to the package list
-       r = pakfire_packagelist_import_solvables(list, pkg->pakfire, &matches);
+       r = pakfire_packagelist_import_solvables(list, pkg->root, &matches);
        if (r < 0)
                goto ERROR;
 
@@ -1733,7 +1732,7 @@ static int pakfire_package_has_rich_deps_in_deparray(
                goto ERROR;
 
        for (int i = 0; i < q.count; i++) {
-               const char* dep = pakfire_dep2str(pkg->pakfire, q.elements[i]);
+               const char* dep = pakfire_dep2str(pkg->root, q.elements[i]);
 
                // Is this a rich dependency?
                if (dep && *dep == '(') {
@@ -1794,7 +1793,7 @@ static int pakfire_package_matches_depid(pakfire_package* pkg,
 int pakfire_package_matches_dep(pakfire_package* pkg,
                const enum pakfire_package_key key, const char* dep) {
        // Get the dependency
-       Id id = pakfire_str2dep(pkg->pakfire, dep);
+       Id id = pakfire_str2dep(pkg->root, dep);
        if (!id)
                return -EINVAL;
 
@@ -1808,7 +1807,7 @@ pakfire_repo* pakfire_package_get_repo(pakfire_package* pkg) {
        if (!pkg->repo) {
                Solvable* s = get_solvable(pkg);
 
-               r = pakfire_repo_open(&pkg->repo, pkg->pakfire, s->repo);
+               r = pakfire_repo_open(&pkg->repo, pkg->root, s->repo);
                if (r < 0)
                        return NULL;
        }
@@ -2256,7 +2255,7 @@ int pakfire_package_get_archive(pakfire_package* pkg, pakfire_archive** archive)
                return -errno;
 
        // Open archive
-       r = pakfire_archive_open(archive, pkg->pakfire, path);
+       r = pakfire_archive_open(archive, pkg->root, path);
        if (r < 0) {
                ERROR(pkg->ctx, "Could not open archive for %s (at %s): %s\n",
                        pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA), path, strerror(-r));
@@ -2267,7 +2266,7 @@ int pakfire_package_get_archive(pakfire_package* pkg, pakfire_archive** archive)
 }
 
 typedef struct pakfire_package_filelist_search {
-       struct pakfire* pakfire;
+       pakfire_root* root;
        pakfire_filelist* filelist;
        int r;
 } pakfire_package_filelist_search;
@@ -2291,7 +2290,7 @@ static int __pakfire_package_fetch_filelist(void* data, Solvable* s, Repodata* r
        }
 
        // Create a new file entry
-       r = pakfire_file_create(&file, search->pakfire, path);
+       r = pakfire_file_create(&file, search->root, path);
        if (r < 0)
                goto ERROR;
 
@@ -2312,7 +2311,7 @@ ERROR:
 
 static int pakfire_package_fetch_filelist(pakfire_package* pkg, pakfire_filelist* filelist) {
        pakfire_package_filelist_search search = {
-               .pakfire  = pkg->pakfire,
+               .root     = pkg->root,
                .filelist = filelist,
                .r = 0,
        };
@@ -2338,7 +2337,7 @@ pakfire_filelist* pakfire_package_get_filelist(pakfire_package* pkg) {
        pakfire_filelist* filelist = NULL;
 
        // Create a new filelist
-       int r = pakfire_filelist_create(&filelist, pkg->pakfire);
+       int r = pakfire_filelist_create(&filelist, pkg->root);
        if (r)
                goto ERROR;
 
@@ -2649,7 +2648,7 @@ static int pakfire_package_add_build_packages(pakfire_package* pkg,
        }
 
        // Fetch the installed repository
-       repo = pakfire_get_installed_repo(pkg->pakfire);
+       repo = pakfire_root_get_installed_repo(pkg->root);
        if (!repo) {
                ERROR(pkg->ctx, "Could not fetch the installed repository: %m\n");
                r = -EINVAL;
@@ -2922,7 +2921,7 @@ int pakfire_package_installcheck(pakfire_package* pkg,
        const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, pkg->pakfire, flags);
+       r = pakfire_transaction_create(&transaction, pkg->root, flags);
        if (r)
                goto ERROR;
 
index c45608854e69fb567842b85ca4008f601cbab143..d61f028a495b6bfdf88c22e8ed4007433ed43853 100644 (file)
@@ -80,7 +80,7 @@ enum pakfire_package_key {
        PAKFIRE_PKG_ENHANCES,
 };
 
-int pakfire_package_create(pakfire_package** package, struct pakfire* pakfire,
+int pakfire_package_create(pakfire_package** package, pakfire_root* root,
        pakfire_repo* repo, const char* name, const char* evr, const char* arch);
 
 pakfire_package* pakfire_package_ref(pakfire_package* pkg);
@@ -158,7 +158,7 @@ enum pakfire_package_dump_flags {
 int pakfire_package_installcheck(pakfire_package* pkg, char** problem, int flags);
 
 int pakfire_package_create_from_solvable(pakfire_package** package,
-       struct pakfire* pakfire, pakfire_repo* repo, Id id);
+       pakfire_root* root, pakfire_repo* repo, Id id);
 
 int pakfire_package_set_strings_from_string(pakfire_package* pkg,
        const enum pakfire_package_key key, const char* value);
index c435ebd7a929c210fd21a18dd38eda72bc9e1578..e4e156ba710dfa504e07807a27c6e75d01f14c56 100644 (file)
@@ -203,13 +203,13 @@ int pakfire_packagelist_walk(pakfire_packagelist* self,
 }
 
 int pakfire_packagelist_import_solvables(pakfire_packagelist* self,
-               struct pakfire* pakfire, Queue* q) {
+               pakfire_root* root, Queue* q) {
        pakfire_package* pkg = NULL;
        int r;
 
        // Walk through all elements on the queue
        for (int i = 0; i < q->count; i++) {
-               r = pakfire_package_create_from_solvable(&pkg, pakfire, NULL, q->elements[i]);
+               r = pakfire_package_create_from_solvable(&pkg, root, NULL, q->elements[i]);
                if (r)
                        return r;
 
index f86dd327bedaf92e5763ae3a646fb1de81d2bb9a..f29c3d712ceed906ca897553c97075796726a032 100644 (file)
@@ -50,7 +50,7 @@ int pakfire_packagelist_walk(pakfire_packagelist* list,
        pakfire_packagelist_walk_callback callback, void* p, int flags);
 
 int pakfire_packagelist_import_solvables(pakfire_packagelist* list,
-       struct pakfire* pakfire, Queue* q);
+       pakfire_root* root, Queue* q);
 
 int pakfire_packagelist_has_path(pakfire_packagelist* self, const char* path);
 
index e1ae7f47d494b465b349b6aa9be02d173c19cbec..be6ca959b5bbee165186d5c64e4c4ba7117ee23d 100644 (file)
@@ -47,7 +47,7 @@
 
 struct pakfire_packager {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        time_t time_created;
@@ -84,15 +84,15 @@ static void pakfire_packager_free(pakfire_packager* packager) {
                pakfire_filelist_unref(packager->filelist);
        if (packager->pkg)
                pakfire_package_unref(packager->pkg);
-       if (packager->pakfire)
-               pakfire_unref(packager->pakfire);
+       if (packager->root)
+               pakfire_root_unref(packager->root);
        if (packager->ctx)
                pakfire_ctx_unref(packager->ctx);
        free(packager);
 }
 
 int pakfire_packager_create(pakfire_packager** packager,
-               struct pakfire* pakfire, pakfire_package* pkg) {
+               pakfire_root* root, pakfire_package* pkg) {
        pakfire_packager* p = NULL;
        char hostname[HOST_NAME_MAX];
        int r = 1;
@@ -109,10 +109,10 @@ int pakfire_packager_create(pakfire_packager** packager,
        p->nrefs = 1;
 
        // Store a reference to the context
-       p->ctx = pakfire_get_ctx(pakfire);
+       p->ctx = pakfire_root_get_ctx(root);
 
        // Store a reference to Pakfire
-       p->pakfire = pakfire_ref(pakfire);
+       p->root = pakfire_root_ref(root);
 
        // Store a reference to the package
        p->pkg = pakfire_package_ref(pkg);
@@ -121,7 +121,7 @@ int pakfire_packager_create(pakfire_packager** packager,
        p->digests = PAKFIRE_PACKAGER_HASHES;
 
        // Set distribution
-       const char* tag = pakfire_get_distro_tag(p->pakfire);
+       const char* tag = pakfire_root_get_distro_tag(p->root);
        if (!tag) {
                ERROR(p->ctx, "Distribution tag is not configured: %m\n");
                goto ERROR;
@@ -147,12 +147,12 @@ int pakfire_packager_create(pakfire_packager** packager,
        pakfire_package_set_num(pkg, PAKFIRE_PKG_BUILD_TIME, p->time_created);
 
        // Create reader
-       p->reader = pakfire_get_disk_reader(p->pakfire);
+       p->reader = pakfire_root_get_disk_reader(p->root);
        if (!p->reader)
                goto ERROR;
 
        // Create filelist
-       r = pakfire_filelist_create(&p->filelist, p->pakfire);
+       r = pakfire_filelist_create(&p->filelist, p->root);
        if (r)
                goto ERROR;
 
@@ -330,8 +330,7 @@ int pakfire_packager_finish(pakfire_packager* packager, FILE* f) {
                goto ERROR;
 
        // Create a new archive writer
-       r = pakfire_archive_writer_create(&writer, packager->pakfire,
-                       PAKFIRE_FORMAT_SOURCE_ARCHIVE, f);
+       r = pakfire_archive_writer_create(&writer, packager->root, PAKFIRE_FORMAT_SOURCE_ARCHIVE, f);
        if (r < 0)
                goto ERROR;
 
@@ -411,7 +410,7 @@ int pakfire_packager_write_archive(pakfire_packager* self,
        f = NULL;
 
        // Open the archive
-       r = pakfire_archive_open(archive, self->pakfire, path);
+       r = pakfire_archive_open(archive, self->root, path);
        if (r < 0) {
                ERROR(self->ctx, "Could not open the generated archive at %s: %s\n",
                        path, strerror(-r));
@@ -518,7 +517,7 @@ int pakfire_packager_add(pakfire_packager* packager,
        }
 
        // Create a new file object from the archive entry
-       r = pakfire_file_create_from_archive_entry(&file, packager->pakfire, entry);
+       r = pakfire_file_create_from_archive_entry(&file, packager->root, entry);
        if (r < 0) {
                ERROR(packager->ctx, "Could not create file object: %s\n", strerror(-r));
                goto ERROR;
index 49a51ac29215332b1447f148e8da9fdada6a8a92..4e33ca16d882c7aa9298c09372bbad3243e81d63 100644 (file)
@@ -32,7 +32,7 @@
 typedef struct pakfire_packager pakfire_packager;
 
 int pakfire_packager_create(pakfire_packager** packager,
-       struct pakfire* pakfire, pakfire_package* pkg);
+       pakfire_root* root, pakfire_package* pkg);
 
 pakfire_packager* pakfire_packager_ref(pakfire_packager* packager);
 pakfire_packager* pakfire_packager_unref(pakfire_packager* packager);
index 275f9088b0a1799f66d74b77c9434f1c8b966304..cce15f68aec053767027fe337092cf5dc8db6f93 100644 (file)
@@ -65,7 +65,7 @@
 #include <pakfire/transaction.h>
 #include <pakfire/util.h>
 
-struct pakfire {
+struct pakfire_root {
        pakfire_ctx* ctx;
        int nrefs;
 
@@ -74,7 +74,7 @@ struct pakfire {
 
        char cache_path[PATH_MAX];
 
-       struct pakfire_arches {
+       struct pakfire_root_arches {
                char nominal[ARCH_MAX];
                const char* effective;
        } arches;
@@ -82,22 +82,22 @@ struct pakfire {
        int flags;
 
        // Keep some internal state
-       enum pakfire_internal_flags {
-               PAKFIRE_HAS_PATH        = (1 << 0),
-               PAKFIRE_DESTROY_ON_FREE = (1 << 1),
-               PAKFIRE_UMOUNT_PATH     = (1 << 2),
-               PAKFIRE_POOL_READY      = (1 << 3),
+       enum pakfire_root_internal_flags {
+               PAKFIRE_ROOT_HAS_PATH        = (1 << 0),
+               PAKFIRE_ROOT_DESTROY_ON_FREE = (1 << 1),
+               PAKFIRE_ROOT_UMOUNT_PATH     = (1 << 2),
+               PAKFIRE_ROOT_POOL_READY      = (1 << 3),
        } internal_flags;
 
        // UID/GID of running user
-       struct pakfire_user {
+       struct pakfire_root_user {
                uid_t uid;
                char name[NAME_MAX];
                char home[PATH_MAX];
                struct pakfire_subid subuids;
        } user;
 
-       struct pakfire_group {
+       struct pakfire_root_group {
                gid_t gid;
                char name[NAME_MAX];
                struct pakfire_subid subgids;
@@ -151,34 +151,34 @@ static const char* features[] = {
        NULL,
 };
 
-int pakfire_on_root(struct pakfire* pakfire) {
-       return (strcmp(pakfire->path, "/") == 0);
+int pakfire_root_on_root(pakfire_root* self) {
+       return (strcmp(self->path, "/") == 0);
 }
 
-uid_t pakfire_uid(struct pakfire* pakfire) {
-       return pakfire->user.uid;
+uid_t pakfire_root_uid(pakfire_root* self) {
+       return self->user.uid;
 }
 
-gid_t pakfire_gid(struct pakfire* pakfire) {
-       return pakfire->group.gid;
+gid_t pakfire_root_gid(pakfire_root* self) {
+       return self->group.gid;
 }
 
-const struct pakfire_subid* pakfire_subuid(struct pakfire* pakfire) {
-       return &pakfire->user.subuids;
+const struct pakfire_subid* pakfire_root_subuid(pakfire_root* self) {
+       return &self->user.subuids;
 }
 
-const struct pakfire_subid* pakfire_subgid(struct pakfire* pakfire) {
-       return &pakfire->group.subgids;
+const struct pakfire_subid* pakfire_root_subgid(pakfire_root* self) {
+       return &self->group.subgids;
 }
 
 /*
        Maps any UID/GIDs to the SUBUID/SUBGIDs so that we can transparently
        copy files in and out of the jail environment.
 */
-static unsigned int pakfire_map_id(struct pakfire* pakfire,
+static unsigned int pakfire_root_map_id(pakfire_root* self,
                const struct pakfire_subid* subid, const unsigned int id) {
        // Nothing to do if we are running on root
-       if (pakfire_on_root(pakfire))
+       if (pakfire_root_on_root(self))
                return id;
 
        // Map the ID
@@ -186,17 +186,17 @@ static unsigned int pakfire_map_id(struct pakfire* pakfire,
 
        // Check if the ID is in range
        if (id > subid->length) {
-               ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
+               ERROR(self->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
                mapped_id = subid->id;
        }
 
        return mapped_id;
 }
 
-static unsigned int pakfire_unmap_id(struct pakfire* pakfire,
+static unsigned int pakfire_root_unmap_id(pakfire_root* self,
                const struct pakfire_subid* subid, const unsigned int id) {
        // Nothing to do if we are running on root
-       if (pakfire_on_root(pakfire))
+       if (pakfire_root_on_root(self))
                return id;
 
        // Unmap the ID
@@ -204,7 +204,7 @@ static unsigned int pakfire_unmap_id(struct pakfire* pakfire,
 
        // Check if the ID is in range
        if (unmapped_id < 0) {
-               ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
+               ERROR(self->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
                unmapped_id = subid->id;
        }
 
@@ -212,12 +212,12 @@ static unsigned int pakfire_unmap_id(struct pakfire* pakfire,
 }
 
 static void pool_log(Pool* pool, void* data, int type, const char* s) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+       pakfire_root* self = data;
 
-       DEBUG(pakfire->ctx, "pool: %s", s);
+       DEBUG(self->ctx, "pool: %s", s);
 }
 
-static Id pakfire_handle_ns_pakfire(struct pakfire* pakfire, const char* name) {
+static Id pakfire_root_handle_ns_pakfire(pakfire_root* self, const char* name) {
        // Find all supported features
        for (const char** feature = features; *feature; feature++) {
                if (strcmp(*feature, name) == 0)
@@ -228,41 +228,41 @@ static Id pakfire_handle_ns_pakfire(struct pakfire* pakfire, const char* name) {
        return 0;
 }
 
-static Id pakfire_handle_ns_arch(struct pakfire* pakfire, const char* name) {
-       const char* arch = pakfire_get_arch(pakfire);
+static Id pakfire_root_handle_ns_arch(pakfire_root* self, const char* name) {
+       const char* arch = pakfire_root_get_arch(self);
 
        return strcmp(arch, name) == 0;
 }
 
-static Id pakfire_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+static Id pakfire_root_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
+       pakfire_root* self = data;
 
        const char* namespace = pool_id2str(pool, ns);
-       const char* name = pakfire_dep2str(pakfire, id);
+       const char* name = pakfire_dep2str(self, id);
 
-       DEBUG(pakfire->ctx, "Namespace callback called for %s(%s)\n", namespace, name);
+       DEBUG(self->ctx, "Namespace callback called for %s(%s)\n", namespace, name);
 
        // Handle the pakfire() namespace
        if (strcmp(namespace, "pakfire") == 0)
-               return pakfire_handle_ns_pakfire(pakfire, name);
+               return pakfire_root_handle_ns_pakfire(self, name);
 
        // Handle the arch() namespace
        else if (strcmp(namespace, "arch") == 0)
-               return pakfire_handle_ns_arch(pakfire, name);
+               return pakfire_root_handle_ns_arch(self, name);
 
        // Not handled here
        else
                return 0;
 }
 
-static int pakfire_setup_path(struct pakfire* self, const char* path) {
+static int pakfire_root_setup_path(pakfire_root* self, const char* path) {
        int r;
 
        // Template when running Pakfire in a temporary environment
        char tmppath[PATH_MAX] = PAKFIRE_TMP_DIR "/pakfire-root-XXXXXX";
 
        // Don't do any of this when in stub mode
-       if (pakfire_has_flag(self, PAKFIRE_FLAGS_STUB))
+       if (pakfire_root_has_flag(self, PAKFIRE_ROOT_FLAGS_STUB))
                return 0;
 
        // If we don't have a path, create something temporary...
@@ -273,7 +273,7 @@ static int pakfire_setup_path(struct pakfire* self, const char* path) {
                        return -errno;
 
                // Destroy the temporary directory afterwards
-               self->internal_flags |= PAKFIRE_DESTROY_ON_FREE;
+               self->internal_flags |= PAKFIRE_ROOT_DESTROY_ON_FREE;
 
                // Mount the snapshot
                if (self->snapshot) {
@@ -284,7 +284,7 @@ static int pakfire_setup_path(struct pakfire* self, const char* path) {
                        }
 
                // Mount a tmpfs
-               } else if (pakfire_has_flag(self, PAKFIRE_USE_TMPFS)) {
+               } else if (pakfire_root_has_flag(self, PAKFIRE_ROOT_USE_TMPFS)) {
                        r = mount("pakfire_root", path, "tmpfs", 0, NULL);
                        if (r) {
                                ERROR(self->ctx, "Could not mount tmpfs: %m\n");
@@ -292,7 +292,7 @@ static int pakfire_setup_path(struct pakfire* self, const char* path) {
                        }
 
                        // Umount path later
-                       self->internal_flags |= PAKFIRE_UMOUNT_PATH;
+                       self->internal_flags |= PAKFIRE_ROOT_UMOUNT_PATH;
                }
        }
 
@@ -314,36 +314,36 @@ static int pakfire_setup_path(struct pakfire* self, const char* path) {
        return 0;
 }
 
-static int pakfire_lock_running_kernel(struct pakfire* pakfire) {
+static int pakfire_root_lock_running_kernel(pakfire_root* self) {
        struct utsname utsname;
        char buffer[NAME_MAX];
 
        // Call uname()
        int r = uname(&utsname);
        if (r) {
-               ERROR(pakfire->ctx, "uname() failed: %m\n");
+               ERROR(self->ctx, "uname() failed: %m\n");
                return r;
        }
 
-       DEBUG(pakfire->ctx, "Locking running kernel %s\n", utsname.release);
+       DEBUG(self->ctx, "Locking running kernel %s\n", utsname.release);
 
        r = pakfire_string_format(buffer, "kernel(%s)", utsname.release);
        if (r)
                return r;
 
        // Add a locking pool job
-       Id id = pool_str2id(pakfire->pool, buffer, 1);
+       Id id = pool_str2id(self->pool, buffer, 1);
        if (id)
-               queue_push2(&pakfire->pool->pooljobs, SOLVER_LOCK|SOLVER_SOLVABLE_PROVIDES, id);
+               queue_push2(&self->pool->pooljobs, SOLVER_LOCK|SOLVER_SOLVABLE_PROVIDES, id);
 
        return 0;
 }
 
-static int pakfire_setup_pool(struct pakfire* pakfire) {
+static int pakfire_root_setup_pool(pakfire_root* self) {
        int r;
 
        // Initialize the pool
-       Pool* pool = pakfire->pool = pool_create();
+       Pool* pool = self->pool = pool_create();
        pool_setdisttype(pool, DISTTYPE_RPM);
 
        // Don't replace source packages with binary packages
@@ -355,26 +355,26 @@ static int pakfire_setup_pool(struct pakfire* pakfire) {
 #endif
 
        // Set architecture of the pool
-       pool_setarchpolicy(pool, pakfire_get_effective_arch(pakfire));
+       pool_setarchpolicy(pool, pakfire_root_get_effective_arch(self));
 
        // Set path
-       pool_set_rootdir(pool, pakfire->path);
+       pool_set_rootdir(pool, self->path);
 
        // Set debug callback
-       pool_setdebugcallback(pool, pool_log, pakfire);
+       pool_setdebugcallback(pool, pool_log, self);
 
        // Install namespace callback
-       pool_setnamespacecallback(pool, pakfire_namespace_callback, pakfire);
+       pool_setnamespacecallback(pool, pakfire_root_namespace_callback, self);
 
        // These packages can be installed multiple times simultaneously
-       static const char* pakfire_multiinstall_packages[] = {
+       static const char* pakfire_root_multiinstall_packages[] = {
                "kernel",
                "kernel-devel",
                NULL,
        };
 
-       for (const char** package = pakfire_multiinstall_packages; *package; package++) {
-               Id id = pakfire_str2dep(pakfire, *package);
+       for (const char** package = pakfire_root_multiinstall_packages; *package; package++) {
+               Id id = pakfire_str2dep(self, *package);
                if (!id)
                        continue;
 
@@ -382,8 +382,8 @@ static int pakfire_setup_pool(struct pakfire* pakfire) {
        }
 
        // Lock the running kernel
-       if (pakfire_on_root(pakfire)) {
-               r = pakfire_lock_running_kernel(pakfire);
+       if (pakfire_root_on_root(self)) {
+               r = pakfire_root_lock_running_kernel(self);
                if (r < 0)
                        return r;
        }
@@ -391,13 +391,13 @@ static int pakfire_setup_pool(struct pakfire* pakfire) {
        return 0;
 }
 
-static int pakfire_load_installed_packages(struct pakfire* self) {
+static int pakfire_root_load_installed_packages(pakfire_root* self) {
        pakfire_repo* repo = NULL;
        pakfire_db* db = NULL;
        int r;
 
        // Fetch the system repository
-       repo = pakfire_get_repo(self, PAKFIRE_REPO_SYSTEM);
+       repo = pakfire_root_get_repo(self, PAKFIRE_REPO_SYSTEM);
 
        // Open the database (or create a new one)
        r = pakfire_db_open(&db, self, PAKFIRE_DB_READWRITE);
@@ -418,7 +418,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_setup_default_repos(struct pakfire* self) {
+static int pakfire_root_setup_default_repos(pakfire_root* self) {
        pakfire_repo* commandline = NULL;
        pakfire_repo* dummy = NULL;
        pakfire_repo* system = NULL;
@@ -456,97 +456,96 @@ ERROR:
        return r;
 }
 
-static void pakfire_free(struct pakfire* pakfire) {
+static void pakfire_root_free(pakfire_root* self) {
        pakfire_repo* repo = NULL;
        int r;
 
        // Avoid recursive free
-       if (pakfire->in_free)
+       if (self->in_free)
                return;
 
-       pakfire->in_free = 1;
+       self->in_free = 1;
 
        // Destroy the commandline repository
-       repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_COMMANDLINE);
+       repo = pakfire_root_get_repo(self, PAKFIRE_REPO_COMMANDLINE);
        if (repo) {
                r = pakfire_repo_clean(repo, PAKFIRE_REPO_CLEAN_FLAGS_DESTROY);
                if (r)
-                       ERROR(pakfire->ctx, "Could not cleanup %s repository: %m\n", PAKFIRE_REPO_COMMANDLINE);
+                       ERROR(self->ctx, "Could not cleanup %s repository: %m\n", PAKFIRE_REPO_COMMANDLINE);
 
                pakfire_repo_unref(repo);
        }
 
        // Write back the local repository
-       repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
+       repo = pakfire_root_get_repo(self, PAKFIRE_REPO_LOCAL);
        if (repo) {
                // Write back the local repository metadata
                r = pakfire_repo_write_metadata(repo, NULL);
                if (r)
-                       ERROR(pakfire->ctx, "Could not write the local repository: %s. Ignoring.\n", strerror(-r));
+                       ERROR(self->ctx, "Could not write the local repository: %s. Ignoring.\n", strerror(-r));
 
                pakfire_repo_unref(repo);
        }
 
        // Close the path
-       if (pakfire->fd >= 0)
-               close(pakfire->fd);
+       if (self->fd >= 0)
+               close(self->fd);
 
        // Umount the snapshot
-       if (pakfire->snapshot) {
-               r = pakfire_snapshot_umount(pakfire->snapshot);
+       if (self->snapshot) {
+               r = pakfire_snapshot_umount(self->snapshot);
                if (r)
-                       ERROR(pakfire->ctx, "Could not umount the snapshot: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not umount the snapshot: %s\n", strerror(-r));
 
-               pakfire_snapshot_unref(pakfire->snapshot);
+               pakfire_snapshot_unref(self->snapshot);
        }
 
        // Umount path
-       if (pakfire->internal_flags & PAKFIRE_UMOUNT_PATH) {
-               r = umount2(pakfire->path, 0);
+       if (self->internal_flags & PAKFIRE_ROOT_UMOUNT_PATH) {
+               r = umount2(self->path, 0);
                if (r)
-                       ERROR(pakfire->ctx, "Could not umount ramdisk at %s: %m\n", pakfire->path);
+                       ERROR(self->ctx, "Could not umount ramdisk at %s: %m\n", self->path);
        }
 
        // Destroy path
-       if (pakfire->internal_flags & PAKFIRE_DESTROY_ON_FREE) {
-               DEBUG(pakfire->ctx, "Destroying %s\n", pakfire->path);
+       if (self->internal_flags & PAKFIRE_ROOT_DESTROY_ON_FREE) {
+               DEBUG(self->ctx, "Destroying %s\n", self->path);
 
                // Destroy the temporary directory
-               r = pakfire_rmtree(pakfire->path, 0);
+               r = pakfire_rmtree(self->path, 0);
                if (r)
-                       ERROR(pakfire->ctx, "Could not destroy %s: %s\n", pakfire->path, strerror(-r));
+                       ERROR(self->ctx, "Could not destroy %s: %s\n", self->path, strerror(-r));
        }
 
-       pakfire_repo_free_all(pakfire);
+       pakfire_repo_free_all(self);
 
-       if (pakfire->pool)
-               pool_free(pakfire->pool);
-       if (pakfire->writer)
-               archive_write_free(pakfire->writer);
-       if (pakfire->config)
-               pakfire_config_unref(pakfire->config);
-       if (pakfire->ctx)
-               pakfire_ctx_unref(pakfire->ctx);
-
-       free(pakfire);
+       if (self->pool)
+               pool_free(self->pool);
+       if (self->writer)
+               archive_write_free(self->writer);
+       if (self->config)
+               pakfire_config_unref(self->config);
+       if (self->ctx)
+               pakfire_ctx_unref(self->ctx);
+       free(self);
 }
 
 // Safety check in case this is being launched on the host system
-static int pakfire_safety_checks(struct pakfire* pakfire) {
+static int pakfire_root_safety_checks(pakfire_root* self) {
        // Nothing to do if we are not working on root
-       if (!pakfire_on_root(pakfire))
+       if (!pakfire_root_on_root(self))
                return 0;
 
        // We must be root in order to operate in /
-       if (pakfire->user.uid) {
-               ERROR(pakfire->ctx, "Must be running as root on /\n");
+       if (self->user.uid) {
+               ERROR(self->ctx, "Must be running as root on /\n");
                return -EPERM;
        }
 
        return 0;
 }
 
-static int pakfire_read_one_repo_config(struct pakfire* pakfire, DIR* dir, const char* path) {
+static int pakfire_root_read_one_repo_config(pakfire_root* self, DIR* dir, const char* path) {
        FILE* f = NULL;
        int fd = -1;
        int r;
@@ -562,7 +561,7 @@ static int pakfire_read_one_repo_config(struct pakfire* pakfire, DIR* dir, const
                return -errno;
 
        // Read the configuration
-       r = pakfire_config_read(pakfire->config, f);
+       r = pakfire_config_read(self->config, f);
 
        // Cleanup
        fclose(f);
@@ -570,17 +569,17 @@ static int pakfire_read_one_repo_config(struct pakfire* pakfire, DIR* dir, const
        return r;
 }
 
-static int pakfire_read_repo_config(struct pakfire* pakfire) {
+static int pakfire_root_read_repo_config(pakfire_root* self) {
        struct dirent* entry = NULL;
        char path[PATH_MAX];
        int r;
 
        // Make path absolute
-       r = pakfire_path(pakfire, path, "%s", PAKFIRE_CONFIG_DIR "/repos");
+       r = pakfire_root_path(self, path, "%s", PAKFIRE_CONFIG_DIR "/repos");
        if (r)
                return r;
 
-       DEBUG(pakfire->ctx, "Reading repository configuration from %s\n", path);
+       DEBUG(self->ctx, "Reading repository configuration from %s\n", path);
 
        // Open path
        DIR* dir = opendir(path);
@@ -590,7 +589,7 @@ static int pakfire_read_repo_config(struct pakfire* pakfire) {
                                return 0;
 
                        default:
-                               ERROR(pakfire->ctx, "Could not open %s: %m\n", path);
+                               ERROR(self->ctx, "Could not open %s: %m\n", path);
                                return -errno;
                }
        }
@@ -609,7 +608,7 @@ static int pakfire_read_repo_config(struct pakfire* pakfire) {
                        continue;
 
                // Read the configuration
-               r = pakfire_read_one_repo_config(pakfire, dir, entry->d_name);
+               r = pakfire_root_read_one_repo_config(self, dir, entry->d_name);
                if (r)
                        goto ERROR;
        }
@@ -624,29 +623,29 @@ ERROR:
        return r;
 }
 
-static int pakfire_setup_local_repo(struct pakfire* self) {
+static int pakfire_root_setup_local_repo(pakfire_root* self) {
        pakfire_repo* local = NULL;
        char path[PATH_MAX];
        char url[PATH_MAX];
        int r;
 
        // Fetch distro ID
-       const char* distro_id = pakfire_get_distro_id(self);
+       const char* distro_id = pakfire_root_get_distro_id(self);
        if (!distro_id) {
                ERROR(self->ctx, "Could not fetch the distro ID\n");
                return -EINVAL;
        }
 
        // Fetch the distro version ID
-       const char* version_id = pakfire_get_distro_version_id(self);
+       const char* version_id = pakfire_root_get_distro_version_id(self);
        if (!version_id) {
                ERROR(self->ctx, "Could not fetch the distro version ID\n");
                return -EINVAL;
        }
 
        // Make the repository path
-       r = pakfire_string_format(path,
-                       "~/.local/share/%s/local/%s/%s", PACKAGE_NAME, distro_id, version_id);
+       r = pakfire_string_format(path, "~/.local/share/%s/local/%s/%s",
+                       PACKAGE_NAME, distro_id, version_id);
        if (r < 0) {
                ERROR(self->ctx, "Could not compose the local repository path: %s\n", strerror(-r));
                goto ERROR;
@@ -702,148 +701,148 @@ ERROR:
        return r;
 }
 
-static int pakfire_refresh_repo(struct pakfire* pakfire, pakfire_repo* repo, void* data) {
+static int pakfire_root_refresh_repo(pakfire_root* self, pakfire_repo* repo, void* data) {
        return pakfire_repo_refresh(repo, 0);
 }
 
-const char* pakfire_get_distro_name(struct pakfire* pakfire) {
-       if (*pakfire->distro.name)
-               return pakfire->distro.name;
+const char* pakfire_root_get_distro_name(pakfire_root* self) {
+       if (*self->distro.name)
+               return self->distro.name;
 
        return NULL;
 }
 
-const char* pakfire_get_distro_id(struct pakfire* pakfire) {
-       if (*pakfire->distro.id)
-               return pakfire->distro.id;
+const char* pakfire_root_get_distro_id(pakfire_root* self) {
+       if (*self->distro.id)
+               return self->distro.id;
 
        return NULL;
 }
 
-const char* pakfire_get_distro_vendor(struct pakfire* pakfire) {
-       if (*pakfire->distro.vendor)
-               return pakfire->distro.vendor;
+const char* pakfire_root_get_distro_vendor(pakfire_root* self) {
+       if (*self->distro.vendor)
+               return self->distro.vendor;
 
        return NULL;
 }
 
-const char* pakfire_get_distro_version(struct pakfire* pakfire) {
-       if (*pakfire->distro.version)
-               return pakfire->distro.version;
+const char* pakfire_root_get_distro_version(pakfire_root* self) {
+       if (*self->distro.version)
+               return self->distro.version;
 
        return NULL;
 }
 
-const char* pakfire_get_distro_version_id(struct pakfire* pakfire) {
-       if (*pakfire->distro.version_id)
-               return pakfire->distro.version_id;
+const char* pakfire_root_get_distro_version_id(pakfire_root* self) {
+       if (*self->distro.version_id)
+               return self->distro.version_id;
 
        return NULL;
 }
 
-const char* pakfire_get_distro_tag(struct pakfire* pakfire) {
+const char* pakfire_root_get_distro_tag(pakfire_root* self) {
        int r;
 
        // Generate the tag
-       if (!*pakfire->distro.tag) {
-               r = pakfire_string_format(pakfire->distro.tag,
-                               "%s%s", pakfire->distro.id, pakfire->distro.version_id);
+       if (!*self->distro.tag) {
+               r = pakfire_string_format(self->distro.tag, "%s%s",
+                               self->distro.id, self->distro.version_id);
                if (r < 0) {
                        errno = -r;
                        return NULL;
                }
        }
 
-       return pakfire->distro.tag;
+       return self->distro.tag;
 }
 
-static int pakfire_config_import_distro(struct pakfire* pakfire) {
+static int pakfire_root_config_import_distro(pakfire_root* self) {
        int r;
 
        // Nothing to do if there is no distro section
-       if (!pakfire_config_has_section(pakfire->config, "distro"))
+       if (!pakfire_config_has_section(self->config, "distro"))
                return 0;
 
        // Name
-       const char* name = pakfire_config_get(pakfire->config, "distro", "name", NULL);
+       const char* name = pakfire_config_get(self->config, "distro", "name", NULL);
        if (name) {
-               r = pakfire_string_set(pakfire->distro.name, name);
+               r = pakfire_string_set(self->distro.name, name);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro name: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro name: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // ID
-       const char* id = pakfire_config_get(pakfire->config, "distro", "id", NULL);
+       const char* id = pakfire_config_get(self->config, "distro", "id", NULL);
        if (id) {
-               r = pakfire_string_set(pakfire->distro.id, id);
+               r = pakfire_string_set(self->distro.id, id);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro ID: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro ID: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // Version ID
-       const char* version_id = pakfire_config_get(pakfire->config, "distro", "version_id", NULL);
+       const char* version_id = pakfire_config_get(self->config, "distro", "version_id", NULL);
        if (version_id) {
-               r = pakfire_string_set(pakfire->distro.version_id, version_id);
+               r = pakfire_string_set(self->distro.version_id, version_id);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro version ID: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro version ID: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // Codename
-       const char* codename = pakfire_config_get(pakfire->config, "distro", "codename", NULL);
+       const char* codename = pakfire_config_get(self->config, "distro", "codename", NULL);
        if (codename) {
-               r = pakfire_string_set(pakfire->distro.version_codename, codename);
+               r = pakfire_string_set(self->distro.version_codename, codename);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro codename: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro codename: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // Fill in version
-       if (*pakfire->distro.version_codename) {
-               r = pakfire_string_format(pakfire->distro.version, "%s (%s)",
-                               pakfire->distro.version_id, pakfire->distro.version_codename);
+       if (*self->distro.version_codename) {
+               r = pakfire_string_format(self->distro.version, "%s (%s)",
+                               self->distro.version_id, self->distro.version_codename);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro version: %s\n", strerror(-r));
                        return r;
                }
        } else {
-               r = pakfire_string_set(pakfire->distro.version, pakfire->distro.version_id);
+               r = pakfire_string_set(self->distro.version, self->distro.version_id);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro version: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // Fill in pretty name
-       r = pakfire_string_format(pakfire->distro.pretty_name, "%s %s",
-                       pakfire->distro.name, pakfire->distro.version);
+       r = pakfire_string_format(self->distro.pretty_name, "%s %s",
+                       self->distro.name, self->distro.version);
        if (r < 0) {
-               ERROR(pakfire->ctx, "Could not set distro pretty name: %s\n", strerror(-r));
+               ERROR(self->ctx, "Could not set distro pretty name: %s\n", strerror(-r));
                return r;
        }
 
        // Vendor
-       const char* vendor = pakfire_config_get(pakfire->config, "distro", "vendor", NULL);
+       const char* vendor = pakfire_config_get(self->config, "distro", "vendor", NULL);
        if (vendor) {
-               r = pakfire_string_set(pakfire->distro.vendor, vendor);
+               r = pakfire_string_set(self->distro.vendor, vendor);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro vendor: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro vendor: %s\n", strerror(-r));
                        return r;
                }
        }
 
        // Slogan
-       const char* slogan = pakfire_config_get(pakfire->config, "distro", "slogan", NULL);
+       const char* slogan = pakfire_config_get(self->config, "distro", "slogan", NULL);
        if (slogan) {
-               r = pakfire_string_set(pakfire->distro.slogan, slogan);
+               r = pakfire_string_set(self->distro.slogan, slogan);
                if (r < 0) {
-                       ERROR(pakfire->ctx, "Could not set distro slogan: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not set distro slogan: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -851,7 +850,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        return 0;
 }
 
-static int pakfire_read_os_release(struct pakfire* pakfire, const char* path) {
+static int pakfire_root_read_os_release(pakfire_root* self, const char* path) {
        char file[PATH_MAX];
        int r;
 
@@ -861,14 +860,14 @@ static int pakfire_read_os_release(struct pakfire* pakfire, const char* path) {
                return r;
 
        // Read the distro
-       r = pakfire_distro(&pakfire->distro, file);
+       r = pakfire_distro(&self->distro, file);
        if (r < 0) {
                switch (-r) {
                        case ENOENT:
                                return 0;
 
                        default:
-                               ERROR(pakfire->ctx, "Could not read /etc/os-release: %s\n", strerror(-r));
+                               ERROR(self->ctx, "Could not read /etc/os-release: %s\n", strerror(-r));
                                break;
                }
        }
@@ -876,16 +875,16 @@ static int pakfire_read_os_release(struct pakfire* pakfire, const char* path) {
        return r;
 }
 
-static int pakfire_set_cache_path(struct pakfire* pakfire) {
-       const char* cache_path = pakfire_ctx_get_cache_path(pakfire->ctx);
-       const char* arch = pakfire_get_effective_arch(pakfire);
+static int pakfire_root_set_cache_path(pakfire_root* self) {
+       const char* cache_path = pakfire_ctx_get_cache_path(self->ctx);
+       const char* arch = pakfire_root_get_effective_arch(self);
 
        // Format the final path
-       return pakfire_string_format(pakfire->cache_path, "%s/%s/%s/%s",
-               cache_path, pakfire->distro.id, pakfire->distro.version_id, arch);
+       return pakfire_string_format(self->cache_path, "%s/%s/%s/%s",
+               cache_path, self->distro.id, self->distro.version_id, arch);
 }
 
-static int pakfire_setup_user(struct pakfire* pakfire) {
+static int pakfire_root_setup_user(pakfire_root* self) {
        struct passwd user;
        struct passwd* u = NULL;
        struct group group;
@@ -903,15 +902,15 @@ static int pakfire_setup_user(struct pakfire* pakfire) {
                goto ERROR;
 
        // Store UID
-       pakfire->user.uid = pakfire->user.subuids.id = uid;
+       self->user.uid = self->user.subuids.id = uid;
 
        // Store username
-       r = pakfire_string_set(pakfire->user.name, user.pw_name);
+       r = pakfire_string_set(self->user.name, user.pw_name);
        if (r)
                goto ERROR;
 
        // Store home directory
-       r = pakfire_string_set(pakfire->user.home, user.pw_dir);
+       r = pakfire_string_set(self->user.home, user.pw_dir);
        if (r)
                goto ERROR;
 
@@ -921,10 +920,10 @@ static int pakfire_setup_user(struct pakfire* pakfire) {
                goto ERROR;
 
        // Store GID
-       pakfire->group.gid = pakfire->group.subgids.id = gid;
+       self->group.gid = self->group.subgids.id = gid;
 
        // Store name
-       r = pakfire_string_set(pakfire->group.name, group.gr_name);
+       r = pakfire_string_set(self->group.name, group.gr_name);
        if (r)
                goto ERROR;
 
@@ -936,14 +935,14 @@ static int pakfire_setup_user(struct pakfire* pakfire) {
                from /etc/sub{u,g}id.
        */
        if (uid == 0)
-               pakfire->user.subuids.length = pakfire->group.subgids.length = 0xffffffff - 1;
+               self->user.subuids.length = self->group.subgids.length = 0xffffffff - 1;
        else
-               pakfire->user.subuids.length = pakfire->group.subgids.length = 1;
+               self->user.subuids.length = self->group.subgids.length = 1;
 
        // Read SUBUID/SUBGIDs from file
-       if (!pakfire_on_root(pakfire)) {
+       if (!pakfire_root_on_root(self)) {
                // Fetch SUBUIDs
-               r = pakfire_getsubuid(pakfire, pakfire->user.name, &pakfire->user.subuids);
+               r = pakfire_getsubuid(self, self->user.name, &self->user.subuids);
                switch (r) {
                        case 0:
                        case 1:
@@ -954,7 +953,7 @@ static int pakfire_setup_user(struct pakfire* pakfire) {
                }
 
                // Fetch SUBGIDs
-               r = pakfire_getsubgid(pakfire, pakfire->user.name, &pakfire->group.subgids);
+               r = pakfire_getsubgid(self, self->user.name, &self->group.subgids);
                switch (r) {
                        case 0:
                        case 1:
@@ -972,9 +971,9 @@ ERROR:
        return r;
 }
 
-int pakfire_create(struct pakfire** pakfire, pakfire_ctx* ctx,
+int pakfire_root_create(pakfire_root** root, pakfire_ctx* ctx,
                pakfire_config* config, const char* path, const char* arch, int flags) {
-       struct pakfire* p = NULL;
+       pakfire_root* self = NULL;
        int r;
 
        // Always require a configuration
@@ -988,14 +987,14 @@ int pakfire_create(struct pakfire** pakfire, pakfire_ctx* ctx,
        // Check path
        if (path) {
                // Check that we don't have a path in stub mode
-               if (flags & PAKFIRE_FLAGS_STUB) {
+               if (flags & PAKFIRE_ROOT_FLAGS_STUB) {
                        ERROR(ctx, "Cannot use path in stub mode\n");
                        r = -EINVAL;
                        goto ERROR;
                }
 
                // Check that we don't have path set when using snapshots
-               if (flags & PAKFIRE_USE_SNAPSHOT) {
+               if (flags & PAKFIRE_ROOT_USE_SNAPSHOT) {
                        ERROR(ctx, "Cannot use path with snapshots\n");
                        r = -EINVAL;
                        goto ERROR;
@@ -1010,217 +1009,219 @@ int pakfire_create(struct pakfire** pakfire, pakfire_ctx* ctx,
        }
 
        // Allocate a new object
-       p = calloc(1, sizeof(*p));
-       if (!p)
+       self = calloc(1, sizeof(*self));
+       if (!self)
                return -errno;
 
        // Reference the context
-       p->ctx = pakfire_ctx_ref(ctx);
+       self->ctx = pakfire_ctx_ref(ctx);
 
        // Initialize the reference counter
-       p->nrefs = 1;
+       self->nrefs = 1;
 
        // Store the flags
-       p->flags = flags;
+       self->flags = flags;
 
        // Store a reference to the configuration
-       p->config = pakfire_config_ref(config);
+       self->config = pakfire_config_ref(config);
 
        // Initialize file descriptors
-       p->fd = -EBADF;
+       self->fd = -EBADF;
 
        // Store the nominal architecture
-       r = pakfire_string_set(p->arches.nominal, arch);
+       r = pakfire_string_set(self->arches.nominal, arch);
        if (r < 0)
                goto ERROR;
 
        // Determine the effective architecture
-       p->arches.effective = pakfire_arch_is_supported_by_host(arch);
-       if (!p->arches.effective) {
-               ERROR(p->ctx, "Unsupported architecture: %s\n", arch);
+       self->arches.effective = pakfire_arch_is_supported_by_host(arch);
+       if (!self->arches.effective) {
+               ERROR(self->ctx, "Unsupported architecture: %s\n", arch);
                r = -ENOTSUP;
                goto ERROR;
        }
 
        // Setup user/group
-       r = pakfire_setup_user(p);
+       r = pakfire_root_setup_user(self);
        if (r < 0) {
-               ERROR(p->ctx, "Could not parse user information: %s\n", strerror(-r));
+               ERROR(self->ctx, "Could not parse user information: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Store if we have a path
        if (path)
-               p->internal_flags |= PAKFIRE_HAS_PATH;
+               self->internal_flags |= PAKFIRE_ROOT_HAS_PATH;
 
        // Import distro configuration
-       r = pakfire_config_import_distro(p);
+       r = pakfire_root_config_import_distro(self);
        if (r < 0) {
-               ERROR(p->ctx, "Could not parse distribution from configuration: %s\n", strerror(-r));
+               ERROR(self->ctx, "Could not parse distribution from configuration: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Read /etc/os-release
-       if (p->internal_flags & PAKFIRE_HAS_PATH) {
-               r = pakfire_read_os_release(p, path);
+       if (self->internal_flags & PAKFIRE_ROOT_HAS_PATH) {
+               r = pakfire_root_read_os_release(self, path);
                if (r < 0)
                        goto ERROR;
 
                // Perform some safety checks
-               r = pakfire_safety_checks(p);
+               r = pakfire_root_safety_checks(self);
                if (r < 0)
                        goto ERROR;
        }
 
        // Set cache path
-       r = pakfire_set_cache_path(p);
+       r = pakfire_root_set_cache_path(self);
        if (r < 0) {
-               ERROR(p->ctx, "Could not set cache path: %m\n");
+               ERROR(self->ctx, "Could not set cache path: %m\n");
                goto ERROR;
        }
 
        // Are we using a snapshot?
-       if (p->flags & PAKFIRE_USE_SNAPSHOT) {
+       if (self->flags & PAKFIRE_ROOT_USE_SNAPSHOT) {
                // Find the most recent snapshot
-               r = pakfire_snapshot_find(&p->snapshot, p);
+               r = pakfire_snapshot_find(&self->snapshot, self);
                if (r < 0) {
-                       ERROR(p->ctx, "Could not find a snapshot: %s\n", strerror(-r));
+                       ERROR(self->ctx, "Could not find a snapshot: %s\n", strerror(-r));
                        goto ERROR;
                }
        }
 
        // Setup path
-       r = pakfire_setup_path(p, path);
+       r = pakfire_root_setup_path(self, path);
        if (r < 0)
                goto ERROR;
 
        // Setup the pool
-       r = pakfire_setup_pool(p);
+       r = pakfire_root_setup_pool(self);
        if (r < 0)
                goto ERROR;
 
        // Create the default repositories
-       r = pakfire_setup_default_repos(p);
+       r = pakfire_root_setup_default_repos(self);
        if (r < 0)
                goto ERROR;
 
        // Create repositories
-       r = pakfire_repo_import(p, p->config);
+       r = pakfire_repo_import(self, self->config);
        if (r < 0)
                goto ERROR;
 
        // Skip a couple of steps when in stub mode
-       if (!pakfire_has_flag(p, PAKFIRE_FLAGS_STUB)) {
+       if (!pakfire_root_has_flag(self, PAKFIRE_ROOT_FLAGS_STUB)) {
                // Setup the local repository
-               if (p->flags & (PAKFIRE_FLAGS_BUILD|PAKFIRE_FLAGS_BUILD_LOCAL)) {
-                       r = pakfire_setup_local_repo(p);
+               if (self->flags & (PAKFIRE_ROOT_FLAGS_BUILD|PAKFIRE_ROOT_FLAGS_BUILD_LOCAL)) {
+                       r = pakfire_root_setup_local_repo(self);
                        if (r < 0)
                                goto ERROR;
                }
 
                // Read repository configuration
-               if (p->internal_flags & PAKFIRE_HAS_PATH) {
-                       r = pakfire_read_repo_config(p);
+               if (self->internal_flags & PAKFIRE_ROOT_HAS_PATH) {
+                       r = pakfire_root_read_repo_config(self);
                        if (r < 0)
                                goto ERROR;
                }
        }
 
        // Load installed packages
-       if (!pakfire_has_flag(p, PAKFIRE_FLAGS_STUB)) {
-               r = pakfire_load_installed_packages(p);
+       if (!pakfire_root_has_flag(self, PAKFIRE_ROOT_FLAGS_STUB)) {
+               r = pakfire_root_load_installed_packages(self);
                if (r < 0)
                        goto ERROR;
        }
 
        // Refresh repositories
-       r = pakfire_repo_walk(p, pakfire_refresh_repo, NULL);
+       r = pakfire_root_repo_walk(self, pakfire_root_refresh_repo, NULL);
        if (r < 0)
                goto ERROR;
 
-       DEBUG(p->ctx, "Pakfire initialized at %p\n", p);
-       DEBUG(p->ctx, "  user   = %s (%u)\n", p->user.name, p->user.uid);
-       DEBUG(p->ctx, "  group  = %s (%u)\n", p->group.name, p->group.gid);
-       DEBUG(p->ctx, "  arch   = %s (%s)\n", pakfire_get_arch(p), pakfire_get_effective_arch(p));
-       DEBUG(p->ctx, "  path   = %s\n", pakfire_get_path(p));
-       if (p->user.subuids.id)
-               DEBUG(p->ctx, "  subuid = %u (%zu)\n", p->user.subuids.id, p->user.subuids.length);
-       if (p->group.subgids.id)
-               DEBUG(p->ctx, "  subgid = %u (%zu)\n", p->group.subgids.id, p->group.subgids.length);
+       DEBUG(self->ctx, "Pakfire initialized at %p\n", self);
+       DEBUG(self->ctx, "  user   = %s (%u)\n", self->user.name, self->user.uid);
+       DEBUG(self->ctx, "  group  = %s (%u)\n", self->group.name, self->group.gid);
+       DEBUG(self->ctx, "  arch   = %s (%s)\n",
+                       pakfire_root_get_arch(self), pakfire_root_get_effective_arch(self));
+       DEBUG(self->ctx, "  path   = %s\n", pakfire_root_get_path(self));
+       if (self->user.subuids.id)
+               DEBUG(self->ctx, "  subuid = %u (%zu)\n",
+                               self->user.subuids.id, self->user.subuids.length);
+       if (self->group.subgids.id)
+               DEBUG(self->ctx, "  subgid = %u (%zu)\n",
+                               self->group.subgids.id, self->group.subgids.length);
 
        // Dump distribution configuration
-       DEBUG(p->ctx, "  Distribution: %s\n", p->distro.pretty_name);
-       DEBUG(p->ctx, "    name       = %s\n", p->distro.name);
-       DEBUG(p->ctx, "    id         = %s\n", p->distro.id);
-       DEBUG(p->ctx, "    version    = %s\n", p->distro.version);
-       DEBUG(p->ctx, "    version_id = %s\n", p->distro.version_id);
-       if (*p->distro.version_codename)
-               DEBUG(p->ctx, "    codename   = %s\n", p->distro.version_codename);
-       if (*p->distro.vendor)
-               DEBUG(p->ctx, "    vendor     = %s\n", p->distro.vendor);
-       if (*p->distro.slogan)
-               DEBUG(p->ctx, "    slogan     = %s\n", p->distro.slogan);
+       DEBUG(self->ctx, "  Distribution: %s\n", self->distro.pretty_name);
+       DEBUG(self->ctx, "    name       = %s\n", self->distro.name);
+       DEBUG(self->ctx, "    id         = %s\n", self->distro.id);
+       DEBUG(self->ctx, "    version    = %s\n", self->distro.version);
+       DEBUG(self->ctx, "    version_id = %s\n", self->distro.version_id);
+       if (*self->distro.version_codename)
+               DEBUG(self->ctx, "    codename   = %s\n", self->distro.version_codename);
+       if (*self->distro.vendor)
+               DEBUG(self->ctx, "    vendor     = %s\n", self->distro.vendor);
+       if (*self->distro.slogan)
+               DEBUG(self->ctx, "    slogan     = %s\n", self->distro.slogan);
 
        // Return the pointer
-       *pakfire = pakfire_ref(p);
+       *root = pakfire_root_ref(self);
 
 ERROR:
-       if (p)
-               pakfire_unref(p);
+       if (self)
+               pakfire_root_unref(self);
 
        return r;
 }
 
-struct pakfire* pakfire_ref(struct pakfire* pakfire) {
-       ++pakfire->nrefs;
+pakfire_root* pakfire_root_ref(pakfire_root* self) {
+       ++self->nrefs;
 
-       return pakfire;
+       return self;
 }
 
-struct pakfire* pakfire_unref(struct pakfire* pakfire) {
-       if (--pakfire->nrefs > 0)
-               return pakfire;
+pakfire_root* pakfire_root_unref(pakfire_root* self) {
+       if (--self->nrefs > 0)
+               return self;
 
-       pakfire_free(pakfire);
+       pakfire_root_free(self);
        return NULL;
 }
 
-pakfire_ctx* pakfire_get_ctx(struct pakfire* pakfire) {
-       return pakfire_ctx_ref(pakfire->ctx);
+pakfire_ctx* pakfire_root_get_ctx(pakfire_root* self) {
+       return pakfire_ctx_ref(self->ctx);
 }
 
-int pakfire_has_flag(struct pakfire* pakfire, const int flag) {
-       return pakfire->flags & flag;
+int pakfire_root_has_flag(pakfire_root* self, const int flag) {
+       return self->flags & flag;
 }
 
-pakfire_config* pakfire_get_config(struct pakfire* pakfire) {
-       if (!pakfire->config)
+pakfire_config* pakfire_root_get_config(pakfire_root* self) {
+       if (!self->config)
                return NULL;
 
-       return pakfire_config_ref(pakfire->config);
+       return pakfire_config_ref(self->config);
 }
 
-const char* pakfire_get_path(struct pakfire* pakfire) {
-       return pakfire->path;
+const char* pakfire_root_get_path(pakfire_root* self) {
+       return self->path;
 }
 
-int pakfire_openat(struct pakfire* pakfire, const char* path, int flags) {
+int pakfire_root_openat(pakfire_root* self, const char* path, int flags) {
        // Make paths relative
        while (*path == '/')
                path++;
 
-       return openat(pakfire->fd, path, flags);
+       return openat(self->fd, path, flags);
 }
 
-int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length,
-               const char* format, ...) {
+int __pakfire_root_path(pakfire_root* self, char* path, const size_t length, const char* format, ...) {
        char buffer[PATH_MAX];
        va_list args;
        int r;
 
        // Check if path is set
-       if (!*pakfire->path) {
-               ERROR(pakfire->ctx, "pakfire_path() called without path being set\n");
+       if (!*self->path) {
+               ERROR(self->ctx, "pakfire_path() called without path being set\n");
                return -ENOTSUP;
        }
 
@@ -1234,14 +1235,14 @@ int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length,
                return r;
 
        // Join paths together
-       return __pakfire_path_append(path, length, pakfire->path, buffer);
+       return __pakfire_path_append(path, length, self->path, buffer);
 }
 
-const char* pakfire_relpath(struct pakfire* pakfire, const char* path) {
-       return pakfire_path_relpath(pakfire->path, path);
+const char* pakfire_root_relpath(pakfire_root* self, const char* path) {
+       return pakfire_path_relpath(self->path, path);
 }
 
-int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length,
+int __pakfire_root_cache_path(pakfire_root* self, char* path, size_t length,
                const char* format, ...) {
        char buffer[PATH_MAX];
        va_list args;
@@ -1257,26 +1258,26 @@ int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length,
                return r;
 
        // Join paths together
-       return __pakfire_path_append(path, length, pakfire->cache_path, buffer);
+       return __pakfire_path_append(path, length, self->cache_path, buffer);
 }
 
-int pakfire_repo_walk(struct pakfire* pakfire,
-               pakfire_repo_walk_callback callback, void* p) {
+int pakfire_root_repo_walk(pakfire_root* self,
+               pakfire_root_repo_walk_callback callback, void* p) {
        pakfire_repo* repo = NULL;
        Repo* solv_repo = NULL;
        int i = 0;
        int r;
 
-       Pool* pool = pakfire->pool;
+       Pool* pool = self->pool;
 
        // Run func for every repository
        FOR_REPOS(i, solv_repo) {
-               r = pakfire_repo_open(&repo, pakfire, solv_repo);
+               r = pakfire_repo_open(&repo, self, solv_repo);
                if (r < 0)
                        return r;
 
                // Run callback
-               r = callback(pakfire, repo, p);
+               r = callback(self, repo, p);
                pakfire_repo_unref(repo);
 
                // Raise any errors
@@ -1287,28 +1288,27 @@ int pakfire_repo_walk(struct pakfire* pakfire,
        return 0;
 }
 
-static int __pakfire_repo_clean(struct pakfire* pakfire, pakfire_repo* repo,
-               void* p) {
+static int __pakfire_root_repo_clean(pakfire_root* self, pakfire_repo* repo, void* p) {
        int flags = *(int*)p;
 
        return pakfire_repo_clean(repo, flags);
 }
 
-int pakfire_clean(struct pakfire* pakfire, int flags) {
+int pakfire_root_clean(pakfire_root* self, int flags) {
        int r;
 
        // Clean all repositories
-       r = pakfire_repo_walk(pakfire, __pakfire_repo_clean, &flags);
+       r = pakfire_root_repo_walk(self, __pakfire_root_repo_clean, &flags);
        if (r)
                return r;
 
        // Clean all snapshots
-       r = pakfire_snapshot_clean(pakfire);
+       r = pakfire_snapshot_clean(self);
        if (r < 0)
                return r;
 
        // Clean build environments
-       r = pakfire_build_clean(pakfire, flags);
+       r = pakfire_build_clean(self, flags);
        if (r)
                return r;
 
@@ -1316,54 +1316,53 @@ int pakfire_clean(struct pakfire* pakfire, int flags) {
        return pakfire_rmtree(PAKFIRE_CACHE_DIR, 0);
 }
 
-const char* pakfire_get_arch(struct pakfire* pakfire) {
-       return pakfire->arches.nominal;
+const char* pakfire_root_get_arch(pakfire_root* self) {
+       return self->arches.nominal;
 }
 
-const char* pakfire_get_effective_arch(struct pakfire* pakfire) {
-       return pakfire->arches.effective;
+const char* pakfire_root_get_effective_arch(pakfire_root* self) {
+       return self->arches.effective;
 }
 
-int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2) {
-       return pool_evrcmp_str(pakfire->pool, evr1, evr2, EVRCMP_COMPARE);
+int pakfire_root_version_compare(pakfire_root* self, const char* evr1, const char* evr2) {
+       return pool_evrcmp_str(self->pool, evr1, evr2, EVRCMP_COMPARE);
 }
 
-Pool* pakfire_get_solv_pool(struct pakfire* pakfire) {
-       return pakfire->pool;
+Pool* pakfire_root_get_solv_pool(pakfire_root* self) {
+       return self->pool;
 }
 
-void pakfire_pool_has_changed(struct pakfire* pakfire) {
-       pakfire->internal_flags &= ~PAKFIRE_POOL_READY;
+void pakfire_root_pool_has_changed(pakfire_root* self) {
+       self->internal_flags &= ~PAKFIRE_ROOT_POOL_READY;
 }
 
-static int __pakfire_repo_internalize(struct pakfire* pakfire, pakfire_repo* repo,
-               void* p) {
+static int __pakfire_root_repo_internalize(pakfire_root* self, pakfire_repo* repo, void* p) {
        int flags = *(int*)p;
 
        return pakfire_repo_internalize(repo, flags);
 }
 
-void pakfire_pool_internalize(struct pakfire* pakfire) {
+void pakfire_root_pool_internalize(pakfire_root* self) {
        int flags = 0;
 
        // Nothing to do if the pool is ready
-       if (pakfire->internal_flags & PAKFIRE_POOL_READY)
+       if (self->internal_flags & PAKFIRE_ROOT_POOL_READY)
                return;
 
        // Internalize all repositories
-       pakfire_repo_walk(pakfire, __pakfire_repo_internalize, &flags);
+       pakfire_root_repo_walk(self, __pakfire_root_repo_internalize, &flags);
 
        // Create fileprovides
-       pool_addfileprovides(pakfire->pool);
+       pool_addfileprovides(self->pool);
 
        // Create whatprovides index
-       pool_createwhatprovides(pakfire->pool);
+       pool_createwhatprovides(self->pool);
 
        // Mark the pool as ready
-       pakfire->internal_flags |= PAKFIRE_POOL_READY;
+       self->internal_flags |= PAKFIRE_ROOT_POOL_READY;
 }
 
-pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire) {
+pakfire_repolist* pakfire_root_get_repos(pakfire_root* self) {
        pakfire_repo* repo = NULL;
        pakfire_repolist* list;
 
@@ -1371,7 +1370,7 @@ pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire) {
        if (r)
                return NULL;
 
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(self);
        Repo* solv_repo;
        int i;
 
@@ -1381,7 +1380,7 @@ pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire) {
                        continue;
 
                // Create repository
-               r = pakfire_repo_open(&repo, pakfire, solv_repo);
+               r = pakfire_repo_open(&repo, self, solv_repo);
                if (r < 0)
                        goto ERROR;
 
@@ -1402,19 +1401,19 @@ ERROR:
        return NULL;
 }
 
-pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name) {
+pakfire_repo* pakfire_root_get_repo(pakfire_root* self, const char* name) {
        pakfire_repo* repo = NULL;
        Repo* solv_repo = NULL;
        int r;
        int i;
 
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(self);
        if (!pool)
                return NULL;
 
        FOR_REPOS(i, solv_repo) {
                if (strcmp(solv_repo->name, name) == 0) {
-                       r = pakfire_repo_open(&repo, pakfire, solv_repo);
+                       r = pakfire_repo_open(&repo, self, solv_repo);
                        if (r < 0)
                                return NULL;
 
@@ -1426,15 +1425,15 @@ pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name) {
        return NULL;
 }
 
-pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire) {
+pakfire_repo* pakfire_root_get_installed_repo(pakfire_root* self) {
        pakfire_repo* repo = NULL;
        int r;
 
-       if (!pakfire->pool->installed)
+       if (!self->pool->installed)
                return NULL;
 
        // Open the repository
-       r = pakfire_repo_open(&repo, pakfire, pakfire->pool->installed);
+       r = pakfire_repo_open(&repo, self, self->pool->installed);
        if (r < 0)
                return NULL;
 
@@ -1444,13 +1443,13 @@ pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire) {
 /*
        Convenience function to dist() a package on the fly
 */
-static int pakfire_commandline_dist(struct pakfire* pakfire, pakfire_repo* repo,
-               const char* path, pakfire_package** pkg) {
+static int pakfire_root_commandline_dist(pakfire_root* self,
+               pakfire_repo* repo, const char* path, pakfire_package** pkg) {
        pakfire_archive* archive = NULL;
        int r;
 
        // Run dist()
-       r = pakfire_dist(pakfire, path, &archive);
+       r = pakfire_dist(self, path, &archive);
        if (r < 0)
                goto ERROR;
 
@@ -1469,15 +1468,15 @@ ERROR:
 /*
        Convenience function to add a package to the @commandline repository
 */
-int pakfire_commandline_add(struct pakfire* pakfire, const char* path,
-               pakfire_package** package) {
+int pakfire_root_commandline_add(pakfire_root* self,
+               const char* path, pakfire_package** package) {
        pakfire_repo* repo = NULL;
        int r;
 
        // Find the commandline repository
-       repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_COMMANDLINE);
+       repo = pakfire_root_get_repo(self, PAKFIRE_REPO_COMMANDLINE);
        if (!repo) {
-               ERROR(pakfire->ctx, "Could not find the commandline repository: %m\n");
+               ERROR(self->ctx, "Could not find the commandline repository: %m\n");
                return 1;
        }
 
@@ -1485,7 +1484,7 @@ int pakfire_commandline_add(struct pakfire* pakfire, const char* path,
        r = pakfire_repo_add(repo, path, package);
        switch (-r) {
                case ENOMSG:
-                       r = pakfire_commandline_dist(pakfire, repo, path, package);
+                       r = pakfire_root_commandline_dist(self, repo, path, package);
                        break;
 
                default:
@@ -1499,20 +1498,20 @@ ERROR:
        return r;
 }
 
-static int __pakfire_search(struct pakfire* pakfire, pakfire_packagelist* list,
+static int __pakfire_root_search(pakfire_root* self, pakfire_packagelist* list,
                const Id* keys, const char* what, int flags) {
        Dataiterator di;
        Queue matches;
        int r;
 
        // Get the pool ready
-       pakfire_pool_internalize(pakfire);
+       pakfire_root_pool_internalize(self);
 
        // Initialize the result queue
        queue_init(&matches);
 
        // Setup the data interator
-       dataiterator_init(&di, pakfire->pool, 0, 0, 0, what, flags);
+       dataiterator_init(&di, self->pool, 0, 0, 0, what, flags);
 
        // Search through these keys and add matches to the queue
        for (const Id* key = keys; *key; key++) {
@@ -1524,7 +1523,7 @@ static int __pakfire_search(struct pakfire* pakfire, pakfire_packagelist* list,
        }
 
        // Import matches into the package list
-       r = pakfire_packagelist_import_solvables(list, pakfire, &matches);
+       r = pakfire_packagelist_import_solvables(list, self, &matches);
        if (r)
                goto ERROR;
 
@@ -1535,25 +1534,25 @@ ERROR:
        return r;
 }
 
-static int pakfire_search_filelist(struct pakfire* pakfire, const char* what, int flags,
+static int pakfire_root_search_filelist(pakfire_root* self, const char* what, int flags,
                pakfire_packagelist* list) {
        const Id keys[] = {
                SOLVABLE_FILELIST,
                ID_NULL,
        };
 
-       return __pakfire_search(pakfire, list, keys, what, SEARCH_FILES|SEARCH_GLOB);
+       return __pakfire_root_search(self, list, keys, what, SEARCH_FILES|SEARCH_GLOB);
 }
 
-static int pakfire_search_dep(struct pakfire* pakfire, Id type, const char* what, int flags,
+static int pakfire_root_search_dep(pakfire_root* self, Id type, const char* what, int flags,
                pakfire_packagelist* list) {
        int r;
 
        // Get the pool ready
-       pakfire_pool_internalize(pakfire);
+       pakfire_root_pool_internalize(self);
 
        // Translate dependency to ID
-       Id dep = pakfire_str2dep(pakfire, what);
+       Id dep = pakfire_str2dep(self, what);
        if (!dep) {
                errno = EINVAL;
                return 1;
@@ -1563,10 +1562,10 @@ static int pakfire_search_dep(struct pakfire* pakfire, Id type, const char* what
        queue_init(&matches);
 
        // Search for anything that matches
-       pool_whatmatchesdep(pakfire->pool, type, dep, &matches, 0);
+       pool_whatmatchesdep(self->pool, type, dep, &matches, 0);
 
        // Add the result to the packagelist
-       r = pakfire_packagelist_import_solvables(list, pakfire, &matches);
+       r = pakfire_packagelist_import_solvables(list, self, &matches);
        if (r)
                goto ERROR;
 
@@ -1576,7 +1575,7 @@ ERROR:
        return r;
 }
 
-int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_whatprovides(pakfire_root* self, const char* what, int flags,
                pakfire_packagelist* list) {
        int r;
 
@@ -1587,13 +1586,13 @@ int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags,
        }
 
        // Search for all packages that match this dependency
-       r = pakfire_search_dep(pakfire, SOLVABLE_PROVIDES, what, flags, list);
+       r = pakfire_root_search_dep(self, SOLVABLE_PROVIDES, what, flags, list);
        if (r)
                return r;
 
        // Search the filelist
        if (*what == '/') {
-               r = pakfire_search_filelist(pakfire, what, flags, list);
+               r = pakfire_root_search_filelist(self, what, flags, list);
                if (r)
                        return r;
        }
@@ -1601,7 +1600,7 @@ int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags,
        return 0;
 }
 
-static int __pakfire_whatrequires(pakfire_ctx* ctx, pakfire_package* pkg, void* data) {
+static int __pakfire_root_whatrequires(pakfire_ctx* ctx, pakfire_package* pkg, void* data) {
        pakfire_packagelist* reverse = NULL;
        pakfire_packagelist* list = data;
        int r;
@@ -1623,7 +1622,7 @@ ERROR:
        return r;
 }
 
-int pakfire_whatrequires(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_whatrequires(pakfire_root* self, const char* what, int flags,
                pakfire_packagelist* list) {
        pakfire_packagelist* packages = NULL;
        int r;
@@ -1634,22 +1633,22 @@ int pakfire_whatrequires(struct pakfire* pakfire, const char* what, int flags,
        };
 
        // Create a new package list
-       r = pakfire_packagelist_create(&packages, pakfire->ctx);
+       r = pakfire_packagelist_create(&packages, self->ctx);
        if (r)
                goto ERROR;
 
        // Find any packages that match the name
-       r = __pakfire_search(pakfire, packages, keys, what, SEARCH_STRING);
+       r = __pakfire_root_search(self, packages, keys, what, SEARCH_STRING);
        if (r)
                goto ERROR;
 
        // Find everything for all packages
-       r = pakfire_packagelist_walk(packages, __pakfire_whatrequires, list, 0);
+       r = pakfire_packagelist_walk(packages, __pakfire_root_whatrequires, list, 0);
        if (r)
                goto ERROR;
 
        // Append any simple dependencies
-       r = pakfire_search_dep(pakfire, SOLVABLE_REQUIRES, what, flags, list);
+       r = pakfire_root_search_dep(self, SOLVABLE_REQUIRES, what, flags, list);
        if (r)
                goto ERROR;
 
@@ -1660,7 +1659,7 @@ ERROR:
        return r;
 }
 
-int pakfire_search(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_search(pakfire_root* self, const char* what, int flags,
                pakfire_packagelist* list) {
        const Id keys[] = {
                SOLVABLE_NAME,
@@ -1674,83 +1673,83 @@ int pakfire_search(struct pakfire* pakfire, const char* what, int flags,
                ID_NULL
        };
 
-       return __pakfire_search(pakfire,
+       return __pakfire_root_search(self,
                list,
-               (flags & PAKFIRE_SEARCH_NAME_ONLY) ? keys_name_only : keys,
+               (flags & PAKFIRE_ROOT_SEARCH_NAME_ONLY) ? keys_name_only : keys,
                what,
                SEARCH_SUBSTRING|SEARCH_NOCASE);
 }
 
-static const char* pakfire_user_lookup(void* data, la_int64_t uid) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+static const char* pakfire_root_user_lookup(void* data, la_int64_t uid) {
+       pakfire_root* self = data;
 
        // Unmap the UID first
-       uid = pakfire_unmap_id(pakfire, &pakfire->user.subuids, uid);
+       uid = pakfire_root_unmap_id(self, &self->user.subuids, uid);
 
        // Fast path for "root"
        if (uid == 0)
                return "root";
 
-       DEBUG(pakfire->ctx, "Looking up name for UID %ld\n", uid);
+       DEBUG(self->ctx, "Looking up name for UID %ld\n", uid);
 
        // Find a matching entry in /etc/passwd
-       struct passwd* entry = pakfire_getpwuid(pakfire, uid);
+       struct passwd* entry = pakfire_getpwuid(self, uid);
        if (!entry) {
-               ERROR(pakfire->ctx, "Could not retrieve uname for %ld: %m\n", uid);
+               ERROR(self->ctx, "Could not retrieve uname for %ld: %m\n", uid);
                return 0;
        }
 
-       DEBUG(pakfire->ctx, "Mapping UID %ld to %s\n", uid, entry->pw_name);
+       DEBUG(self->ctx, "Mapping UID %ld to %s\n", uid, entry->pw_name);
 
        return entry->pw_name;
 }
 
-static const char* pakfire_group_lookup(void* data, la_int64_t gid) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+static const char* pakfire_root_group_lookup(void* data, la_int64_t gid) {
+       pakfire_root* self = data;
 
        // Unmap the GID first
-       gid = pakfire_unmap_id(pakfire, &pakfire->group.subgids, gid);
+       gid = pakfire_root_unmap_id(self, &self->group.subgids, gid);
 
        // Fast path for "root"
        if (gid == 0)
                return "root";
 
-       DEBUG(pakfire->ctx, "Looking up name for GID %ld\n", gid);
+       DEBUG(self->ctx, "Looking up name for GID %ld\n", gid);
 
        // Find a matching entry in /etc/group
-       struct group* entry = pakfire_getgrgid(pakfire, gid);
+       struct group* entry = pakfire_getgrgid(self, gid);
        if (!entry) {
-               ERROR(pakfire->ctx, "Could not retrieve gname for %ld: %m\n", gid);
+               ERROR(self->ctx, "Could not retrieve gname for %ld: %m\n", gid);
                return 0;
        }
 
-       DEBUG(pakfire->ctx, "Mapping GID %ld to %s\n", gid, entry->gr_name);
+       DEBUG(self->ctx, "Mapping GID %ld to %s\n", gid, entry->gr_name);
 
        return entry->gr_name;
 }
 
-struct archive* pakfire_get_disk_reader(struct pakfire* pakfire) {
+struct archive* pakfire_root_get_disk_reader(pakfire_root* self) {
        struct archive* reader = NULL;
        int r;
 
        // Create a new reader
        reader = archive_read_disk_new();
        if (!reader) {
-               ERROR(pakfire->ctx, "Could not set up reader: %m\n");
+               ERROR(self->ctx, "Could not set up reader: %m\n");
                return NULL;
        }
 
        // Do not read fflags
        r = archive_read_disk_set_behavior(reader, ARCHIVE_READDISK_NO_FFLAGS);
        if (r) {
-               ERROR(pakfire->ctx, "Could not change behavior of reader: %s\n",
+               ERROR(self->ctx, "Could not change behavior of reader: %s\n",
                        archive_error_string(reader));
                goto ERROR;
        }
 
        // Install user/group lookups
-       archive_read_disk_set_uname_lookup(reader, pakfire, pakfire_user_lookup, NULL);
-       archive_read_disk_set_gname_lookup(reader, pakfire, pakfire_group_lookup, NULL);
+       archive_read_disk_set_uname_lookup(reader, self, pakfire_root_user_lookup, NULL);
+       archive_read_disk_set_gname_lookup(reader, self, pakfire_root_group_lookup, NULL);
 
        return reader;
 
@@ -1761,8 +1760,8 @@ ERROR:
        return NULL;
 }
 
-static la_int64_t pakfire_uid_lookup(void* data, const char* name, la_int64_t uid) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+static la_int64_t pakfire_root_uid_lookup(void* data, const char* name, la_int64_t uid) {
+       pakfire_root* self = data;
 
        // Cannot handle empty names
        if (!*name)
@@ -1772,26 +1771,26 @@ static la_int64_t pakfire_uid_lookup(void* data, const char* name, la_int64_t ui
        if (strcmp(name, "root") == 0)
                goto ERROR;
 
-       DEBUG(pakfire->ctx, "Looking up UID for '%s' (%ld)\n", name, uid);
+       DEBUG(self->ctx, "Looking up UID for '%s' (%ld)\n", name, uid);
 
        // Find a matching entry in /etc/passwd
-       struct passwd* entry = pakfire_getpwnam(pakfire, name);
+       struct passwd* entry = pakfire_getpwnam(self, name);
        if (!entry) {
-               ERROR(pakfire->ctx, "Could not retrieve UID for '%s': %m\n", name);
+               ERROR(self->ctx, "Could not retrieve UID for '%s': %m\n", name);
                goto ERROR;
        }
 
-       DEBUG(pakfire->ctx, "Mapping %s to UID %u\n", name, entry->pw_uid);
+       DEBUG(self->ctx, "Mapping %s to UID %u\n", name, entry->pw_uid);
 
-       return pakfire_map_id(pakfire, &pakfire->user.subuids, entry->pw_uid);
+       return pakfire_root_map_id(self, &self->user.subuids, entry->pw_uid);
 
 ERROR:
        // Return root on error
-       return pakfire_map_id(pakfire, &pakfire->user.subuids, 0);
+       return pakfire_root_map_id(self, &self->user.subuids, 0);
 }
 
-static la_int64_t pakfire_gid_lookup(void* data, const char* name, la_int64_t gid) {
-       struct pakfire* pakfire = (struct pakfire*)data;
+static la_int64_t pakfire_root_gid_lookup(void* data, const char* name, la_int64_t gid) {
+       pakfire_root* self = data;
 
        // Cannot handle empty names
        if (!*name)
@@ -1801,25 +1800,25 @@ static la_int64_t pakfire_gid_lookup(void* data, const char* name, la_int64_t gi
        if (strcmp(name, "root") == 0)
                goto ERROR;
 
-       DEBUG(pakfire->ctx, "Looking up GID for '%s' (%ld)\n", name, gid);
+       DEBUG(self->ctx, "Looking up GID for '%s' (%ld)\n", name, gid);
 
        // Find a matching entry in /etc/group
-       struct group* entry = pakfire_getgrnam(pakfire, name);
+       struct group* entry = pakfire_getgrnam(self, name);
        if (!entry) {
-               ERROR(pakfire->ctx, "Could not retrieve GID for '%s': %m\n", name);
+               ERROR(self->ctx, "Could not retrieve GID for '%s': %m\n", name);
                goto ERROR;
        }
 
-       DEBUG(pakfire->ctx, "Mapping %s to GID %u\n", name, entry->gr_gid);
+       DEBUG(self->ctx, "Mapping %s to GID %u\n", name, entry->gr_gid);
 
-       return pakfire_map_id(pakfire, &pakfire->group.subgids, entry->gr_gid);
+       return pakfire_root_map_id(self, &self->group.subgids, entry->gr_gid);
 
 ERROR:
        // Return root on error
-       return pakfire_map_id(pakfire, &pakfire->group.subgids, 0);
+       return pakfire_root_map_id(self, &self->group.subgids, 0);
 }
 
-struct archive* pakfire_get_disk_writer(struct pakfire* pakfire) {
+struct archive* pakfire_root_get_disk_writer(pakfire_root* self) {
        // Set flags for extracting files
        const int flags =
                ARCHIVE_EXTRACT_ACL |
@@ -1829,39 +1828,38 @@ struct archive* pakfire_get_disk_writer(struct pakfire* pakfire) {
                ARCHIVE_EXTRACT_UNLINK |
                ARCHIVE_EXTRACT_XATTR;
 
-       if (!pakfire->writer) {
+       if (!self->writer) {
                // Create a new writer
-               pakfire->writer = archive_write_disk_new();
-               if (!pakfire->writer) {
-                       ERROR(pakfire->ctx, "Could not set up writer: %m\n");
+               self->writer = archive_write_disk_new();
+               if (!self->writer) {
+                       ERROR(self->ctx, "Could not set up writer: %m\n");
                        return NULL;
                }
 
-               archive_write_disk_set_options(pakfire->writer, flags);
+               archive_write_disk_set_options(self->writer, flags);
 
                // Install our own routine for user/group lookups
-               archive_write_disk_set_user_lookup(pakfire->writer,
-                       pakfire, pakfire_uid_lookup, NULL);
-               archive_write_disk_set_group_lookup(pakfire->writer,
-                       pakfire, pakfire_gid_lookup, NULL);
+               archive_write_disk_set_user_lookup(self->writer,
+                       self, pakfire_root_uid_lookup, NULL);
+               archive_write_disk_set_group_lookup(self->writer,
+                       self, pakfire_root_gid_lookup, NULL);
        }
 
-       return pakfire->writer;
+       return self->writer;
 }
 
 // Convenience functions to install/erase/update packages
 
-static int pakfire_verify(struct pakfire* pakfire, int *changed) {
+static int pakfire_root_verify(pakfire_root* self, int *changed) {
 #if 0
-       return pakfire_perform_transaction_simple(pakfire, 0, PAKFIRE_JOB_VERIFY,
+       return pakfire_root_perform_transaction_simple(self, 0, pakfire_root_JOB_VERIFY,
                0, changed, NULL, NULL);
 #endif
        #warning TODO
        return 0;
 }
 
-static int pakfire_check_files(struct pakfire* pakfire,
-               pakfire_db* db, pakfire_filelist* errors) {
+static int pakfire_root_check_files(pakfire_root* self, pakfire_db* db, pakfire_filelist* errors) {
        pakfire_filelist* filelist = NULL;
        int r;
 
@@ -1880,12 +1878,12 @@ ERROR:
        return r;
 }
 
-int pakfire_check(struct pakfire* pakfire, pakfire_filelist* errors) {
+int pakfire_root_check(pakfire_root* self, pakfire_filelist* errors) {
        pakfire_db* db = NULL;
        int r;
 
        // Open database in read-only mode and try to load all installed packages
-       r = pakfire_db_open(&db, pakfire, PAKFIRE_DB_READWRITE);
+       r = pakfire_db_open(&db, self, PAKFIRE_DB_READWRITE);
        if (r)
                goto ERROR;
 
@@ -1895,12 +1893,12 @@ int pakfire_check(struct pakfire* pakfire, pakfire_filelist* errors) {
                goto ERROR;
 
        // Check if all dependencies are intact
-       r = pakfire_verify(pakfire, NULL);
+       r = pakfire_root_verify(self, NULL);
        if (r)
                goto ERROR;
 
        // Check files
-       r = pakfire_check_files(pakfire, db, errors);
+       r = pakfire_root_check_files(self, db, errors);
        if (r)
                goto ERROR;
 
@@ -1911,12 +1909,12 @@ ERROR:
        return r;
 }
 
-int pakfire_update_snapshot(struct pakfire* pakfire) {
+int pakfire_root_update_snapshot(pakfire_root* self) {
        pakfire_snapshot* snapshot = NULL;
        int r;
 
        // Make a new snapshot
-       r = pakfire_snapshot_make(&snapshot, pakfire);
+       r = pakfire_snapshot_make(&snapshot, self);
        if (r < 0)
                goto ERROR;
 
@@ -1930,7 +1928,7 @@ ERROR:
 /*
  * Convenience function to install a couple of packages. Simple.
  */
-int pakfire_install(struct pakfire* self, const char** packages) {
+int pakfire_root_install(pakfire_root* self, const char** packages) {
        pakfire_transaction* transaction = NULL;
        char* problems = NULL;
        int r;
index b02be311788511d95dacb828d3bb1fb327d8d2b1..a0e902175a4add3dbc416f1d5b99889ad44244f0 100644 (file)
@@ -18,8 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
-#ifndef PAKFIRE_PAKFIRE_H
-#define PAKFIRE_PAKFIRE_H
+#ifndef PAKFIRE_ROOT_H
+#define PAKFIRE_ROOT_H
 
 #include <stdarg.h>
 #include <stddef.h>
@@ -31,7 +31,7 @@
 // libsolv
 #include <solv/pool.h>
 
-struct pakfire;
+typedef struct pakfire_root pakfire_root;
 
 #include <pakfire/config.h>
 #include <pakfire/ctx.h>
@@ -45,112 +45,108 @@ struct pakfire;
 #include <pakfire/repolist.h>
 #include <pakfire/transaction.h>
 
-enum pakfire_flags {
-       PAKFIRE_FLAGS_STUB              = (1 << 0),
-       PAKFIRE_FLAGS_BUILD             = (1 << 1),
-       PAKFIRE_FLAGS_BUILD_LOCAL       = (1 << 2),
-       PAKFIRE_USE_TMPFS               = (1 << 3),
-       PAKFIRE_USE_SNAPSHOT            = (1 << 4),
+enum pakfire_rootflags {
+       PAKFIRE_ROOT_FLAGS_STUB              = (1 << 0),
+       PAKFIRE_ROOT_FLAGS_BUILD             = (1 << 1),
+       PAKFIRE_ROOT_FLAGS_BUILD_LOCAL       = (1 << 2),
+       PAKFIRE_ROOT_USE_TMPFS               = (1 << 3),
+       PAKFIRE_ROOT_USE_SNAPSHOT            = (1 << 4),
 };
 
-int pakfire_create(struct pakfire** pakfire, pakfire_ctx* ctx,
+int pakfire_root_create(pakfire_root** pakfire, pakfire_ctx* ctx,
        pakfire_config* config, const char* path, const char* arch, int flags);
 
-struct pakfire* pakfire_ref(struct pakfire* pakfire);
-struct pakfire* pakfire_unref(struct pakfire* pakfire);
+pakfire_root* pakfire_root_ref(pakfire_root* pakfire);
+pakfire_root* pakfire_root_unref(pakfire_root* pakfire);
 
-int pakfire_has_flag(struct pakfire* pakfire, const int flag);
+int pakfire_root_has_flag(pakfire_root* pakfire, const int flag);
 
-const char* pakfire_get_path(struct pakfire* pakfire);
+const char* pakfire_root_get_path(pakfire_root* pakfire);
 
-int pakfire_clean(struct pakfire* pakfire, int flags);
+int pakfire_root_clean(pakfire_root* pakfire, int flags);
 
-const char* pakfire_get_arch(struct pakfire* pakfire);
+const char* pakfire_root_get_arch(pakfire_root* pakfire);
 
-int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2);
+int pakfire_root_version_compare(pakfire_root* pakfire, const char* evr1, const char* evr2);
 
-pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire);
-pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name);
+pakfire_repolist* pakfire_root_get_repos(pakfire_root* pakfire);
+pakfire_repo* pakfire_root_get_repo(pakfire_root* pakfire, const char* name);
 
-int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_whatprovides(pakfire_root* pakfire, const char* what, int flags,
        pakfire_packagelist* list);
-int pakfire_whatrequires(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_whatrequires(pakfire_root* pakfire, const char* what, int flags,
        pakfire_packagelist* list);
 
 // Search
 
-enum pakfire_search_flags {
-       PAKFIRE_SEARCH_NAME_ONLY        = (1 << 0),
+enum pakfire_rootsearch_flags {
+       PAKFIRE_ROOT_SEARCH_NAME_ONLY        = (1 << 0),
 };
 
-int pakfire_search(struct pakfire* pakfire, const char* what, int flags,
+int pakfire_root_search(pakfire_root* pakfire, const char* what, int flags,
        pakfire_packagelist* list);
 
 // Check
 
-int pakfire_check(struct pakfire* pakfire, pakfire_filelist* errors);
+int pakfire_root_check(pakfire_root* pakfire, pakfire_filelist* errors);
 
 // Snapshots
-int pakfire_update_snapshot(struct pakfire* pakfire);
+int pakfire_root_update_snapshot(pakfire_root* pakfire);
 
-pakfire_ctx* pakfire_get_ctx(struct pakfire* pakfire);
+pakfire_ctx* pakfire_root_get_ctx(pakfire_root* pakfire);
 
-const char* pakfire_get_effective_arch(struct pakfire* pakfire);
+const char* pakfire_root_get_effective_arch(pakfire_root* pakfire);
 
-int pakfire_on_root(struct pakfire* pakfire);
+int pakfire_root_on_root(pakfire_root* pakfire);
 
-uid_t pakfire_uid(struct pakfire* pakfire);
-gid_t pakfire_gid(struct pakfire* pakfire);
+uid_t pakfire_root_uid(pakfire_root* pakfire);
+gid_t pakfire_root_gid(pakfire_root* pakfire);
 
-const struct pakfire_subid* pakfire_subuid(struct pakfire* pakfire);
-const struct pakfire_subid* pakfire_subgid(struct pakfire* pakfire);
+const struct pakfire_subid* pakfire_root_subuid(pakfire_root* pakfire);
+const struct pakfire_subid* pakfire_root_subgid(pakfire_root* pakfire);
 
-pakfire_config* pakfire_get_config(struct pakfire* pakfire);
+pakfire_config* pakfire_root_get_config(pakfire_root* pakfire);
 
-int pakfire_confirm(struct pakfire* pakfire, const char* message, const char* question);
-int pakfire_pick_solution(struct pakfire* pakfire, pakfire_transaction* transaction);
-int pakfire_setup_progress(struct pakfire* pakfire, pakfire_progress* progress);
+const char* pakfire_root_get_distro_name(pakfire_root* pakfire);
+const char* pakfire_root_get_distro_id(pakfire_root* pakfire);
+const char* pakfire_root_get_distro_vendor(pakfire_root* pakfire);
+const char* pakfire_root_get_distro_version(pakfire_root* pakfire);
+const char* pakfire_root_get_distro_version_id(pakfire_root* pakfire);
+const char* pakfire_root_get_distro_tag(pakfire_root* pakfire);
 
-const char* pakfire_get_distro_name(struct pakfire* pakfire);
-const char* pakfire_get_distro_id(struct pakfire* pakfire);
-const char* pakfire_get_distro_vendor(struct pakfire* pakfire);
-const char* pakfire_get_distro_version(struct pakfire* pakfire);
-const char* pakfire_get_distro_version_id(struct pakfire* pakfire);
-const char* pakfire_get_distro_tag(struct pakfire* pakfire);
+int pakfire_root_openat(pakfire_root* pakfire, const char* path, int flags) __nonnull((2));
 
-int pakfire_openat(struct pakfire* pakfire, const char* path, int flags) __nonnull((2));
-
-#define pakfire_path(pakfire, path, format, ...) \
-       __pakfire_path(pakfire, path, sizeof(path), format, __VA_ARGS__)
-int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length,
+#define pakfire_root_path(pakfire, path, format, ...) \
+       __pakfire_root_path(pakfire, path, sizeof(path), format, __VA_ARGS__)
+int __pakfire_root_path(pakfire_root* pakfire, char* path, const size_t length,
        const char* format, ...) __attribute__((format(printf, 4, 5)));
 
-const char* pakfire_relpath(struct pakfire* pakfire, const char* path);
+const char* pakfire_root_relpath(pakfire_root* pakfire, const char* path);
 
-#define pakfire_cache_path(pakfire, path, format, ...) \
-       __pakfire_cache_path(pakfire, path, sizeof(path), format, __VA_ARGS__)
-int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length,
+#define pakfire_root_cache_path(pakfire, path, format, ...) \
+       __pakfire_root_cache_path(pakfire, path, sizeof(path), format, __VA_ARGS__)
+int __pakfire_root_cache_path(pakfire_root* pakfire, char* path, size_t length,
        const char* format, ...) __attribute__((format(printf, 4, 5)));
 
-void pakfire_pool_has_changed(struct pakfire* pakfire);
-void pakfire_pool_internalize(struct pakfire* pakfire);
+void pakfire_root_pool_has_changed(pakfire_root* pakfire);
+void pakfire_root_pool_internalize(pakfire_root* pakfire);
 
-Pool* pakfire_get_solv_pool(struct pakfire* pakfire);
+Pool* pakfire_root_get_solv_pool(pakfire_root* pakfire);
 
-pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire);
+pakfire_repo* pakfire_root_get_installed_repo(pakfire_root* pakfire);
 
-int pakfire_commandline_add(struct pakfire* pakfire, const char* path,
+int pakfire_root_commandline_add(pakfire_root* pakfire, const char* path,
        pakfire_package** package);
 
-typedef int (*pakfire_repo_walk_callback)
-       (struct pakfire* pakfire, pakfire_repo* repo, void* p);
-int pakfire_repo_walk(struct pakfire* pakfire,
-       pakfire_repo_walk_callback callback, void* p);
+typedef int (*pakfire_root_repo_walk_callback)
+       (pakfire_root* pakfire, pakfire_repo* repo, void* p);
+int pakfire_root_repo_walk(pakfire_root* pakfire,
+       pakfire_root_repo_walk_callback callback, void* p);
 
 // Archive helpers
-struct archive* pakfire_get_disk_reader(struct pakfire* pakfire);
-struct archive* pakfire_get_disk_writer(struct pakfire* pakfire);
+struct archive* pakfire_root_get_disk_reader(pakfire_root* pakfire);
+struct archive* pakfire_root_get_disk_writer(pakfire_root* pakfire);
 
-int pakfire_install(struct pakfire* self, const char** packages);
+int pakfire_root_install(pakfire_root* self, const char** packages);
 
-#endif /* PAKFIRE_PAKFIRE_H */
+#endif /* pakfire_rootPAKFIRE_H */
index dbbcd6a8888a9acd6ef8fd04e060e188c055190f..03389cbd2505c1225e23924b4ad5cfa78133415b 100644 (file)
@@ -53,7 +53,7 @@ static struct pakfire_parser_regexes {
 
 struct pakfire_parser {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        pakfire_parser* parent;
@@ -87,15 +87,15 @@ static void pakfire_parser_free(pakfire_parser* parser) {
 
        if (parser->parent)
                pakfire_parser_unref(parser->parent);
-       if (parser->pakfire)
-               pakfire_unref(parser->pakfire);
+       if (parser->root)
+               pakfire_root_unref(parser->root);
        if (parser->ctx)
                pakfire_ctx_unref(parser->ctx);
        free(parser);
 }
 
 int pakfire_parser_create(pakfire_parser** parser,
-               struct pakfire* pakfire, pakfire_parser* parent, const char* namespace, int flags) {
+               pakfire_root* root, pakfire_parser* parent, const char* namespace, int flags) {
        pakfire_parser* self = NULL;
        int r;
 
@@ -105,10 +105,10 @@ int pakfire_parser_create(pakfire_parser** parser,
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        self->nrefs = 1;
@@ -140,7 +140,7 @@ pakfire_parser* pakfire_parser_create_child(pakfire_parser* parser, const char*
        int r;
 
        // Create the parser
-       r = pakfire_parser_create(&child, parser->pakfire, parser, namespace, parser->flags);
+       r = pakfire_parser_create(&child, parser->root, parser, namespace, parser->flags);
        if (r < 0)
                return NULL;
 
@@ -153,8 +153,8 @@ pakfire_parser* pakfire_parser_ref(pakfire_parser* parser) {
        return parser;
 }
 
-struct pakfire* pakfire_parser_get_pakfire(pakfire_parser* parser) {
-       return pakfire_ref(parser->pakfire);
+pakfire_root* pakfire_parser_get_root(pakfire_parser* parser) {
+       return pakfire_root_ref(parser->root);
 }
 
 pakfire_parser* pakfire_parser_unref(pakfire_parser* parser) {
@@ -540,7 +540,7 @@ static int pakfire_parser_expand_commands(pakfire_parser* parser, char** buffer)
                size_t length = 0;
 
                // Execute the command inside the Pakfire environment
-               r = pakfire_jail_run(parser->pakfire, argv, NULL, 0, &output, &length);
+               r = pakfire_jail_run(parser->root, argv, NULL, 0, &output, &length);
                if (r) {
                        // Just log this and continue
                        DEBUG(parser->ctx, "Command '%s' failed with return code %d\n", command, r);
@@ -1073,7 +1073,7 @@ int pakfire_parser_create_package(pakfire_parser* parser,
        }
 
        // Create a new package object
-       r = pakfire_package_create(pkg, parser->pakfire, repo, name, evr, (arch) ? arch : default_arch);
+       r = pakfire_package_create(pkg, parser->root, repo, name, evr, (arch) ? arch : default_arch);
        if (r < 0) {
                ERROR(parser->ctx, "Could not create package: %m\n");
                goto CLEANUP;
@@ -1130,7 +1130,7 @@ int pakfire_parser_create_package(pakfire_parser* parser,
        if (is_source) {
                deps = pakfire_parser_get(parser, "build", "requires");
                if (deps) {
-                       r = pakfire_str2deps(parser->pakfire, *pkg, PAKFIRE_PKG_REQUIRES, deps);
+                       r = pakfire_str2deps(parser->root, *pkg, PAKFIRE_PKG_REQUIRES, deps);
                        if (r)
                                goto CLEANUP;
                }
@@ -1138,7 +1138,7 @@ int pakfire_parser_create_package(pakfire_parser* parser,
                for (const struct pakfire_dep* dep = pakfire_deps; dep->key; dep++) {
                        deps = pakfire_parser_get(parser, namespace, dep->name);
                        if (deps) {
-                               r = pakfire_str2deps(parser->pakfire, *pkg, dep->key, deps);
+                               r = pakfire_str2deps(parser->root, *pkg, dep->key, deps);
                                if (r)
                                        goto CLEANUP;
                        }
index da39c847235c7c5a83e70021de685e9cc7d44255..91d1046e4226e4eda8de78d87351d127dbcbaea9 100644 (file)
@@ -38,7 +38,7 @@ enum pakfire_parser_flags {
 
 typedef struct pakfire_parser_error pakfire_parser_error;
 
-int pakfire_parser_create(pakfire_parser** parser, struct pakfire* pakfire,
+int pakfire_parser_create(pakfire_parser** parser, pakfire_root* root,
        pakfire_parser* parent, const char* namespace, int flags);
 pakfire_parser* pakfire_parser_create_child(pakfire_parser* parser,
        const char* namespace);
@@ -82,7 +82,7 @@ const char* pakfire_parser_error_get_filename(pakfire_parser_error* error);
 int pakfire_parser_error_get_line(pakfire_parser_error* error);
 const char* pakfire_parser_error_get_message(pakfire_parser_error* error);
 
-struct pakfire* pakfire_parser_get_pakfire(pakfire_parser* parser);
+pakfire_root* pakfire_parser_get_root(pakfire_parser* parser);
 
 typedef struct pakfire_parser_state {
        unsigned int lineno;
index eb17159974637bae93da2fac0b63e7539a31146e..6c1cf74319cfd326c770b21fcdd4785dd4013e04 100644 (file)
@@ -23,7 +23,7 @@
 %parse-param
        {yyscan_t* scanner}
        {pakfire_ctx* ctx}
-       {struct pakfire* pakfire}
+       {pakfire_root* root}
        {pakfire_parser** parser}
        {pakfire_parser* parent}
        {pakfire_parser_error** error}
@@ -77,7 +77,7 @@ enum operator {
        OP_EQUALS = 0,
 };
 
-static void yyerror(yyscan_t* scanner, pakfire_ctx* ctx, struct pakfire* pakfire,
+static void yyerror(yyscan_t* scanner, pakfire_ctx* ctx, pakfire_root* root,
                pakfire_parser** parser, pakfire_parser* parent,
                pakfire_parser_error** error, const char* s) {
        const pakfire_parser_state* state = yyget_extra(scanner);
@@ -171,7 +171,7 @@ static void pakfire_parser_free_declaration(pakfire_parser_declaration* declarat
 }
 
 %initial-action {
-       int r = pakfire_parser_create(parser, pakfire, parent, NULL, 0);
+       int r = pakfire_parser_create(parser, root, parent, NULL, 0);
        if (r < 0)
                ABORT;
 };
@@ -185,7 +185,7 @@ static void pakfire_parser_free_declaration(pakfire_parser_declaration* declarat
 
 grammar                                                : %empty
                                                        {
-                                                               int r = pakfire_parser_create(&$$, pakfire, *parser, NULL, 0);
+                                                               int r = pakfire_parser_create(&$$, root, *parser, NULL, 0);
                                                                if (r < 0)
                                                                        ABORT;
 
@@ -347,7 +347,7 @@ subparser                                   : subparser_name T_EOL block T_END T_EOL
                                                                int r;
 
                                                                // Create a new parser
-                                                               r = pakfire_parser_create(&$$, pakfire, *parser, NULL, 0);
+                                                               r = pakfire_parser_create(&$$, root, *parser, NULL, 0);
                                                                if (r < 0)
                                                                        ABORT;
 
@@ -411,7 +411,7 @@ else_stmt                                   : T_ELSE T_EOL block
 
 int pakfire_parser_parse_data(pakfire_parser* parent, const char* data, size_t len,
                pakfire_parser_error** error) {
-       struct pakfire* pakfire = pakfire_parser_get_pakfire(parent);
+       pakfire_root* root = pakfire_parser_get_root(parent);
        yyscan_t scanner;
        int r;
 
@@ -424,7 +424,7 @@ int pakfire_parser_parse_data(pakfire_parser* parent, const char* data, size_t l
        };
 
        // Fetch context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
 #ifdef ENABLE_DEBUG
        DEBUG(ctx, "Parsing the following data (%zu):\n%.*s\n", len, (int)len, data);
@@ -440,7 +440,7 @@ int pakfire_parser_parse_data(pakfire_parser* parent, const char* data, size_t l
        pakfire_parser* parser = NULL;
 
        YY_BUFFER_STATE buffer = yy_scan_bytes(data, len, scanner);
-       r = yyparse(scanner, ctx, pakfire, &parser, parent, error);
+       r = yyparse(scanner, ctx, root, &parser, parent, error);
        yy_delete_buffer(buffer, scanner);
 
        // Deal with the return code of the parser
@@ -482,8 +482,8 @@ int pakfire_parser_parse_data(pakfire_parser* parent, const char* data, size_t l
 ERROR:
        if (parser)
                pakfire_parser_unref(parser);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
        if (ctx)
                pakfire_ctx_unref(ctx);
        yylex_destroy(scanner);
index fad1cec67e974a09a600ce019d8ecef901b5f484..15ee89bcaa1878340fa1da5b4cd64655779748b3 100644 (file)
@@ -34,7 +34,7 @@
 
 struct pakfire_problem {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        pakfire_transaction* transaction;
@@ -87,17 +87,17 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides requested %s"),
-                               pakfire_dep2str(problem->pakfire, dep));
+                               pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
                        r = asprintf(&s, _("package %s does not exist"),
-                               pakfire_dep2str(problem->pakfire, dep));
+                               pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
                        r = asprintf(&s, _("%s is provided by the system"),
-                               pakfire_dep2str(problem->pakfire, dep));
+                               pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_RPM:
@@ -119,7 +119,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides %s needed by %s"),
-                               pakfire_dep2str(problem->pakfire, dep), pool_solvid2str(pool, source));
+                               pakfire_dep2str(problem->root, dep), pool_solvid2str(pool, source));
                        break;
 
                case SOLVER_RULE_RPM_SAME_NAME:
@@ -129,42 +129,42 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_PACKAGE_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_OBSOLETES:
                        r = asprintf(&s, _("package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES:
                        r = asprintf(&s, _("installed package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_IMPLICIT_OBSOLETES:
                        r = asprintf(&s, _("package %s implicitely obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_REQUIRES:
                        r = asprintf(&s, _("package %s requires %s, but none of the providers can be installed"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_RPM_SELF_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by itself"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_YUMOBS:
                        r = asprintf(&s, _("both package %s and %s obsolete %s"),
                                pool_solvid2str(pool, source), pool_solvid2str(pool, target),
-                               pakfire_dep2str(problem->pakfire, dep));
+                               pakfire_dep2str(problem->root, dep));
                        break;
 
                case SOLVER_RULE_BLACK:
@@ -174,7 +174,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_PKG_CONSTRAINS:
                        r = asprintf(&s, _("package %s has constraint %s conflicting with %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
@@ -191,7 +191,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 }
 
 int pakfire_problem_create(pakfire_problem** problem,
-               struct pakfire* pakfire, pakfire_transaction* transaction, Id id) {
+               pakfire_root* root, pakfire_transaction* transaction, Id id) {
        pakfire_problem* p = NULL;
 
        // Allocate some memory
@@ -200,10 +200,10 @@ int pakfire_problem_create(pakfire_problem** problem,
                return -errno;
 
        // Store a reference to the context
-       p->ctx = pakfire_get_ctx(pakfire);
+       p->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       p->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       p->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        p->nrefs = 1;
@@ -228,8 +228,8 @@ static void pakfire_problem_free(pakfire_problem* problem) {
                pakfire_transaction_unref(problem->transaction);
        if (problem->string)
                free(problem->string);
-       if (problem->pakfire)
-               pakfire_unref(problem->pakfire);
+       if (problem->root)
+               pakfire_root_unref(problem->root);
        if (problem->ctx)
                pakfire_ctx_unref(problem->ctx);
        free(problem);
@@ -290,7 +290,7 @@ pakfire_solution** pakfire_problem_get_solutions(
                        break;
 
                // Create a new solution
-               r = pakfire_solution_create(&solution, problem->pakfire, problem, id);
+               r = pakfire_solution_create(&solution, problem->root, problem, id);
                if (r)
                        goto ERROR;
 
index ba3cc24e814103c57eb644f73b6da969d18bf427..f98e36b4d52785602bdee3b929ba6ea34e53f9e1 100644 (file)
@@ -37,7 +37,7 @@ const char* pakfire_problem_to_string(pakfire_problem* problem);
 pakfire_solution** pakfire_problem_get_solutions(
        pakfire_problem* problem);
 
-int pakfire_problem_create(pakfire_problem** problem, struct pakfire* pakfire,
+int pakfire_problem_create(pakfire_problem** problem, pakfire_root* root,
        pakfire_transaction* transaction, Id id);
 
 pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* problem);
index 18526e21c972ba4f9983de34abe5bff3e75b1235..b19f4625df945e4428e6e3bfb9344c59c5d32ada 100644 (file)
 #define ETC_SUBUID "/etc/subuid"
 #define ETC_SUBGID "/etc/subgid"
 
-static struct passwd* pakfire_getpwent(struct pakfire* pakfire,
+static struct passwd* pakfire_getpwent(pakfire_root* root,
                int(*cmp)(struct passwd* entry, const void* value), const void* value) {
        struct passwd* entry = NULL;
        char path[PATH_MAX];
        int r;
 
        // This cannot be performed in stub mode
-       if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_STUB))
+       if (pakfire_root_has_flag(root, PAKFIRE_ROOT_FLAGS_STUB))
                return NULL;
 
        // Get path to /etc/passwd
-       r = pakfire_path(pakfire, path, "%s", "/etc/passwd");
+       r = pakfire_root_path(root, path, "%s", "/etc/passwd");
        if (r < 0)
                return NULL;
 
@@ -87,8 +87,8 @@ static int __pakfire_getpwnam(struct passwd* entry, const void* value) {
        return 0;
 }
 
-struct passwd* pakfire_getpwnam(struct pakfire* pakfire, const char* name) {
-       return pakfire_getpwent(pakfire, __pakfire_getpwnam, name);
+struct passwd* pakfire_getpwnam(pakfire_root* root, const char* name) {
+       return pakfire_getpwent(root, __pakfire_getpwnam, name);
 }
 
 static int __pakfire_getpwuid(struct passwd* entry, const void* value) {
@@ -100,22 +100,22 @@ static int __pakfire_getpwuid(struct passwd* entry, const void* value) {
        return 0;
 }
 
-struct passwd* pakfire_getpwuid(struct pakfire* pakfire, uid_t uid) {
-       return pakfire_getpwent(pakfire, __pakfire_getpwuid, &uid);
+struct passwd* pakfire_getpwuid(pakfire_root* root, uid_t uid) {
+       return pakfire_getpwent(root, __pakfire_getpwuid, &uid);
 }
 
-static struct group* pakfire_getgrent(struct pakfire* pakfire,
+static struct group* pakfire_getgrent(pakfire_root* root,
                int(*cmp)(struct group* entry, const void* value), const void* value) {
        struct group* entry = NULL;
        char path[PATH_MAX];
        int r;
 
        // This cannot be performed in stub mode
-       if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_STUB))
+       if (pakfire_root_has_flag(root, PAKFIRE_ROOT_FLAGS_STUB))
                return NULL;
 
        // Get path to /etc/group
-       r = pakfire_path(pakfire, path, "%s", "/etc/group");
+       r = pakfire_root_path(root, path, "%s", "/etc/group");
        if (r < 0)
                return NULL;
 
@@ -152,8 +152,8 @@ static int __pakfire_getgrnam(struct group* entry, const void* value) {
        return 0;
 }
 
-struct group* pakfire_getgrnam(struct pakfire* pakfire, const char* name) {
-       return pakfire_getgrent(pakfire, __pakfire_getgrnam, name);
+struct group* pakfire_getgrnam(pakfire_root* root, const char* name) {
+       return pakfire_getgrent(root, __pakfire_getgrnam, name);
 }
 
 static int __pakfire_getgrgid(struct group* entry, const void* value) {
@@ -165,21 +165,21 @@ static int __pakfire_getgrgid(struct group* entry, const void* value) {
        return 0;
 }
 
-struct group* pakfire_getgrgid(struct pakfire* pakfire, gid_t gid) {
-       return pakfire_getgrent(pakfire, __pakfire_getgrgid, &gid);
+struct group* pakfire_getgrgid(pakfire_root* root, gid_t gid) {
+       return pakfire_getgrent(root, __pakfire_getgrgid, &gid);
 }
 
 // SUBUID/SUBGID
 
 #ifdef HAVE_SUBID
 
-static int pakfire_getsubid(struct pakfire* pakfire, const char* owner,
+static int pakfire_getsubid(pakfire_root* root, const char* owner,
                struct pakfire_subid* subid, int (callback)(const char* owner, struct subid_range** ranges)) {
        struct subid_range* ranges = NULL;
        int count;
        int r = -1;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        r = subid_init(PACKAGE_NAME, stderr);
        if (r) {
@@ -210,24 +210,24 @@ ERROR:
        return r;
 }
 
-int pakfire_getsubuid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid) {
-       return pakfire_getsubid(pakfire, owner, subid, subid_get_uid_ranges);
+int pakfire_getsubuid(pakfire_root* root, const char* owner, struct pakfire_subid* subid) {
+       return pakfire_getsubid(root, owner, subid, subid_get_uid_ranges);
 }
 
-int pakfire_getsubgid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid) {
-       return pakfire_getsubid(pakfire, owner, subid, subid_get_gid_ranges);
+int pakfire_getsubgid(pakfire_root* root, const char* owner, struct pakfire_subid* subid) {
+       return pakfire_getsubid(root, owner, subid, subid_get_gid_ranges);
 }
 
 # else /* Our own implementation */
 
-static int pakfire_fgetsubid(struct pakfire* pakfire, struct pakfire_subid* subid, FILE* f) {
+static int pakfire_fgetsubid(pakfire_root* root, struct pakfire_subid* subid, FILE* f) {
        int r;
 
        char* line = NULL;
        size_t length = 0;
        char* p = NULL;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Read the next line
        while (1) {
@@ -299,7 +299,7 @@ ERROR:
        If nothing was found, the function returns 1.
        If there was an error, the function may return something else.
 */
-static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const char* owner,
+static int pakfire_getsubid(pakfire_root* root, const char* path, const char* owner,
                struct pakfire_subid* subid) {
        struct pakfire_subid entry = {};
        int r;
@@ -308,7 +308,7 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const cha
        if (!owner)
                return 1;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        DEBUG(ctx, "Fetching SUBID from %s for %s\n", path, owner);
 
@@ -331,7 +331,7 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const cha
 
        // Walk through all entries
        while (1) {
-               r = pakfire_fgetsubid(pakfire, &entry, f);
+               r = pakfire_fgetsubid(root, &entry, f);
                switch (r) {
                        case 0:
                                break;
@@ -367,12 +367,12 @@ END:
        return r;
 }
 
-int pakfire_getsubuid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid) {
-       return pakfire_getsubid(pakfire, ETC_SUBUID, owner, subid);
+int pakfire_getsubuid(pakfire_root* root, const char* owner, struct pakfire_subid* subid) {
+       return pakfire_getsubid(root, ETC_SUBUID, owner, subid);
 }
 
-int pakfire_getsubgid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid) {
-       return pakfire_getsubid(pakfire, ETC_SUBGID, owner, subid);
+int pakfire_getsubgid(pakfire_root* root, const char* owner, struct pakfire_subid* subid) {
+       return pakfire_getsubid(root, ETC_SUBGID, owner, subid);
 }
 
 #endif
index 2c76de2b59124e13405d4e9cda8889866535be82..0bbb4e0acf7e487581616779501243e5a1d05fcd 100644 (file)
@@ -30,13 +30,13 @@ struct pakfire_subid {
        size_t length;
 };
 
-struct passwd* pakfire_getpwnam(struct pakfire* pakfire, const char* name);
-struct passwd* pakfire_getpwuid(struct pakfire* pakfire, uid_t uid);
+struct passwd* pakfire_getpwnam(pakfire_root* root, const char* name);
+struct passwd* pakfire_getpwuid(pakfire_root* root, uid_t uid);
 
-struct group* pakfire_getgrnam(struct pakfire* pakfire, const char* name);
-struct group* pakfire_getgrgid(struct pakfire* pakfire, gid_t gid);
+struct group* pakfire_getgrnam(pakfire_root* root, const char* name);
+struct group* pakfire_getgrgid(pakfire_root* root, gid_t gid);
 
-int pakfire_getsubuid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid);
-int pakfire_getsubgid(struct pakfire* pakfire, const char* owner, struct pakfire_subid* subid);
+int pakfire_getsubuid(pakfire_root* root, const char* owner, struct pakfire_subid* subid);
+int pakfire_getsubgid(pakfire_root* root, const char* owner, struct pakfire_subid* subid);
 
 #endif /* PAKFIRE_PWD_H */
index 73e49299652699eb2bbc5c2d2020e2d114ceea54..b64578374abec29398ba60fe3c3f3ed4a179b417 100644 (file)
@@ -125,7 +125,7 @@ typedef struct pakfire_repo_appdata {
 
 struct pakfire_repo {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        Repo* repo;
@@ -195,9 +195,9 @@ char* pakfire_repo_url_replace(pakfire_repo* repo, const char* url) {
                const char* replacement;
        } replacements[] = {
                { "%{name}",    pakfire_repo_get_name(repo) },
-               { "%{arch}",    pakfire_get_effective_arch(repo->pakfire) },
-               { "%{distro}",  pakfire_get_distro_id(repo->pakfire) },
-               { "%{version}", pakfire_get_distro_version_id(repo->pakfire) },
+               { "%{arch}",    pakfire_root_get_effective_arch(repo->root) },
+               { "%{distro}",  pakfire_root_get_distro_id(repo->root) },
+               { "%{version}", pakfire_root_get_distro_version_id(repo->root) },
                { NULL },
        };
 
@@ -258,7 +258,7 @@ int __pakfire_repo_path(pakfire_repo* repo,
        const char* name = pakfire_repo_get_name(repo);
 
        // Otherwise return the cached path
-       return __pakfire_cache_path(repo->pakfire, path, length, "%s/%s", name, buffer);
+       return __pakfire_root_cache_path(repo->root, path, length, "%s/%s", name, buffer);
 }
 
 static int pakfire_repo_xfer_create(pakfire_xfer** xfer, pakfire_repo* repo,
@@ -343,7 +343,7 @@ ERROR:
 
 static int __pakfire_repo_import(pakfire_config* config, const char* section, void* data) {
        pakfire_repo* self = NULL;
-       struct pakfire* pakfire = data;
+       pakfire_root* root = data;
        int r;
 
        // Ignore if the section does not start with "repo:"
@@ -358,7 +358,7 @@ static int __pakfire_repo_import(pakfire_config* config, const char* section, vo
                return 0;
 
        // Create a new repository
-       r = pakfire_repo_create(&self, pakfire, name);
+       r = pakfire_repo_create(&self, root, name);
        if (r < 0)
                goto ERROR;
 
@@ -430,11 +430,11 @@ ERROR:
        return r;
 }
 
-int pakfire_repo_import(struct pakfire* pakfire, pakfire_config* config) {
+int pakfire_repo_import(pakfire_root* root, pakfire_config* config) {
        int r;
 
        // Import all repositories from the configuration
-       r = pakfire_config_walk_sections(config, __pakfire_repo_import, pakfire);
+       r = pakfire_config_walk_sections(config, __pakfire_repo_import, root);
        if (r)
                return r;
 
@@ -463,7 +463,7 @@ static int pakfire_repo_to_packagelist(
                id = pool_solvable2id(self->repo->pool, s);
 
                // Create a new package
-               r = pakfire_package_create_from_solvable(&pkg, self->pakfire, self, id);
+               r = pakfire_package_create_from_solvable(&pkg, self->root, self, id);
                if (r < 0)
                        goto ERROR;
 
@@ -682,7 +682,7 @@ static int __pakfire_repo_scan_archive(pakfire_repo* repo,
        }
 
        // Open archive
-       r = pakfire_archive_open(&archive, repo->pakfire, entry->fts_path);
+       r = pakfire_archive_open(&archive, repo->root, entry->fts_path);
        if (r < 0)
                goto ERROR;
 
@@ -1174,7 +1174,7 @@ static int pakfire_repo_refresh_mirrorlist(pakfire_repo* self, const int force)
        const char* name = pakfire_repo_get_name(self);
 
        // Make path to mirrorlist
-       r = pakfire_cache_path(self->pakfire, path, "repodata/%s/mirrorlist", name);
+       r = pakfire_root_cache_path(self->root, path, "repodata/%s/mirrorlist", name);
        if (r < 0)
                goto ERROR;
 
@@ -1388,19 +1388,19 @@ static void pakfire_repo_free_appdata(pakfire_repo_appdata* appdata) {
 static void pakfire_repo_free(pakfire_repo* self) {
        if (self->appdata)
                pakfire_repo_free_appdata(self->appdata);
-       if (self->pakfire)
-               pakfire_unref(self->pakfire);
+       if (self->root)
+               pakfire_root_unref(self->root);
        if (self->ctx)
                pakfire_ctx_unref(self->ctx);
        free(self);
 }
 
-void pakfire_repo_free_all(struct pakfire* pakfire) {
+void pakfire_repo_free_all(pakfire_root* root) {
        Repo* repo = NULL;
        int i;
 
        // Fetch the pool
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(root);
        if (!pool)
                return;
 
@@ -1445,8 +1445,7 @@ static int pakfire_repo_setup_appdata(pakfire_repo* self) {
        return 0;
 }
 
-int pakfire_repo_create(pakfire_repo** repo,
-               struct pakfire* pakfire, const char* name) {
+int pakfire_repo_create(pakfire_repo** repo, pakfire_root* root, const char* name) {
        pakfire_repo* self = NULL;
        int r;
 
@@ -1456,16 +1455,16 @@ int pakfire_repo_create(pakfire_repo** repo,
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        self->nrefs = 1;
 
        // Fetch the pool
-       Pool* pool = pakfire_get_solv_pool(pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(root);
 
        // Allocate a libsolv repository
        self->repo = repo_create(pool, name);
@@ -1506,7 +1505,7 @@ ERROR:
        return r;
 }
 
-int pakfire_repo_open(pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo) {
+int pakfire_repo_open(pakfire_repo** repo, pakfire_root* root, Repo* _repo) {
        pakfire_repo* self = NULL;
 
        // Allocate some memory
@@ -1515,10 +1514,10 @@ int pakfire_repo_open(pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo)
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        self->nrefs = 1;
@@ -1582,7 +1581,7 @@ int pakfire_repo_cmp(pakfire_repo* repo1, pakfire_repo* repo2) {
 }
 
 int pakfire_repo_count(pakfire_repo* repo) {
-       Pool* pool = pakfire_get_solv_pool(repo->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(repo->root);
        int cnt = 0;
 
        for (int i = 2; i < pool->nsolvables; i++) {
@@ -1598,7 +1597,7 @@ void pakfire_repo_has_changed(pakfire_repo* repo) {
        repo->appdata->ready = 0;
 
        // Mark pool as changed, too
-       pakfire_pool_has_changed(repo->pakfire);
+       pakfire_root_pool_has_changed(repo->root);
 }
 
 int pakfire_repo_internalize(pakfire_repo* repo, int flags) {
@@ -2008,7 +2007,7 @@ int pakfire_repo_add(pakfire_repo* repo, const char* path,
        }
 
        // Try to open the archive
-       r = pakfire_archive_open(&archive, repo->pakfire, path);
+       r = pakfire_archive_open(&archive, repo->root, path);
        if (r < 0)
                goto ERROR;
 
@@ -2063,7 +2062,7 @@ int pakfire_repo_write_solv(pakfire_repo* repo, FILE *f, int flags) {
        Queue addedfileprovides;
        int r;
 
-       pakfire_pool_internalize(repo->pakfire);
+       pakfire_root_pool_internalize(repo->root);
 
        // Initialize file provides
        queue_init(&addedfileprovides);
@@ -2129,7 +2128,7 @@ static int pakfire_repo_delete_all_packages(
                Id id = pool_solvable2id(pool, s);
 
                // Allocate package
-               r = pakfire_package_create_from_solvable(&pkg, repo->pakfire, repo, id);
+               r = pakfire_package_create_from_solvable(&pkg, repo->root, repo, id);
                if (r)
                        return 1;
 
@@ -2191,9 +2190,9 @@ int pakfire_repo_clean(pakfire_repo* repo, int flags) {
        }
 
        // Destroy all files in the cache directory
-       r = pakfire_cache_path(repo->pakfire, cache_path,
-               "repodata/%s", pakfire_repo_get_name(repo));
-       if (r)
+       r = pakfire_root_cache_path(repo->root, cache_path,
+                       "repodata/%s", pakfire_repo_get_name(repo));
+       if (r < 0)
                return r;
 
        return pakfire_rmtree(cache_path, 0);
@@ -2552,7 +2551,7 @@ ERROR:
        return r;
 }
 
-int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
+int pakfire_repo_compose(pakfire_root* root, const char* path,
                pakfire_key* key, const char** files) {
        pakfire_archive* archive = NULL;
        pakfire_repo* repo = NULL;
@@ -2567,7 +2566,7 @@ int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
        }
 
        // Fetch context
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // XXX Check if the key is a secret key
 
@@ -2593,7 +2592,7 @@ int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
                goto ERROR;
 
        // Create a new temporary repository at path
-       r = pakfire_repo_create(&repo, pakfire, "tmp");
+       r = pakfire_repo_create(&repo, root, "tmp");
        if (r) {
                ERROR(ctx, "Could not create a temporary repository: %m\n");
                goto ERROR;
@@ -2621,7 +2620,7 @@ int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
                        DEBUG(ctx, "Adding %s to repository...\n", *file);
 
                        // Open source archive
-                       r = pakfire_archive_open(&archive, pakfire, *file);
+                       r = pakfire_archive_open(&archive, root, *file);
                        if (r) {
                                ERROR(ctx, "Could not open %s: %m\n", *file);
                                goto OUT;
index 5d1158feda235837835f8588fdebd56ce340f5be..a20677216f1e19855e8e346463f23d87759e0cb8 100644 (file)
@@ -39,8 +39,8 @@ typedef struct pakfire_repo pakfire_repo;
 #include <pakfire/pakfire.h>
 #include <pakfire/xfer.h>
 
-int pakfire_repo_create(pakfire_repo** repo, struct pakfire* pakfire, const char* name);
-int pakfire_repo_open(pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo);
+int pakfire_repo_create(pakfire_repo** repo, pakfire_root* root, const char* name);
+int pakfire_repo_open(pakfire_repo** repo, pakfire_root* root, Repo* _repo);
 
 pakfire_repo* pakfire_repo_ref(pakfire_repo* repo);
 pakfire_repo* pakfire_repo_unref(pakfire_repo* repo);
@@ -106,7 +106,7 @@ int pakfire_repo_refresh(pakfire_repo* repo, int force);
 
 int pakfire_repo_write_metadata(pakfire_repo* repo, pakfire_key* key);
 
-int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
+int pakfire_repo_compose(pakfire_root* root, const char* path,
        pakfire_key* key, const char** files);
 
 #define PAKFIRE_REPO_COMMANDLINE               "@commandline"
@@ -121,7 +121,7 @@ int pakfire_repo_is_local(pakfire_repo* repo);
 
 char* pakfire_repo_url_replace(pakfire_repo* repo, const char* url);
 
-int pakfire_repo_import(struct pakfire* pakfire, pakfire_config* config);
+int pakfire_repo_import(pakfire_root* root, pakfire_config* config);
 const char* pakfire_repo_get_path(pakfire_repo* repo);
 
 void pakfire_repo_has_changed(pakfire_repo* repo);
@@ -142,7 +142,7 @@ int pakfire_repo_download_package(pakfire_xfer** xfer,
 int pakfire_repo_add(pakfire_repo* repo, const char* path,
        pakfire_package** package);
 
-void pakfire_repo_free_all(struct pakfire* pakfire);
+void pakfire_repo_free_all(pakfire_root* root);
 
 Repo* pakfire_repo_get_repo(pakfire_repo* repo);
 Repodata* pakfire_repo_get_repodata(pakfire_repo* repo);
index bc6458f0199fb8e13dfb63f25c25d2b9b6522110..6d3d264621130c2d96b2420b495fe51283a69bac 100644 (file)
@@ -178,10 +178,10 @@ static int pakfire_scriptlet_is_shell_script(pakfire_scriptlet* scriptlet) {
        return 0;
 }
 
-int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, struct pakfire* pakfire) {
+int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, pakfire_root* root) {
        // Detect what kind of script this is and run it
        if (pakfire_scriptlet_is_shell_script(scriptlet))
-               return pakfire_jail_run_script(pakfire, scriptlet->data, scriptlet->size, NULL, NULL, 0);
+               return pakfire_jail_run_script(root, scriptlet->data, scriptlet->size, NULL, NULL, 0);
 
        ERROR(scriptlet->ctx, "Scriptlet is of an unknown kind\n");
        return -ENOTSUP;
index b53586836354de942efa66d6695520fbb2743ef6..8da1723f323f37f1f885d62b84f162fc74d32b10 100644 (file)
@@ -36,6 +36,6 @@ pakfire_scriptlet* pakfire_scriptlet_unref(pakfire_scriptlet* scriptlet);
 const char* pakfire_scriptlet_get_type(pakfire_scriptlet* scriptlet);
 const char* pakfire_scriptlet_get_data(pakfire_scriptlet* scriptlet, size_t* size);
 
-int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, struct pakfire* pakfire);
+int pakfire_scriptlet_execute(pakfire_scriptlet* scriptlet, pakfire_root* root);
 
 #endif /* PAKFIRE_SCRIPTLET_H */
index bb525202427c029b9807b1f1c8866c5e91567bc3..b0c9cd1d3761059c3a0dd82c6ffdde86e331c606 100644 (file)
@@ -199,17 +199,17 @@ static int pakfire_snapshot_filter(const struct dirent* dirent) {
 /*
        Finds and returns the latest snapshot
 */
-int pakfire_snapshot_find(pakfire_snapshot** snapshot, struct pakfire* pakfire) {
+int pakfire_snapshot_find(pakfire_snapshot** snapshot, pakfire_root* root) {
        struct dirent** paths = NULL;
        int num_paths = 0;
        char path[PATH_MAX];
        int fd = -EBADF;
        int r;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Make the path
-       r = pakfire_cache_path(pakfire, path, "%s", "snapshots");
+       r = pakfire_root_cache_path(root, path, "%s", "snapshots");
        if (r < 0)
                return r;
 
@@ -219,7 +219,7 @@ int pakfire_snapshot_find(pakfire_snapshot** snapshot, struct pakfire* pakfire)
                switch (errno) {
                        // If the directory does not exist, we will make a new snapshot
                        case ENOENT:
-                               r = pakfire_snapshot_make(snapshot, pakfire);
+                               r = pakfire_snapshot_make(snapshot, root);
                                if (r < 0)
                                        goto ERROR;
 
@@ -240,7 +240,7 @@ int pakfire_snapshot_find(pakfire_snapshot** snapshot, struct pakfire* pakfire)
 
        // Create a new snapshot if none was found
        } else if (num_paths == 0) {
-               r = pakfire_snapshot_make(snapshot, pakfire);
+               r = pakfire_snapshot_make(snapshot, root);
                if (r < 0)
                        goto ERROR;
 
@@ -471,12 +471,12 @@ static int pakfire_snapshot_destroy(pakfire_snapshot* self) {
        return 0;
 }
 
-static int pakfire_snapshot_install_packages(struct pakfire* pakfire, const char** packages) {
+static int pakfire_snapshot_install_packages(pakfire_root* root, const char** packages) {
        pakfire_transaction* transaction = NULL;
        int r;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&transaction, pakfire, 0);
+       r = pakfire_transaction_create(&transaction, root, 0);
        if (r)
                goto ERROR;
 
@@ -507,15 +507,15 @@ ERROR:
 /*
        Creates a new snapshot
 */
-int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire) {
+int pakfire_snapshot_make(pakfire_snapshot** snapshot, pakfire_root* root) {
        pakfire_config* config = NULL;
-       struct pakfire* p = NULL;
+       pakfire_root* p = NULL;
        char snapshot_path[PATH_MAX];
        char tmp[PATH_MAX];
        const char* arch = NULL;
        const char* path = NULL;
        char time[1024];
-       int flags = PAKFIRE_FLAGS_BUILD|PAKFIRE_FLAGS_BUILD_LOCAL;
+       int flags = PAKFIRE_ROOT_FLAGS_BUILD|PAKFIRE_ROOT_FLAGS_BUILD_LOCAL;
        int r;
 
        const char* packages[] = {
@@ -523,13 +523,13 @@ int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire)
                NULL,
        };
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        // Fetch the configuration
-       config = pakfire_get_config(pakfire);
+       config = pakfire_root_get_config(root);
 
        // Fetch the architecture
-       arch = pakfire_get_arch(pakfire);
+       arch = pakfire_root_get_arch(root);
 
        // Store the current time
        r = pakfire_strftime_now(time, PAKFIRE_SNAPSHOT_TIMESTAMP_FORMAT);
@@ -537,12 +537,12 @@ int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire)
                goto ERROR;
 
        // Make the final snapshot path
-       r = pakfire_cache_path(pakfire, snapshot_path, "snapshots/%s", time);
+       r = pakfire_root_cache_path(root, snapshot_path, "snapshots/%s", time);
        if (r < 0)
                goto ERROR;
 
        // Make a new temporary path
-       r = pakfire_cache_path(pakfire, tmp, "%s", "snapshots/.XXXXXXX");
+       r = pakfire_root_cache_path(root, tmp, "%s", "snapshots/.XXXXXXX");
        if (r < 0)
                goto ERROR;
 
@@ -553,10 +553,10 @@ int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire)
                goto ERROR;
        }
 
-       // Create a new pakfire instance
-       r = pakfire_create(&p, ctx, config, tmp, arch, flags);
+       // Create a new root instance
+       r = pakfire_root_create(&p, ctx, config, tmp, arch, flags);
        if (r < 0) {
-               ERROR(ctx, "Could not clone pakfire: %s\n", strerror(-r));
+               ERROR(ctx, "Could not clone root: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -565,8 +565,8 @@ int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire)
        if (r < 0)
                goto ERROR;
 
-       // Close the pakfire instance
-       pakfire_unref(p);
+       // Close the root instance
+       pakfire_root_unref(p);
        p = NULL;
 
        // Move the snapshot to its final place
@@ -583,15 +583,15 @@ int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire)
                goto ERROR;
 
        // Cleanup any older snapshots (and ignore if something goes wrong)
-       pakfire_snapshot_clean(pakfire);
+       pakfire_snapshot_clean(root);
 
 ERROR:
-       if (p)
-               pakfire_unref(p);
        if (config)
                pakfire_config_unref(config);
        if (ctx)
                pakfire_ctx_unref(ctx);
+       if (p)
+               pakfire_root_unref(p);
 
        // Cleanup the temporary directory
        if (r)
@@ -603,18 +603,18 @@ ERROR:
 /*
        Cleans up any unused snapshots
 */
-int pakfire_snapshot_clean(struct pakfire* pakfire) {
+int pakfire_snapshot_clean(pakfire_root* root) {
        pakfire_snapshot* snapshot = NULL;
        char path[PATH_MAX];
        FTS* f = NULL;
        int r;
 
-       pakfire_ctx* ctx = pakfire_get_ctx(pakfire);
+       pakfire_ctx* ctx = pakfire_root_get_ctx(root);
 
        DEBUG(ctx, "Cleaning up snapshots...\n");
 
        // Make the path
-       r = pakfire_cache_path(pakfire, path, "%s", "snapshots");
+       r = pakfire_root_cache_path(root, path, "%s", "snapshots");
        if (r < 0)
                return r;
 
index 3f62510f3971b1b238f67ceb48006748206e944b..5c2e5093c26c96dbd08c00d9cd6c2418993261cc 100644 (file)
@@ -32,15 +32,15 @@ int pakfire_snapshot_create(
 pakfire_snapshot* pakfire_snapshot_ref(pakfire_snapshot* self);
 pakfire_snapshot* pakfire_snapshot_unref(pakfire_snapshot* self);
 
-int pakfire_snapshot_find(pakfire_snapshot** snapshot, struct pakfire* pakfire);
+int pakfire_snapshot_find(pakfire_snapshot** snapshot, pakfire_root* root);
 
 const char* pakfire_snapshot_path(pakfire_snapshot* self);
 
 int pakfire_snapshot_mount(pakfire_snapshot* self, const char* path);
 int pakfire_snapshot_umount(pakfire_snapshot* self);
 
-int pakfire_snapshot_make(pakfire_snapshot** snapshot, struct pakfire* pakfire);
+int pakfire_snapshot_make(pakfire_snapshot** snapshot, pakfire_root* root);
 
-int pakfire_snapshot_clean(struct pakfire* pakfire);
+int pakfire_snapshot_clean(pakfire_root* root);
 
 #endif /* PAKFIRE_SNAPSHOT_H */
index 83d7bebaa3b8d01a00bd6d48012eb53a83a83aba..eefdfd2f7918cb3da3175e7ccc11a214c9223bc4 100644 (file)
@@ -34,7 +34,7 @@
 #include <pakfire/util.h>
 
 struct pakfire_solution {
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        pakfire_problem* problem;
@@ -43,13 +43,13 @@ struct pakfire_solution {
 };
 
 int pakfire_solution_create(pakfire_solution** solution,
-               struct pakfire* pakfire, pakfire_problem* problem, Id id) {
+               pakfire_root* root, pakfire_problem* problem, Id id) {
        pakfire_solution* s = calloc(1, sizeof(*s));
        if (!s)
                return -errno;
 
-       // Store a reference to pakfire
-       s->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       s->root = pakfire_root_ref(root);
 
        // Initialize the ref counter
        s->nrefs = 1;
@@ -76,7 +76,8 @@ static void pakfire_solution_free(pakfire_solution* solution) {
        if (solution->string)
                free(solution->string);
 
-       pakfire_unref(solution->pakfire);
+       if (solution->root)
+               pakfire_root_unref(solution->root);
        free(solution);
 }
 
index 1c5b86e283e9b8484aff16cdfac6198d44c286c0..bea10d7401d4ced71ed58a851024229aef74c0b1 100644 (file)
@@ -34,7 +34,7 @@ pakfire_solution* pakfire_solution_unref(pakfire_solution* solution);
 
 const char* pakfire_solution_to_string(pakfire_solution* solution);
 
-int pakfire_solution_create(pakfire_solution** solution, struct pakfire* pakfire,
+int pakfire_solution_create(pakfire_solution** solution, pakfire_root* root,
        pakfire_problem* problem, Id id);
 pakfire_problem* pakfire_solution_get_problem(pakfire_solution* solution);
 Id pakfire_solution_get_id(pakfire_solution* solution);
index a00a4c7fb26cdf4dce423b44e9b2d869e4fa729a..841ab15f9aed9dace431d2d9f604812963b6a5d8 100644 (file)
@@ -40,8 +40,8 @@ struct pakfire_stripper {
        pakfire_ctx* ctx;
        int nrefs;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 
        // Jail
        pakfire_jail* jail;
@@ -61,7 +61,7 @@ struct pakfire_stripper {
 
 static int pakfire_stripper_open_sources(pakfire_stripper* self) {
        // Open the source directory
-       self->sourcesfd = pakfire_openat(self->pakfire, BUILD_SRC_DIR, O_DIRECTORY|O_PATH);
+       self->sourcesfd = pakfire_root_openat(self->root, BUILD_SRC_DIR, O_DIRECTORY|O_PATH);
        if (self->sourcesfd < 0) {
                switch (errno) {
                        case ENOENT:
@@ -77,7 +77,7 @@ static int pakfire_stripper_open_sources(pakfire_stripper* self) {
 }
 
 int pakfire_stripper_create(pakfire_stripper** stripper,
-               struct pakfire* pakfire, pakfire_jail* jail, const char* path) {
+               pakfire_root* root, pakfire_jail* jail, const char* path) {
        pakfire_stripper* self = NULL;
        int r;
 
@@ -87,10 +87,10 @@ int pakfire_stripper_create(pakfire_stripper** stripper,
                return -errno;
 
        // Store a reference to the context
-       self->ctx = pakfire_get_ctx(pakfire);
+       self->ctx = pakfire_root_get_ctx(root);
 
-       // Store a reference to Pakfire
-       self->pakfire = pakfire_ref(pakfire);
+       // Store a reference to the root
+       self->root = pakfire_root_ref(root);
 
        // Store a reference to the jail
        self->jail = pakfire_jail_ref(jail);
@@ -107,12 +107,12 @@ int pakfire_stripper_create(pakfire_stripper** stripper,
                goto ERROR;
 
        // Create a filelist
-       r = pakfire_filelist_create(&self->filelist, self->pakfire);
+       r = pakfire_filelist_create(&self->filelist, self->root);
        if (r < 0)
                goto ERROR;
 
        // Create a list for the sources
-       r = pakfire_filelist_create(&self->sources, self->pakfire);
+       r = pakfire_filelist_create(&self->sources, self->root);
        if (r < 0)
                goto ERROR;
 
@@ -138,8 +138,8 @@ static void pakfire_stripper_free(pakfire_stripper* self) {
                close(self->sourcesfd);
        if (self->filelist)
                pakfire_filelist_unref(self->filelist);
-       if (self->pakfire)
-               pakfire_unref(self->pakfire);
+       if (self->root)
+               pakfire_root_unref(self->root);
        if (self->jail)
                pakfire_jail_unref(self->jail);
        if (self->ctx)
@@ -188,7 +188,7 @@ static int pakfire_stripper_scan(pakfire_stripper* self) {
        int r;
 
        // Create a new filelist
-       r = pakfire_filelist_create(&filelist, self->pakfire);
+       r = pakfire_filelist_create(&filelist, self->root);
        if (r < 0)
                goto ERROR;
 
@@ -224,7 +224,7 @@ static int pakfire_stripper_collect_sources(
                return 0;
 
        // Create a new file object
-       r = pakfire_file_create(&file, self->pakfire, filename);
+       r = pakfire_file_create(&file, self->root, filename);
        if (r < 0)
                goto ERROR;
 
@@ -435,7 +435,7 @@ static int pakfire_stripper_strip_debuginfo(pakfire_stripper* self,
        }
 
        // Make a path for a new temporary file
-       r = pakfire_path(self->pakfire, tmppath, "%s", PAKFIRE_TMP_DIR "/.pakfire-strip.XXXXXXX");
+       r = pakfire_root_path(self->root, tmppath, "%s", PAKFIRE_TMP_DIR "/.pakfire-strip.XXXXXXX");
        if (r < 0)
                goto ERROR;
 
@@ -467,7 +467,7 @@ static int pakfire_stripper_strip_debuginfo(pakfire_stripper* self,
                path,
 
                // The stripped output
-               pakfire_relpath(self->pakfire, tmppath),
+               pakfire_root_relpath(self->root, tmppath),
                NULL,
        };
 
index 04f16371f1288872096186f496fec61c3f5f8f2f..ad2088edb875e6c3226229bdbec8758c314cdd59 100644 (file)
@@ -30,7 +30,7 @@ typedef struct pakfire_stripper pakfire_stripper;
 #include <pakfire/pakfire.h>
 
 int pakfire_stripper_create(pakfire_stripper** stripper,
-       struct pakfire* pakfire, pakfire_jail* jail, const char* path);
+       pakfire_root* root, pakfire_jail* jail, const char* path);
 
 pakfire_stripper* pakfire_stripper_ref(pakfire_stripper* self);
 pakfire_stripper* pakfire_stripper_unref(pakfire_stripper* self);
index 015cef2a35f738b24d0805d9b0eefabe8ef2fc5a..b692f00ab130d858c1893c42ca0d32aac934b498 100644 (file)
@@ -47,7 +47,7 @@
 
 struct pakfire_transaction {
        pakfire_ctx* ctx;
-       struct pakfire* pakfire;
+       pakfire_root* root;
        int nrefs;
 
        // Flags
@@ -208,7 +208,7 @@ static int pakfire_transaction_import_transaction(pakfire_transaction* transacti
        // Create all packages
        for (unsigned int i = 0; i < transaction->num; i++) {
                r = pakfire_package_create_from_solvable(&transaction->packages[i],
-                       transaction->pakfire, NULL, transaction->transaction->steps.elements[i]);
+                       transaction->root, NULL, transaction->transaction->steps.elements[i]);
                if (r < 0)
                        goto ERROR;
        }
@@ -219,7 +219,7 @@ static int pakfire_transaction_import_transaction(pakfire_transaction* transacti
        // Store all newly installed and overall all installed packages
        for (int i = 0; i < pkgs.count; i++) {
                r = pakfire_package_create_from_solvable(&pkg,
-                               transaction->pakfire, NULL, pkgs.elements[i]);
+                               transaction->root, NULL, pkgs.elements[i]);
                if (r < 0)
                        goto ERROR;
 
@@ -274,7 +274,7 @@ static int pakfire_transaction_import_userinstalled(pakfire_transaction* transac
                goto ERROR;
        }
 
-       Pool* pool = pakfire_get_solv_pool(transaction->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(transaction->root);
 
        // Store the names of all userinstalled packages
        for (int i = 0; i < userinstalled.count; i++) {
@@ -304,7 +304,7 @@ OUT:
 }
 
 static int pakfire_transaction_setup_solver(pakfire_transaction* transaction) {
-       Pool* pool = pakfire_get_solv_pool(transaction->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(transaction->root);
 
        // Allocate a new solver
        transaction->solver = solver_create(pool);
@@ -325,7 +325,7 @@ static int pakfire_transaction_setup_solver(pakfire_transaction* transaction) {
 #endif
 
        // In build mode, we want to install the best versions
-       if (pakfire_has_flag(transaction->pakfire, PAKFIRE_FLAGS_BUILD))
+       if (pakfire_root_has_flag(transaction->root, PAKFIRE_ROOT_FLAGS_BUILD))
                solver_set_flag(transaction->solver, SOLVER_FLAG_FOCUS_BEST, 1);
 
        // Can the solver downgrade packages?
@@ -358,8 +358,8 @@ static void pakfire_transaction_free(pakfire_transaction* transaction) {
                transaction_free(transaction->transaction);
        if (transaction->solver)
                solver_free(transaction->solver);
-       if (transaction->pakfire)
-               pakfire_unref(transaction->pakfire);
+       if (transaction->root)
+               pakfire_root_unref(transaction->root);
        if (transaction->ctx)
                pakfire_ctx_unref(transaction->ctx);
        queue_free(&transaction->jobs);
@@ -367,7 +367,7 @@ static void pakfire_transaction_free(pakfire_transaction* transaction) {
 }
 
 int pakfire_transaction_create(pakfire_transaction** transaction,
-               struct pakfire* pakfire, int flags) {
+               pakfire_root* root, int flags) {
        int r;
 
        // Allocate the transaction
@@ -376,10 +376,10 @@ int pakfire_transaction_create(pakfire_transaction** transaction,
                return -errno;
 
        // Store a reference to the context
-       t->ctx = pakfire_get_ctx(pakfire);
+       t->ctx = pakfire_root_get_ctx(root);
 
        // Store reference to Pakfire
-       t->pakfire = pakfire_ref(pakfire);
+       t->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
        t->nrefs = 1;
@@ -464,7 +464,7 @@ pakfire_problem** pakfire_transaction_get_problems(
                        break;
 
                // Create a new problem
-               r = pakfire_problem_create(&problem, transaction->pakfire, transaction, id);
+               r = pakfire_problem_create(&problem, transaction->root, transaction, id);
                if (r)
                        goto ERROR;
 
@@ -590,9 +590,9 @@ int pakfire_transaction_solve(pakfire_transaction* transaction,
        // XXX halt if the request has already been solved
 
        // Prepare pool
-       pakfire_pool_internalize(transaction->pakfire);
+       pakfire_root_pool_internalize(transaction->root);
 
-       Pool* pool = pakfire_get_solv_pool(transaction->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(transaction->root);
 
        const char* selection = pool_selection2str(pool, &transaction->jobs, 0);
        if (selection)
@@ -654,7 +654,7 @@ int pakfire_transaction_solve(pakfire_transaction* transaction,
                                }
 
                                // Ask the user to pick a solution
-                               r = pakfire_ctx_pick_solution(transaction->ctx, transaction->pakfire, transaction);
+                               r = pakfire_ctx_pick_solution(transaction->ctx, transaction->root, transaction);
                                switch (r) {
                                        case 0:
                                                continue;
@@ -759,10 +759,10 @@ static int pakfire_transaction_add_job(pakfire_transaction* transaction,
        Queue jobs;
        int r;
 
-       Pool* pool = pakfire_get_solv_pool(transaction->pakfire);
+       Pool* pool = pakfire_root_get_solv_pool(transaction->root);
 
        // Make the pool ready
-       pakfire_pool_internalize(transaction->pakfire);
+       pakfire_root_pool_internalize(transaction->root);
 
        // Initialize jobs
        queue_init(&jobs);
@@ -790,7 +790,7 @@ static int pakfire_transaction_add_job(pakfire_transaction* transaction,
 
        // Did we find anything?
        if (jobs.count == 0) {
-               Id id = pakfire_str2dep(transaction->pakfire, what);
+               Id id = pakfire_str2dep(transaction->root, what);
                if (!id) {
                        r = -errno;
                        goto ERROR;
@@ -837,7 +837,7 @@ int pakfire_transaction_request(pakfire_transaction* transaction,
        // Check if we got given a URL or some file
        } else if (pakfire_string_is_url(what) || pakfire_transaction_is_file(what)) {
                // Add them to the commandline repository
-               r = pakfire_commandline_add(transaction->pakfire, what, &package);
+               r = pakfire_root_commandline_add(transaction->root, what, &package);
                if (r)
                        goto ERROR;
 
@@ -1160,7 +1160,7 @@ char* pakfire_transaction_dump(pakfire_transaction* transaction, size_t width) {
                        pakfire_package* old_pkg = NULL;
                        pakfire_package* new_pkg = NULL;
 
-                       r = pakfire_package_create_from_solvable(&old_pkg, transaction->pakfire,
+                       r = pakfire_package_create_from_solvable(&old_pkg, transaction->root,
                                        NULL, pkgs.elements[j]);
                        if (r)
                                continue;
@@ -1168,7 +1168,7 @@ char* pakfire_transaction_dump(pakfire_transaction* transaction, size_t width) {
                        switch (class) {
                                case SOLVER_TRANSACTION_UPGRADED:
                                case SOLVER_TRANSACTION_DOWNGRADED:
-                                       r = pakfire_package_create_from_solvable(&new_pkg, transaction->pakfire,
+                                       r = pakfire_package_create_from_solvable(&new_pkg, transaction->root,
                                                        NULL, transaction_obs_pkg(transaction->transaction, pkgs.elements[j]));
                                        if (r)
                                                continue;
@@ -1314,7 +1314,7 @@ static int pakfire_transaction_run_script(pakfire_transaction* transaction,
                return 0;
 
        // Execute the scriptlet
-       pakfire_scriptlet_execute(scriptlet, transaction->pakfire);
+       pakfire_scriptlet_execute(scriptlet, transaction->root);
 
        pakfire_scriptlet_unref(scriptlet);
 
@@ -1349,7 +1349,7 @@ static int pakfire_transaction_extract(pakfire_transaction* transaction,
 
        // Update the runtime linker cache
        if (pakfire_filelist_contains(filelist, "*/lib*.so.?"))
-               pakfire_jail_ldconfig(transaction->pakfire);
+               pakfire_jail_ldconfig(transaction->root);
 
        if (filelist)
                pakfire_filelist_unref(filelist);
@@ -1384,7 +1384,7 @@ static int pakfire_transaction_erase(pakfire_transaction* transaction,
                goto ERROR;
 
        // Update the runtime linker cache after all files have been removed
-       pakfire_jail_ldconfig(transaction->pakfire);
+       pakfire_jail_ldconfig(transaction->root);
 
 ERROR:
        pakfire_progress_pop_status(transaction->progress);
@@ -1480,7 +1480,7 @@ static int pakfire_transaction_apply_systemd_tmpfiles(
                pakfire_transaction* transaction, pakfire_package* pkg) {
        // Apply any tmpfiles (ignore any errors)
        if (pakfire_package_matches_dep(pkg, PAKFIRE_PKG_REQUIRES, "pakfire(systemd-tmpfiles)"))
-               pakfire_jail_run_systemd_tmpfiles(transaction->pakfire);
+               pakfire_jail_run_systemd_tmpfiles(transaction->root);
 
        return 0;
 }
@@ -1780,14 +1780,14 @@ static int pakfire_transaction_open_archives(
        return 0;
 }
 
-static int pakfire_usrmove_symlink(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int pakfire_usrmove_symlink(pakfire_ctx* ctx, pakfire_root* root,
                const char* src, const char* dst) {
        char link[PATH_MAX];
        char path[PATH_MAX];
        int r;
 
        // Compose the link path
-       r = pakfire_path(pakfire, link, "%s", src);
+       r = pakfire_root_path(root, link, "%s", src);
        if (r)
                return r;
 
@@ -1796,7 +1796,7 @@ static int pakfire_usrmove_symlink(pakfire_ctx* ctx, struct pakfire* pakfire,
                return 0;
 
        // Compose the destination path
-       r = pakfire_path(pakfire, path, "%s", dst);
+       r = pakfire_root_path(root, path, "%s", dst);
        if (r)
                return r;
 
@@ -1822,22 +1822,22 @@ static int pakfire_usrmove_symlink(pakfire_ctx* ctx, struct pakfire* pakfire,
        that /bin, /sbin, /lib and /lib64 are symlinks to their
        corresponding path in /usr.
 */
-static int pakfire_usrmove(pakfire_ctx* ctx, struct pakfire* pakfire) {
+static int pakfire_usrmove(pakfire_ctx* ctx, pakfire_root* root) {
        int r;
 
-       r = pakfire_usrmove_symlink(ctx, pakfire, "/bin", "usr/bin");
+       r = pakfire_usrmove_symlink(ctx, root, "/bin", "usr/bin");
        if (r)
                return r;
 
-       r = pakfire_usrmove_symlink(ctx, pakfire, "/sbin", "usr/sbin");
+       r = pakfire_usrmove_symlink(ctx, root, "/sbin", "usr/sbin");
        if (r)
                return r;
 
-       r = pakfire_usrmove_symlink(ctx, pakfire, "/lib", "usr/lib");
+       r = pakfire_usrmove_symlink(ctx, root, "/lib", "usr/lib");
        if (r)
                return r;
 
-       r = pakfire_usrmove_symlink(ctx, pakfire, "/lib64", "usr/lib64");
+       r = pakfire_usrmove_symlink(ctx, root, "/lib64", "usr/lib64");
        if (r)
                return r;
 
@@ -1868,7 +1868,7 @@ static int pakfire_transaction_perform(pakfire_transaction* transaction) {
                return r;
 
        // Open the database
-       r = pakfire_db_open(&db, transaction->pakfire, PAKFIRE_DB_READWRITE);
+       r = pakfire_db_open(&db, transaction->root, PAKFIRE_DB_READWRITE);
        if (r) {
                ERROR(transaction->ctx, "Could not open the database\n");
                return r;
@@ -1880,7 +1880,7 @@ static int pakfire_transaction_perform(pakfire_transaction* transaction) {
                goto ERROR;
 
        // Make sure /usr-move is working
-       r = pakfire_usrmove(transaction->ctx, transaction->pakfire);
+       r = pakfire_usrmove(transaction->ctx, transaction->root);
        if (r)
                goto ERROR;
 
@@ -1907,7 +1907,7 @@ static int pakfire_transaction_perform(pakfire_transaction* transaction) {
 
        // Reload database for next transaction
 
-       repo = pakfire_get_installed_repo(transaction->pakfire);
+       repo = pakfire_root_get_installed_repo(transaction->root);
        if (!repo)
                goto ERROR;
 
@@ -2052,7 +2052,7 @@ int pakfire_transaction_run(pakfire_transaction* transaction) {
        dump = pakfire_transaction_dump(transaction, 80);
 
        // Check if we should continue
-       r = pakfire_ctx_confirm(transaction->ctx, transaction->pakfire, dump, _("Is this okay?"));
+       r = pakfire_ctx_confirm(transaction->ctx, transaction->root, dump, _("Is this okay?"));
        if (r) {
                ERROR(transaction->ctx, "Transaction aborted upon user request\n");
                goto ERROR;
@@ -2113,5 +2113,5 @@ int pakfire_transaction_compose_repo(pakfire_transaction* transaction,
        files[num] = NULL;
 
        // Create the repository
-       return pakfire_repo_compose(transaction->pakfire, path, key, files);
+       return pakfire_repo_compose(transaction->root, path, key, files);
 }
index d861eabe6aa36941aae8862fb54fdfdcb6ad97f5..feeacb0de45dd9407c8c1c6b0e66a2e771fe7030 100644 (file)
@@ -59,8 +59,7 @@ enum pakfire_job_flags {
        PAKFIRE_JOB_BEST                = 1 << 3,
 };
 
-int pakfire_transaction_create(pakfire_transaction** transaction,
-       struct pakfire* pakfire, int flags);
+int pakfire_transaction_create(pakfire_transaction** transaction, pakfire_root* root, int flags);
 
 pakfire_transaction* pakfire_transaction_ref(pakfire_transaction* transaction);
 pakfire_transaction* pakfire_transaction_unref(pakfire_transaction* transaction);
index 363c8a31dc7b73ef1aba3503e1e5951e9b1fad4e..92429d061e76ef8d551f1b3e8ebe8352c421fa81 100644 (file)
@@ -337,7 +337,7 @@ int pakfire_rmtree(const char* path, int flags) {
        return r;
 }
 
-int __pakfire_which(struct pakfire* pakfire, char* path, const size_t length,
+int __pakfire_which(pakfire_root* root, char* path, const size_t length,
                const char* what) {
        char buffer[PATH_MAX];
        int r;
@@ -359,13 +359,13 @@ int __pakfire_which(struct pakfire* pakfire, char* path, const size_t length,
 
        for (const char** p = paths; *p; p++) {
                // Compose path
-               r = pakfire_path(pakfire, buffer, "%s/%s", *p, what);
+               r = pakfire_root_path(root, buffer, "%s/%s", *p, what);
                if (r)
                        return r;
 
                // If the path exists and is executable we are done
                if (access(buffer, X_OK) == 0) {
-                       const char* relpath = pakfire_relpath(pakfire, buffer);
+                       const char* relpath = pakfire_root_relpath(root, buffer);
 
                        // Store the result in path
                        return __pakfire_string_set(path, length, relpath);
index 5151c7fc9021307326e86e1fd319cf2c01286de3..c806c802f13127cedb2520ee3619bc75a9a981b9 100644 (file)
@@ -67,9 +67,9 @@ char* pakfire_mkdtemp(char* path);
 int pakfire_symlink(pakfire_ctx* ctx, const char* target, const char* linkpath);
 int pakfire_rmtree(const char* path, int flags);
 
-#define pakfire_which(pakfire, path, what) \
-       __pakfire_which(pakfire, path, sizeof(path), what)
-int __pakfire_which(struct pakfire* pakfire, char* path, const size_t length, const char* what);
+#define pakfire_which(root, path, what) \
+       __pakfire_which(root, path, sizeof(path), what)
+int __pakfire_which(pakfire_root* root, char* path, const size_t length, const char* what);
 
 // UUID Stuff
 
index ba951b1f9ec176f102aefe542fc09bbb058de2a3..93556309e302dd1929f7799050d52882712e20a0 100644 (file)
@@ -66,7 +66,7 @@ static int Archive_init(ArchiveObject* self, PyObject* args, PyObject* kwds) {
        if (!PyArg_ParseTuple(args, "O!s", &PakfireType, &pakfire, &filename))
                return -1;
 
-       errno = -pakfire_archive_open(&self->archive, pakfire->pakfire, filename);
+       errno = -pakfire_archive_open(&self->archive, pakfire->root, filename);
        if (errno) {
                PyErr_SetFromErrno(PyExc_OSError);
                return -1;
index cc8f5aa92bbf322ed02da8f5b8feea92ee0c63ad..0cd72c38d5a96a5be9030da3839cc28747b5255b 100644 (file)
@@ -228,7 +228,7 @@ static PyObject* Ctx_set_logger(CtxObject* self, PyObject* args) {
 
 // Confirm Callback
 
-static int Ctx_confirm_callback(pakfire_ctx* ctx, struct pakfire* pakfire,
+static int Ctx_confirm_callback(pakfire_ctx* ctx, pakfire_root* root,
                void* data, const char* message, const char* question) {
        PyObject* callback = data;
        PyObject* ret = NULL;
index dc09566ae96f930b12e6eab5f86e355953601fdd..044cc0b4648bac9269d7246abc677555ea21e659 100644 (file)
@@ -73,7 +73,7 @@ static int Package_init(PackageObject* self, PyObject* args, PyObject* kwds) {
                return -1;
 
        // Create the package object
-       r = pakfire_package_create(&self->package, pakfire->pakfire, repo->repo, name, evr, arch);
+       r = pakfire_package_create(&self->package, pakfire->root, repo->repo, name, evr, arch);
        if (r < 0) {
                errno = -r;
                PyErr_SetFromErrno(PyExc_OSError);
index 92435be552da7268726fd3af14f218601cf4c54e..6d2995069c0b4848f618faa33bf3639410fe2235 100644 (file)
@@ -52,7 +52,7 @@ static PyObject* Pakfire_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
        PakfireObject* self = (PakfireObject *)type->tp_alloc(type, 0);
        if (self) {
                self->ctx = NULL;
-               self->pakfire = NULL;
+               self->root = NULL;
        }
 
        return (PyObject *)self;
@@ -79,7 +79,7 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
 
        // Setup flags
        if (stub)
-               flags |= PAKFIRE_FLAGS_STUB;
+               flags |= PAKFIRE_ROOT_FLAGS_STUB;
 
        // Create a new configuration object
        r = pakfire_config_create(&c);
@@ -101,8 +101,8 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
 
        Py_BEGIN_ALLOW_THREADS
 
-       // Create a new Pakfire instance
-       r = pakfire_create(&self->pakfire, self->ctx->ctx, c, path, arch, flags);
+       // Create a new root
+       r = pakfire_root_create(&self->root, self->ctx->ctx, c, path, arch, flags);
        if (r < 0) {
                Py_BLOCK_THREADS
                errno = -r;
@@ -123,8 +123,8 @@ ERROR:
 static void Pakfire_dealloc(PakfireObject* self) {
        Py_BEGIN_ALLOW_THREADS
 
-       if (self->pakfire)
-               pakfire_unref(self->pakfire);
+       if (self->root)
+               pakfire_root_unref(self->root);
 
        Py_END_ALLOW_THREADS
 
@@ -134,20 +134,20 @@ static void Pakfire_dealloc(PakfireObject* self) {
 }
 
 static PyObject* Pakfire_repr(PakfireObject* self) {
-       const char* path = pakfire_get_path(self->pakfire);
-       const char* arch = pakfire_get_arch(self->pakfire);
+       const char* path = pakfire_root_get_path(self->root);
+       const char* arch = pakfire_root_get_arch(self->root);
 
        return PyUnicode_FromFormat("<_pakfire.Pakfire %s (%s)>", path, arch);
 }
 
 static PyObject* Pakfire_get_path(PakfireObject* self) {
-       const char* path = pakfire_get_path(self->pakfire);
+       const char* path = pakfire_root_get_path(self->root);
 
        return PyUnicode_FromString(path);
 }
 
 static PyObject* Pakfire_get_arch(PakfireObject* self) {
-       const char* arch = pakfire_get_arch(self->pakfire);
+       const char* arch = pakfire_root_get_arch(self->root);
 
        return PyUnicode_FromString(arch);
 }
@@ -158,7 +158,7 @@ static PyObject* Pakfire_get_repo(PakfireObject* self, PyObject* args) {
        if (!PyArg_ParseTuple(args, "s", &name))
                return NULL;
 
-       pakfire_repo* repo = pakfire_get_repo(self->pakfire, name);
+       pakfire_repo* repo = pakfire_root_get_repo(self->root, name);
        if (!repo)
                Py_RETURN_NONE;
 
@@ -249,7 +249,7 @@ static PyObject* Pakfire_whatprovides(PakfireObject* self, PyObject* args) {
                goto ERROR;
        }
 
-       r = pakfire_whatprovides(self->pakfire, provides, 0, list);
+       r = pakfire_root_whatprovides(self->root, provides, 0, list);
        if (r < 0) {
                errno = -r;
                PyErr_SetFromErrno(PyExc_OSError);
@@ -286,7 +286,7 @@ static PyObject* Pakfire_whatrequires(PakfireObject* self, PyObject* args) {
                goto ERROR;
        }
 
-       r = pakfire_whatrequires(self->pakfire, requires, 0, list);
+       r = pakfire_root_whatrequires(self->root, requires, 0, list);
        if (r < 0) {
                Py_BLOCK_THREADS
                errno = -r;
@@ -320,7 +320,7 @@ static PyObject* Pakfire_search(PakfireObject* self, PyObject* args, PyObject* k
 
        // Search for package names only
        if (name_only)
-               flags |= PAKFIRE_SEARCH_NAME_ONLY;
+               flags |= PAKFIRE_ROOT_SEARCH_NAME_ONLY;
 
        r = pakfire_packagelist_create(&list, self->ctx->ctx);
        if (r < 0) {
@@ -329,7 +329,7 @@ static PyObject* Pakfire_search(PakfireObject* self, PyObject* args, PyObject* k
                goto ERROR;
        }
 
-       r = pakfire_search(self->pakfire, pattern, flags, list);
+       r = pakfire_root_search(self->root, pattern, flags, list);
        if (r < 0) {
                errno = -r;
                PyErr_SetFromErrno(PyExc_OSError);
@@ -352,7 +352,7 @@ static PyObject* Pakfire_version_compare(PakfireObject* self, PyObject* args) {
        if (!PyArg_ParseTuple(args, "ss", &evr1, &evr2))
                return NULL;
 
-       int cmp = pakfire_version_compare(self->pakfire, evr1, evr2);
+       int cmp = pakfire_root_version_compare(self->root, evr1, evr2);
 
        return PyLong_FromLong(cmp);
 }
@@ -369,7 +369,7 @@ static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
 
        Py_BEGIN_ALLOW_THREADS
 
-       r = pakfire_dist(self->pakfire, path, &archive);
+       r = pakfire_dist(self->root, path, &archive);
        if (r) {
                Py_BLOCK_THREADS
                PyErr_SetFromErrno(PyExc_OSError);
@@ -388,7 +388,7 @@ static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
 }
 
 static PyObject* Pakfire_get_repos(PakfireObject* self) {
-       pakfire_repolist* repos = pakfire_get_repos(self->pakfire);
+       pakfire_repolist* repos = pakfire_root_get_repos(self->root);
        if (!repos) {
                PyErr_SetFromErrno(PyExc_OSError);
                return NULL;
@@ -422,7 +422,7 @@ static PyObject* Pakfire_clean(PakfireObject* self) {
 
        Py_BEGIN_ALLOW_THREADS
 
-       r = pakfire_clean(self->pakfire, 0);
+       r = pakfire_root_clean(self->root, 0);
        if (r) {
                Py_BLOCK_THREADS
                PyErr_SetFromErrno(PyExc_OSError);
@@ -443,7 +443,7 @@ static PyObject* Pakfire_open(PakfireObject* self, PyObject* args) {
 
        Py_BEGIN_ALLOW_THREADS
 
-       int r = pakfire_archive_open(&archive, self->pakfire, path);
+       int r = pakfire_archive_open(&archive, self->root, path);
        if (r) {
                Py_BLOCK_THREADS
                PyErr_SetFromErrno(PyExc_OSError);
@@ -510,7 +510,7 @@ static PyObject* Pakfire_repo_compose(PakfireObject* self, PyObject* args, PyObj
 
        Py_BEGIN_ALLOW_THREADS
 
-       int r = pakfire_repo_compose(self->pakfire, path, (key) ? key->key : NULL, files);
+       int r = pakfire_repo_compose(self->root, path, (key) ? key->key : NULL, files);
        if (r) {
                Py_BLOCK_THREADS
                PyErr_SetFromErrno(PyExc_OSError);
@@ -681,7 +681,7 @@ static PyObject* Pakfire_execute(PakfireObject* self, PyObject* args, PyObject*
                input_callback = pakfire_jail_send_buffer;
 
        // Create a new jail
-       r = pakfire_jail_create(&jail, self->pakfire);
+       r = pakfire_jail_create(&jail, self->root);
        if (r < 0) {
                errno = -r;
                PyErr_SetFromErrno(PyExc_OSError);
index f8487450b12b12a3fad077c9670696faf2bd1e6c..029453d851a38365a6c67af9a437b887fb37186b 100644 (file)
@@ -33,8 +33,8 @@ typedef struct {
        // The Python context object
        CtxObject* ctx;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 } PakfireObject;
 
 extern PyTypeObject PakfireType;
index 5383c13745e6d1d14a0297e0c4e6b072c9ec0a63..985399ab6b1282413793c5152419f2957af29cde 100644 (file)
@@ -64,7 +64,7 @@ static int Repo_init(RepoObject* self, PyObject* args, PyObject* kwds) {
                return -1;
 
        // Create a new repository
-       int r = pakfire_repo_create(&self->repo, pakfire->pakfire, name);
+       int r = pakfire_repo_create(&self->repo, pakfire->root, name);
        if (r) {
                PyErr_SetFromErrno(PyExc_OSError);
                return -1;
index a56bd04e28754eac62f6fdd4936ab9cba9626812..54c94ddbf69851e3a0e28ef9403331c1d7ac3810 100644 (file)
@@ -73,7 +73,7 @@ static int Transaction_init(TransactionObject* self, PyObject* args, PyObject* k
                flags |= PAKFIRE_TRANSACTION_WITHOUT_RECOMMENDED;
 
        // Create a new transaction
-       r = pakfire_transaction_create(&self->transaction, pakfire->pakfire, flags);
+       r = pakfire_transaction_create(&self->transaction, pakfire->root, flags);
        if (r < 0) {
                errno = -r;
                PyErr_SetFromErrno(PyExc_OSError);
index 39b51830071c45505685afb88be52ad2683cbc71..57dc5aaf7d641320e8b8f733d7d979220543d742 100644 (file)
@@ -36,7 +36,7 @@ static int test_open(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Open the archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH TEST_PKG1_PATH));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH TEST_PKG1_PATH));
 
        // Check if path was set correctly
        ASSERT_STRING_EQUALS(pakfire_archive_get_path(archive), TEST_SRC_PATH TEST_PKG1_PATH);
@@ -73,7 +73,7 @@ static int test_open_directory(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Open the archive
-       ASSERT_ERROR(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH), EISDIR);
+       ASSERT_ERROR(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH), EISDIR);
        ASSERT_NULL(archive);
 
        // Everything passed
@@ -99,7 +99,7 @@ static int test_read(const struct test* t) {
        };
 
        // Open the archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH TEST_PKG1_PATH));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH TEST_PKG1_PATH));
 
        // Read a file
        ASSERT(f = pakfire_archive_read(archive, "/usr/bin/beep", 0));
@@ -141,7 +141,7 @@ static int test_copy(const struct test* t) {
        ASSERT(f && path);
 
        // Open the archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH TEST_PKG1_PATH));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH TEST_PKG1_PATH));
 
        // Copy archive
        ASSERT_SUCCESS(pakfire_archive_copy(archive, path));
@@ -168,7 +168,7 @@ static int test_filelist(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Open the archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH TEST_PKG1_PATH));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH TEST_PKG1_PATH));
 
        // Fetch the filelist
        ASSERT_SUCCESS(pakfire_archive_get_filelist(archive, &list));
@@ -193,13 +193,13 @@ static int test_extract(const struct test* t) {
        char path[PATH_MAX];
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, TEST_SRC_PATH TEST_PKG1_PATH));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, TEST_SRC_PATH TEST_PKG1_PATH));
 
        // Extract the archive payload
        ASSERT_SUCCESS(pakfire_archive_extract(archive, NULL, 0, NULL));
 
        // Check if test file from the archive exists
-       pakfire_path(t->pakfire, path, "%s", "/usr/bin/beep");
+       pakfire_root_path(t->root, path, "%s", "/usr/bin/beep");
        ASSERT_SUCCESS(access(path, F_OK));
 
        r = EXIT_SUCCESS;
@@ -220,11 +220,11 @@ static int test_import(const struct test* t) {
        pakfire_package* package = NULL;
 
        // Open archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, path));
        ASSERT(archive);
 
        // Create a new repository
-       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "@tmp"));
+       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->root, "@tmp"));
        ASSERT(repo);
 
        // Add the package to the repository
@@ -246,13 +246,13 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_open, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_open_directory, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_read, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_copy, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_filelist, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_extract, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_import, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_open, TEST_WANTS_ROOT);
+       testsuite_add_test(test_open_directory, TEST_WANTS_ROOT);
+       testsuite_add_test(test_read, TEST_WANTS_ROOT);
+       testsuite_add_test(test_copy, TEST_WANTS_ROOT);
+       testsuite_add_test(test_filelist, TEST_WANTS_ROOT);
+       testsuite_add_test(test_extract, TEST_WANTS_ROOT);
+       testsuite_add_test(test_import, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 4b4f74e4ff8c44537397c13c5a46c232847d0a04..156543a10e16ccc643acfdb49deed3f682a78cf2 100644 (file)
@@ -117,7 +117,7 @@ static int test_stats(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_create(&cgroup, t->ctx, NULL, "pakfire-test", 0));
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Connect jail to the cgroup
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
@@ -154,7 +154,7 @@ int main(int argc, const char* argv[]) {
        testsuite_add_test(test_create_and_destroy, 0);
        testsuite_add_test(test_recursive, 0);
        testsuite_add_test(test_child, 0);
-       testsuite_add_test(test_stats, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_stats, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 545d71c2bfd0cfcaabbaa44e217e7dde9fa85042..e360178ac11cb9dd689f906c89b113b4fe1c2072 100644 (file)
@@ -30,7 +30,7 @@ static int test_open_ro(const struct test* t) {
        pakfire_db* db = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_db_open(&db, t->pakfire, PAKFIRE_DB_READONLY));
+       ASSERT_SUCCESS(pakfire_db_open(&db, t->root, PAKFIRE_DB_READONLY));
 
        // Everything passed
        r = EXIT_SUCCESS;
@@ -46,7 +46,7 @@ static int test_open_rw(const struct test* t) {
        pakfire_db* db = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_db_open(&db, t->pakfire, PAKFIRE_DB_READWRITE));
+       ASSERT_SUCCESS(pakfire_db_open(&db, t->root, PAKFIRE_DB_READWRITE));
 
        // Everything passed
        r = EXIT_SUCCESS;
@@ -62,7 +62,7 @@ static int test_check(const struct test* t) {
        pakfire_db* db = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_db_open(&db, t->pakfire, PAKFIRE_DB_READWRITE));
+       ASSERT_SUCCESS(pakfire_db_open(&db, t->root, PAKFIRE_DB_READWRITE));
 
        // Perform check
        ASSERT_SUCCESS(pakfire_db_check(db));
@@ -84,9 +84,9 @@ static int test_add_package(const struct test* t) {
        pakfire_archive* archive = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT(repo = pakfire_get_repo(t->pakfire, PAKFIRE_REPO_DUMMY));
+       ASSERT(repo = pakfire_root_get_repo(t->root, PAKFIRE_REPO_DUMMY));
 
-       ASSERT_SUCCESS(pakfire_db_open(&db, t->pakfire, PAKFIRE_DB_READWRITE));
+       ASSERT_SUCCESS(pakfire_db_open(&db, t->root, PAKFIRE_DB_READWRITE));
 
        // There must be no packages installed
        ssize_t packages = pakfire_db_packages(db);
@@ -95,7 +95,7 @@ static int test_add_package(const struct test* t) {
        const char* path = TEST_SRC_PATH "/data/beep-1.3-2.ip3.x86_64.pfm";
 
        // Open archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, path));
        ASSERT(archive);
 
        // Get package
@@ -131,10 +131,10 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_open_ro, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_open_rw, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_check, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_add_package, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_open_ro, TEST_WANTS_ROOT);
+       testsuite_add_test(test_open_rw, TEST_WANTS_ROOT);
+       testsuite_add_test(test_check, TEST_WANTS_ROOT);
+       testsuite_add_test(test_add_package, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 582a98de9d504230d75806fe53f7a07551db4083..878a2fa575df4251f082ea4510c4cca8d6340118 100644 (file)
@@ -125,18 +125,18 @@ static int test_dependencies(const struct test* t) {
        const char* result = NULL;
 
        // Check some invalid inputs
-       ASSERT(pakfire_str2dep(t->pakfire, NULL) == ID_NULL);
-       ASSERT(pakfire_str2dep(t->pakfire, "") == ID_NULL);
+       ASSERT(pakfire_str2dep(t->root, NULL) == ID_NULL);
+       ASSERT(pakfire_str2dep(t->root, "") == ID_NULL);
 
        // Check some valid inputs
        for (const char** relation = relations; *relation; relation++) {
                printf("Parsing '%s'...\n", *relation);
 
                // Parse relation
-               dep = pakfire_str2dep(t->pakfire, *relation);
+               dep = pakfire_str2dep(t->root, *relation);
 
                // Convert it back to string
-               result = pakfire_dep2str(t->pakfire, dep);
+               result = pakfire_dep2str(t->root, dep);
                ASSERT(result);
 
                // Check if the output matches the input
@@ -148,7 +148,7 @@ static int test_dependencies(const struct test* t) {
                printf("Parsing '%s'...\n", *relation);
 
                // Parse relation
-               dep = pakfire_str2dep(t->pakfire, *relation);
+               dep = pakfire_str2dep(t->root, *relation);
 
                // The return value must be ID_NULL
                ASSERT(dep == ID_NULL);
@@ -159,10 +159,10 @@ static int test_dependencies(const struct test* t) {
                printf("Parsing '%s'...\n", *relation);
 
                // Parse relation
-               ASSERT(dep = pakfire_str2dep(t->pakfire, *relation));
+               ASSERT(dep = pakfire_str2dep(t->root, *relation));
 
                // Convert it back to string
-               ASSERT(result = pakfire_dep2str(t->pakfire, dep));
+               ASSERT(result = pakfire_dep2str(t->root, dep));
 
                printf("  as '%s'\n", result);
        }
@@ -177,7 +177,7 @@ static int test_dep_match(const struct test* t) {
        pakfire_package* pkg = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL,
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL,
                "test", "1.0-1", "x86_64"));
 
        // Check if the package matches itself
@@ -212,8 +212,8 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_dependencies, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_dep_match, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_dependencies, TEST_WANTS_ROOT);
+       testsuite_add_test(test_dep_match, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 61efe4364875147aeb7ae8ce94a6f24f7de627fc..8fae33f837a0e13fd592f72edfb69b5fbf1bba40 100644 (file)
@@ -27,7 +27,7 @@ static int test_create(const struct test* t) {
        pakfire_file* file = NULL;
 
        // Create a new file
-       ASSERT_SUCCESS(pakfire_file_create(&file, t->pakfire, NULL));
+       ASSERT_SUCCESS(pakfire_file_create(&file, t->root, NULL));
 
        // Set path & check
        ASSERT_SUCCESS(pakfire_file_set_path(file, "/abc"));
@@ -46,7 +46,7 @@ static int test_create_invalid(const struct test* t) {
        pakfire_file* file = NULL;
 
        // Create a new file
-       ASSERT_SUCCESS(pakfire_file_create(&file, t->pakfire, NULL));
+       ASSERT_SUCCESS(pakfire_file_create(&file, t->root, NULL));
 
        // Set path
        ASSERT(pakfire_file_set_path(file, NULL) == -EINVAL);
@@ -68,12 +68,12 @@ static int test_create_filelist(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Create a new filelist
-       ASSERT_SUCCESS(pakfire_filelist_create(&list, t->pakfire));
+       ASSERT_SUCCESS(pakfire_filelist_create(&list, t->root));
 
        // Create some files
-       ASSERT_SUCCESS(pakfire_file_create(&file1, t->pakfire, "/1"));
-       ASSERT_SUCCESS(pakfire_file_create(&file2, t->pakfire, "/2"));
-       ASSERT_SUCCESS(pakfire_file_create(&file3, t->pakfire, "/3"));
+       ASSERT_SUCCESS(pakfire_file_create(&file1, t->root, "/1"));
+       ASSERT_SUCCESS(pakfire_file_create(&file2, t->root, "/2"));
+       ASSERT_SUCCESS(pakfire_file_create(&file3, t->root, "/3"));
 
        // Add the files to the list
        ASSERT_SUCCESS(pakfire_filelist_add(list, file1));
@@ -103,10 +103,10 @@ FAIL:
 
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_create, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_create_invalid, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_create, TEST_WANTS_ROOT);
+       testsuite_add_test(test_create_invalid, TEST_WANTS_ROOT);
 
-       testsuite_add_test(test_create_filelist, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_create_filelist, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index e61330dead776b4c03619afe5d31e49eb11e8a7a..77218b7f726fd255f5d7c72e457e29f80f84f1b2 100644 (file)
@@ -45,7 +45,7 @@ static int test_create(const struct test* t) {
        pakfire_jail* jail = NULL;
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Destroy it
        ASSERT_NULL(pakfire_jail_unref(jail));
@@ -65,7 +65,7 @@ static int test_exit_code(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Check if we receive the correct exit code
        ASSERT_EQUALS(pakfire_jail_execute_command(jail, argv, NULL, 0), 123);
@@ -89,7 +89,7 @@ static int test_segv(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Check if we receive the correct exit code
        ASSERT(pakfire_jail_execute_command(jail, argv, NULL, 0) == 139);
@@ -111,7 +111,7 @@ static int test_exec(const struct test* t) {
        size_t length = 0;
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Try to execute something
        ASSERT_SUCCESS(pakfire_jail_execute_capture_output(jail, cmd_hello_world, NULL, 0, &output, &length));
@@ -142,7 +142,7 @@ static int test_launch_into_cgroup(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_create(&cgroup, t->ctx, NULL, "pakfire-test", 0));
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Connect jail to the cgroup
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
@@ -174,7 +174,7 @@ static int test_nice(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Set invalid nice levels
        ASSERT_ERROR(pakfire_jail_nice(jail,  100), EINVAL);
@@ -209,7 +209,7 @@ static int test_memory_limit(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_create(&cgroup, t->ctx, NULL, "pakfire-test", 0));
 
        // Create jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Connect jail to the cgroup
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
@@ -246,7 +246,7 @@ static int test_pid_limit(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_create(&cgroup, t->ctx, NULL, "pakfire-test", 0));
 
        // Create jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Connect jail to the cgroup
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
@@ -276,7 +276,7 @@ static int test_file_ownership(const struct test* t) {
        char* output = NULL;
 
        // Execute a simple command
-       ASSERT_SUCCESS(pakfire_jail_run(t->pakfire, cmd_stat_ownership, NULL, 0, &output, NULL));
+       ASSERT_SUCCESS(pakfire_jail_run(t->root, cmd_stat_ownership, NULL, 0, &output, NULL));
 
        // Check if the file has been mapped to root/root
        ASSERT_STRING_EQUALS(output, "uid=0 gid=0\n");
@@ -303,7 +303,7 @@ static int test_bind(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Bind-mount nonsense
        ASSERT_ERROR(pakfire_jail_bind(jail, NULL, target, 0), EINVAL);
@@ -365,7 +365,7 @@ static int test_communicate(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Check if the mount actually works
        ASSERT_SUCCESS(pakfire_jail_communicate(jail, argv, NULL, 0,
@@ -396,7 +396,7 @@ static int test_send_signal(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Sending SIGTERM to ourselves
        ASSERT(test_send_one_signal(t, jail, "15") == 0);
@@ -426,7 +426,7 @@ static int test_timeout(const struct test* t) {
        };
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Set a timeout of one second
        ASSERT_SUCCESS(pakfire_jail_set_timeout(jail, 1));
@@ -460,7 +460,7 @@ static int test_callback(const struct test* t) {
        int i = 123;
 
        // Create a new jail
-       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
+       ASSERT_SUCCESS(pakfire_jail_create(&jail, t->root));
 
        // Check if we receive the correct exit code
        ASSERT(pakfire_jail_execute(jail, __callback, &i, 0) == 123);
@@ -476,24 +476,24 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_create, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_exit_code, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_segv, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_exec, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_create, TEST_WANTS_ROOT);
+       testsuite_add_test(test_exit_code, TEST_WANTS_ROOT);
+       testsuite_add_test(test_segv, TEST_WANTS_ROOT);
+       testsuite_add_test(test_exec, TEST_WANTS_ROOT);
 #if 0
-       testsuite_add_test(test_launch_into_cgroup, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_launch_into_cgroup, TEST_WANTS_ROOT);
 #endif
-       testsuite_add_test(test_nice, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_nice, TEST_WANTS_ROOT);
 #if 0
-       testsuite_add_test(test_memory_limit, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_pid_limit, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_file_ownership, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_memory_limit, TEST_WANTS_ROOT);
+       testsuite_add_test(test_pid_limit, TEST_WANTS_ROOT);
+       testsuite_add_test(test_file_ownership, TEST_WANTS_ROOT);
 #endif
-       testsuite_add_test(test_bind, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_communicate, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_send_signal, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_timeout, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_callback, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_bind, TEST_WANTS_ROOT);
+       testsuite_add_test(test_communicate, TEST_WANTS_ROOT);
+       testsuite_add_test(test_send_signal, TEST_WANTS_ROOT);
+       testsuite_add_test(test_timeout, TEST_WANTS_ROOT);
+       testsuite_add_test(test_callback, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 9624e76bd98337ba35a40bc0b43bad6673668f0f..10ed58d67bc65046bc1e0af493e70338c2ccd614 100644 (file)
 #include "../testsuite.h"
 
 static int test_init(const struct test* t) {
-       LOG("Allocated at %p\n", t->pakfire);
+       LOG("Allocated at %p\n", t->root);
 
        // Check if the path matches
-       ASSERT_STRING_EQUALS(pakfire_get_path(t->pakfire), TEST_STUB_ROOT);
+       ASSERT_STRING_EQUALS(pakfire_root_get_path(t->root), TEST_STUB_ROOT);
 
        return EXIT_SUCCESS;
 
@@ -35,44 +35,44 @@ FAIL:
 }
 
 static int test_stub(const struct test* t) {
-       struct pakfire* pakfire = NULL;
+       pakfire_root* root = NULL;
        int r = EXIT_FAILURE;
 
        // Have some illegal calls
-       ASSERT_ERROR(pakfire_create(&pakfire, t->ctx, t->config, "PATH", NULL, PAKFIRE_FLAGS_STUB), EINVAL);
+       ASSERT_ERROR(pakfire_root_create(&root, t->ctx, t->config, "PATH", NULL, PAKFIRE_ROOT_FLAGS_STUB), EINVAL);
 
        // Have a success call
-       ASSERT_SUCCESS(pakfire_create(&pakfire, t->ctx, t->config, NULL, NULL, PAKFIRE_FLAGS_STUB));
+       ASSERT_SUCCESS(pakfire_root_create(&root, t->ctx, t->config, NULL, NULL, PAKFIRE_ROOT_FLAGS_STUB));
 
        r = EXIT_SUCCESS;
 
 FAIL:
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
 
        return r;
 }
 
 static int test_fail(const struct test* t) {
        pakfire_config* config = NULL;
-       struct pakfire* pakfire = NULL;
+       pakfire_root* root = NULL;
        int r = EXIT_FAILURE;
 
        // Create a configuration
        ASSERT_SUCCESS(pakfire_config_create(&config));
 
        // Init without anything
-       ASSERT_ERROR(pakfire_create(&pakfire, t->ctx, NULL, NULL, NULL, 0), EINVAL);
+       ASSERT_ERROR(pakfire_root_create(&root, t->ctx, NULL, NULL, NULL, 0), EINVAL);
 
        // Invalid architecture
-       ASSERT_ERROR(pakfire_create(&pakfire, t->ctx, config, NULL, "arch", 0), ENOTSUP);
+       ASSERT_ERROR(pakfire_root_create(&root, t->ctx, config, NULL, "arch", 0), ENOTSUP);
 
        // Invalid path (must be absolute)
-       ASSERT_ERROR(pakfire_create(&pakfire, t->ctx, config, "path", NULL, 0), EINVAL);
+       ASSERT_ERROR(pakfire_root_create(&root, t->ctx, config, "path", NULL, 0), EINVAL);
 
        // Cannot use snapshots with a path
-       ASSERT_ERROR(pakfire_create(&pakfire, t->ctx, NULL, PAKFIRE_TMP_DIR "/test",
-               NULL, PAKFIRE_USE_SNAPSHOT), EINVAL);
+       ASSERT_ERROR(pakfire_root_create(&root, t->ctx, NULL, PAKFIRE_TMP_DIR "/test",
+               NULL, PAKFIRE_ROOT_USE_SNAPSHOT), EINVAL);
 
        r = EXIT_SUCCESS;
 
@@ -84,7 +84,7 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_init, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_init, TEST_WANTS_ROOT);
        testsuite_add_test(test_stub, 0);
        testsuite_add_test(test_fail, 0);
 
index 32a3b6424a1118f69a59984b8dc070ffa527fe28..823c435544859020a084c3f803bad28340660a48 100644 (file)
@@ -70,7 +70,7 @@ static int test_parse(const struct test* t) {
                FILE* f = fopen(path, "r");
                ASSERT(f);
 
-               ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, 0));
+               ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
 
                ASSERT_SUCCESS(pakfire_parser_read(parser, f, NULL));
 
@@ -96,7 +96,7 @@ static int test_macros(const struct test* t) {
        pakfire_parser* parser = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, 0));
+       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
 
        // Load 'em all
        ASSERT_SUCCESS(load_macros(parser));
@@ -118,10 +118,10 @@ static int test_packages(const struct test* t) {
        char* s = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
+       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->root, "test"));
        ASSERT(repo);
 
-       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL,
+       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL,
                PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
 
        // Set some architecture
@@ -181,7 +181,7 @@ static int test_dist_dummy(const struct test* t) {
        ASSERT(tmp);
 
        // Attempt to dist the dummy package
-       ASSERT_SUCCESS(pakfire_dist(t->pakfire,
+       ASSERT_SUCCESS(pakfire_dist(t->root,
                TEST_SRC_PATH "data/packages/dummy/dummy.nm", &archive));
 
        // Extract all package metadata
@@ -211,7 +211,7 @@ static int test_dist_dummy(const struct test* t) {
 
        // Check vendor
        const char* vendor = pakfire_package_get_string(package, PAKFIRE_PKG_VENDOR);
-       ASSERT_STRING_EQUALS(vendor, pakfire_get_distro_vendor(t->pakfire));
+       ASSERT_STRING_EQUALS(vendor, pakfire_root_get_distro_vendor(t->root));
 
        // Check UUID
        const char* uuid = pakfire_package_get_string(package, PAKFIRE_PKG_UUID);
@@ -263,10 +263,10 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_macros, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_parse, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_packages, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_dist_dummy, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_macros, TEST_WANTS_ROOT);
+       testsuite_add_test(test_parse, TEST_WANTS_ROOT);
+       testsuite_add_test(test_packages, TEST_WANTS_ROOT);
+       testsuite_add_test(test_dist_dummy, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index d1a990a2ed1df7c98c3257f56d52175a7a6e50b4..7f403308c73d7d43bbb02012db04c48a1a8a9fec 100644 (file)
@@ -36,7 +36,7 @@ static int test_create(const struct test* t) {
        char** groups = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "x86_64"));
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL, "test", "1.0-1", "x86_64"));
 
        ASSERT_STRING_EQUALS(pakfire_package_get_string(pkg, PAKFIRE_PKG_NAME), "test");
        ASSERT_STRING_EQUALS(pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR), "1.0-1");
@@ -155,12 +155,12 @@ static int test_invalid_inputs(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Try to create a package with some values missing
-       ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, NULL, "1.0-1", "src"), EINVAL);
-       ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, "test", NULL, "src"), EINVAL);
-       ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", NULL), EINVAL);
+       ASSERT_ERRNO(pakfire_package_create(&pkg, t->root, NULL, NULL, "1.0-1", "src"), EINVAL);
+       ASSERT_ERRNO(pakfire_package_create(&pkg, t->root, NULL, "test", NULL, "src"), EINVAL);
+       ASSERT_ERRNO(pakfire_package_create(&pkg, t->root, NULL, "test", "1.0-1", NULL), EINVAL);
 
        // Finally create a package
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "x86_64"));
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL, "test", "1.0-1", "x86_64"));
 
        // Try to set non-sense for strings
        ASSERT_ERRNO(pakfire_package_set_string(pkg, PAKFIRE_PKG_INSTALLTIME, "today"), EINVAL);
@@ -192,7 +192,7 @@ static int test_uuid(const struct test* t) {
        uuid_unparse(uuid, uuid_string);
 
        // Create a new package
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "src"));
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL, "test", "1.0-1", "src"));
 
        // Set the UUID
        ASSERT_SUCCESS(pakfire_package_set_uuid(pkg, PAKFIRE_PKG_UUID, uuid));
@@ -224,7 +224,7 @@ static int test_deps(const struct test* t) {
        char** deps = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "src"));
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL, "test", "1.0-1", "src"));
 
        // Add a "provides"
        ASSERT_SUCCESS(pakfire_package_add_dep(pkg, PAKFIRE_PKG_PROVIDES, "a"));
@@ -256,10 +256,10 @@ static int test_filelist(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Create a filelist
-       ASSERT_SUCCESS(pakfire_filelist_create(&filelist, t->pakfire));
+       ASSERT_SUCCESS(pakfire_filelist_create(&filelist, t->root));
 
        // Create a file
-       ASSERT_SUCCESS(pakfire_file_create(&file, t->pakfire, "/bin/bash"));
+       ASSERT_SUCCESS(pakfire_file_create(&file, t->root, "/bin/bash"));
 
        // Append the file to the filelist
        ASSERT_SUCCESS(pakfire_filelist_add(filelist, file));
@@ -271,7 +271,7 @@ static int test_filelist(const struct test* t) {
        ASSERT_EQUALS(pakfire_filelist_length(filelist), 1);
 
        // Create a new package
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL,
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, NULL,
                "bash", "1.0-1", "i386"));
 
        // Set filelist
@@ -309,11 +309,11 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_create, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_invalid_inputs, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_uuid, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_deps, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_filelist, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_create, TEST_WANTS_ROOT);
+       testsuite_add_test(test_invalid_inputs, TEST_WANTS_ROOT);
+       testsuite_add_test(test_uuid, TEST_WANTS_ROOT);
+       testsuite_add_test(test_deps, TEST_WANTS_ROOT);
+       testsuite_add_test(test_filelist, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 3fcc559870796e6a449baa6724ec62d9c2ee37af..9917ca3c4b36f9ee0c66ae7e4f09a8b592eec656 100644 (file)
@@ -33,13 +33,13 @@ static int test_create(const struct test* t) {
        pakfire_repo* repo = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
+       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->root, "test"));
        ASSERT(repo);
 
-       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, repo, "test", "1.0-1", "src"));
+       ASSERT_SUCCESS(pakfire_package_create(&pkg, t->root, repo, "test", "1.0-1", "src"));
 
        // Create packager
-       ASSERT_SUCCESS(pakfire_packager_create(&packager, t->pakfire, pkg));
+       ASSERT_SUCCESS(pakfire_packager_create(&packager, t->root, pkg));
 
        // Add a file to the package
        const char* path = TEST_SRC_PATH "data/beep-1.3-2.ip3.x86_64.pfm";
@@ -74,10 +74,10 @@ static int test_compare_metadata(const struct test* t) {
        int r = EXIT_FAILURE;
 
        // Fetch the dummy repository
-       pakfire_repo* repo = pakfire_get_repo(t->pakfire, PAKFIRE_REPO_DUMMY);
+       pakfire_repo* repo = pakfire_root_get_repo(t->root, PAKFIRE_REPO_DUMMY);
        ASSERT(repo);
 
-       ASSERT_SUCCESS(pakfire_package_create(&pkg1, t->pakfire, repo,
+       ASSERT_SUCCESS(pakfire_package_create(&pkg1, t->root, repo,
                "test", "1.0-1", "x86_64"));
 
        // Set all metadata
@@ -85,7 +85,7 @@ static int test_compare_metadata(const struct test* t) {
        pakfire_package_set_string(pkg1, PAKFIRE_PKG_DESCRIPTION, "DESCRIPTION");
 
        // Create packager
-       ASSERT_SUCCESS(pakfire_packager_create(&packager, t->pakfire, pkg1));
+       ASSERT_SUCCESS(pakfire_packager_create(&packager, t->root, pkg1));
 
        // Write archive
        FILE* f = test_mktemp(&path);
@@ -97,7 +97,7 @@ static int test_compare_metadata(const struct test* t) {
        printf("Archive written to %s\n", path);
 
        // Try to open the archive
-       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->pakfire, path));
+       ASSERT_SUCCESS(pakfire_archive_open(&archive, t->root, path));
 
        // Parse package from archive
        ASSERT_SUCCESS(pakfire_archive_make_package(archive, repo, &pkg2));
@@ -150,8 +150,8 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_create, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_compare_metadata, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_create, TEST_WANTS_ROOT);
+       testsuite_add_test(test_compare_metadata, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index 07d79f849003a945967f6b0c6d25fbe492f94c98..39b97fc67027a7b187e4727b93c8c52b5c83458a 100644 (file)
@@ -35,7 +35,7 @@ static int test_parser(const struct test* t) {
        char* s = NULL;
 
        // Create a new parser
-       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, 0));
+       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
 
        // Retrieve a value that does not exist
        ASSERT_NULL(pakfire_parser_get(parser, NULL, "null"));
@@ -119,7 +119,7 @@ static int test_parser_files(const struct test* t) {
                ASSERT_SUCCESS(pakfire_string_format(path, "%s/%s", TEST_SRC_PATH, *file));
 
                // Create a new parser
-               ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, 0));
+               ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
 
                FILE* f = fopen(path, "r");
                ASSERT(f);
@@ -150,7 +150,7 @@ static int test_append(const struct test* t) {
        char* s = NULL;
 
        // Create a new parser
-       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, 0));
+       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, 0));
 
        const char* str1 =
                "a  = 1\n"
@@ -202,7 +202,7 @@ static int test_parser_command(const struct test* t) {
        pakfire_parser* parser = NULL;
        int r = EXIT_FAILURE;
 
-       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->pakfire, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
+       ASSERT_SUCCESS(pakfire_parser_create(&parser, t->root, NULL, NULL, PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS));
 
        ASSERT_SUCCESS(pakfire_parser_set(parser, NULL, "command", command, 0));
 
@@ -221,11 +221,11 @@ FAIL:
 #endif
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_parser, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_parser_files, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_append, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_parser, TEST_WANTS_ROOT);
+       testsuite_add_test(test_parser_files, TEST_WANTS_ROOT);
+       testsuite_add_test(test_append, TEST_WANTS_ROOT);
 #if 0
-       testsuite_add_test(test_parser_command, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_parser_command, TEST_WANTS_ROOT);
 #endif
 
        return testsuite_run(argc, argv);
index 25b3c8947ceb8b194a59d74f8544d4b19a8fe06c..4d03e0774a9563efad7b23dcf1774d457f5c9980 100644 (file)
@@ -34,7 +34,7 @@ static int test_scan(const struct test* t) {
 
        pakfire_string_format(baseurl, "file://%s/data", TEST_SRC_PATH);
 
-       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test"));
+       ASSERT_SUCCESS(pakfire_repo_create(&repo, t->root, "test"));
        ASSERT(repo);
 
        // Set the base URL (where to scan for files)
@@ -90,7 +90,7 @@ static int test_compose(const struct test* t) {
 
        // Compose the repository
        ASSERT_SUCCESS(
-               pakfire_repo_compose(t->pakfire, path, NULL, files)
+               pakfire_repo_compose(t->root, path, NULL, files)
        );
 
        // Everything passed
@@ -106,8 +106,8 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_scan, TEST_WANTS_PAKFIRE);
-       testsuite_add_test(test_compose, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_scan, TEST_WANTS_ROOT);
+       testsuite_add_test(test_compose, TEST_WANTS_ROOT);
 
        return testsuite_run(argc, argv);
 }
index ff710304dd3820efaed19ea94d5b0d56b345b054..02395b994ff1296ad4f65aaf6ca684c8922302af 100644 (file)
@@ -28,7 +28,7 @@ static int test_mkdir(const struct test* t) {
        char path[PATH_MAX];
 
        // Create some random path
-       ASSERT_SUCCESS(pakfire_path(t->pakfire, path, "%s", "/a/b/c/d/e"));
+       ASSERT_SUCCESS(pakfire_root_path(t->root, path, "%s", "/a/b/c/d/e"));
 
        // Create this directory
        ASSERT_SUCCESS(pakfire_mkdir(path, 0755));
@@ -91,7 +91,7 @@ FAIL:
 }
 
 int main(int argc, const char* argv[]) {
-       testsuite_add_test(test_mkdir, TEST_WANTS_PAKFIRE);
+       testsuite_add_test(test_mkdir, TEST_WANTS_ROOT);
        testsuite_add_test(test_base64, 0);
 
        return testsuite_run(argc, argv);
index a737c979c243a1a9cd801736822e455df96da11f..9c496edfe483c7e607325392abe98a514b491df4 100644 (file)
 int main(int argc, const char* argv[]) {
        pakfire_config* config = NULL;
        pakfire_ctx* ctx = NULL;
-       struct pakfire* pakfire = NULL;
+       pakfire_root* root = NULL;
        pakfire_parser* parser = NULL;
        pakfire_parser_error* error = NULL;
        const char* message = NULL;
        FILE* f = NULL;
        int r = 1;
 
-       char root[PATH_MAX] = "/tmp/pakfire-parser-test.XXXXXX";
+       char path[PATH_MAX] = "/tmp/pakfire-parser-test.XXXXXX";
 
        // Create test root directory
-       char* tmp = pakfire_mkdtemp(root);
+       char* tmp = pakfire_mkdtemp(path);
        if (!tmp) {
-               fprintf(stderr, "Could not create temporary directory %s: %m\n", root);
+               fprintf(stderr, "Could not create temporary directory %s: %m\n", path);
                goto ERROR;
        }
 
@@ -64,15 +64,15 @@ int main(int argc, const char* argv[]) {
        if (r < 0)
                goto ERROR;
 
-       // Create a pakfire instance
-       r = pakfire_create(&pakfire, ctx, config, root, NULL, 0);
+       // Create a new root
+       r = pakfire_root_create(&root, ctx, config, path, NULL, 0);
        if (r) {
                fprintf(stderr, "Could not create Pakfire: %m\n");
                goto ERROR;
        }
 
        // Create a new parser
-       r = pakfire_parser_create(&parser, pakfire, NULL, NULL, 0);
+       r = pakfire_parser_create(&parser, root, NULL, NULL, 0);
        if (r < 0) {
                fprintf(stderr, "Could not create a parser: %s\n", strerror(-r));
                goto ERROR;
@@ -117,8 +117,8 @@ ERROR:
                pakfire_parser_error_unref(error);
        if (parser)
                pakfire_parser_unref(parser);
-       if (pakfire)
-               pakfire_unref(pakfire);
+       if (root)
+               pakfire_root_unref(root);
        if (config)
                pakfire_config_unref(config);
        if (ctx) {
index f7cb59fea59b24fa39811cd68ea049c4df6830e9..9b3009037ff2acf5fbb5d5c4a8fcd631a6dc1043 100644 (file)
@@ -36,7 +36,7 @@ struct testsuite ts;
 
 static int test_run(int i, struct test* t) {
        pakfire_ctx* ctx = NULL;
-       struct pakfire* p = NULL;
+       pakfire_root* p = NULL;
        int r;
 
        LOG("running %s\n", t->name);
@@ -68,17 +68,17 @@ static int test_run(int i, struct test* t) {
                goto ERROR;
        }
 
-       // Create a pakfire instance (if requested)
-       if (t->flags & TEST_WANTS_PAKFIRE) {
-               r = pakfire_create(&t->pakfire, t->ctx, t->config, TEST_STUB_ROOT, NULL, 0);
+       // Create a root instance (if requested)
+       if (t->flags & TEST_WANTS_ROOT) {
+               r = pakfire_root_create(&t->root, t->ctx, t->config, TEST_STUB_ROOT, NULL, 0);
                if (r < 0) {
-                       LOG("ERROR: Could not initialize pakfire: %s\n", strerror(-r));
+                       LOG("ERROR: Could not initialize root: %s\n", strerror(-r));
                        goto ERROR;
                }
 
                // Check if the instance was created properly
-               if (r == 0 && !t->pakfire) {
-                       LOG("ERROR: Pakfire was not initialized, but no error was raised: %m\n");
+               if (r == 0 && !t->root) {
+                       LOG("ERROR: Root was not initialized, but no error was raised: %m\n");
                        goto ERROR;
                }
        }
@@ -102,18 +102,18 @@ ERROR:
        if (t->httpclient)
                pakfire_httpclient_unref(t->httpclient);
 
-       // Release pakfire
-       if (t->pakfire) {
-               p = pakfire_unref(t->pakfire);
+       // Release root
+       if (t->root) {
+               p = pakfire_root_unref(t->root);
 
                // Check if Pakfire was actually released
                if (p) {
-                       LOG("Error: Pakfire instance was not released in test %d\n", i);
+                       LOG("Error: Root instance was not released in test %d\n", i);
                        r = 1;
                }
 
                // Reset pointer (just in case)
-               t->pakfire = NULL;
+               t->root = NULL;
        }
 
        // Release context
index a7123616b7cf9c4bd8b608a2328116fac24988f2..487b4940d5338c6594e7dcd5435040285a145770 100644 (file)
@@ -36,7 +36,7 @@
 #define TEST_SRC_PATH  ABS_TOP_SRCDIR "/tests/"
 
 enum test_flags {
-       TEST_WANTS_PAKFIRE    = (1 << 0),
+       TEST_WANTS_ROOT       = (1 << 0),
        TEST_WANTS_HTTPCLIENT = (1 << 1),
 };
 
@@ -48,11 +48,11 @@ struct test {
        // Config
        pakfire_config* config;
 
-       // Pakfire Context
+       // Context
        pakfire_ctx* ctx;
 
-       // Pakfire
-       struct pakfire* pakfire;
+       // Root
+       pakfire_root* root;
 
        // HTTP Client
        pakfire_httpclient* httpclient;