]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
libpakfire: Add global flags attribute
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2021 19:58:59 +0000 (19:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2021 19:58:59 +0000 (19:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/pakfire.c
tests/testsuite.c

index 2cf36fd418c8fba92c10b70850f85d0bf7932054..9b49d0bf2d5fa47235fb4c9a1c21c55357cce236 100644 (file)
@@ -56,13 +56,14 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
        const char* arch = NULL;
        const char* conf = NULL;
        int offline = 0;
+       int flags = 0;
 
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzpz", kwlist,
                        &path, &arch, &offline, &conf))
                return -1;
 
        // Create a new Pakfire instance
-       int r = pakfire_create(&self->pakfire, path, arch, conf);
+       int r = pakfire_create(&self->pakfire, path, arch, conf, flags);
        if (r) {
                switch (errno) {
                        // Invalid architecture or path
index a6f6ca8c6230a6f8693eb9d3217e8c91c7e6dc3f..17aa78f3b8e06356f7c6cc6a83131479e0acc88f 100644 (file)
@@ -30,7 +30,8 @@
 #include <pakfire/repolist.h>
 #include <pakfire/types.h>
 
-int pakfire_create(Pakfire* pakfire, const char* path, const char* arch, const char* conf);
+int pakfire_create(Pakfire* pakfire, const char* path, const char* arch,
+       const char* conf, int flags);
 
 Pakfire pakfire_ref(Pakfire pakfire);
 Pakfire pakfire_unref(Pakfire pakfire);
index 373c0916de651c9f90937e5a08094a80307ff720..739a38b2d3528dffd7a0b76cff9460dfd50302a2 100644 (file)
@@ -66,6 +66,7 @@ struct _Pakfire {
        char arch[ARCH_MAX];
 
        int offline;
+       int flags;
 
        // Pool stuff
        Pool* pool;
@@ -778,8 +779,8 @@ ERROR:
        return r;
 }
 
-PAKFIRE_EXPORT int pakfire_create(
-               Pakfire* pakfire, const char* path, const char* arch, const char* conf) {
+PAKFIRE_EXPORT int pakfire_create(Pakfire* pakfire, const char* path, const char* arch,
+               const char* conf, int flags) {
        char tempdir[PATH_MAX] = PAKFIRE_PRIVATE_DIR "/tmp/XXXXXX";
        int r = 1;
 
@@ -811,6 +812,7 @@ PAKFIRE_EXPORT int pakfire_create(
                return 1;
 
        p->nrefs = 1;
+       p->flags = flags;
 
        // Initialise configuration
        r = pakfire_config_create(&p->config);
index 76d0e1531372798a11c91fc91ffcf3af8b02150c..b211b3d277df7a51913debee16998849cdbf001b 100644 (file)
@@ -41,7 +41,7 @@ static int test_run(int i, struct test* t) {
        LOG("running %s (%s)\n", t->name, root);
 
        // Create a pakfire instance
-       r = pakfire_create(&t->pakfire, root, NULL, TEST_SRC_PATH "/pakfire.conf");
+       r = pakfire_create(&t->pakfire, root, NULL, TEST_SRC_PATH "/pakfire.conf", 0);
        if (r) {
                LOG("ERROR: Could not initialize Pakfire: %s\n", strerror(errno));
                exit(1);