return pakfire_timespec_delta(&now, &build->time_start);
}
-static int pakfire_build_jail_log_callback(struct pakfire_ctx* ctx,
- void* data, int priority, const char* line, size_t length) {
+static int pakfire_build_output_callback(
+ struct pakfire_ctx* ctx, void* data, const char* buffer, size_t length) {
struct pakfire_build* build = data;
// Get the runtime of the build
const unsigned int ms = (unsigned int)(t * 1000.0) % 1000;
if (h)
- pakfire_ctx_log_condition(ctx, priority, "[%02u:%02u:%02u.%04u] %.*s", h, m, s, ms, (int)length, line);
+ CTX_INFO(ctx, "[%02u:%02u:%02u.%04u] %.*s", h, m, s, ms, (int)length, buffer);
else if (m)
- pakfire_ctx_log_condition(ctx, priority, "[ %02u:%02u.%04u] %.*s", m, s, ms, (int)length, line);
+ CTX_INFO(ctx, "[ %02u:%02u.%04u] %.*s", m, s, ms, (int)length, buffer);
else
- pakfire_ctx_log_condition(ctx, priority, "[ %02u.%04u] %.*s", s, ms, (int)length, line);
+ CTX_INFO(ctx, "[ %02u.%04u] %.*s", s, ms, (int)length, buffer);
- return 0;
+ return length;
}
static int __pakfire_build_setup_repo(struct pakfire* pakfire,
}
// Execute the script
- r = pakfire_jail_exec_script(build->jail, script, length, args);
+ r = pakfire_jail_exec_script(build->jail, script, length, args,
+ stdin_callback, stdin_data, stdout_callback, stdout_data);
if (r)
CTX_ERROR(build->ctx, "Script '%s' failed with status %d\n", filename, r);
goto ERROR;
}
-#warning We are thworing away the output here. Do we want this?
-
// Run the script
- r = pakfire_jail_exec_script(build->jail, script, strlen(script), NULL);
+ r = pakfire_jail_exec_script(build->jail, script, strlen(script), NULL,
+ NULL, NULL, pakfire_build_output_callback, build);
if (r)
CTX_ERROR(build->ctx, "Build stage '%s' failed with status %d\n", stage, r);
const char* script, const size_t length, const char* argv[], int flags);
int pakfire_jail_exec_script(struct pakfire_jail* jail,
- const char* script,
- const size_t size,
- const char* args[]);
+ const char* script, const size_t size, const char* args[],
+ pakfire_pty_stdin_callback stdin_callback, void* stdin_data,
+ pakfire_pty_stdout_callback stdout_callback, void* stdout_data);
int pakfire_jail_shell(struct pakfire_jail* jail);
int pakfire_jail_ldconfig(struct pakfire* pakfire);
}
int pakfire_jail_exec_script(struct pakfire_jail* jail,
- const char* script,
- const size_t size,
- const char* args[]) {
+ const char* script, const size_t size, const char* args[],
+ pakfire_pty_stdin_callback stdin_callback, void* stdin_data,
+ pakfire_pty_stdout_callback stdout_callback, void* stdout_data) {
char path[PATH_MAX];
const char** argv = NULL;
FILE* f = NULL;
argv[i] = args[i-1];
// Run the script
- r = pakfire_jail_exec(jail, argv, 0, NULL);
+ r = pakfire_jail_communicate(jail, argv, 0,
+ stdin_callback, stdin_data, stdout_callback, stdout_data);
ERROR:
if (argv)
goto ERROR;
// Execute the command
- r = pakfire_jail_exec_script(jail, script, length, argv);
+ r = pakfire_jail_exec_script(jail, script, length, argv, NULL, NULL, NULL, NULL);
ERROR:
if (jail)