// Compose the source path
r = pakfire_path_append(path, PAKFIRE_SCRIPTS_DIR, filename);
if (r) {
- ERROR(build->pakfire, "Could not compose path for script '%s': %m\n", filename);
+ CTX_ERROR(build->ctx, "Could not compose path for script '%s': %m\n", filename);
goto ERROR;
}
// Read the script
r = pakfire_build_read_script(build, filename, &script, &length);
if (r) {
- ERROR(build->pakfire, "Could not read script %s: %m\n", filename);
+ CTX_ERROR(build->ctx, "Could not read script %s: %m\n", filename);
return r;
}
if (!pattern || !*pattern)
goto ERROR;
- DEBUG(build->pakfire, "Found filter for %s: %s\n", filter, pattern);
+ CTX_DEBUG(build->ctx, "Found filter for %s: %s\n", filter, pattern);
// Compile the regular expression
r = pakfire_compile_regex(build->pakfire, regex, pattern);
// Skip calling the script if class doesn't match
if (class && !pakfire_filelist_matches_class(filelist, class)) {
- DEBUG(build->pakfire, "Skipping calling %s as class does not match\n", script);
+ CTX_DEBUG(build->ctx, "Skipping calling %s as class does not match\n", script);
return 0;
}
r = pakfire_build_make_filter(build, &filter_provides,
makefile, namespace, "filter_provides");
if (r) {
- ERROR(build->pakfire, "Provides filter is broken: %m\n");
+ CTX_ERROR(build->ctx, "Provides filter is broken: %m\n");
goto ERROR;
}
r = pakfire_build_make_filter(build, &filter_requires,
makefile, namespace, "filter_requires");
if (r) {
- ERROR(build->pakfire, "Requires filter is broken: %m\n");
+ CTX_ERROR(build->ctx, "Requires filter is broken: %m\n");
goto ERROR;
}
// Expand the handle into the package name
char* name = pakfire_parser_expand(makefile, "packages", namespace);
if (!name) {
- ERROR(build->pakfire, "Could not get package name: %m\n");
+ CTX_ERROR(build->ctx, "Could not get package name: %m\n");
goto ERROR;
}
for (char** package = packages; *package; package++)
num_packages++;
- DEBUG(build->pakfire, "Found %u package(s)\n", num_packages);
+ CTX_DEBUG(build->ctx, "Found %u package(s)\n", num_packages);
// Build packages in reverse order
for (int i = num_packages - 1; i >= 0; i--) {
// If the filelist is empty, we can are done
if (pakfire_filelist_is_empty(filelist)) {
- DEBUG(build->pakfire, "Empty BUILDROOT. Skipping post build checks...\n");
+ CTX_DEBUG(build->ctx, "Empty BUILDROOT. Skipping post build checks...\n");
r = 0;
goto ERROR;
}
if (id) {
r = uuid_parse(id, build->id);
if (r) {
- ERROR(build->pakfire, "Could not parse build ID '%s'\n", id);
+ CTX_ERROR(build->ctx, "Could not parse build ID '%s'\n", id);
return -EINVAL;
}
// Compose path
r = pakfire_string_format(path, "pakfire/build-%s", build->_id);
if (r) {
- ERROR(build->pakfire, "Could not compose path for cgroup: %m\n");
+ CTX_ERROR(build->ctx, "Could not compose path for cgroup: %m\n");
goto ERROR;
}
r = pakfire_cgroup_open(&build->cgroup, build->ctx, path,
PAKFIRE_CGROUP_ENABLE_ACCOUNTING);
if (r) {
- ERROR(build->pakfire, "Could not create cgroup for build %s: %m\n", build->_id);
+ CTX_ERROR(build->ctx, "Could not create cgroup for build %s: %m\n", build->_id);
goto ERROR;
}
// Create a new jail
r = pakfire_jail_create(&build->jail, build->pakfire);
if (r) {
- ERROR(build->pakfire, "Could not create jail for build %s: %m\n", build->_id);
+ CTX_ERROR(build->ctx, "Could not create jail for build %s: %m\n", build->_id);
return r;
}
// Connect the jail to our cgroup
r = pakfire_jail_set_cgroup(build->jail, build->cgroup);
if (r) {
- ERROR(build->pakfire, "Could not set cgroup for jail: %m\n");
+ CTX_ERROR(build->ctx, "Could not set cgroup for jail: %m\n");
return r;
}
// Build everything with a slightly lower priority
r = pakfire_jail_nice(build->jail, 5);
if (r) {
- ERROR(build->pakfire, "Could not set nice level: %m\n");
+ CTX_ERROR(build->ctx, "Could not set nice level: %m\n");
return r;
}
// Make sure the path exists
r = pakfire_mkdir(build->ccache_path, 0755);
if (r) {
- ERROR(build->pakfire, "Could not create %s: %m\n", build->ccache_path);
+ CTX_ERROR(build->ctx, "Could not create %s: %m\n", build->ccache_path);
return r;
}
// Check if we want a ccache
if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_CCACHE)) {
- DEBUG(build->pakfire, "ccache usage has been disabled for this build\n");
+ CTX_DEBUG(build->ctx, "ccache usage has been disabled for this build\n");
// Set CCACHE_DISABLE=1 so that if ccache is installed, it will disable itself
r = pakfire_jail_set_env(build->jail, "CCACHE_DISABLE", "1");
if (r) {
- ERROR(build->pakfire, "Could not disable ccache: %m\n");
+ CTX_ERROR(build->ctx, "Could not disable ccache: %m\n");
return r;
}
// Set CCACHE_DIR
r = pakfire_jail_set_env(build->jail, "CCACHE_DIR", CCACHE_DIR);
if (r) {
- ERROR(build->pakfire, "Could not set ccache directory: %m\n");
+ CTX_ERROR(build->ctx, "Could not set ccache directory: %m\n");
return r;
}
// Set CCACHE_TEMPDIR
r = pakfire_jail_set_env(build->jail, "CCACHE_TEMPDIR", "/tmp");
if (r) {
- ERROR(build->pakfire, "Could not set ccache tempdir: %m\n");
+ CTX_ERROR(build->ctx, "Could not set ccache tempdir: %m\n");
return r;
}
// Create a new repository
r = pakfire_repo_create(&build->repo, build->pakfire, PAKFIRE_REPO_RESULT);
if (r) {
- ERROR(build->pakfire, "Could not create repository %s: %m", PAKFIRE_REPO_RESULT);
+ CTX_ERROR(build->ctx, "Could not create repository %s: %m", PAKFIRE_REPO_RESULT);
return r;
}
// Create a temporary directory
const char* p = pakfire_mkdtemp(path);
if (!p) {
- ERROR(build->pakfire, "Could not create a the build repository: %m\n");
+ CTX_ERROR(build->ctx, "Could not create a the build repository: %m\n");
return 1;
}
// Fetch current time
r = clock_gettime(CLOCK_MONOTONIC, &build->time_start);
if (r < 0)
- ERROR(build->pakfire, "Could not fetch start time: %m\n");
+ CTX_ERROR(build->ctx, "Could not fetch start time: %m\n");
return r;
}
// Don't do it again
if (build->init) {
- DEBUG(build->pakfire, "Build environment has already been initialized\n");
+ CTX_DEBUG(build->ctx, "Build environment has already been initialized\n");
return 0;
}
struct pakfire_repo* local = NULL;
int r = 0;
- DEBUG(build->pakfire, "Copying built packages\n");
+ CTX_DEBUG(build->ctx, "Copying built packages\n");
// Fetch local repository
local = pakfire_get_repo(build->pakfire, PAKFIRE_REPO_LOCAL);
// Check if this package can be build in this environment
if (!pakfire_package_supports_build_arch(package, arch)) {
- ERROR(build->pakfire, "%s does not support being built on %s\n", nevra, arch);
+ CTX_ERROR(build->ctx, "%s does not support being built on %s\n", nevra, arch);
r = -ENOTSUP;
goto ERROR;
}
// Create a new transaction
r = pakfire_transaction_create(&transaction, build->pakfire, 0);
if (r) {
- ERROR(build->pakfire, "Could not create transaction: %m\n");
+ CTX_ERROR(build->ctx, "Could not create transaction: %m\n");
goto ERROR;
}
r = pakfire_transaction_request(transaction,
PAKFIRE_JOB_INSTALL, requires, PAKFIRE_JOB_ESSENTIAL);
if (r) {
- ERROR(build->pakfire, "Could not add '%s' to the transaction: %m\n", requires);
+ CTX_ERROR(build->ctx, "Could not add '%s' to the transaction: %m\n", requires);
goto ERROR;
}
// Solve the request
r = pakfire_transaction_solve(transaction, 0, &problems);
if (r) {
- ERROR(build->pakfire, "Could not solve the request:\n%s\n", problems);
+ CTX_ERROR(build->ctx, "Could not solve the request:\n%s\n", problems);
goto ERROR;
}
// Create a new transaction
r = pakfire_transaction_create(&transaction, build->pakfire, 0);
if (r) {
- ERROR(build->pakfire, "Could not create transaction: %m\n");
+ CTX_ERROR(build->ctx, "Could not create transaction: %m\n");
goto ERROR;
}
r = pakfire_transaction_request(transaction,
PAKFIRE_JOB_INSTALL, "ipfire-release", PAKFIRE_JOB_ESSENTIAL);
if (r) {
- ERROR(build->pakfire, "Could not install 'ipfire-release': %m\n");
+ CTX_ERROR(build->ctx, "Could not install 'ipfire-release': %m\n");
goto ERROR;
}
// Solve the transaction
r = pakfire_transaction_solve(transaction, 0, &problems);
if (r) {
- ERROR(build->pakfire, "Could not solve request:\n%s\n", problems);
+ CTX_ERROR(build->ctx, "Could not solve request:\n%s\n", problems);
goto ERROR;
}
// Empty transaction?
if (!pakfire_transaction_count(transaction)) {
- ERROR(build->pakfire, "The transaction is unexpectedly empty\n");
+ CTX_ERROR(build->ctx, "The transaction is unexpectedly empty\n");
r = 1;
goto ERROR;
}
// Dump the transaction
p = pakfire_transaction_dump(transaction, 80);
if (!p) {
- ERROR(build->pakfire, "Could not dump the transaction: %m\n");
+ CTX_ERROR(build->ctx, "Could not dump the transaction: %m\n");
r = 1;
goto ERROR;
}
// Log the dump
- INFO(build->pakfire, "%s\n", p);
+ CTX_INFO(build->ctx, "%s\n", p);
// Download all packages
r = pakfire_transaction_download(transaction);
if (r) {
- ERROR(build->pakfire, "Could not download the transaction: %m\n");
+ CTX_ERROR(build->ctx, "Could not download the transaction: %m\n");
goto ERROR;
}
// Create a repository with all packages in this transaction
r = pakfire_transaction_compose_repo(transaction, NULL, path);
if (r) {
- ERROR(build->pakfire, "Could not create repository: %m\n");
+ CTX_ERROR(build->ctx, "Could not create repository: %m\n");
goto ERROR;
}
// Allocate a temporary file
t = pakfire_mktemp(path, 0600);
if (!t) {
- ERROR(build->pakfire, "Could not allocate a temporary file: %m\n");
+ CTX_ERROR(build->ctx, "Could not allocate a temporary file: %m\n");
r = 1;
goto ERROR;
}
struct pakfire_repo* local = NULL;
int r = 0;
+ #warning Requires the legacy logger here... :(
+
// Fetch local repository
local = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
if (!local) {
// Solve the transaction
r = pakfire_transaction_solve(transaction, 0, &problems);
if (r) {
- ERROR(build->pakfire, "Could not install packages:\n%s\n", problems);
+ CTX_ERROR(build->ctx, "Could not install packages:\n%s\n", problems);
goto ERROR;
}