#include <errno.h>
#include <stdlib.h>
#include <sys/mount.h>
+#include <time.h>
#include <unistd.h>
#include <uuid/uuid.h>
char target[PATH_MAX];
+ // Times
+ time_t time_start;
+
// cgroup
struct pakfire_cgroup* cgroup;
return build->flags & flag;
}
+static time_t pakfire_build_duration(struct pakfire_build* build) {
+ // What time is it now?
+ time_t now = time(NULL);
+
+ // Return any errors
+ if (now < 0)
+ return now;
+
+ return now - build->time_start;
+}
+
static int __pakfire_build_setup_repo(struct pakfire* pakfire,
struct pakfire_repo* repo, void* p) {
char path[PATH_MAX];
return r;
}
+static int pakfire_build_set_time_start(struct pakfire_build* build) {
+ const time_t now = time(NULL);
+
+ if (now < 0) {
+ ERROR(build->pakfire, "Could not fetch start time: %m\n");
+ return 1;
+ }
+
+ build->time_start = now;
+
+ return 0;
+}
+
PAKFIRE_EXPORT int pakfire_build_create(struct pakfire_build** build,
struct pakfire* pakfire, const char* id, int flags) {
int r;
// Copy flags
b->flags = flags;
+ // Store start time
+ r = pakfire_build_set_time_start(b);
+ if (r)
+ goto ERROR;
+
// Parse ID
r = pakfire_build_parse_id(b, id);
if (r)
struct pakfire_package* package = NULL;
struct pakfire_parser* makefile = NULL;
char* buildroot = NULL;
+ char duration[TIME_STRING_MAX];
int r;
// Set buildroot
if (r)
goto ERROR;
+ // Log duration
+ r = pakfire_format_time(duration, pakfire_build_duration(build));
+ if (r)
+ goto ERROR;
+
+ INFO(build->pakfire, "Build successfully completed in %s\n", duration);
+
ERROR:
if (makefile)
pakfire_parser_unref(makefile);