]> git.ipfire.org Git - pakfire.git/commitdiff
shell: Setup build environment before entering the shell
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Sep 2021 17:29:57 +0000 (17:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Sep 2021 17:31:00 +0000 (17:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/execute.c
src/libpakfire/include/pakfire/execute.h

index f2a61825852c8720a3cf255f7c5e187f60596592..d2d3eb461143f77f2ac948ddb9afba04a234bb76 100644 (file)
@@ -683,7 +683,7 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con
                if (r) {
                        // Drop to a shell for debugging
                        if (flags & PAKFIRE_BUILD_INTERACTIVE)
-                               pakfire_shell(pakfire);
+                               pakfire_execute_shell(pakfire);
 
                        goto ERROR;
                }
@@ -799,12 +799,12 @@ ERROR:
 }
 
 PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire) {
-       const char* argv[] = {
-               "/bin/bash", "--login", NULL,
-       };
+       int r;
 
-       const int flags =
-               PAKFIRE_EXECUTE_INTERACTIVE | PAKFIRE_EXECUTE_ENABLE_NETWORK;
+       // Setup build environment
+       r = pakfire_build_setup(pakfire);
+       if (r)
+               return r;
 
-       return pakfire_execute(pakfire, argv, NULL, flags, NULL, NULL);
+       return pakfire_execute_shell(pakfire);
 }
index 307e98f7b988732d9a3c64d7a879ecd553c4a5fe..f0bfada32979feac76bb755ec529e347c154bfab 100644 (file)
@@ -751,6 +751,17 @@ out:
        return r;
 }
 
+int pakfire_execute_shell(struct pakfire* pakfire) {
+       const char* argv[] = {
+               "/bin/bash", "--login", NULL,
+       };
+
+       const int flags =
+               PAKFIRE_EXECUTE_INTERACTIVE | PAKFIRE_EXECUTE_ENABLE_NETWORK;
+
+       return pakfire_execute(pakfire, argv, NULL, flags, NULL, NULL);
+}
+
 int pakfire_execute_ldconfig(struct pakfire* pakfire) {
        char path[PATH_MAX];
 
index 07317ec1a0aa70e3438eb3f3bb4830d8935ce2e6..73d38d8c13f3ec0ff0af162c4b8d637dc9eb15b1 100644 (file)
@@ -45,6 +45,7 @@ int pakfire_execute_capture_stdout(struct pakfire* pakfire, void* data, int prio
        const char* line, size_t length);
 int pakfire_execute_capture_stdout_to_array(struct pakfire* pakfire, void* data, int priority,
        const char* line, size_t length);
+int pakfire_execute_shell(struct pakfire* pakfire);
 int pakfire_execute_ldconfig(struct pakfire* pakfire);
 
 #endif