return pakfire_timespec_delta(&now, &build->time_start);
}
+static int pakfire_build_jail_log_callback(struct pakfire* pakfire,
+ void* data, int priority, const char* line, size_t length) {
+ struct pakfire_build* build = data;
+
+ // Get the runtime of the build
+ const double t = pakfire_build_duration(build);
+ if (t < 0)
+ return t;
+
+ const unsigned int h = (unsigned int)t / 3600;
+ const unsigned int m = (unsigned int)t % 3600 / 60;
+ const unsigned int s = (unsigned int)t % 60;
+ const unsigned int ms = (unsigned int)(t * 1000.0) % 1000;
+
+ if (h)
+ return BUILD_LOG(build, priority, "[%02d:%02d:%02d.%04d] %.*s", h, m, s, ms, length, line);
+
+ else if (m)
+ return BUILD_LOG(build, priority, "[ %02d:%02d.%04d] %.*s", m, s, ms, length, line);
+
+ else
+ return BUILD_LOG(build, priority, "[ %02d.%04d] %.*s", s, ms, length, line);
+}
+
static int __pakfire_build_setup_repo(struct pakfire* pakfire,
struct pakfire_repo* repo, void* p) {
char path[PATH_MAX];
}
// Run the script
- r = pakfire_jail_exec_script(build->jail, script, strlen(script), NULL, NULL, NULL, NULL);
+ r = pakfire_jail_exec_script(build->jail, script, strlen(script),
+ NULL, NULL, pakfire_build_jail_log_callback, build);
if (r)
BUILD_ERROR(build, "Build stage '%s' failed with status %d\n", stage, r);
return r;
}
-static int pakfire_build_jail_log_callback(struct pakfire* pakfire,
- void* data, int priority, const char* line, size_t length) {
- struct pakfire_build* build = data;
-
- // Get the runtime of the build
- const double t = pakfire_build_duration(build);
- if (t < 0)
- return t;
-
- const unsigned int h = (unsigned int)t / 3600;
- const unsigned int m = (unsigned int)t % 3600 / 60;
- const unsigned int s = (unsigned int)t % 60;
- const unsigned int ms = (unsigned int)(t * 1000.0) % 1000;
-
- if (h)
- return BUILD_LOG(build, priority, "[%02d:%02d:%02d.%04d] %.*s", h, m, s, ms, length, line);
-
- else if (m)
- return BUILD_LOG(build, priority, "[ %02d:%02d.%04d] %.*s", m, s, ms, length, line);
-
- else
- return BUILD_LOG(build, priority, "[ %02d.%04d] %.*s", s, ms, length, line);
-}
-
/*
Sets up a new jail for this build
*/
return r;
}
- // Configure our custom logging callback
- pakfire_jail_set_log_callback(build->jail, pakfire_build_jail_log_callback, build);
-
// Connect the jail to our cgroup
r = pakfire_jail_set_cgroup(build->jail, build->cgroup);
if (r) {