From: Michael Tremer Date: Mon, 9 May 2022 20:01:03 +0000 (+0000) Subject: build: Drop redundant interactivity flag X-Git-Tag: 0.9.28~808 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4e104172b8282868596f727c46f06eab0dd812d;p=pakfire.git build: Drop redundant interactivity flag There is already a flag for this which can be used. Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index eda9663d5..d67330ae1 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -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); diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index 3a1080194..88f173651 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -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; diff --git a/src/libpakfire/include/pakfire/build.h b/src/libpakfire/include/pakfire/build.h index 908511cf2..68741dcdc 100644 --- a/src/libpakfire/include/pakfire/build.h +++ b/src/libpakfire/include/pakfire/build.h @@ -24,10 +24,6 @@ #include #include -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); diff --git a/src/scripts/pakfire-builder.in b/src/scripts/pakfire-builder.in index e7fb98725..e2f697f94 100644 --- a/src/scripts/pakfire-builder.in +++ b/src/scripts/pakfire-builder.in @@ -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