// Local build repo
struct pakfire_repo* repo;
+ // Buildroot
+ char buildroot[PATH_MAX];
+
// States
int init:1;
};
struct pakfire_parser_error* error = NULL;
+ const char* root = pakfire_get_path(build->pakfire);
+
const char* nevra = pakfire_package_get_nevra(package);
const char* name = pakfire_package_get_name(package);
goto ERROR;
}
+ // Set BUILDROOT
+ const char* buildroot = pakfire_path_relpath(root, build->buildroot);
+ if (buildroot)
+ pakfire_parser_set(*parser, NULL, "BUILDROOT", buildroot, 0);
+
ERROR:
if (error)
pakfire_parser_error_unref(error);
struct pakfire_archive* archive = NULL;
struct pakfire_package* package = NULL;
struct pakfire_parser* makefile = NULL;
+ char* buildroot = NULL;
int r;
+ // Set buildroot
+ pakfire_make_path(build->pakfire, build->buildroot, "/var/tmp/.buildroot.XXXXXX");
+
// Open source archive
r = pakfire_archive_open(&archive, build->pakfire, path);
if (r) {
goto ERROR;
}
+ // Create BUILDROOT
+ buildroot = pakfire_mkdtemp(build->buildroot);
+ if (!buildroot) {
+ ERROR(build->pakfire, "Could not create BUILDROOT: %m\n");
+ goto ERROR;
+ }
+
// Open the makefile
r = pakfire_build_read_makefile(build, &makefile, package);
if (r)
if (package)
pakfire_package_unref(package);
+ // Cleanup buildroot
+ if (buildroot)
+ pakfire_rmtree(buildroot, 0);
+
return r;
}