]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
build: Allow creating shells without a snapshot
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Nov 2022 11:05:04 +0000 (11:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Nov 2022 11:17:15 +0000 (11:17 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/build.c
src/libpakfire/include/pakfire/build.h

index edd92475774ad785a4f929b6a6e8200511d34bf3..3843d94068c0d2a90b4c920e23bffe592b519948 100644 (file)
@@ -1169,15 +1169,23 @@ static PyObject* Pakfire_build(PakfireObject* self, PyObject* args, PyObject* kw
 static PyObject* Pakfire_shell(PakfireObject* self, PyObject* args, PyObject* kwargs) {
        char* kwlist[] = {
                "install",
+               "disable_snapshot",
                NULL,
        };
        char** packages = NULL;
+       int disable_snapshot = 0;
 
        // Parse everything
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&", kwlist, convert_packages, &packages))
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&p", kwlist,
+                       convert_packages, &packages, &disable_snapshot))
                return NULL;
 
-       int r = pakfire_shell(self->pakfire, (const char**)packages);
+       int flags = 0;
+
+       if (disable_snapshot)
+               flags |= PAKFIRE_BUILD_DISABLE_SNAPSHOT;
+
+       int r = pakfire_shell(self->pakfire, (const char**)packages, flags);
 
        return execute_return_value(r);
 }
index 9ff3ea850d27321e92bd4adf5e1af4edc951fd49..8e2b61f0b1782ef3eda6f07148de8f168c6f1f5a 100644 (file)
@@ -1655,12 +1655,15 @@ ERROR:
        This is a convenience function that sets up a build environment and
        then drops the user into an interactive shell.
 */
-PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire, const char** packages) {
+PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire, const char** packages, int flags) {
        struct pakfire_build* build = NULL;
        int r;
 
+       // Shells are always interactive
+       flags |= PAKFIRE_BUILD_INTERACTIVE;
+
        // Create a new build environment
-       r = pakfire_build_create(&build, pakfire, NULL, PAKFIRE_BUILD_INTERACTIVE);
+       r = pakfire_build_create(&build, pakfire, NULL, flags);
        if (r) {
                ERROR(pakfire, "Could not create build: %m\n");
                goto ERROR;
index 2eda64eed6ff2abfa827043f77c8de53ed279469..cef7cfcdd46946c83e7499126e0d7f4d50ec1d2b 100644 (file)
@@ -46,6 +46,6 @@ int pakfire_build(struct pakfire* pakfire, const char* path, const char* target,
        const char* id, int flags);
 int pakfire_build_clean(struct pakfire* pakfire, int flags);
 
-int pakfire_shell(struct pakfire* pakfire, const char** packages);
+int pakfire_shell(struct pakfire* pakfire, const char** packages, int flags);
 
 #endif /* PAKFIRE_BUILD_H */