]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
build: Drop redundant interactivity flag
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 20:01:03 +0000 (20:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 20:01:03 +0000 (20:01 +0000)
There is already a flag for this which can be used.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/build.c
src/libpakfire/include/pakfire/build.h
src/scripts/pakfire-builder.in

index eda9663d5bd01fa689b63ae199d370e0b3c4415a..d67330ae1d5615bd74c538df822438ff008e54a4 100644 (file)
@@ -1054,23 +1054,21 @@ static PyObject* execute_return_value(int r) {
 }
 
 static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kwargs) {
-       char* kwlist[] = { "path", "build_id", "logging_callback", "interactive", NULL };
+       char* kwlist[] = {
+               "path",
+               "build_id",
+               "logging_callback",
+               NULL,
+       };
 
        const char* path = NULL;
        const char* build_id = NULL;
        PyObject* logging_callback = NULL;
-       int interactive = 0;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zOp", kwlist, &path,
-                       &build_id, &logging_callback, &interactive))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zO", kwlist, &path,
+                       &build_id, &logging_callback))
                return NULL;
 
-       int flags = 0;
-
-       // Enable interactive mode
-       if (interactive)
-               flags |= PAKFIRE_BUILD_INTERACTIVE;
-
        // Check if logging_callback is
        if (logging_callback && !PyCallable_Check(logging_callback)) {
                PyErr_SetString(PyExc_TypeError, "logging_callback must be callable\n");
@@ -1081,7 +1079,7 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
        Pakfire_execute_logging_callback = logging_callback;
 
        // Run build
-       int r = pakfire_build(self->pakfire, path, NULL, build_id, flags,
+       int r = pakfire_build(self->pakfire, path, NULL, build_id, 0,
                (logging_callback) ? __Pakfire_execute_logging_callback : NULL, NULL);
 
        return execute_return_value(r);
index 3a1080194658cab1257c8cd1033df95e3e10f9c2..88f173651a1d32fa7601b5f0d855672bcbe3925c 100644 (file)
@@ -675,7 +675,7 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con
                r = pakfire_build_stage(pakfire, makefile, *stage, logging_callback, data);
                if (r) {
                        // Drop to a shell for debugging
-                       if (flags & PAKFIRE_BUILD_INTERACTIVE)
+                       if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE))
                                pakfire_execute_shell(pakfire);
 
                        goto ERROR;
index 908511cf2e35cd749271c3fff5b3a6620e7f515a..68741dcdc82b5c1aca23e78fd4f4227331252403 100644 (file)
 #include <pakfire/execute.h>
 #include <pakfire/pakfire.h>
 
-enum pakfire_build_flags {
-       PAKFIRE_BUILD_INTERACTIVE = (1 << 0),
-};
-
 int pakfire_build(struct pakfire* pakfire, const char* path, const char* target,
        const char* id, int flags, pakfire_execute_logging_callback logging_callback, void* data);
 int pakfire_shell(struct pakfire* pakfire);
index e7fb9872518166a6b61d00b93974d66ba9fb6247..e2f697f94fd8f0bcdefac8b814517d665ec0df16 100644 (file)
@@ -161,7 +161,7 @@ class Cli(object):
 
                return args
 
-       def pakfire(self, ns, build=True):
+       def pakfire(self, ns, build=True, interactive=True):
                # Find distro configuration file
                conf = os.path.join(CONFIG_DISTRO_DIR, "%s.conf" % ns.distro)
 
@@ -171,11 +171,11 @@ class Cli(object):
 
                        # Set up logging
                        logger=self.logger.log,
+                       interactive=interactive,
 
                        # Enable build mode
                        build=build,
                        enable_snapshot=not ns.disable_snapshot,
-
                )
 
        def __call__(self):
@@ -211,7 +211,7 @@ class Cli(object):
 
                try:
                        # Initialise a builder instance and build this package
-                       p = self.pakfire(ns)
+                       p = self.pakfire(ns, interactive=ns.interactive)
 
                        # Package any makefiles
                        if package.endswith(".nm"):
@@ -221,7 +221,6 @@ class Cli(object):
                        p.build(
                                package,
                                build_id="%s" % ns.build_id if ns.build_id else None,
-                               interactive=ns.interactive,
                        )
 
                # Cleanup the temporary directory