]> git.ipfire.org Git - pakfire.git/commitdiff
logging: Rename the logging functions to something sane again
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 25 Oct 2024 14:40:25 +0000 (14:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 25 Oct 2024 14:40:25 +0000 (14:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
40 files changed:
src/libpakfire/archive.c
src/libpakfire/build.c
src/libpakfire/buildservice.c
src/libpakfire/cgroup.c
src/libpakfire/compress.c
src/libpakfire/ctx.c
src/libpakfire/daemon.c
src/libpakfire/db.c
src/libpakfire/digest.c
src/libpakfire/dist.c
src/libpakfire/fhs.c
src/libpakfire/file.c
src/libpakfire/filelist.c
src/libpakfire/httpclient.c
src/libpakfire/include/pakfire/logging.h
src/libpakfire/jail.c
src/libpakfire/job.c
src/libpakfire/key.c
src/libpakfire/linter.c
src/libpakfire/log_stream.c
src/libpakfire/mirror.c
src/libpakfire/mirrorlist.c
src/libpakfire/mount.c
src/libpakfire/package.c
src/libpakfire/packagelist.c
src/libpakfire/packager.c
src/libpakfire/pakfire.c
src/libpakfire/parser.c
src/libpakfire/parser/grammar.y
src/libpakfire/problem.c
src/libpakfire/progress.c
src/libpakfire/pty.c
src/libpakfire/pwd.c
src/libpakfire/repo.c
src/libpakfire/scriptlet.c
src/libpakfire/snapshot.c
src/libpakfire/stripper.c
src/libpakfire/transaction.c
src/libpakfire/util.c
src/libpakfire/xfer.c

index 088c9189ab72e22aa09306b75467034facef0ea5..880c51111f136d3702ec30e747ecea7e0941ed51 100644 (file)
@@ -233,7 +233,7 @@ static int pakfire_archive_open_archive(struct pakfire_archive* archive,
                        goto ERROR;
 
                default:
-                       CTX_ERROR(archive->ctx, "Could not open archive %s: %s\n",
+                       ERROR(archive->ctx, "Could not open archive %s: %s\n",
                                archive->path, archive_error_string(a));
                        goto ERROR;
        }
@@ -261,7 +261,7 @@ static int pakfire_archive_compute_digests(struct pakfire_archive* archive) {
        r = pakfire_digests_compute_from_file(archive->ctx, &archive->digests,
                        PAKFIRE_ARCHIVE_CHECKSUM, archive->f);
        if (r)
-               CTX_ERROR(archive->ctx, "Could not calculate digest of %s: %m\n", archive->path);
+               ERROR(archive->ctx, "Could not calculate digest of %s: %m\n", archive->path);
 
        return r;
 }
@@ -305,27 +305,27 @@ static int pakfire_archive_walk(struct pakfire_archive* archive, struct archive*
                                        break;
 
                                case PAKFIRE_WALK_END:
-                                       CTX_DEBUG(archive->ctx, "Filter callback sent END\n");
+                                       DEBUG(archive->ctx, "Filter callback sent END\n");
                                        return 0;
 
                                case PAKFIRE_WALK_SKIP:
-                                       CTX_DEBUG(archive->ctx, "Filter callback sent SKIP\n");
+                                       DEBUG(archive->ctx, "Filter callback sent SKIP\n");
                                        continue;
 
                                case PAKFIRE_WALK_DONE:
-                                       CTX_DEBUG(archive->ctx, "Filter callback sent DONE\n");
+                                       DEBUG(archive->ctx, "Filter callback sent DONE\n");
 
                                        // Clear the callback function
                                        filter_callback = NULL;
                                        break;
 
                                case PAKFIRE_WALK_AGAIN:
-                                       CTX_DEBUG(archive->ctx, "Filter callback sent AGAIN\n");
+                                       DEBUG(archive->ctx, "Filter callback sent AGAIN\n");
                                        return -EAGAIN;
 
                                // Raise any other errors
                                default:
-                                       CTX_DEBUG(archive->ctx, "Filter callback returned an error: %d\n", r);
+                                       DEBUG(archive->ctx, "Filter callback returned an error: %d\n", r);
                                        return r;
                        }
                }
@@ -340,7 +340,7 @@ static int pakfire_archive_walk(struct pakfire_archive* archive, struct archive*
                                        break;
 
                                case PAKFIRE_WALK_DONE:
-                                       CTX_DEBUG(archive->ctx, "Callback sent DONE\n");
+                                       DEBUG(archive->ctx, "Callback sent DONE\n");
                                        return 0;
 
                                // Raise any other errors
@@ -431,7 +431,7 @@ static int pakfire_archive_parse_json_metadata(struct pakfire_archive* archive,
        // Create tokener
        struct json_tokener* tokener = json_tokener_new();
        if (!tokener) {
-               CTX_ERROR(archive->ctx, "Could not allocate JSON tokener: %m\n");
+               ERROR(archive->ctx, "Could not allocate JSON tokener: %m\n");
                goto ERROR;
        }
 
@@ -440,12 +440,12 @@ static int pakfire_archive_parse_json_metadata(struct pakfire_archive* archive,
        if (!archive->metadata) {
                enum json_tokener_error error = json_tokener_get_error(tokener);
 
-               CTX_ERROR(archive->ctx, "JSON parsing error: %s\n",
+               ERROR(archive->ctx, "JSON parsing error: %s\n",
                        json_tokener_error_desc(error));
                goto ERROR;
        }
 
-       CTX_DEBUG(archive->ctx, "Successfully parsed package metadata:\n%s\n",
+       DEBUG(archive->ctx, "Successfully parsed package metadata:\n%s\n",
                json_object_to_json_string_ext(archive->metadata,
                        JSON_C_TO_STRING_PRETTY|JSON_C_TO_STRING_PRETTY_TAB));
 
@@ -463,7 +463,7 @@ static int pakfire_archive_parse_format(struct pakfire_archive* archive,
                const char* data, const size_t length) {
        // Check if format has already been set
        if (archive->format) {
-               CTX_ERROR(archive->ctx, "Archive format has already been parsed\n");
+               ERROR(archive->ctx, "Archive format has already been parsed\n");
                return -EINVAL;
        }
 
@@ -477,7 +477,7 @@ static int pakfire_archive_parse_format(struct pakfire_archive* archive,
 
                // Break on anything else
                default:
-                       CTX_ERROR(archive->ctx, "This version of Pakfire does not support "
+                       ERROR(archive->ctx, "This version of Pakfire does not support "
                                "archive format %u\n", archive->format);
                        return -ENOTSUP;
        }
@@ -493,14 +493,14 @@ static int pakfire_archive_parse_scriptlet(struct pakfire_archive* archive,
 
        // Check for any available space
        if (archive->num_scriptlets >= MAX_SCRIPTLETS) {
-               CTX_ERROR(archive->ctx, "Too many scriptlets\n");
+               ERROR(archive->ctx, "Too many scriptlets\n");
                return -ENOBUFS;
        }
 
        // Determine type
        type = pakfire_path_relpath(".scriptlets/", path);
        if (!type) {
-               CTX_ERROR(archive->ctx, "Could not determine the scriptlet type from '%s'\n", path);
+               ERROR(archive->ctx, "Could not determine the scriptlet type from '%s'\n", path);
                return -EINVAL;
        }
 
@@ -534,7 +534,7 @@ static int pakfire_archive_copy_data_to_buffer(struct pakfire_archive* archive,
        // Read the data into the buffer
        bytes_read = archive_read_data(a, buffer, required_size);
        if (bytes_read < required_size) {
-               CTX_ERROR(archive->ctx, "Could not read from archive: %s\n", archive_error_string(a));
+               ERROR(archive->ctx, "Could not read from archive: %s\n", archive_error_string(a));
                r = -errno;
                goto ERROR;
        }
@@ -560,12 +560,12 @@ static int __pakfire_archive_read_metadata(struct pakfire_archive* archive,
 
        const char* path = archive_entry_pathname(entry);
 
-       CTX_DEBUG(archive->ctx, "Reading metadata file: %s\n", path);
+       DEBUG(archive->ctx, "Reading metadata file: %s\n", path);
 
        // Load the file into memory
        r = pakfire_archive_copy_data_to_buffer(archive, a, entry, &data, &length);
        if (r) {
-               CTX_ERROR(archive->ctx, "Could not read data from archive: %s\n", archive_error_string(a));
+               ERROR(archive->ctx, "Could not read data from archive: %s\n", archive_error_string(a));
                goto ERROR;
        }
 
@@ -596,7 +596,7 @@ static int __pakfire_archive_read_metadata(struct pakfire_archive* archive,
                if (r)
                        goto ERROR;
 
-               CTX_DEBUG(archive->ctx, "Archive format is %u (%s using %s)\n",
+               DEBUG(archive->ctx, "Archive format is %u (%s using %s)\n",
                        archive->format, archive_format_name(a), archive_filter_name(a, 0));
        }
 
@@ -632,11 +632,11 @@ static int __pakfire_archive_filter_metadata(struct pakfire_archive* archive,
 static int pakfire_archive_read_metadata(struct pakfire_archive* archive) {
        int r;
 
-       CTX_DEBUG(archive->ctx, "Reading archive metadata...\n");
+       DEBUG(archive->ctx, "Reading archive metadata...\n");
 
        // Check if the archive file actually has any contect
        if (!archive->stat.st_size) {
-               CTX_ERROR(archive->ctx, "Trying to open an empty archive file\n");
+               ERROR(archive->ctx, "Trying to open an empty archive file\n");
                return -EINVAL;
        }
 
@@ -648,13 +648,13 @@ static int pakfire_archive_read_metadata(struct pakfire_archive* archive) {
 
        // Check if we could successfully read something
        if (!archive->format) {
-               CTX_DEBUG(archive->ctx, "Archive has an unknown format\n");
+               DEBUG(archive->ctx, "Archive has an unknown format\n");
                return -ENOMSG;
        }
 
        // Check if we have read some metadata
        if (!archive->metadata) {
-               CTX_DEBUG(archive->ctx, "Archive has no metadata\n");
+               DEBUG(archive->ctx, "Archive has no metadata\n");
                return -ENOMSG;
        }
 
@@ -685,12 +685,12 @@ PAKFIRE_EXPORT int pakfire_archive_open(struct pakfire_archive** archive,
        if (r < 0)
                goto ERROR;
 
-       CTX_DEBUG(a->ctx, "Opening archive %s\n", a->path);
+       DEBUG(a->ctx, "Opening archive %s\n", a->path);
 
        // Open the file (and keep the file descriptor open)
        a->f = fopen(a->path, "r");
        if (!a->f) {
-               CTX_ERROR(a->ctx, "Could not open archive %s: %m\n", a->path);
+               ERROR(a->ctx, "Could not open archive %s: %m\n", a->path);
                r = -errno;
                goto ERROR;
        }
@@ -698,7 +698,7 @@ PAKFIRE_EXPORT int pakfire_archive_open(struct pakfire_archive** archive,
        // Call stat() on f
        r = fstat(fileno(a->f), &a->stat);
        if (r < 0) {
-               CTX_ERROR(a->ctx, "Could not stat archive %s: %m\n", a->path);
+               ERROR(a->ctx, "Could not stat archive %s: %m\n", a->path);
                r = -errno;
                goto ERROR;
        }
@@ -734,7 +734,7 @@ static struct json_object* pakfire_archive_metadata_get_object(
                // Try finding a matching JSON object
                r = json_object_object_get_ex(object, *key, &object);
                if (!r) {
-                       CTX_DEBUG(archive->ctx, "Could not find JSON object at '%s': %m\n", *key);
+                       DEBUG(archive->ctx, "Could not find JSON object at '%s': %m\n", *key);
                        break;
                }
        }
@@ -877,7 +877,7 @@ static int pakfire_archive_read_filter(struct pakfire_archive* archive,
 
                        // Increment counter
                        if (++cookie->followed_symlinks >= MAX_FOLLOW_SYMLINKS) {
-                               CTX_ERROR(archive->ctx, "Reached maximum number of symlinks to follow\n");
+                               ERROR(archive->ctx, "Reached maximum number of symlinks to follow\n");
                                return PAKFIRE_WALK_ERROR;
                        }
 
@@ -899,7 +899,7 @@ static int __pakfire_archive_read(struct pakfire_archive* archive,
        // Create a file descriptor
        cookie->f = fopencookie(cookie, "r", pakfire_archive_read_functions);
        if (!cookie->f) {
-               CTX_ERROR(archive->ctx, "Could not open /%s: %m\n", cookie->path);
+               ERROR(archive->ctx, "Could not open /%s: %m\n", cookie->path);
                return PAKFIRE_WALK_ERROR;
        }
 
@@ -919,7 +919,7 @@ PAKFIRE_EXPORT FILE* pakfire_archive_read(struct pakfire_archive* archive, const
        // Allocate a cookie
        cookie = calloc(1, sizeof(*cookie));
        if (!cookie) {
-               CTX_ERROR(archive->ctx, "Could not allocate a cookie: %m\n");
+               ERROR(archive->ctx, "Could not allocate a cookie: %m\n");
                goto ERROR;
        }
 
@@ -932,7 +932,7 @@ PAKFIRE_EXPORT FILE* pakfire_archive_read(struct pakfire_archive* archive, const
        // Store the path
        r = pakfire_string_set(cookie->path, path);
        if (r) {
-               CTX_ERROR(archive->ctx, "Could not set path: %m\n");
+               ERROR(archive->ctx, "Could not set path: %m\n");
                goto ERROR;
        }
 
@@ -964,7 +964,7 @@ PAKFIRE_EXPORT FILE* pakfire_archive_read(struct pakfire_archive* archive, const
 
                // Nothing found
                if (!cookie->f) {
-                       CTX_ERROR(archive->ctx, "Could not find /%s\n", path);
+                       ERROR(archive->ctx, "Could not find /%s\n", path);
 
                        // No such file or directory
                        errno = ENOENT;
@@ -990,7 +990,7 @@ int pakfire_archive_copy(struct pakfire_archive* archive, const char* path) {
        if (size < 0)
                return -EINVAL;
 
-       CTX_DEBUG(archive->ctx, "Copying %s to %s...\n", archive->path, path);
+       DEBUG(archive->ctx, "Copying %s to %s...\n", archive->path, path);
 
        // Ensure we copy from the very beginning
        rewind(archive->f);
@@ -1008,7 +1008,7 @@ int pakfire_archive_copy(struct pakfire_archive* archive, const char* path) {
        // Copy everything
        ssize_t bytes_written = sendfile(fileno(f), fileno(archive->f), NULL, size);
        if (bytes_written < size) {
-               CTX_ERROR(archive->ctx, "Could not copy archive (%zd byte(s) written): %m\n",
+               ERROR(archive->ctx, "Could not copy archive (%zd byte(s) written): %m\n",
                        bytes_written);
                goto ERROR;
        }
@@ -1033,7 +1033,7 @@ static int pakfire_archive_link(struct pakfire_archive* archive, const char* pat
        if (!path)
                return -EINVAL;
 
-       CTX_DEBUG(archive->ctx, "Linking %s to %s...\n", archive->path, path);
+       DEBUG(archive->ctx, "Linking %s to %s...\n", archive->path, path);
 
        // Delete the destination file (if it exists)
        unlink(path);
@@ -1041,7 +1041,7 @@ static int pakfire_archive_link(struct pakfire_archive* archive, const char* pat
        // Create the new link
        r = link(archive->path, path);
        if (r) {
-               CTX_DEBUG(archive->ctx, "Could not create hardlink %s: %m\n", path);
+               DEBUG(archive->ctx, "Could not create hardlink %s: %m\n", path);
                return r;
        }
 
@@ -1142,7 +1142,7 @@ static int pakfire_archive_extract_one(struct pakfire_archive* archive,
                // Compose file path
                r = pakfire_path_append(buffer, state->prefix, path);
                if (r < 0) {
-                       CTX_ERROR(archive->ctx, "Could not compose file path: %m\n");
+                       ERROR(archive->ctx, "Could not compose file path: %m\n");
                        goto ERROR;
                }
 
@@ -1154,7 +1154,7 @@ static int pakfire_archive_extract_one(struct pakfire_archive* archive,
                if (link) {
                        r = pakfire_path_append(buffer, state->prefix, link);
                        if (r < 0) {
-                               CTX_ERROR(archive->ctx, "Could not compose hardlink path: %m\n");
+                               ERROR(archive->ctx, "Could not compose hardlink path: %m\n");
                                goto ERROR;
                        }
 
@@ -1168,12 +1168,12 @@ static int pakfire_archive_extract_one(struct pakfire_archive* archive,
                path = archive_entry_pathname(entry);
 
                if (pakfire_path_exists(path)) {
-                       CTX_DEBUG(archive->ctx, "The configuration file %s exists\n",
+                       DEBUG(archive->ctx, "The configuration file %s exists\n",
                                pakfire_file_get_path(file));
 
                        r = pakfire_string_format(buffer, "%s.paknew", path);
                        if (r < 0) {
-                               CTX_ERROR(archive->ctx, "Could not compose path for configuration file: %m\n");
+                               ERROR(archive->ctx, "Could not compose path for configuration file: %m\n");
                                goto ERROR;
                        }
 
@@ -1187,7 +1187,7 @@ static int pakfire_archive_extract_one(struct pakfire_archive* archive,
                // Fetch path again since we changed it
                path = archive_entry_pathname(entry);
 
-               CTX_DEBUG(archive->ctx, "Extracting %s\n", path);
+               DEBUG(archive->ctx, "Extracting %s\n", path);
 
                // Remove any extended attributes which we never write to disk
                archive_entry_xattr_clear(entry);
@@ -1211,14 +1211,14 @@ static int pakfire_archive_extract_one(struct pakfire_archive* archive,
                                break;
 
                        case ARCHIVE_WARN:
-                               CTX_ERROR(archive->ctx, "%s\n", archive_error_string(state->writer));
+                               ERROR(archive->ctx, "%s\n", archive_error_string(state->writer));
 
                                // Pretend everything has been okay
                                r = 0;
                                break;
 
                        case ARCHIVE_FATAL:
-                               CTX_ERROR(archive->ctx, "%s\n", archive_error_string(state->writer));
+                               ERROR(archive->ctx, "%s\n", archive_error_string(state->writer));
                                r = 1;
                                break;
                }
@@ -1238,7 +1238,7 @@ static int __pakfire_archive_extract(struct pakfire_archive* archive, const char
        struct archive* a = NULL;
        int r;
 
-       CTX_DEBUG(archive->ctx, "Extracting %s\n", archive->path);
+       DEBUG(archive->ctx, "Extracting %s\n", archive->path);
 
        int progress_flags = PAKFIRE_PROGRESS_SHOW_PERCENTAGE;
 
@@ -1404,9 +1404,9 @@ int pakfire_archive_check_digest(struct pakfire_archive* archive,
                char* expected_hexdigest = __pakfire_hexlify(digest, length);
                char* computed_hexdigest = __pakfire_hexlify(computed_digest, computed_length);
 
-               CTX_ERROR(archive->ctx, "Archive digest does not match for %s:\n", archive->path);
-               CTX_ERROR(archive->ctx, "  Expected: %s\n", expected_hexdigest);
-               CTX_ERROR(archive->ctx, "  Computed: %s\n", computed_hexdigest);
+               ERROR(archive->ctx, "Archive digest does not match for %s:\n", archive->path);
+               ERROR(archive->ctx, "  Expected: %s\n", expected_hexdigest);
+               ERROR(archive->ctx, "  Computed: %s\n", computed_hexdigest);
 
                if (expected_hexdigest)
                        free(expected_hexdigest);
@@ -1427,7 +1427,7 @@ static int pakfire_archive_import_filelist_from_json(
        // Fetch the array with the filelist
        array = pakfire_archive_metadata_get_object(archive, "filelist", NULL);
        if (!array) {
-               CTX_ERROR(archive->ctx, "Archive has no filelist: %m\n");
+               ERROR(archive->ctx, "Archive has no filelist: %m\n");
                return 1;
        }
 
@@ -1481,7 +1481,7 @@ static int pakfire_archive_make_package_from_json(struct pakfire_archive* archiv
 #ifdef ENABLE_DEBUG
        const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
 
-       CTX_DEBUG(archive->ctx, "Created package %s (%p) from archive %p\n",
+       DEBUG(archive->ctx, "Created package %s (%p) from archive %p\n",
                nevra, pkg, archive);
 #endif
 
@@ -1780,7 +1780,7 @@ static ssize_t pakfire_archive_stream_payload(
        // Fill the buffer with data from the archive
        bytes_read = archive_read_data(a, buffer, length);
        if (bytes_read < 0)
-               CTX_ERROR(ctx, "Could not read from archive: %s\n", archive_error_string(a));
+               ERROR(ctx, "Could not read from archive: %s\n", archive_error_string(a));
 
        return bytes_read;
 }
index 3ce25815abda6f186cda8a8b5b10e6ea25522618..532cfebd99275e14e6c92bb9717a1a11dfca0e9b 100644 (file)
@@ -150,13 +150,13 @@ static int pakfire_build_output_callback(
        const unsigned int ms = (unsigned int)(t * 1000.0) % 1000;
 
        if (h)
-               CTX_INFO(ctx, "[%02u:%02u:%02u.%04u] %.*s", h, m, s, ms, (int)length, buffer);
+               INFO(ctx, "[%02u:%02u:%02u.%04u] %.*s", h, m, s, ms, (int)length, buffer);
 
        else if (m)
-               CTX_INFO(ctx, "[   %02u:%02u.%04u] %.*s", m, s, ms, (int)length, buffer);
+               INFO(ctx, "[   %02u:%02u.%04u] %.*s", m, s, ms, (int)length, buffer);
 
        else
-               CTX_INFO(ctx, "[      %02u.%04u] %.*s", s, ms, (int)length, buffer);
+               INFO(ctx, "[      %02u.%04u] %.*s", s, ms, (int)length, buffer);
 
        return length;
 }
@@ -179,12 +179,12 @@ static int __pakfire_build_setup_repo(struct pakfire* pakfire,
 
        const char* name = pakfire_repo_get_name(repo);
 
-       CTX_DEBUG(build->ctx, "Exporting repository configuration for '%s'\n", name);
+       DEBUG(build->ctx, "Exporting repository configuration for '%s'\n", name);
 
        // Make path for configuration file
        r = pakfire_path(build->pakfire, path, PAKFIRE_CONFIG_DIR "/repos/%s.repo", name);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not make repository configuration path for %s: %m\n", name);
+               ERROR(build->ctx, "Could not make repository configuration path for %s: %m\n", name);
                goto ERROR;
        }
 
@@ -196,14 +196,14 @@ static int __pakfire_build_setup_repo(struct pakfire* pakfire,
        // Open the repository configuration
        f = fopen(path, "w");
        if (!f) {
-               CTX_ERROR(build->ctx, "Could not open %s for writing: %m\n", path);
+               ERROR(build->ctx, "Could not open %s for writing: %m\n", path);
                goto ERROR;
        }
 
        // Write repository configuration
        r = pakfire_repo_write_config(repo, f);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not write repository configuration for %s: %m\n", name);
+               ERROR(build->ctx, "Could not write repository configuration for %s: %m\n", name);
                goto ERROR;
        }
 
@@ -215,7 +215,7 @@ static int __pakfire_build_setup_repo(struct pakfire* pakfire,
                if (pakfire_path_exists(_path)) {
                        r = pakfire_jail_bind(build->jail, _path, _path, MS_RDONLY);
                        if (r) {
-                               CTX_ERROR(build->ctx, "Could not bind-mount the repository at %s: %m\n", _path);
+                               ERROR(build->ctx, "Could not bind-mount the repository at %s: %m\n", _path);
                                goto ERROR;
                        }
                }
@@ -245,23 +245,23 @@ static int pakfire_build_read_script(struct pakfire_build* build,
        // Compose the source path
        r = pakfire_path_append(path, PAKFIRE_SCRIPTS_DIR, filename);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not compose path for script '%s': %m\n", filename);
+               ERROR(build->ctx, "Could not compose path for script '%s': %m\n", filename);
                goto ERROR;
        }
 
-       CTX_DEBUG(build->ctx, "Reading script from %s...\n", path);
+       DEBUG(build->ctx, "Reading script from %s...\n", path);
 
        // Open the file
        f = fopen(path, "r");
        if (!f) {
-               CTX_ERROR(build->ctx, "Could not open script %s: %m\n", path);
+               ERROR(build->ctx, "Could not open script %s: %m\n", path);
                goto ERROR;
        }
 
        // Read the file into a the buffer
        r = pakfire_read_file_into_buffer(f, buffer, length);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not read script: %m\n");
+               ERROR(build->ctx, "Could not read script: %m\n");
                goto ERROR;
        }
 
@@ -283,12 +283,12 @@ static int pakfire_build_run_script(
        char* script = NULL;
        size_t length = 0;
 
-       CTX_DEBUG(build->ctx, "Running build script '%s'...\n", filename);
+       DEBUG(build->ctx, "Running build script '%s'...\n", filename);
 
        // Read the script
        r = pakfire_build_read_script(build, filename, &script, &length);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not read script %s: %m\n", filename);
+               ERROR(build->ctx, "Could not read script %s: %m\n", filename);
                return r;
        }
 
@@ -296,7 +296,7 @@ static int pakfire_build_run_script(
        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);
+               ERROR(build->ctx, "Script '%s' failed with status %d\n", filename, r);
 
        if (script)
                free(script);
@@ -328,7 +328,7 @@ static int pakfire_build_make_filter(struct pakfire_build* build, pcre2_code** r
        if (!pattern || !*pattern)
                goto ERROR;
 
-       CTX_DEBUG(build->ctx, "Found filter for %s: %s\n", filter, pattern);
+       DEBUG(build->ctx, "Found filter for %s: %s\n", filter, pattern);
 
        // Compile the regular expression
        r = pakfire_compile_regex(build->ctx, regex, pattern);
@@ -355,7 +355,7 @@ static ssize_t pakfire_build_send_filelist(
        // Fetch the next file
        file = pakfire_filelist_get(p->filelist, p->i);
        if (!file) {
-               CTX_DEBUG(ctx, "Could not fetch file %u: %m\n", p->i);
+               DEBUG(ctx, "Could not fetch file %u: %m\n", p->i);
                r = -errno;
                goto ERROR;
        }
@@ -363,7 +363,7 @@ static ssize_t pakfire_build_send_filelist(
        // Fetch the path of the file
        const char* path = pakfire_file_get_path(file);
        if (!path) {
-               CTX_ERROR(ctx, "Received a file with an empty path\n");
+               ERROR(ctx, "Received a file with an empty path\n");
                r = -errno;
                goto ERROR;
        }
@@ -412,7 +412,7 @@ static int pakfire_build_process_deps(struct pakfire_ctx* ctx, void* data,
        if (r)
                return r;
 
-       CTX_DEBUG(ctx, "Processing dependency: %s\n", dep);
+       DEBUG(ctx, "Processing dependency: %s\n", dep);
 
        // Filter out any dependencies that are provided by this package
        if (p->dep == PAKFIRE_PKG_REQUIRES) {
@@ -429,7 +429,7 @@ static int pakfire_build_process_deps(struct pakfire_ctx* ctx, void* data,
        if (p->filter) {
                match = pcre2_match_data_create_from_pattern(p->filter, NULL);
                if (!match) {
-                       CTX_ERROR(ctx, "Could not allocate PCRE match data: %m\n");
+                       ERROR(ctx, "Could not allocate PCRE match data: %m\n");
                        goto ERROR;
                }
 
@@ -448,18 +448,18 @@ static int pakfire_build_process_deps(struct pakfire_ctx* ctx, void* data,
                        // Fetch the error message
                        r = pcre2_get_error_message(r, (PCRE2_UCHAR*)error, sizeof(error));
                        if (r < 0) {
-                               CTX_ERROR(ctx, "Could not fetch PCRE error message: %m\n");
+                               ERROR(ctx, "Could not fetch PCRE error message: %m\n");
                                r = 1;
                                goto ERROR;
                        }
 
-                       CTX_ERROR(ctx, "Could not match the filter: %s\n", error);
+                       ERROR(ctx, "Could not match the filter: %s\n", error);
                        r = 1;
                        goto ERROR;
 
                // Match!
                } else {
-                       CTX_DEBUG(ctx, "Skipping dependency that has been filtered: %s\n", dep);
+                       DEBUG(ctx, "Skipping dependency that has been filtered: %s\n", dep);
                        r = 0;
                        goto ERROR;
                }
@@ -468,14 +468,14 @@ static int pakfire_build_process_deps(struct pakfire_ctx* ctx, void* data,
        // Add dependency
        r = pakfire_package_add_dep(p->pkg, p->dep, buffer);
        if (r) {
-               CTX_ERROR(ctx, "Could not process dependency '%s': %m\n", buffer);
+               ERROR(ctx, "Could not process dependency '%s': %m\n", buffer);
                return r;
        }
 
        goto ERROR;
 
 SKIP:
-       CTX_DEBUG(ctx, "Skipping dependency that is provided by the package itself: %s\n", dep);
+       DEBUG(ctx, "Skipping dependency that is provided by the package itself: %s\n", dep);
 
        // Return how many bytes we have consumed
        r = length;
@@ -512,7 +512,7 @@ static int pakfire_build_find_deps(struct pakfire_build* build,
 
        // Skip calling the script if class doesn't match
        if (class && !pakfire_filelist_matches_class(filelist, class)) {
-               CTX_DEBUG(build->ctx, "Skipping calling %s as class does not match\n", script);
+               DEBUG(build->ctx, "Skipping calling %s as class does not match\n", script);
                return 0;
        }
 
@@ -526,7 +526,7 @@ static int pakfire_build_find_deps(struct pakfire_build* build,
        r = pakfire_build_run_script(build, script, args,
                        pakfire_build_send_filelist, &ctx, pakfire_build_process_deps, &ctx);
        if (r)
-               CTX_ERROR(build->ctx, "%s returned with error %d\n", script, r);
+               ERROR(build->ctx, "%s returned with error %d\n", script, r);
 
        return r;
 }
@@ -542,7 +542,7 @@ static int pakfire_build_find_dependencies(struct pakfire_build* build,
        r = pakfire_build_make_filter(build, &filter_provides,
                makefile, namespace, "filter_provides");
        if (r) {
-               CTX_ERROR(build->ctx, "Provides filter is broken: %m\n");
+               ERROR(build->ctx, "Provides filter is broken: %m\n");
                goto ERROR;
        }
 
@@ -550,7 +550,7 @@ static int pakfire_build_find_dependencies(struct pakfire_build* build,
        r = pakfire_build_make_filter(build, &filter_requires,
                makefile, namespace, "filter_requires");
        if (r) {
-               CTX_ERROR(build->ctx, "Requires filter is broken: %m\n");
+               ERROR(build->ctx, "Requires filter is broken: %m\n");
                goto ERROR;
        }
 
@@ -668,7 +668,7 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
        if (r < 0)
                goto ERROR;
 
-       CTX_DEBUG(build->ctx, "%zu file(s) found\n", pakfire_filelist_length(filelist));
+       DEBUG(build->ctx, "%zu file(s) found\n", pakfire_filelist_length(filelist));
 
        // Nothing to do if the filelist is empty
        if (pakfire_filelist_is_empty(filelist))
@@ -680,7 +680,7 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
        // Find dependencies
        r = pakfire_build_find_dependencies(build, makefile, namespace, pkg, filelist);
        if (r) {
-               CTX_ERROR(build->ctx, "Finding dependencies failed: %m\n");
+               ERROR(build->ctx, "Finding dependencies failed: %m\n");
                goto ERROR;
        }
 
@@ -720,7 +720,7 @@ static ssize_t pakfire_build_send_scriptlet(
        if (!state->p) {
                state->p = pakfire_scriptlet_get_data(state->scriptlet, &state->l);
                if (!state->p) {
-                       CTX_ERROR(ctx, "Could not fetch scriptlet: %m\n");
+                       ERROR(ctx, "Could not fetch scriptlet: %m\n");
                        return -errno;
                }
        }
@@ -787,14 +787,14 @@ static int pakfire_build_package_add_scriptlet(struct pakfire_build* build,
        // Add it to the package
        r = pakfire_packager_add_scriptlet(packager, scriptlet);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not add scriptlet %s\n", type);
+               ERROR(build->ctx, "Could not add scriptlet %s\n", type);
                goto ERROR;
        }
 
        // Add scriptlet requirements
        r = pakfire_build_add_scriptlet_requires(build, pkg, scriptlet);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not add scriptlet requirements: %m\n");
+               ERROR(build->ctx, "Could not add scriptlet requirements: %m\n");
                goto ERROR;
        }
 
@@ -849,12 +849,12 @@ static int pakfire_build_package(struct pakfire_build* build, struct pakfire_par
        // Expand the handle into the package name
        char* name = pakfire_parser_expand(makefile, "packages", namespace);
        if (!name) {
-               CTX_ERROR(build->ctx, "Could not get package name: %m\n");
+               ERROR(build->ctx, "Could not get package name: %m\n");
                goto ERROR;
        }
 
-       CTX_INFO(build->ctx, "Building package '%s'...\n", name);
-       CTX_DEBUG(build->ctx, "  buildroot = %s\n", buildroot);
+       INFO(build->ctx, "Building package '%s'...\n", name);
+       DEBUG(build->ctx, "  buildroot = %s\n", buildroot);
 
        // Fetch build architecture
        const char* arch = pakfire_get_arch(build->pakfire);
@@ -864,7 +864,7 @@ static int pakfire_build_package(struct pakfire_build* build, struct pakfire_par
        // Fetch package from makefile
        r = pakfire_parser_create_package(makefile, &pkg, NULL, namespace, arch);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create package from makefile: %m\n");
+               ERROR(build->ctx, "Could not create package from makefile: %m\n");
                goto ERROR;
        }
 
@@ -922,7 +922,7 @@ static int pakfire_build_package(struct pakfire_build* build, struct pakfire_par
        // Write the finished package
        r = pakfire_packager_finish_to_directory(packager, path, NULL);
        if (r) {
-               CTX_ERROR(build->ctx, "pakfire_packager_finish() failed: %m\n");
+               ERROR(build->ctx, "pakfire_packager_finish() failed: %m\n");
                goto ERROR;
        }
 
@@ -953,7 +953,7 @@ static int pakfire_build_package_dump(struct pakfire_ctx* ctx,
        if (!dump)
                return 1;
 
-       CTX_INFO(build->ctx, "%s\n", dump);
+       INFO(build->ctx, "%s\n", dump);
        free(dump);
 
        return 0;
@@ -961,7 +961,7 @@ static int pakfire_build_package_dump(struct pakfire_ctx* ctx,
 
 static int pakfire_build_packages(struct pakfire_build* build,
                struct pakfire_parser* makefile) {
-       CTX_INFO(build->ctx, "Creating packages...");
+       INFO(build->ctx, "Creating packages...");
        int r = 1;
 
        const char* buildroot = pakfire_relpath(build->pakfire, build->buildroot);
@@ -969,7 +969,7 @@ static int pakfire_build_packages(struct pakfire_build* build,
        // Fetch a list all all packages
        char** packages = pakfire_parser_list_namespaces(makefile, "packages.package:*");
        if (!packages) {
-               CTX_ERROR(build->ctx, "Could not find any packages: %m\n");
+               ERROR(build->ctx, "Could not find any packages: %m\n");
                goto ERROR;
        }
 
@@ -979,7 +979,7 @@ static int pakfire_build_packages(struct pakfire_build* build,
        for (char** package = packages; *package; package++)
                num_packages++;
 
-       CTX_DEBUG(build->ctx, "Found %u package(s)\n", num_packages);
+       DEBUG(build->ctx, "Found %u package(s)\n", num_packages);
 
        // Build packages in reverse order
        for (int i = num_packages - 1; i >= 0; i--) {
@@ -1033,17 +1033,17 @@ static int pakfire_build_stage(struct pakfire_build* build,
        // Create the build script
        char* script = pakfire_parser_expand(makefile, "build", template);
        if (!script) {
-               CTX_ERROR(build->ctx, "Could not generate the build script for stage '%s': %m\n", stage);
+               ERROR(build->ctx, "Could not generate the build script for stage '%s': %m\n", stage);
                goto ERROR;
        }
 
-       CTX_INFO(build->ctx, "Running build stage '%s'\n", stage);
+       INFO(build->ctx, "Running build stage '%s'\n", stage);
 
        // Import environment
        // XXX is this a good idea?
        r = pakfire_jail_import_env(build->jail, (const char**)envp);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not import environment: %m\n");
+               ERROR(build->ctx, "Could not import environment: %m\n");
                goto ERROR;
        }
 
@@ -1051,7 +1051,7 @@ static int pakfire_build_stage(struct pakfire_build* build,
        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);
+               ERROR(build->ctx, "Build stage '%s' failed with status %d\n", stage, r);
 
 ERROR:
        if (envp) {
@@ -1094,7 +1094,7 @@ static int pakfire_build_post_process_files(struct pakfire_build* build,
 
        if (!pakfire_filelist_is_empty(removees)) {
                if (description)
-                       CTX_INFO(build->ctx, "%s\n", description);
+                       INFO(build->ctx, "%s\n", description);
 
                // Show all files which will be removed
                pakfire_filelist_dump(removees, PAKFIRE_FILE_DUMP_FULL|PAKFIRE_FILE_DUMP_ISSUES);
@@ -1252,7 +1252,7 @@ static int pakfire_build_run_post_build_checks(struct pakfire_build* build) {
        // Create a filelist of all files in the build
        r = pakfire_filelist_create(&filelist, build->pakfire);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create filelist: %m\n");
+               ERROR(build->ctx, "Could not create filelist: %m\n");
                goto ERROR;
        }
 
@@ -1263,7 +1263,7 @@ static int pakfire_build_run_post_build_checks(struct pakfire_build* build) {
 
        // If the filelist is empty, we can are done
        if (pakfire_filelist_is_empty(filelist)) {
-               CTX_DEBUG(build->ctx, "Empty BUILDROOT. Skipping post build checks...\n");
+               DEBUG(build->ctx, "Empty BUILDROOT. Skipping post build checks...\n");
                r = 0;
                goto ERROR;
        }
@@ -1375,7 +1375,7 @@ static int pakfire_build_parse_id(struct pakfire_build* build, const char* id) {
        if (id) {
                r = uuid_parse(id, build->id);
                if (r) {
-                       CTX_ERROR(build->ctx, "Could not parse build ID '%s'\n", id);
+                       ERROR(build->ctx, "Could not parse build ID '%s'\n", id);
                        return -EINVAL;
                }
 
@@ -1401,7 +1401,7 @@ static int pakfire_build_setup_cgroup(struct pakfire_build* build) {
        // Compose path
        r = pakfire_string_format(path, "pakfire/build-%s", build->_id);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not compose path for cgroup: %m\n");
+               ERROR(build->ctx, "Could not compose path for cgroup: %m\n");
                goto ERROR;
        }
 
@@ -1409,7 +1409,7 @@ static int pakfire_build_setup_cgroup(struct pakfire_build* build) {
        r = pakfire_cgroup_open(&build->cgroup, build->ctx, path,
                PAKFIRE_CGROUP_ENABLE_ACCOUNTING);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create cgroup for build %s: %m\n", build->_id);
+               ERROR(build->ctx, "Could not create cgroup for build %s: %m\n", build->_id);
                goto ERROR;
        }
 
@@ -1460,21 +1460,21 @@ static int pakfire_build_setup_jail(struct pakfire_build* build) {
        // Create a new jail
        r = pakfire_jail_create(&build->jail, build->pakfire);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create jail for build %s: %m\n", build->_id);
+               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) {
-               CTX_ERROR(build->ctx, "Could not set cgroup for jail: %m\n");
+               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) {
-               CTX_ERROR(build->ctx, "Could not set nice level: %m\n");
+               ERROR(build->ctx, "Could not set nice level: %m\n");
                return r;
        }
 
@@ -1499,7 +1499,7 @@ static int pakfire_build_mount_ccache(struct pakfire_build* build) {
        // Make sure the path exists
        r = pakfire_mkdir(build->ccache_path, 0755);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create %s: %m\n", build->ccache_path);
+               ERROR(build->ctx, "Could not create %s: %m\n", build->ccache_path);
                return r;
        }
 
@@ -1513,12 +1513,12 @@ static int pakfire_build_setup_ccache(struct pakfire_build* build) {
 
        // Check if we want a ccache
        if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_CCACHE)) {
-               CTX_DEBUG(build->ctx, "ccache usage has been disabled for this build\n");
+               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) {
-                       CTX_ERROR(build->ctx, "Could not disable ccache: %m\n");
+                       ERROR(build->ctx, "Could not disable ccache: %m\n");
                        return r;
                }
 
@@ -1528,14 +1528,14 @@ static int pakfire_build_setup_ccache(struct pakfire_build* build) {
        // Set CCACHE_DIR
        r = pakfire_jail_set_env(build->jail, "CCACHE_DIR", CCACHE_DIR);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not set ccache directory: %m\n");
+               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) {
-               CTX_ERROR(build->ctx, "Could not set ccache tempdir: %m\n");
+               ERROR(build->ctx, "Could not set ccache tempdir: %m\n");
                return r;
        }
 
@@ -1555,7 +1555,7 @@ static int pakfire_build_setup_repo(struct pakfire_build* build) {
        // Create a new repository
        r = pakfire_repo_create(&build->repo, build->pakfire, PAKFIRE_REPO_RESULT);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create repository %s: %m", PAKFIRE_REPO_RESULT);
+               ERROR(build->ctx, "Could not create repository %s: %m", PAKFIRE_REPO_RESULT);
                return r;
        }
 
@@ -1565,7 +1565,7 @@ static int pakfire_build_setup_repo(struct pakfire_build* build) {
        // Create a temporary directory
        const char* p = pakfire_mkdtemp(path);
        if (!p) {
-               CTX_ERROR(build->ctx, "Could not create a the build repository: %m\n");
+               ERROR(build->ctx, "Could not create a the build repository: %m\n");
                return 1;
        }
 
@@ -1586,7 +1586,7 @@ static int pakfire_build_set_time_start(struct pakfire_build* build) {
        // Fetch current time
        r = clock_gettime(CLOCK_MONOTONIC, &build->time_start);
        if (r < 0)
-               CTX_ERROR(build->ctx, "Could not fetch start time: %m\n");
+               ERROR(build->ctx, "Could not fetch start time: %m\n");
 
        return r;
 }
@@ -1709,7 +1709,7 @@ static int pakfire_build_install_packages(struct pakfire_build* build) {
        // Solve the transaction
        r = pakfire_transaction_solve(transaction, 0, &problems);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not install build dependencies:\n%s\n", problems);
+               ERROR(build->ctx, "Could not install build dependencies:\n%s\n", problems);
                goto ERROR;
        }
 
@@ -1735,7 +1735,7 @@ static int pakfire_build_init(struct pakfire_build* build) {
 
        // Don't do it again
        if (build->state != PAKFIRE_BUILD_INIT) {
-               CTX_DEBUG(build->ctx, "Build environment has already been initialized\n");
+               DEBUG(build->ctx, "Build environment has already been initialized\n");
                return 0;
        }
 
@@ -1769,10 +1769,10 @@ static int pakfire_build_read_makefile(struct pakfire_build* build,
        r = pakfire_read_makefile(parser, build->pakfire, path, &error);
        if (r) {
                if (error) {
-                       CTX_ERROR(build->ctx, "Could not parse makefile %s: %s\n", path,
+                       ERROR(build->ctx, "Could not parse makefile %s: %s\n", path,
                                pakfire_parser_error_get_message(error));
                } else {
-                       CTX_ERROR(build->ctx, "Could not parse makefile %s: %m\n", path);
+                       ERROR(build->ctx, "Could not parse makefile %s: %m\n", path);
                }
 
                goto ERROR;
@@ -1819,7 +1819,7 @@ static int pakfire_build_perform(struct pakfire_build* build,
        // Run post build checks
        r = pakfire_build_run_post_build_checks(build);
        if (r) {
-               CTX_ERROR(build->ctx, "Post build checks failed\n");
+               ERROR(build->ctx, "Post build checks failed\n");
                goto ERROR;
        }
 
@@ -1848,7 +1848,7 @@ static int __pakfire_build_unpackaged_file(
                struct pakfire_ctx* ctx, struct pakfire_file* file, void* p) {
        char* s = pakfire_file_dump(file, PAKFIRE_FILE_DUMP_FULL);
        if (s) {
-               CTX_ERROR(ctx, "%s\n", s);
+               ERROR(ctx, "%s\n", s);
                free(s);
        }
 
@@ -1870,7 +1870,7 @@ static int pakfire_build_check_unpackaged_files(struct pakfire_build* build) {
                goto ERROR;
 
        if (!pakfire_filelist_is_empty(filelist)) {
-               CTX_ERROR(build->ctx, "Unpackaged files found:\n");
+               ERROR(build->ctx, "Unpackaged files found:\n");
 
                r = pakfire_filelist_walk(filelist, __pakfire_build_unpackaged_file, NULL, 0);
                if (r)
@@ -1919,12 +1919,12 @@ static int pakfire_build_install_test(struct pakfire_build* build) {
 
                // Dependency Error
                case 2:
-                       CTX_ERROR(build->ctx, "Install test failed:\n%s\n", problems);
+                       ERROR(build->ctx, "Install test failed:\n%s\n", problems);
                        break;
 
                // Any other errors
                default:
-                       CTX_ERROR(build->ctx, "Install test failed: %m\n");
+                       ERROR(build->ctx, "Install test failed: %m\n");
                        goto ERROR;
        }
 
@@ -1997,7 +1997,7 @@ static int pakfire_build_copy_packages(struct pakfire_build* build) {
        struct pakfire_repo* local = NULL;
        int r = 0;
 
-       CTX_DEBUG(build->ctx, "Copying built packages\n");
+       DEBUG(build->ctx, "Copying built packages\n");
 
        // Fetch local repository
        local = pakfire_get_repo(build->pakfire, PAKFIRE_REPO_LOCAL);
@@ -2057,7 +2057,7 @@ static int pakfire_build_install_source_package(
        r = pakfire_transaction_solve(transaction, 0, &problems);
        if (r) {
                if (problems)
-                       CTX_ERROR(build->ctx, "Could not install the source package:\n%s\n", problems);
+                       ERROR(build->ctx, "Could not install the source package:\n%s\n", problems);
 
                goto ERROR;
        }
@@ -2067,7 +2067,7 @@ static int pakfire_build_install_source_package(
 
        // Sanity check to see if we actually try to install anything
        if (!changes) {
-               CTX_ERROR(build->ctx, "The source package did not get installed\n");
+               ERROR(build->ctx, "The source package did not get installed\n");
                r = 1;
                goto ERROR;
        }
@@ -2139,11 +2139,11 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        const char* nevra = pakfire_package_get_string(package, PAKFIRE_PKG_NEVRA);
        const char* uuid = pakfire_package_get_string(package, PAKFIRE_PKG_UUID);
 
-       CTX_INFO(build->ctx, "Building %s (%s)...\n", nevra, uuid);
+       INFO(build->ctx, "Building %s (%s)...\n", nevra, uuid);
 
        // Check if this package can be build in this environment
        if (!pakfire_package_supports_build_arch(package, arch)) {
-               CTX_ERROR(build->ctx, "%s does not support being built on %s\n", nevra, arch);
+               ERROR(build->ctx, "%s does not support being built on %s\n", nevra, arch);
                r = -ENOTSUP;
                goto ERROR;
        }
@@ -2151,7 +2151,7 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        // Perform an install check to see whether we can build this at all
        r = pakfire_package_installcheck(package, &problems, 0);
        if (r) {
-               CTX_ERROR(build->ctx, "Cannot build %s:\n%s\n", nevra, problems);
+               ERROR(build->ctx, "Cannot build %s:\n%s\n", nevra, problems);
                goto ERROR;
        }
 
@@ -2163,21 +2163,21 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        // Install the source package
        r = pakfire_build_install_source_package(build, package);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not install the source package: %m\n");
+               ERROR(build->ctx, "Could not install the source package: %m\n");
                goto ERROR;
        }
 
        // Mount the ccache
        r = pakfire_build_mount_ccache(build);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not mount the ccache: %m\n");
+               ERROR(build->ctx, "Could not mount the ccache: %m\n");
                goto ERROR;
        }
 
        // Create BUILDROOT
        buildroot = pakfire_mkdtemp(build->buildroot);
        if (!buildroot) {
-               CTX_ERROR(build->ctx, "Could not create BUILDROOT: %m\n");
+               ERROR(build->ctx, "Could not create BUILDROOT: %m\n");
                goto ERROR;
        }
 
@@ -2194,7 +2194,7 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        // Create the packages
        r = pakfire_build_packages(build, makefile);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create packages: %m\n");
+               ERROR(build->ctx, "Could not create packages: %m\n");
                goto ERROR;
        }
 
@@ -2218,7 +2218,7 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        if (r)
                goto ERROR;
 
-       CTX_INFO(build->ctx, "Build successfully completed in %s\n", duration);
+       INFO(build->ctx, "Build successfully completed in %s\n", duration);
 
 ERROR:
        if (makefile)
@@ -2250,7 +2250,7 @@ static int pakfire_build_mkimage_install_deps(struct pakfire_build* build,
        // Create a new transaction
        r = pakfire_transaction_create(&transaction, build->pakfire, 0);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create transaction: %m\n");
+               ERROR(build->ctx, "Could not create transaction: %m\n");
                goto ERROR;
        }
 
@@ -2258,14 +2258,14 @@ static int pakfire_build_mkimage_install_deps(struct pakfire_build* build,
        r = pakfire_transaction_request(transaction,
                        PAKFIRE_JOB_INSTALL, requires, PAKFIRE_JOB_ESSENTIAL);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not add '%s' to the transaction: %m\n", requires);
+               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) {
-               CTX_ERROR(build->ctx, "Could not solve the request:\n%s\n", problems);
+               ERROR(build->ctx, "Could not solve the request:\n%s\n", problems);
                goto ERROR;
        }
 
@@ -2292,7 +2292,7 @@ static int pakfire_build_collect_packages(struct pakfire_build* build, const cha
        // Create a new transaction
        r = pakfire_transaction_create(&transaction, build->pakfire, 0);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not create transaction: %m\n");
+               ERROR(build->ctx, "Could not create transaction: %m\n");
                goto ERROR;
        }
 
@@ -2301,20 +2301,20 @@ static int pakfire_build_collect_packages(struct pakfire_build* build, const cha
        r = pakfire_transaction_request(transaction,
                        PAKFIRE_JOB_INSTALL, "ipfire-release", PAKFIRE_JOB_ESSENTIAL);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not install 'ipfire-release': %m\n");
+               ERROR(build->ctx, "Could not install 'ipfire-release': %m\n");
                goto ERROR;
        }
 
        // Solve the transaction
        r = pakfire_transaction_solve(transaction, 0, &problems);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not solve request:\n%s\n", problems);
+               ERROR(build->ctx, "Could not solve request:\n%s\n", problems);
                goto ERROR;
        }
 
        // Empty transaction?
        if (!pakfire_transaction_count(transaction)) {
-               CTX_ERROR(build->ctx, "The transaction is unexpectedly empty\n");
+               ERROR(build->ctx, "The transaction is unexpectedly empty\n");
                r = 1;
                goto ERROR;
        }
@@ -2322,25 +2322,25 @@ static int pakfire_build_collect_packages(struct pakfire_build* build, const cha
        // Dump the transaction
        p = pakfire_transaction_dump(transaction, 80);
        if (!p) {
-               CTX_ERROR(build->ctx, "Could not dump the transaction: %m\n");
+               ERROR(build->ctx, "Could not dump the transaction: %m\n");
                r = 1;
                goto ERROR;
        }
 
        // Log the dump
-       CTX_INFO(build->ctx, "%s\n", p);
+       INFO(build->ctx, "%s\n", p);
 
        // Download all packages
        r = pakfire_transaction_download(transaction);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not download the transaction: %m\n");
+               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) {
-               CTX_ERROR(build->ctx, "Could not create repository: %m\n");
+               ERROR(build->ctx, "Could not create repository: %m\n");
                goto ERROR;
        }
 
@@ -2378,7 +2378,7 @@ PAKFIRE_EXPORT int pakfire_build_mkimage(struct pakfire_build* build,
        // Allocate a temporary file
        t = pakfire_mktemp(path, 0600);
        if (!t) {
-               CTX_ERROR(build->ctx, "Could not allocate a temporary file: %m\n");
+               ERROR(build->ctx, "Could not allocate a temporary file: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -2448,7 +2448,7 @@ int pakfire_build_clean(struct pakfire* pakfire, int flags) {
        // Fetch local repository
        local = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
        if (!local) {
-               CTX_ERROR(ctx, "Could not find repository %s: %m\n", PAKFIRE_REPO_LOCAL);
+               ERROR(ctx, "Could not find repository %s: %m\n", PAKFIRE_REPO_LOCAL);
                goto ERROR;
        }
 
@@ -2486,7 +2486,7 @@ PAKFIRE_EXPORT int pakfire_build_install(struct pakfire_build* build, const char
        // Solve the transaction
        r = pakfire_transaction_solve(transaction, 0, &problems);
        if (r) {
-               CTX_ERROR(build->ctx, "Could not install packages:\n%s\n", problems);
+               ERROR(build->ctx, "Could not install packages:\n%s\n", problems);
                goto ERROR;
        }
 
index 651d5cd0f5c011e4e751e1b550eb825d481cd1a0..fc8f84e74465d2da9572f634288954372f612769 100644 (file)
@@ -94,7 +94,7 @@ static int pakfire_buildservice_setup_auth(struct pakfire_buildservice* service)
        if (r) {
                error = krb5_get_error_message(service->krb5_ctx, r);
 
-               CTX_ERROR(service->ctx, "Could not initialize Kerberos: %s\n", error);
+               ERROR(service->ctx, "Could not initialize Kerberos: %s\n", error);
                krb5_free_error_message(service->krb5_ctx, error);
 
                goto ERROR;
@@ -120,7 +120,7 @@ static int pakfire_buildservice_setup(struct pakfire_buildservice* service) {
        // Fetch the URL
        url = pakfire_config_get(config, "client", "url", NULL);
        if (!url) {
-               CTX_ERROR(service->ctx, "Build Service URL is not configured\n");
+               ERROR(service->ctx, "Build Service URL is not configured\n");
                r = 1;
                goto ERROR;
        }
@@ -180,7 +180,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_create(
        if (r)
                goto ERROR;
 
-       CTX_DEBUG(s->ctx,
+       DEBUG(s->ctx,
                "Pakfire Build Service initialized for %s\n", pakfire_buildservice_get_url(s));
 
        // Return the pointer
@@ -287,14 +287,14 @@ static int pakfire_buildservice_create_upload(struct pakfire_buildservice* servi
        // Stat the file
        r = fstat(fd, &stat);
        if (r) {
-               CTX_ERROR(service->ctx, "Could not stat %s: %s\n", path, strerror(errno));
+               ERROR(service->ctx, "Could not stat %s: %s\n", path, strerror(errno));
                goto ERROR;
        }
 
        // Compute the digest
        r = pakfire_digests_compute_from_file(service->ctx, &digests, PAKFIRE_DIGEST_BLAKE2B512, f);
        if (r) {
-               CTX_ERROR(service->ctx, "Could not compute the digest of %s: %s\n",
+               ERROR(service->ctx, "Could not compute the digest of %s: %s\n",
                        path, strerror(-r));
                goto ERROR;
        }
@@ -342,7 +342,7 @@ static int pakfire_buildservice_create_upload(struct pakfire_buildservice* servi
        // Fetch the ID
        r = json_object_object_get_ex(response, "id", &id);
        if (r == 0) {
-               CTX_ERROR(service->ctx, "Could not fetch ID from response\n");
+               ERROR(service->ctx, "Could not fetch ID from response\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -350,7 +350,7 @@ static int pakfire_buildservice_create_upload(struct pakfire_buildservice* servi
        // Extract the UUID
        __id = json_object_get_string(id);
        if (!__id) {
-               CTX_ERROR(service->ctx, "Could not fetch ID from response\n");
+               ERROR(service->ctx, "Could not fetch ID from response\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -431,7 +431,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_upload(struct pakfire_buildservice* serv
        // Open the source file
        f = fopen(path, "r");
        if (!f) {
-               CTX_ERROR(service->ctx, "Could not open file for upload %s: %m\n", path);
+               ERROR(service->ctx, "Could not open file for upload %s: %m\n", path);
                return -errno;
        }
 
@@ -440,7 +440,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_upload(struct pakfire_buildservice* serv
        if (r)
                goto ERROR;
 
-       CTX_DEBUG(service->ctx, "Created a new download (%s)\n", *uuid);
+       DEBUG(service->ctx, "Created a new download (%s)\n", *uuid);
 
        // Send the payload
        r = pakfire_buildservice_upload_payload(service, filename, *uuid, f);
@@ -485,7 +485,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_list_uploads(
        // Fetch the uploads
        uploads = json_object_object_get(response, "uploads");
        if (!uploads) {
-               CTX_ERROR(service->ctx, "Malformed response\n");
+               ERROR(service->ctx, "Malformed response\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -567,7 +567,7 @@ PAKFIRE_EXPORT int pakfire_buildservice_list_repos(struct pakfire_buildservice*
 
        // Fetch the repos
        if (!json_object_object_get_ex(response, "repos", &repos)) {
-               CTX_ERROR(service->ctx, "Malformed response\n");
+               ERROR(service->ctx, "Malformed response\n");
                r = -EBADMSG;
                goto ERROR;
        }
index 2f8c6f015821b89a021fb985e4ac055e009ef347..13f9858e4016cb4e660afcfaf50370d60ca47634 100644 (file)
@@ -119,7 +119,7 @@ static int pakfire_cgroup_set_root(struct pakfire_cgroup* cgroup) {
        }
 
        if (r)
-               CTX_ERROR(cgroup->ctx, "Could not determine cgroup root: %m\n");
+               ERROR(cgroup->ctx, "Could not determine cgroup root: %m\n");
 
        return r;
 }
@@ -181,7 +181,7 @@ static struct pakfire_cgroup* pakfire_cgroup_parent(struct pakfire_cgroup* cgrou
        // Determine the path of the parent
        r = pakfire_path_dirname(path, cgroup->path);
        if (r) {
-               CTX_ERROR(cgroup->ctx, "Could not determine path for parent cgroup: %m\n");
+               ERROR(cgroup->ctx, "Could not determine path for parent cgroup: %m\n");
                return NULL;
        }
 
@@ -192,7 +192,7 @@ static struct pakfire_cgroup* pakfire_cgroup_parent(struct pakfire_cgroup* cgrou
        // Open the cgroup
        r = pakfire_cgroup_open(&parent, cgroup->ctx, path, 0);
        if (r) {
-               CTX_ERROR(cgroup->ctx, "Could not open parent cgroup: %m\n");
+               ERROR(cgroup->ctx, "Could not open parent cgroup: %m\n");
                parent = NULL;
        }
 
@@ -200,7 +200,7 @@ static struct pakfire_cgroup* pakfire_cgroup_parent(struct pakfire_cgroup* cgrou
 }
 
 static void pakfire_cgroup_free(struct pakfire_cgroup* cgroup) {
-       CTX_DEBUG(cgroup->ctx, "Releasing cgroup %s at %p\n",
+       DEBUG(cgroup->ctx, "Releasing cgroup %s at %p\n",
                pakfire_cgroup_name(cgroup), cgroup);
 
        // Close the file descriptors
@@ -232,7 +232,7 @@ static int pakfire_cgroup_setup_devices(struct pakfire_cgroup* cgroup) {
        r = bpf_prog_load(BPF_PROG_TYPE_CGROUP_DEVICE, NULL, "GPL",
                program, sizeof(program) / sizeof(*program), &opts);
        if (r < 0) {
-               CTX_ERROR(cgroup->ctx, "Could not load BPF program: %m\n");
+               ERROR(cgroup->ctx, "Could not load BPF program: %m\n");
                return r;
        }
 
@@ -243,7 +243,7 @@ static int pakfire_cgroup_setup_devices(struct pakfire_cgroup* cgroup) {
        r = bpf_prog_attach(cgroup->devicesfd, cgroup->fd,
                BPF_CGROUP_DEVICE, BPF_F_ALLOW_MULTI);
        if (r) {
-               CTX_ERROR(cgroup->ctx, "Could not attach BPF program to cgroup: %m\n");
+               ERROR(cgroup->ctx, "Could not attach BPF program to cgroup: %m\n");
                return r;
        }
 
@@ -253,7 +253,7 @@ static int pakfire_cgroup_setup_devices(struct pakfire_cgroup* cgroup) {
 static int pakfire_cgroup_open_root(struct pakfire_cgroup* cgroup) {
        int fd = open(cgroup->root, O_DIRECTORY|O_PATH|O_CLOEXEC);
        if (fd < 0) {
-               CTX_ERROR(cgroup->ctx, "Could not open %s: %m\n", cgroup->root);
+               ERROR(cgroup->ctx, "Could not open %s: %m\n", cgroup->root);
                return -1;
        }
 
@@ -264,7 +264,7 @@ static int __pakfire_cgroup_create(struct pakfire_cgroup* cgroup) {
        char path[PATH_MAX];
        int r;
 
-       CTX_DEBUG(cgroup->ctx, "Trying to create cgroup %s\n", pakfire_cgroup_name(cgroup));
+       DEBUG(cgroup->ctx, "Trying to create cgroup %s\n", pakfire_cgroup_name(cgroup));
 
        // Compose the absolute path
        r = pakfire_path_append(path, cgroup->root, cgroup->path);
@@ -310,7 +310,7 @@ RETRY:
 
                        // Exit on all other errors
                        default:
-                               CTX_ERROR(cgroup->ctx, "Could not open cgroup %s: %m\n",
+                               ERROR(cgroup->ctx, "Could not open cgroup %s: %m\n",
                                        pakfire_cgroup_name(cgroup));
                                goto ERROR;
                }
@@ -335,7 +335,7 @@ static FILE* pakfire_cgroup_open_file(struct pakfire_cgroup* cgroup,
        // Open cgroup.procs
        int fd = openat(cgroup->fd, "cgroup.procs", O_CLOEXEC);
        if (fd < 0) {
-               CTX_ERROR(cgroup->ctx, "%s: Could not open %s: %m\n",
+               ERROR(cgroup->ctx, "%s: Could not open %s: %m\n",
                        pakfire_cgroup_name(cgroup), path);
                goto ERROR;
        }
@@ -358,14 +358,14 @@ static ssize_t pakfire_cgroup_read(struct pakfire_cgroup* cgroup, const char* pa
 
        // Check if this cgroup has been destroyed already
        if (cgroup->fd < 0) {
-               CTX_ERROR(cgroup->ctx, "Trying to read from destroyed cgroup\n");
+               ERROR(cgroup->ctx, "Trying to read from destroyed cgroup\n");
                return -1;
        }
 
        // Open the file
        int fd = openat(cgroup->fd, path, O_CLOEXEC);
        if (fd < 0) {
-               CTX_DEBUG(cgroup->ctx, "Could not open %s/%s: %m\n",
+               DEBUG(cgroup->ctx, "Could not open %s/%s: %m\n",
                        pakfire_cgroup_name(cgroup), path);
                goto ERROR;
        }
@@ -373,7 +373,7 @@ static ssize_t pakfire_cgroup_read(struct pakfire_cgroup* cgroup, const char* pa
        // Read file content into buffer
        bytes_read = read(fd, buffer, length);
        if (bytes_read < 0) {
-               CTX_DEBUG(cgroup->ctx, "Could not read from %s/%s: %m\n",
+               DEBUG(cgroup->ctx, "Could not read from %s/%s: %m\n",
                        pakfire_cgroup_name(cgroup), path);
                goto ERROR;
        }
@@ -399,7 +399,7 @@ static int pakfire_cgroup_write(struct pakfire_cgroup* cgroup,
 
        // Check if this cgroup has been destroyed already
        if (cgroup->fd < 0) {
-               CTX_ERROR(cgroup->ctx, "Trying to write to destroyed cgroup\n");
+               ERROR(cgroup->ctx, "Trying to write to destroyed cgroup\n");
                errno = EPERM;
                return 1;
        }
@@ -407,7 +407,7 @@ static int pakfire_cgroup_write(struct pakfire_cgroup* cgroup,
        // Open the file
        int fd = openat(cgroup->fd, path, O_WRONLY|O_CLOEXEC);
        if (fd < 0) {
-               CTX_DEBUG(cgroup->ctx, "Could not open %s/%s for writing: %m\n",
+               DEBUG(cgroup->ctx, "Could not open %s/%s for writing: %m\n",
                        pakfire_cgroup_name(cgroup), path);
                return 1;
        }
@@ -419,7 +419,7 @@ static int pakfire_cgroup_write(struct pakfire_cgroup* cgroup,
 
        // Check if content was written okay
        if (bytes_written < 0) {
-               CTX_DEBUG(cgroup->ctx, "Could not write to %s/%s: %m\n",
+               DEBUG(cgroup->ctx, "Could not write to %s/%s: %m\n",
                        pakfire_cgroup_name(cgroup), path);
                r = 1;
        }
@@ -450,7 +450,7 @@ static int pakfire_cgroup_read_controllers(
        char* token = strtok_r(buffer, " \n", &p);
 
        while (token) {
-               CTX_DEBUG(cgroup->ctx, "Found controller '%s'\n", token);
+               DEBUG(cgroup->ctx, "Found controller '%s'\n", token);
 
                // Try finding this controller
                int controller = pakfire_cgroup_find_controller_by_name(token);
@@ -490,7 +490,7 @@ static int pakfire_cgroup_enable_controllers(struct pakfire_cgroup* cgroup,
        // Find all enabled controllers
        const int enabled_controllers = pakfire_cgroup_enabled_controllers(cgroup);
        if (enabled_controllers < 0) {
-               CTX_ERROR(cgroup->ctx, "Could not fetch enabled controllers: %m\n");
+               ERROR(cgroup->ctx, "Could not fetch enabled controllers: %m\n");
                goto ERROR;
        }
 
@@ -499,20 +499,20 @@ static int pakfire_cgroup_enable_controllers(struct pakfire_cgroup* cgroup,
 
        // Exit if everything is already enabled
        if (!controllers) {
-               CTX_DEBUG(cgroup->ctx, "All controllers are already enabled\n");
+               DEBUG(cgroup->ctx, "All controllers are already enabled\n");
                return 0;
        }
 
        // Find all available controllers
        const int available_controllers = pakfire_cgroup_available_controllers(cgroup);
        if (available_controllers < 0) {
-               CTX_ERROR(cgroup->ctx, "Could not fetch available controllers: %m\n");
+               ERROR(cgroup->ctx, "Could not fetch available controllers: %m\n");
                goto ERROR;
        }
 
        // Are all controllers we need available, yet?
        if (controllers & ~available_controllers) {
-               CTX_DEBUG(cgroup->ctx, "Not all controllers are available, yet\n");
+               DEBUG(cgroup->ctx, "Not all controllers are available, yet\n");
 
                parent = pakfire_cgroup_parent(cgroup);
 
@@ -536,13 +536,13 @@ static int pakfire_cgroup_enable_controllers(struct pakfire_cgroup* cgroup,
                // Fetch name
                const char* name = pakfire_cgroup_controller_name(controller);
 
-               CTX_DEBUG(cgroup->ctx, "Enabling controller %s in cgroup %s\n",
+               DEBUG(cgroup->ctx, "Enabling controller %s in cgroup %s\n",
                        name, pakfire_cgroup_name(cgroup));
 
                // Try enabling the controller (this will succeed if it already is enabled)
                r = pakfire_cgroup_write(cgroup, "cgroup.subtree_control", "+%s\n", name);
                if (r) {
-                       CTX_ERROR(cgroup->ctx, "Could not enable controller %s in cgroup %s\n",
+                       ERROR(cgroup->ctx, "Could not enable controller %s in cgroup %s\n",
                                name, pakfire_cgroup_name(cgroup));
                        goto ERROR;
                }
@@ -575,7 +575,7 @@ int pakfire_cgroup_open(struct pakfire_cgroup** cgroup,
        if (!c)
                return 1;
 
-       CTX_DEBUG(ctx, "Allocated cgroup %s at %p\n", path, c);
+       DEBUG(ctx, "Allocated cgroup %s at %p\n", path, c);
 
        // Store a reference to the context
        c->ctx = pakfire_ctx_ref(ctx);
@@ -702,11 +702,11 @@ static int pakfire_cgroup_procs_callback(struct pakfire_cgroup* cgroup,
 }
 
 static int send_sigkill(struct pakfire_cgroup* cgroup, const pid_t pid, void* data) {
-       CTX_DEBUG(cgroup->ctx, "Sending signal SIGKILL to PID %d\n", pid);
+       DEBUG(cgroup->ctx, "Sending signal SIGKILL to PID %d\n", pid);
 
        int r = kill(pid, SIGKILL);
        if (r < 0 && errno != ESRCH) {
-               CTX_ERROR(cgroup->ctx, "Could not send signal SIGKILL to PID %d: %m\n", pid);
+               ERROR(cgroup->ctx, "Could not send signal SIGKILL to PID %d: %m\n", pid);
                return r;
        }
 
@@ -717,7 +717,7 @@ static int send_sigkill(struct pakfire_cgroup* cgroup, const pid_t pid, void* da
        Immediately kills all processes in this cgroup
 */
 static int pakfire_cgroup_killall(struct pakfire_cgroup* cgroup) {
-       CTX_DEBUG(cgroup->ctx, "%s: Killing all processes\n", pakfire_cgroup_name(cgroup));
+       DEBUG(cgroup->ctx, "%s: Killing all processes\n", pakfire_cgroup_name(cgroup));
 
        // Do we have support for cgroup.kill?
        int r = pakfire_cgroup_access(cgroup, "cgroup.kill", F_OK, 0);
@@ -742,7 +742,7 @@ int pakfire_cgroup_destroy(struct pakfire_cgroup* cgroup) {
                return 1;
        }
 
-       CTX_DEBUG(cgroup->ctx, "Destroying cgroup %s\n", pakfire_cgroup_name(cgroup));
+       DEBUG(cgroup->ctx, "Destroying cgroup %s\n", pakfire_cgroup_name(cgroup));
 
        // Kill everything in this group
        r = pakfire_cgroup_killall(cgroup);
@@ -763,7 +763,7 @@ int pakfire_cgroup_destroy(struct pakfire_cgroup* cgroup) {
        // Delete the directory
        r = unlinkat(fd, cgroup->path, AT_REMOVEDIR);
        if (r)
-               CTX_ERROR(cgroup->ctx, "Could not destroy cgroup: %m\n");
+               ERROR(cgroup->ctx, "Could not destroy cgroup: %m\n");
 
        // Close fd
        close(fd);
@@ -785,13 +785,13 @@ int pakfire_cgroup_set_guaranteed_memory(struct pakfire_cgroup* cgroup, size_t m
        if (r)
                return r;
 
-       CTX_DEBUG(cgroup->ctx, "%s: Setting guaranteed memory to %zu byte(s)\n",
+       DEBUG(cgroup->ctx, "%s: Setting guaranteed memory to %zu byte(s)\n",
                pakfire_cgroup_name(cgroup), mem);
 
        // Set value
        r = pakfire_cgroup_write(cgroup, "memory.min", "%zu\n", mem);
        if (r)
-               CTX_ERROR(cgroup->ctx, "%s: Could not set guaranteed memory: %m\n",
+               ERROR(cgroup->ctx, "%s: Could not set guaranteed memory: %m\n",
                        pakfire_cgroup_name(cgroup));
 
        return r;
@@ -805,13 +805,13 @@ int pakfire_cgroup_set_memory_limit(struct pakfire_cgroup* cgroup, size_t mem) {
        if (r)
                return r;
 
-       CTX_DEBUG(cgroup->ctx, "%s: Setting memory limit to %zu byte(s)\n",
+       DEBUG(cgroup->ctx, "%s: Setting memory limit to %zu byte(s)\n",
                pakfire_cgroup_name(cgroup), mem);
 
        // Set value
        r = pakfire_cgroup_write(cgroup, "memory.max", "%zu\n", mem);
        if (r)
-               CTX_ERROR(cgroup->ctx, "%s: Could not set memory limit: %m\n",
+               ERROR(cgroup->ctx, "%s: Could not set memory limit: %m\n",
                        pakfire_cgroup_name(cgroup));
 
        return r;
@@ -827,13 +827,13 @@ int pakfire_cgroup_set_pid_limit(struct pakfire_cgroup* cgroup, size_t limit) {
        if (r)
                return r;
 
-       CTX_DEBUG(cgroup->ctx, "%s: Setting PID limit to %zu\n",
+       DEBUG(cgroup->ctx, "%s: Setting PID limit to %zu\n",
                pakfire_cgroup_name(cgroup), limit);
 
        // Set value
        r = pakfire_cgroup_write(cgroup, "pids.max", "%zu\n", limit);
        if (r)
-               CTX_ERROR(cgroup->ctx, "%s: Could not set PID limit: %m\n",
+               ERROR(cgroup->ctx, "%s: Could not set PID limit: %m\n",
                        pakfire_cgroup_name(cgroup));
 
        return r;
@@ -868,7 +868,7 @@ static int __pakfire_cgroup_read_stats_line(struct pakfire_cgroup* cgroup,
 
                        // Ignore the rest
                        default:
-                               CTX_DEBUG(cgroup->ctx, "%s: Unknown value in cgroup stats (%d): %s\n",
+                               DEBUG(cgroup->ctx, "%s: Unknown value in cgroup stats (%d): %s\n",
                                        pakfire_cgroup_name(cgroup), i, elem);
                                break;
                }
@@ -878,7 +878,7 @@ static int __pakfire_cgroup_read_stats_line(struct pakfire_cgroup* cgroup,
 
        // Check if we parsed both fields
        if (i < 2) {
-               CTX_ERROR(cgroup->ctx, "Could not parse line\n");
+               ERROR(cgroup->ctx, "Could not parse line\n");
                return 1;
        }
 
@@ -894,7 +894,7 @@ static int __pakfire_cgroup_read_stats(struct pakfire_cgroup* cgroup, const char
 
        char buffer[BUFFER_SIZE];
 
-       CTX_DEBUG(cgroup->ctx, "%s: Reading stats from %s\n", pakfire_cgroup_name(cgroup), path);
+       DEBUG(cgroup->ctx, "%s: Reading stats from %s\n", pakfire_cgroup_name(cgroup), path);
 
        // Open the file
        r = pakfire_cgroup_read(cgroup, path, buffer, sizeof(buffer));
@@ -944,7 +944,7 @@ static int __pakfire_cgroup_parse_cpu_stats(struct pakfire_cgroup* cgroup,
                }
        }
 
-       CTX_DEBUG(cgroup->ctx, "Unknown key for CPU stats: %s = %lu\n", key, val);
+       DEBUG(cgroup->ctx, "Unknown key for CPU stats: %s = %lu\n", key, val);
 
        return 0;
 }
@@ -1015,7 +1015,7 @@ static int __pakfire_cgroup_parse_memory_stats(struct pakfire_cgroup* cgroup,
        }
 
        // Log any unknown keys
-       CTX_DEBUG(cgroup->ctx, "Unknown key for memory stats: %s = %lu\n", key, val);
+       DEBUG(cgroup->ctx, "Unknown key for memory stats: %s = %lu\n", key, val);
 
        return 0;
 }
@@ -1044,7 +1044,7 @@ int pakfire_cgroup_stat(struct pakfire_cgroup* cgroup,
 
 ERROR:
        if (r)
-               CTX_ERROR(cgroup->ctx, "%s: Could not read cgroup stats: %m\n",
+               ERROR(cgroup->ctx, "%s: Could not read cgroup stats: %m\n",
                        pakfire_cgroup_name(cgroup));
 
        return r;
@@ -1058,7 +1058,7 @@ int pakfire_cgroup_stat_dump(struct pakfire_cgroup* cgroup,
                return 1;
        }
 
-       CTX_DEBUG(cgroup->ctx, "%s: Total CPU time usage: %lu\n",
+       DEBUG(cgroup->ctx, "%s: Total CPU time usage: %lu\n",
                pakfire_cgroup_name(cgroup), stats->cpu.usage_usec);
 
        return 0;
index fb06916e5043093844b7d275557ad3a0152b60a4..22f6144b6109efc41950ca37636faea76357e08c 100644 (file)
@@ -566,14 +566,14 @@ static int pakfire_copy_data_from_file(struct pakfire_ctx* ctx,
 
                // Check if any error occured
                if (ferror(f)) {
-                       CTX_ERROR(ctx, "Read error: %m\n");
+                       ERROR(ctx, "Read error: %m\n");
                        return -errno;
                }
 
                // Write the block to the archive
                bytes_written = archive_write_data(archive, buffer, bytes_read);
                if (bytes_written < bytes_read) {
-                       CTX_ERROR(ctx, "Write error: %s\n", archive_error_string(archive));
+                       ERROR(ctx, "Write error: %s\n", archive_error_string(archive));
                        return -errno;
                }
        }
@@ -597,7 +597,7 @@ static int __pakfire_compress_entry(struct pakfire_ctx* ctx, struct pakfire_file
        // Write the header
        r = archive_write_header(data->archive, entry);
        if (r) {
-               CTX_ERROR(data->ctx, "Error writing file header: %s\n",
+               ERROR(data->ctx, "Error writing file header: %s\n",
                        archive_error_string(data->archive));
                goto ERROR;
        }
@@ -747,7 +747,7 @@ int pakfire_compress(struct pakfire* pakfire, struct archive* archive,
        // Setup the link resolver
        data.linkresolver = archive_entry_linkresolver_new();
        if (!data.linkresolver) {
-               CTX_ERROR(ctx, "Could not setup link resolver: m\n");
+               ERROR(ctx, "Could not setup link resolver: m\n");
                goto ERROR;
        }
 
@@ -785,7 +785,7 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
        // Open a new archive
        a = archive_write_new();
        if (!a) {
-               CTX_ERROR(ctx, "archive_write_new() failed\n");
+               ERROR(ctx, "archive_write_new() failed\n");
                r = 1;
                goto ERROR;
        }
@@ -793,14 +793,14 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
        // Use the PAX format
        r = archive_write_set_format_pax(a);
        if (r) {
-               CTX_ERROR(ctx, "Could not set format to PAX: %s\n", archive_error_string(a));
+               ERROR(ctx, "Could not set format to PAX: %s\n", archive_error_string(a));
                goto ERROR;
        }
 
        // Store any extended attributes in the SCHILY headers
        r = archive_write_set_format_option(a, "pax", "xattrheader", "SCHILY");
        if (r) {
-               CTX_ERROR(ctx, "Could not set xattrheader option: %s\n", archive_error_string(a));
+               ERROR(ctx, "Could not set xattrheader option: %s\n", archive_error_string(a));
                goto ERROR;
        }
 
@@ -809,7 +809,7 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
                        // Enable Zstd
                        r = archive_write_add_filter_zstd(a);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not enable Zstandard compression: %s\n",
+                               ERROR(ctx, "Could not enable Zstandard compression: %s\n",
                                        archive_error_string(a));
                                goto ERROR;
                        }
@@ -825,7 +825,7 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
 
                                r = archive_write_set_filter_option(a, NULL, "compression-level", value);
                                if (r) {
-                                       CTX_ERROR(ctx, "Could not set Zstandard compression level: %s\n",
+                                       ERROR(ctx, "Could not set Zstandard compression level: %s\n",
                                                archive_error_string(a));
                                        goto ERROR;
                                }
@@ -838,14 +838,14 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
                        if (processors > 1) {
                                r = pakfire_string_format(value, "%ld", processors);
                                if (r) {
-                                       CTX_ERROR(ctx, "Could not format threads: %m\n");
+                                       ERROR(ctx, "Could not format threads: %m\n");
                                        goto ERROR;
                                }
 
                                // Try using multiple threads
                                r = archive_write_set_filter_option(a, NULL, "threads", value);
                                if (r) {
-                                       CTX_ERROR(ctx, "Could not enable %ld threads for compression: %s\n",
+                                       ERROR(ctx, "Could not enable %ld threads for compression: %s\n",
                                                processors, archive_error_string(a));
                                        goto ERROR;
                                }
@@ -857,7 +857,7 @@ int pakfire_compress_create_archive(struct pakfire* pakfire, struct archive** ar
        if (f) {
                r = archive_write_open_FILE(a, f);
                if (r) {
-                       CTX_ERROR(ctx, "archive_write_open_FILE() failed: %s\n", archive_error_string(a));
+                       ERROR(ctx, "archive_write_open_FILE() failed: %s\n", archive_error_string(a));
                        goto ERROR;
                }
        }
index 554c28e9aa899e4ef7d33fd8b741a140408e73f6..b5ca1e9ea3cad0da2fc9b5cb723b73bad497b82f 100644 (file)
@@ -132,7 +132,7 @@ static int pakfire_ctx_setup_logging(struct pakfire_ctx* ctx) {
 static int pakfire_ctx_default_confirm_callback(struct pakfire_ctx* ctx,
                struct pakfire* pakfire, void* data, const char* message, const char* question) {
        // Just log the message
-       CTX_INFO(ctx, "%s\n", message);
+       INFO(ctx, "%s\n", message);
 
        return 0;
 }
@@ -397,14 +397,14 @@ CURLSH* pakfire_ctx_curl_share(struct pakfire_ctx* ctx) {
        if (!ctx->share) {
                ctx->share = curl_share_init();
                if (!ctx->share) {
-                       CTX_ERROR(ctx, "Could not setup cURL share handle\n");
+                       ERROR(ctx, "Could not setup cURL share handle\n");
                        goto ERROR;
                }
 
                // Share connections between handles
                r = curl_share_setopt(ctx->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
                if (r) {
-                       CTX_ERROR(ctx, "Could not configure the share handle: %s\n", curl_share_strerror(r));
+                       ERROR(ctx, "Could not configure the share handle: %s\n", curl_share_strerror(r));
                        goto ERROR;
                }
        }
@@ -430,14 +430,14 @@ magic_t pakfire_ctx_magic(struct pakfire_ctx* ctx) {
                // Allocate a new context
                ctx->magic = magic_open(MAGIC_MIME_TYPE | MAGIC_ERROR | MAGIC_NO_CHECK_TOKENS);
                if (!ctx->magic) {
-                       CTX_ERROR(ctx, "Could not allocate magic context: %m\n");
+                       ERROR(ctx, "Could not allocate magic context: %m\n");
                        return NULL;
                }
 
                // Load the database
                r = magic_load(ctx->magic, NULL);
                if (r) {
-                       CTX_ERROR(ctx, "Could not open the magic database: %s\n", magic_error(ctx->magic));
+                       ERROR(ctx, "Could not open the magic database: %s\n", magic_error(ctx->magic));
                        goto ERROR;
                }
        }
index 4ddda48e6f72748d3d6d75609a2911c224f87503..5488b9c92829f7780f76bfbbfd40f59faf010daa 100644 (file)
@@ -88,7 +88,7 @@ static int pakfire_daemon_terminate(sd_event_source* source,
                const struct signalfd_siginfo* si, void* data) {
        struct pakfire_daemon* daemon = data;
 
-       CTX_DEBUG(daemon->ctx, "Received signal to terminate...\n");
+       DEBUG(daemon->ctx, "Received signal to terminate...\n");
 
        // Terminate all jobs
        pakfire_daemon_terminate_jobs(daemon);
@@ -115,17 +115,17 @@ static int pakfire_daemon_submit_stats(sd_event_source* s, uint64_t usec, void*
        // Reset the timer
        r = sd_event_source_set_time_relative(daemon->stats_timer, next);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not set the stat timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not set the stat timer: %s\n", strerror(-r));
                return r;
        }
 
        // Don't do anything if we don't have a control connection
        if (!daemon->control) {
-               CTX_DEBUG(daemon->ctx, "Won't send stats without a control connection\n");
+               DEBUG(daemon->ctx, "Won't send stats without a control connection\n");
                return 0;
        }
 
-       CTX_DEBUG(daemon->ctx, "Submitting stats...\n");
+       DEBUG(daemon->ctx, "Submitting stats...\n");
 
        // Fetch the distro
        const struct pakfire_distro* distro = pakfire_ctx_get_distro(daemon->ctx);
@@ -133,35 +133,35 @@ static int pakfire_daemon_submit_stats(sd_event_source* s, uint64_t usec, void*
        // Fetch CPU info
        r = pakfire_cpuinfo(&cpuinfo);
        if (r) {
-               CTX_ERROR(daemon->ctx, "Failed to fetch CPU info: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Failed to fetch CPU info: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Fetch CPU stats
        r = pakfire_cpustat(&cpustat);
        if (r) {
-               CTX_ERROR(daemon->ctx, "Failed to fetch CPU stats: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Failed to fetch CPU stats: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Fetch load average
        r = pakfire_loadavg(&loadavg);
        if (r) {
-               CTX_ERROR(daemon->ctx, "Failed to fetch load average: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Failed to fetch load average: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Fetch meminfo
        r = pakfire_meminfo(&meminfo);
        if (r) {
-               CTX_ERROR(daemon->ctx, "Failed to fetch meminfo: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Failed to fetch meminfo: %s\n", strerror(-r));
                goto ERROR;
        }
 
        // Fetch native arch
        arch = pakfire_arch_native();
        if (!arch) {
-               CTX_ERROR(daemon->ctx, "Failed to fetch native arch: %s\n", strerror(errno));
+               ERROR(daemon->ctx, "Failed to fetch native arch: %s\n", strerror(errno));
                r = -errno;
                goto ERROR;
        }
@@ -367,7 +367,7 @@ static int pakfire_daemon_job(struct pakfire_daemon* daemon, json_object* m) {
 
        // Fetch the data from the message
        if (!json_object_object_get_ex(m, "data", &data)) {
-               CTX_ERROR(daemon->ctx, "Job does not have any data\n");
+               ERROR(daemon->ctx, "Job does not have any data\n");
 
                return -EINVAL;
        }
@@ -375,7 +375,7 @@ static int pakfire_daemon_job(struct pakfire_daemon* daemon, json_object* m) {
        // Create a new job
        r = pakfire_job_create(&job, daemon->ctx, daemon, data);
        if (r) {
-               CTX_ERROR(daemon->ctx, "Could not create a new job: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not create a new job: %s\n", strerror(-r));
 
                goto ERROR;
        }
@@ -419,7 +419,7 @@ static int pakfire_daemon_recv(struct pakfire_xfer* xfer,
 
        // Fetch the message type
        if (!json_object_object_get_ex(m, "type", &type)) {
-               CTX_ERROR(daemon->ctx, "Invalid message with missing type\n");
+               ERROR(daemon->ctx, "Invalid message with missing type\n");
 
                return -EINVAL;
        }
@@ -432,7 +432,7 @@ static int pakfire_daemon_recv(struct pakfire_xfer* xfer,
                r = pakfire_daemon_job(daemon, m);
 
        } else {
-               CTX_ERROR(daemon->ctx, "Unknown message. Ignoring:\n%s\n",
+               ERROR(daemon->ctx, "Unknown message. Ignoring:\n%s\n",
                        json_object_to_json_string_ext(m, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY));
 
                r = 0;
@@ -459,20 +459,20 @@ static int pakfire_daemon_close(struct pakfire_xfer* xfer, int code, void* data)
                daemon->control = NULL;
        }
 
-       CTX_INFO(daemon->ctx, "Will attempt to reconnect in %u second(s)\n",
+       INFO(daemon->ctx, "Will attempt to reconnect in %u second(s)\n",
                daemon->reconnect_holdoff / 1000000);
 
        // Set the reconnection timer
        r = sd_event_source_set_time_relative(daemon->connect_timer, daemon->reconnect_holdoff);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not set the reconnection timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not set the reconnection timer: %s\n", strerror(-r));
                return r;
        }
 
        // Activate the timer
        r = sd_event_source_set_enabled(daemon->connect_timer, SD_EVENT_ONESHOT);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not activate the connect timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not activate the connect timer: %s\n", strerror(-r));
                return r;
        }
 
@@ -528,7 +528,7 @@ static int pakfire_daemon_connected(struct pakfire_xfer* xfer, void* data) {
        struct pakfire_daemon* daemon = data;
        int r;
 
-       CTX_DEBUG(daemon->ctx, "Connected!\n");
+       DEBUG(daemon->ctx, "Connected!\n");
 
        // Store a reference to the control connection
        daemon->control = pakfire_xfer_ref(xfer);
@@ -537,14 +537,14 @@ static int pakfire_daemon_connected(struct pakfire_xfer* xfer, void* data) {
        r = sd_event_add_time_relative(daemon->loop, &daemon->stats_timer,
                CLOCK_MONOTONIC, 0, 0, pakfire_daemon_submit_stats, daemon);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not register the stat timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not register the stat timer: %s\n", strerror(-r));
                return r;
        }
 
        // Submit stats continuously
        r = sd_event_source_set_enabled(daemon->stats_timer, SD_EVENT_ON);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not activate the stat timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not activate the stat timer: %s\n", strerror(-r));
                return r;
        }
 
@@ -556,7 +556,7 @@ static int pakfire_daemon_connect(sd_event_source* s, uint64_t usec, void* data)
        struct pakfire_xfer* xfer = NULL;
        int r;
 
-       CTX_INFO(daemon->ctx, "Connecting...\n");
+       INFO(daemon->ctx, "Connecting...\n");
 
        // Create a new xfer
        r = pakfire_daemon_xfer_create(&xfer, daemon, "/api/v1/builders/control");
@@ -599,14 +599,14 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
        // Fetch a reference to the default event loop
        r = sd_event_default(&daemon->loop);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not setup event loop: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not setup event loop: %s\n", strerror(-r));
                return r;
        }
 
        // Enable the watchdog
        r = sd_event_set_watchdog(daemon->loop, 1);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not activate watchdog: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not activate watchdog: %s\n", strerror(-r));
                return r;
        }
 
@@ -614,7 +614,7 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
        r = sd_event_add_signal(daemon->loop, NULL, SIGTERM|SD_EVENT_SIGNAL_PROCMASK,
                pakfire_daemon_terminate, daemon);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not register handling SIGTERM: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not register handling SIGTERM: %s\n", strerror(-r));
                return r;
        }
 
@@ -622,7 +622,7 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
        r = sd_event_add_signal(daemon->loop, NULL, SIGINT|SD_EVENT_SIGNAL_PROCMASK,
                pakfire_daemon_terminate, daemon);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not register handling SIGINT: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not register handling SIGINT: %s\n", strerror(-r));
                return r;
        }
 
@@ -630,7 +630,7 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
        r = sd_event_add_signal(daemon->loop, NULL, SIGCHLD|SD_EVENT_SIGNAL_PROCMASK,
                pakfire_daemon_SIGCHLD, daemon);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not register handling SIGCHLD: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not register handling SIGCHLD: %s\n", strerror(-r));
                return r;
        }
 
@@ -638,7 +638,7 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
        r = sd_event_add_time_relative(daemon->loop, &daemon->connect_timer,
                CLOCK_MONOTONIC, 0, 0, pakfire_daemon_connect, daemon);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not register the connection timer: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not register the connection timer: %s\n", strerror(-r));
                return r;
        }
 
@@ -653,7 +653,7 @@ static int pakfire_daemon_configure(struct pakfire_daemon* daemon) {
        // Fetch the configuration
        config = pakfire_ctx_get_config(daemon->ctx);
        if (!config) {
-               CTX_ERROR(daemon->ctx, "Could not fetch configuration: %m\n");
+               ERROR(daemon->ctx, "Could not fetch configuration: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -769,7 +769,7 @@ int pakfire_daemon_main(struct pakfire_daemon* daemon) {
        // Launch the event loop
        r = sd_event_loop(daemon->loop);
        if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not run the event loop: %s\n", strerror(-r));
+               ERROR(daemon->ctx, "Could not run the event loop: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -788,7 +788,7 @@ ERROR:
        Called after a job has exited
 */
 int pakfire_daemon_job_finished(struct pakfire_daemon* daemon, struct pakfire_job* job) {
-       CTX_DEBUG(daemon->ctx, "Removing job %p\n", job);
+       DEBUG(daemon->ctx, "Removing job %p\n", job);
 
        for (unsigned int i = 0; i < MAX_JOBS; i++) {
                if (daemon->jobs[i] != job)
index a68e53a76a990c9ec1c003ada69ab368be2ccb33..03cb1b681d4daef8c37abc94c07c6db1130ffd6c 100644 (file)
@@ -62,7 +62,7 @@ struct pakfire_db {
 static void logging_callback(void* data, int r, const char* msg) {
        struct pakfire_ctx* ctx = data;
 
-       CTX_ERROR(ctx, "Database Error: %s: %s\n",
+       ERROR(ctx, "Database Error: %s: %s\n",
                sqlite3_errstr(r), msg);
 }
 
@@ -75,7 +75,7 @@ static int pakfire_db_check_table(struct pakfire_db* db, const char* table) {
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -83,14 +83,14 @@ static int pakfire_db_check_table(struct pakfire_db* db, const char* table) {
        // Bind type
        r = sqlite3_bind_text(stmt, 1, "table", -1, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Bind name
        r = sqlite3_bind_text(stmt, 2, table, -1, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind name: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind name: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -130,7 +130,7 @@ static sqlite3_value* pakfire_db_get(struct pakfire_db* db, const char* key) {
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r != SQLITE_OK) {
-               //CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               //ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                //      sql, sqlite3_errmsg(db->handle));
                return NULL;
        }
@@ -138,7 +138,7 @@ static sqlite3_value* pakfire_db_get(struct pakfire_db* db, const char* key) {
        // Bind key
        r = sqlite3_bind_text(stmt, 1, key, strlen(key), NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -154,7 +154,7 @@ static sqlite3_value* pakfire_db_get(struct pakfire_db* db, const char* key) {
        // Read value
        val = sqlite3_column_value(stmt, 0);
        if (!val) {
-               CTX_ERROR(db->ctx, "Could not read value\n");
+               ERROR(db->ctx, "Could not read value\n");
                goto ERROR;
        }
 
@@ -195,7 +195,7 @@ static int pakfire_db_set_string(struct pakfire_db* db, const char* key, const c
        sqlite3_stmt* stmt = NULL;
        int r;
 
-       CTX_DEBUG(db->ctx, "Setting %s to '%s'\n", key, val);
+       DEBUG(db->ctx, "Setting %s to '%s'\n", key, val);
 
        const char* sql = "INSERT INTO settings(key, val) VALUES(?, ?) \
                ON CONFLICT (key) DO UPDATE SET val = excluded.val";
@@ -203,7 +203,7 @@ static int pakfire_db_set_string(struct pakfire_db* db, const char* key, const c
        // Prepare statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -211,14 +211,14 @@ static int pakfire_db_set_string(struct pakfire_db* db, const char* key, const c
        // Bind key
        r = sqlite3_bind_text(stmt, 1, key, strlen(key), NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Bind val
        r = sqlite3_bind_text(stmt, 2, val, strlen(val), NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind val: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind val: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -241,7 +241,7 @@ static int pakfire_db_set_int(struct pakfire_db* db, const char* key, int val) {
        sqlite3_stmt* stmt = NULL;
        int r;
 
-       CTX_DEBUG(db->ctx, "Setting %s to '%d'\n", key, val);
+       DEBUG(db->ctx, "Setting %s to '%d'\n", key, val);
 
        const char* sql = "INSERT INTO settings(key, val) VALUES(?, ?) \
                ON CONFLICT (key) DO UPDATE SET val = excluded.val";
@@ -249,7 +249,7 @@ static int pakfire_db_set_int(struct pakfire_db* db, const char* key, int val) {
        // Prepare statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -257,14 +257,14 @@ static int pakfire_db_set_int(struct pakfire_db* db, const char* key, int val) {
        // Bind key
        r = sqlite3_bind_text(stmt, 1, key, strlen(key), NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind key: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Bind val
        r = sqlite3_bind_int64(stmt, 2, val);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not bind val: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind val: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -292,7 +292,7 @@ static time_t pakfire_read_modification_time(struct pakfire_db* db) {
                t = sqlite3_value_int64(value);
                sqlite3_value_free(value);
        } else {
-               CTX_DEBUG(db->ctx, "Could not find last modification timestamp\n");
+               DEBUG(db->ctx, "Could not find last modification timestamp\n");
        }
 
        return t;
@@ -316,7 +316,7 @@ static int pakfire_update_modification_time(struct pakfire_db* db) {
 static int pakfire_db_execute(struct pakfire_db* db, const char* stmt) {
        int r;
 
-       CTX_DEBUG(db->ctx, "Executing database query: %s\n", stmt);
+       DEBUG(db->ctx, "Executing database query: %s\n", stmt);
 
        do {
                r = sqlite3_exec(db->handle, stmt, NULL, NULL, NULL);
@@ -324,7 +324,7 @@ static int pakfire_db_execute(struct pakfire_db* db, const char* stmt) {
 
        // Log any errors
        if (r) {
-               CTX_ERROR(db->ctx, "Database query failed: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Database query failed: %s\n", sqlite3_errmsg(db->handle));
        }
 
        return r;
@@ -370,7 +370,7 @@ static void pakfire_db_free(struct pakfire_db* db) {
                // Close database handle
                int r = sqlite3_close(db->handle);
                if (r != SQLITE_OK) {
-                       CTX_ERROR(db->ctx, "Could not close database handle: %s\n",
+                       ERROR(db->ctx, "Could not close database handle: %s\n",
                                sqlite3_errmsg(db->handle));
                }
        }
@@ -391,7 +391,7 @@ static int pakfire_db_get_schema(struct pakfire_db* db) {
        int schema = sqlite3_value_int64(value);
        sqlite3_value_free(value);
 
-       CTX_DEBUG(db->ctx, "Database has schema version %d\n", schema);
+       DEBUG(db->ctx, "Database has schema version %d\n", schema);
 
        return schema;
 }
@@ -525,7 +525,7 @@ static int pakfire_db_create_schema(struct pakfire_db* db) {
        // Set architecture
        r = pakfire_db_set_string(db, "arch", arch);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not set architecture\n");
+               ERROR(db->ctx, "Could not set architecture\n");
                return r;
        }
 
@@ -570,7 +570,7 @@ static int pakfire_db_migrate_schema(struct pakfire_db* db) {
                                break;
 
                        default:
-                               CTX_ERROR(db->ctx, "Cannot migrate database from schema %d\n", db->schema);
+                               ERROR(db->ctx, "Cannot migrate database from schema %d\n", db->schema);
                                goto ROLLBACK;
                }
 
@@ -599,7 +599,7 @@ static int pakfire_db_check_arch(struct pakfire_db* db) {
        // Fetch database architecture
        char* db_arch = pakfire_db_get_string(db, "arch");
        if (!db_arch) {
-               CTX_ERROR(db->ctx, "Database is of an unknown architecture\n");
+               ERROR(db->ctx, "Database is of an unknown architecture\n");
                goto ERROR;
        }
 
@@ -636,7 +636,7 @@ static int pakfire_db_setup(struct pakfire_db* db) {
 
        // Check if the schema is recent enough
        if (db->schema && db->schema < SCHEMA_MIN_SUP) {
-               CTX_ERROR(db->ctx, "Database schema %d is not supported by this version of Pakfire\n",
+               ERROR(db->ctx, "Database schema %d is not supported by this version of Pakfire\n",
                        db->schema);
                return 1;
        }
@@ -644,7 +644,7 @@ static int pakfire_db_setup(struct pakfire_db* db) {
        // Read modification timestamp
        db->last_modified_at = pakfire_read_modification_time(db);
 
-       CTX_DEBUG(db->ctx, "The database was last modified at %ld\n", db->last_modified_at);
+       DEBUG(db->ctx, "The database was last modified at %ld\n", db->last_modified_at);
 
        // Done when not in read-write mode
        if (db->mode != PAKFIRE_DB_READWRITE)
@@ -656,7 +656,7 @@ static int pakfire_db_setup(struct pakfire_db* db) {
        // Set database journal to WAL
        r = pakfire_db_execute(db, "PRAGMA journal_mode = WAL");
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not set journal mode to WAL: %s\n",
+               ERROR(db->ctx, "Could not set journal mode to WAL: %s\n",
                        sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -664,7 +664,7 @@ static int pakfire_db_setup(struct pakfire_db* db) {
        // Disable autocheckpoint
        r = sqlite3_wal_autocheckpoint(db->handle, 0);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not disable autocheckpoint: %s\n",
+               ERROR(db->ctx, "Could not disable autocheckpoint: %s\n",
                        sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -714,7 +714,7 @@ int pakfire_db_open(struct pakfire_db** db, struct pakfire* pakfire, int flags)
        // Try to open the sqlite3 database file
        r = sqlite3_open_v2(o->path, &o->handle, sqlite3_flags, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(o->ctx, "Could not open database %s: %s\n",
+               ERROR(o->ctx, "Could not open database %s: %s\n",
                        o->path, sqlite3_errmsg(o->handle));
 
                r = 1;
@@ -762,7 +762,7 @@ static unsigned long pakfire_db_integrity_check(struct pakfire_db* db) {
 
        r = sqlite3_prepare_v2(db->handle, "PRAGMA integrity_check", -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare integrity check: %s\n",
+               ERROR(db->ctx, "Could not prepare integrity check: %s\n",
                        sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -786,7 +786,7 @@ static unsigned long pakfire_db_integrity_check(struct pakfire_db* db) {
                        errors++;
 
                        // Log the message
-                       CTX_ERROR(db->ctx, "%s\n", error);
+                       ERROR(db->ctx, "%s\n", error);
 
                // Break on anything else
                } else
@@ -796,9 +796,9 @@ static unsigned long pakfire_db_integrity_check(struct pakfire_db* db) {
        sqlite3_finalize(stmt);
 
        if (errors)
-               CTX_ERROR(db->ctx, "Database integrity check failed\n");
+               ERROR(db->ctx, "Database integrity check failed\n");
        else
-               CTX_INFO(db->ctx, "Database integrity check passed\n");
+               INFO(db->ctx, "Database integrity check passed\n");
 
        return errors;
 }
@@ -809,7 +809,7 @@ static unsigned long pakfire_db_foreign_key_check(struct pakfire_db* db) {
 
        r = sqlite3_prepare_v2(db->handle, "PRAGMA foreign_key_check", -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare foreign key check: %s\n",
+               ERROR(db->ctx, "Could not prepare foreign key check: %s\n",
                        sqlite3_errmsg(db->handle));
                return 1;
        }
@@ -832,7 +832,7 @@ static unsigned long pakfire_db_foreign_key_check(struct pakfire_db* db) {
                        errors++;
 
                        // Log the message
-                       CTX_ERROR(db->ctx, "Foreign key violation found in %s, row %lu: "
+                       ERROR(db->ctx, "Foreign key violation found in %s, row %lu: "
                                "%lu does not exist in table %s\n", table, rowid, foreign_rowid, foreign_table);
 
                // Break on anything else
@@ -843,9 +843,9 @@ static unsigned long pakfire_db_foreign_key_check(struct pakfire_db* db) {
        sqlite3_finalize(stmt);
 
        if (errors)
-               CTX_ERROR(db->ctx, "Foreign key check failed\n");
+               ERROR(db->ctx, "Foreign key check failed\n");
        else
-               CTX_INFO(db->ctx, "Foreign key check passed\n");
+               INFO(db->ctx, "Foreign key check passed\n");
 
        return errors;
 }
@@ -876,7 +876,7 @@ ssize_t pakfire_db_packages(struct pakfire_db* db) {
 
        int r = sqlite3_prepare_v2(db->handle, "SELECT COUNT(*) FROM packages", -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s\n",
                        sqlite3_errmsg(db->handle));
                return -1;
        }
@@ -915,7 +915,7 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id,
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto END;
        }
@@ -931,7 +931,7 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id,
                        // Bind package ID
                        r = sqlite3_bind_int64(stmt, 1, id);
                        if (r) {
-                               CTX_ERROR(db->ctx, "Could not bind id: %s\n",
+                               ERROR(db->ctx, "Could not bind id: %s\n",
                                        sqlite3_errmsg(db->handle));
                                goto END;
                        }
@@ -939,7 +939,7 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id,
                        // Bind type
                        r = sqlite3_bind_text(stmt, 2, dep->name, -1, NULL);
                        if (r) {
-                               CTX_ERROR(db->ctx, "Could not bind type: %s\n",
+                               ERROR(db->ctx, "Could not bind type: %s\n",
                                        sqlite3_errmsg(db->handle));
                                goto END;
                        }
@@ -947,7 +947,7 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id,
                        // Bind dependency
                        r = sqlite3_bind_text(stmt, 3, *d, -1, NULL);
                        if (r) {
-                               CTX_ERROR(db->ctx, "Could not bind dependency: %s\n",
+                               ERROR(db->ctx, "Could not bind dependency: %s\n",
                                        sqlite3_errmsg(db->handle));
                                goto END;
                        }
@@ -1000,7 +1000,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
        // Get the filelist from the archive
        struct pakfire_filelist* filelist = pakfire_archive_get_filelist(archive);
        if (!filelist) {
-               CTX_ERROR(db->ctx, "Could not fetch filelist from archive\n");
+               ERROR(db->ctx, "Could not fetch filelist from archive\n");
                return 1;
        }
 
@@ -1037,7 +1037,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto END;
        }
@@ -1048,7 +1048,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // Bind package ID
                r = sqlite3_bind_int64(stmt, 1, id);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind id: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind id: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1058,7 +1058,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_text(stmt, 2, path, -1, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind path: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind path: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1068,7 +1068,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_int64(stmt, 3, size);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind size: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind size: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1076,7 +1076,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // Bind config - XXX TODO
                r = sqlite3_bind_null(stmt, 4);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind config: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind config: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1084,7 +1084,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // Bind datafile - XXX TODO
                r = sqlite3_bind_null(stmt, 5);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind datafile: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind datafile: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1094,7 +1094,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_int64(stmt, 6, mode);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind mode: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind mode: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1104,7 +1104,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_text(stmt, 7, uname, -1, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind uname: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind uname: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1114,7 +1114,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_text(stmt, 8, gname, -1, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind gname: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind gname: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1124,7 +1124,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_int64(stmt, 9, ctime);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind ctime: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind ctime: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1134,7 +1134,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                r = sqlite3_bind_int64(stmt, 10, mtime);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind mtime: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind mtime: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1145,7 +1145,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                if (mimetype) {
                        r = sqlite3_bind_text(stmt, 11, mimetype, -1, NULL);
                        if (r) {
-                               CTX_ERROR(db->ctx, "Could not bind MIME type: %s\n",
+                               ERROR(db->ctx, "Could not bind MIME type: %s\n",
                                        sqlite3_errmsg(db->handle));
                                pakfire_file_unref(file);
                                goto END;
@@ -1153,7 +1153,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                } else {
                        r = sqlite3_bind_null(stmt, 11);
                        if (r) {
-                               CTX_ERROR(db->ctx, "Could not bind an empty MIME type: %s\n",
+                               ERROR(db->ctx, "Could not bind an empty MIME type: %s\n",
                                        sqlite3_errmsg(db->handle));
                                pakfire_file_unref(file);
                                goto END;
@@ -1163,7 +1163,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // Bind capabilities - XXX TODO
                r = sqlite3_bind_null(stmt, 12);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind capabilities: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind capabilities: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
                }
@@ -1171,7 +1171,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // SHA2-512 Digest
                r = pakfire_db_bind_digest(db, stmt, 13, file, PAKFIRE_DIGEST_SHA2_512);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind SHA2-512 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind SHA2-512 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1180,7 +1180,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // SHA2-256 Digest
                r = pakfire_db_bind_digest(db, stmt, 14, file, PAKFIRE_DIGEST_SHA2_256);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind SHA2-256 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind SHA2-256 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1189,7 +1189,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // BLAKE2b512 Digest
                r = pakfire_db_bind_digest(db, stmt, 15, file, PAKFIRE_DIGEST_BLAKE2B512);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind BLAKE2b512 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind BLAKE2b512 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1198,7 +1198,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // BLAKE2s256 Digest
                r = pakfire_db_bind_digest(db, stmt, 16, file, PAKFIRE_DIGEST_BLAKE2S256);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind BLAKE2s256 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind BLAKE2s256 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1207,7 +1207,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // SHA3-512 Digest
                r = pakfire_db_bind_digest(db, stmt, 17, file, PAKFIRE_DIGEST_SHA3_512);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind SHA3-512 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind SHA3-512 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1216,7 +1216,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
                // SHA3-256 Digest
                r = pakfire_db_bind_digest(db, stmt, 18, file, PAKFIRE_DIGEST_SHA3_256);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind SHA3-256 digest: %s\n",
+                       ERROR(db->ctx, "Could not bind SHA3-256 digest: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1229,7 +1229,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, struct
 
                // Check for errors
                if (r != SQLITE_DONE) {
-                       CTX_ERROR(db->ctx, "Could not add file to database: %s\n",
+                       ERROR(db->ctx, "Could not add file to database: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
                        goto END;
@@ -1263,7 +1263,7 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, st
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto END;
        }
@@ -1277,7 +1277,7 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, st
                // Bind package ID
                r = sqlite3_bind_int64(stmt, 1, id);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind id: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind id: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_scriptlet_unref(scriptlet);
                        goto END;
                }
@@ -1285,7 +1285,7 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, st
                // Bind handle
                r = sqlite3_bind_text(stmt, 2, *type, -1, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_scriptlet_unref(scriptlet);
                        goto END;
                }
@@ -1295,7 +1295,7 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, st
                // Bind scriptlet
                r = sqlite3_bind_text(stmt, 3, data, size, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind scriptlet: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind scriptlet: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_scriptlet_unref(scriptlet);
                        goto END;
                }
@@ -1307,7 +1307,7 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, st
 
                // Check for errors
                if (r != SQLITE_DONE) {
-                       CTX_ERROR(db->ctx, "Could not add scriptlet to database: %s\n",
+                       ERROR(db->ctx, "Could not add scriptlet to database: %s\n",
                                sqlite3_errmsg(db->handle));
                        pakfire_scriptlet_unref(scriptlet);
                        goto END;
@@ -1396,7 +1396,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r != SQLITE_OK) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s: %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -1406,7 +1406,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 1, name, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind name: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind name: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1415,7 +1415,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 2, evr, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind evr: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind evr: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1424,7 +1424,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 3, arch, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind arch: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind arch: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1440,7 +1440,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
                r = sqlite3_bind_text(stmt, 4, __groups, -1, NULL);
                if (r) {
-                       CTX_ERROR(db->ctx, "Could not bind groups: %s\n", sqlite3_errmsg(db->handle));
+                       ERROR(db->ctx, "Could not bind groups: %s\n", sqlite3_errmsg(db->handle));
                        goto ERROR;
                }
 
@@ -1456,7 +1456,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 5, filename, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind filename: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind filename: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1465,7 +1465,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_int64(stmt, 6, size);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind size: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind size: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1474,7 +1474,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_int64(stmt, 7, inst_size);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind inst_size: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind inst_size: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1485,7 +1485,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
        // Fetch the digest
        digest = pakfire_package_get_digest(pkg, &digest_type, &digest_length);
        if (!digest) {
-               CTX_ERROR(db->ctx, "Could not fetch the package's digest: %m\n");
+               ERROR(db->ctx, "Could not fetch the package's digest: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -1493,14 +1493,14 @@ int pakfire_db_add_package(struct pakfire_db* db,
        // Set the digest type
        r = sqlite3_bind_int64(stmt, 8, digest_type);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind digest type: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind digest type: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Set the digest
        r = sqlite3_bind_blob(stmt, 9, digest, digest_length, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind digest: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind digest: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1509,7 +1509,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 10, license, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind license: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind license: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1518,7 +1518,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 11, summary, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind summary: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind summary: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1527,7 +1527,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 12, description, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind description: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind description: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1536,7 +1536,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 13, uuid, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1545,7 +1545,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 14, vendor, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind vendor: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind vendor: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1554,7 +1554,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_text(stmt, 15, build_host, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind build_host: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind build_host: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1563,7 +1563,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
 
        r = sqlite3_bind_int64(stmt, 16, build_time);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind build_time: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind build_time: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1587,7 +1587,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
        // installed by the user?
        r = sqlite3_bind_int(stmt, 18, userinstalled);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind userinstalled: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind userinstalled: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1645,7 +1645,7 @@ int pakfire_db_add_package(struct pakfire_db* db,
        } while (r == SQLITE_BUSY);
 
        if (r != SQLITE_DONE) {
-               CTX_ERROR(db->ctx, "Could not add package to database: %s\n",
+               ERROR(db->ctx, "Could not add package to database: %s\n",
                        sqlite3_errmsg(db->handle));
                r = 1;
                goto ERROR;
@@ -1698,7 +1698,7 @@ int pakfire_db_remove_package(struct pakfire_db* db, struct pakfire_package* pkg
        // Fetch the package's UUID
        const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
        if (!uuid) {
-               CTX_ERROR(db->ctx, "Package has no UUID\n");
+               ERROR(db->ctx, "Package has no UUID\n");
                r = 1;
                goto ERROR;
        }
@@ -1706,7 +1706,7 @@ int pakfire_db_remove_package(struct pakfire_db* db, struct pakfire_package* pkg
        r = sqlite3_prepare_v2(db->handle,
                "DELETE FROM packages WHERE uuid = ?", -1, &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s\n",
                        sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -1714,7 +1714,7 @@ int pakfire_db_remove_package(struct pakfire_db* db, struct pakfire_package* pkg
        // Bind UUID
        r = sqlite3_bind_text(stmt, 1, uuid, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
@@ -1725,7 +1725,7 @@ int pakfire_db_remove_package(struct pakfire_db* db, struct pakfire_package* pkg
 
        // Check if we have been successful
        if (r != SQLITE_DONE) {
-               CTX_ERROR(db->ctx, "Could not delete package %s\n", uuid);
+               ERROR(db->ctx, "Could not delete package %s\n", uuid);
                r = 1;
                goto ERROR;
        }
@@ -1755,7 +1755,7 @@ struct pakfire_scriptlet* pakfire_db_get_scriptlet(struct pakfire_db* db,
        // Fetch the package's UUID
        const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
        if (!uuid) {
-               CTX_ERROR(db->ctx, "Package has no UUID\n");
+               ERROR(db->ctx, "Package has no UUID\n");
                goto ERROR;
        }
 
@@ -1765,7 +1765,7 @@ struct pakfire_scriptlet* pakfire_db_get_scriptlet(struct pakfire_db* db,
 
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -1773,17 +1773,17 @@ struct pakfire_scriptlet* pakfire_db_get_scriptlet(struct pakfire_db* db,
        // Bind UUID
        r = sqlite3_bind_text(stmt, 1, uuid, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind uuid: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        r = sqlite3_bind_text(stmt, 2, type, -1, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
-       CTX_DEBUG(db->ctx, "Searching for scriptlet for package %s of type %s\n", uuid, type);
+       DEBUG(db->ctx, "Searching for scriptlet for package %s of type %s\n", uuid, type);
 
        // Execute query
        do {
@@ -1815,28 +1815,28 @@ static int pakfire_db_load_package(struct pakfire_db* db, struct pakfire_repo* r
        // Name
        const char* name = (const char*)sqlite3_column_text(stmt, 0);
        if (!name) {
-               CTX_ERROR(db->ctx, "Could not read name: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not read name: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // EVR
        const char* evr = (const char*)sqlite3_column_text(stmt, 1);
        if (!evr) {
-               CTX_ERROR(db->ctx, "Could not read evr: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not read evr: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Arch
        const char* arch = (const char*)sqlite3_column_text(stmt, 2);
        if (!arch) {
-               CTX_ERROR(db->ctx, "Could not read arch: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not read arch: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
        // Create package
        r = pakfire_package_create(&pkg, db->pakfire, repo, name, evr, arch);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not create package '%s-%s.%s': %m\n", name, evr, arch);
+               ERROR(db->ctx, "Could not create package '%s-%s.%s': %m\n", name, evr, arch);
                goto ERROR;
        }
 
@@ -2042,7 +2042,7 @@ int pakfire_db_load(struct pakfire_db* db, struct pakfire_repo* repo) {
        sqlite3_stmt* stmt = NULL;
        int r = 1;
 
-       CTX_DEBUG(db->ctx, "Loading package database...\n");
+       DEBUG(db->ctx, "Loading package database...\n");
 
        // Drop contents of the repository
        pakfire_repo_clear(repo);
@@ -2122,7 +2122,7 @@ int pakfire_db_load(struct pakfire_db* db, struct pakfire_repo* repo) {
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -2157,7 +2157,7 @@ END:
        // Save time when we finished
        t_end = clock();
 
-       CTX_DEBUG(db->ctx, "Loading package database completed in %.4fms\n",
+       DEBUG(db->ctx, "Loading package database completed in %.4fms\n",
                (double)(t_end - t_start) * 1000 / CLOCKS_PER_SEC);
 
        // Mark repository as changed
@@ -2168,7 +2168,7 @@ END:
 
 ERROR:
        if (r) {
-               CTX_ERROR(db->ctx, "Failed reading package database: %m\n");
+               ERROR(db->ctx, "Failed reading package database: %m\n");
                pakfire_repo_clear(repo);
        }
 
@@ -2204,7 +2204,7 @@ static int pakfire_db_load_file(struct pakfire_db* db, struct pakfire_filelist*
 
        // Abort if no path is set
        if (!path) {
-               CTX_ERROR(db->ctx, "File has no path\n");
+               ERROR(db->ctx, "File has no path\n");
                r = -errno;
                goto ERROR;
        }
@@ -2229,7 +2229,7 @@ static int pakfire_db_load_file(struct pakfire_db* db, struct pakfire_filelist*
 
        // Abort if no user is set
        if (!uname) {
-               CTX_ERROR(db->ctx, "%s: No user\n", path);
+               ERROR(db->ctx, "%s: No user\n", path);
                r = 1;
                goto ERROR;
        }
@@ -2237,7 +2237,7 @@ static int pakfire_db_load_file(struct pakfire_db* db, struct pakfire_filelist*
        // Set uname
        r = pakfire_file_set_uname(file, uname);
        if (r) {
-               CTX_ERROR(db->ctx, "%s: Could not set user '%s': %m\n", path, uname);
+               ERROR(db->ctx, "%s: Could not set user '%s': %m\n", path, uname);
                goto ERROR;
        }
 
@@ -2246,7 +2246,7 @@ static int pakfire_db_load_file(struct pakfire_db* db, struct pakfire_filelist*
 
        // Abort if no group is set
        if (!gname) {
-               CTX_ERROR(db->ctx, "%s: No group\n", path);
+               ERROR(db->ctx, "%s: No group\n", path);
                r = 1;
                goto ERROR;
        }
@@ -2254,7 +2254,7 @@ static int pakfire_db_load_file(struct pakfire_db* db, struct pakfire_filelist*
        // Set gname
        r = pakfire_file_set_gname(file, gname);
        if (r) {
-               CTX_ERROR(db->ctx, "%s: Could not set group '%s': %m\n", path, gname);
+               ERROR(db->ctx, "%s: Could not set group '%s': %m\n", path, gname);
                goto ERROR;
        }
 
@@ -2345,7 +2345,7 @@ int pakfire_db_filelist(struct pakfire_db* db, struct pakfire_filelist** filelis
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -2389,7 +2389,7 @@ END:
 
 ERROR:
        if (r)
-               CTX_ERROR(db->ctx, "Could not fetch filelist: %m\n");
+               ERROR(db->ctx, "Could not fetch filelist: %m\n");
 
        if (stmt)
                sqlite3_finalize(stmt);
@@ -2408,14 +2408,14 @@ int pakfire_db_package_filelist(struct pakfire_db* db, struct pakfire_filelist**
        // Fetch the package ID
        uint64_t id = pakfire_package_get_num(pkg, PAKFIRE_PKG_DBID, 0);
        if (!id) {
-               CTX_ERROR(db->ctx, "Package did not have an ID\n");
+               ERROR(db->ctx, "Package did not have an ID\n");
                return 1;
        }
 
        // Create a new filelist
        r = pakfire_filelist_create(&fl, db->pakfire);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not create filelist: %m\n");
+               ERROR(db->ctx, "Could not create filelist: %m\n");
                goto ERROR;
        }
 
@@ -2461,7 +2461,7 @@ int pakfire_db_package_filelist(struct pakfire_db* db, struct pakfire_filelist**
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, strlen(sql), &stmt, NULL);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
+               ERROR(db->ctx, "Could not prepare SQL statement: %s %s\n",
                        sql, sqlite3_errmsg(db->handle));
                goto ERROR;
        }
@@ -2469,7 +2469,7 @@ int pakfire_db_package_filelist(struct pakfire_db* db, struct pakfire_filelist**
        // Bind package ID
        r = sqlite3_bind_int64(stmt, 1, id);
        if (r) {
-               CTX_ERROR(db->ctx, "Could not bind package ID: %s\n", sqlite3_errmsg(db->handle));
+               ERROR(db->ctx, "Could not bind package ID: %s\n", sqlite3_errmsg(db->handle));
                goto ERROR;
        }
 
index 52ae91ee43cc0e10defe757e57ebded4820c4392..f31dfae851af0f9316f5efdb2c740b50ad780f14 100644 (file)
@@ -245,7 +245,7 @@ static int pakfire_digests_check_length(struct pakfire_ctx* ctx,
                return 0;
 
        // Otherwise set an error
-       CTX_ERROR(ctx, "Digest is of an unexpected length\n");
+       ERROR(ctx, "Digest is of an unexpected length\n");
 
        return -ENOMSG;
 }
@@ -257,7 +257,7 @@ static EVP_MD_CTX* __pakfire_digest_setup(struct pakfire_ctx* ctx, const EVP_MD*
        // Setup a new context
        evp_ctx = EVP_MD_CTX_new();
        if (!evp_ctx) {
-               CTX_ERROR(ctx, "Could not initialize OpenSSL context: %s\n",
+               ERROR(ctx, "Could not initialize OpenSSL context: %s\n",
                        ERR_error_string(ERR_get_error(), NULL));
                goto ERROR;
        }
@@ -265,7 +265,7 @@ static EVP_MD_CTX* __pakfire_digest_setup(struct pakfire_ctx* ctx, const EVP_MD*
        // Setup digest
        r = EVP_DigestInit_ex(evp_ctx, md, NULL);
        if (r != 1) {
-               CTX_ERROR(ctx, "Could not setup digest: %s\n",
+               ERROR(ctx, "Could not setup digest: %s\n",
                        ERR_error_string(ERR_get_error(), NULL));
                goto ERROR;
        }
@@ -290,7 +290,7 @@ static int __pakfire_digest_update(struct pakfire_ctx* ctx, EVP_MD_CTX* evp_ctx,
        // Update digest
        r = EVP_DigestUpdate(evp_ctx, buffer, length);
        if (r != 1) {
-               CTX_ERROR(ctx, "EVP_Digest_Update() failed: %s\n",
+               ERROR(ctx, "EVP_Digest_Update() failed: %s\n",
                        ERR_error_string(ERR_get_error(), NULL));
                return 1;
        }
@@ -309,7 +309,7 @@ static int __pakfire_digest_finalize(struct pakfire_ctx* ctx,
        // Finalize digest
        r = EVP_DigestFinal_ex(evp_ctx, digest, NULL);
        if (r != 1) {
-               CTX_ERROR(ctx, "EVP_DigestFinal_ex() failed: %s\n",
+               ERROR(ctx, "EVP_DigestFinal_ex() failed: %s\n",
                        ERR_error_string(ERR_get_error(), NULL));
                return 1;
        }
@@ -476,12 +476,12 @@ static void pakfire_digests_compare_mismatch(struct pakfire_ctx* ctx, const char
        char* hexdigest1 = __pakfire_hexlify(digest1, length);
        char* hexdigest2 = __pakfire_hexlify(digest2, length);
 
-       CTX_DEBUG(ctx, "%s digest does not match:\n", what);
+       DEBUG(ctx, "%s digest does not match:\n", what);
 
        if (hexdigest1)
-               CTX_DEBUG(ctx, "  Digest 1: %s\n", hexdigest1);
+               DEBUG(ctx, "  Digest 1: %s\n", hexdigest1);
        if (hexdigest2)
-               CTX_DEBUG(ctx, "  Digest 2: %s\n", hexdigest2);
+               DEBUG(ctx, "  Digest 2: %s\n", hexdigest2);
 
        if (hexdigest1)
                free(hexdigest1);
index c5dae34af962751b657999f2f8a88c22d1bbbf4f..1dbbcd9a113e82f34cdabee59e277bb7b791e93f 100644 (file)
@@ -170,7 +170,7 @@ int pakfire_read_makefile(struct pakfire_parser** parser, struct pakfire* pakfir
 
        // Find all macros
 
-       CTX_DEBUG(ctx, "Searching for macros in %s\n", PAKFIRE_MACROS_GLOB_PATTERN);
+       DEBUG(ctx, "Searching for macros in %s\n", PAKFIRE_MACROS_GLOB_PATTERN);
 
        glob_t globmacros;
        r = glob(PAKFIRE_MACROS_GLOB_PATTERN, 0, NULL, &globmacros);
@@ -189,11 +189,11 @@ int pakfire_read_makefile(struct pakfire_parser** parser, struct pakfire* pakfir
                        goto ERROR;
 
                default:
-                       CTX_ERROR(ctx, "glob() returned an unhandled error: %d\n", r);
+                       ERROR(ctx, "glob() returned an unhandled error: %d\n", r);
                        goto ERROR;
        }
 
-       CTX_DEBUG(ctx, "Found %zu macro(s)\n", globmacros.gl_pathc);
+       DEBUG(ctx, "Found %zu macro(s)\n", globmacros.gl_pathc);
 
        // Read all macros
        for (unsigned int i = 0; i < globmacros.gl_pathc; i++) {
@@ -208,7 +208,7 @@ int pakfire_read_makefile(struct pakfire_parser** parser, struct pakfire* pakfir
        // Finally, parse the makefile
        r = pakfire_parser_read_file(*parser, path, error);
        if (r) {
-               CTX_ERROR(ctx, "Could not read makefile %s: %m\n", path);
+               ERROR(ctx, "Could not read makefile %s: %m\n", path);
                goto ERROR;
        }
 
@@ -245,7 +245,7 @@ static int pakfire_dist_get_mirrorlist(struct pakfire_ctx* ctx, struct pakfire*
        // Create mirrorlist
        r = pakfire_mirrorlist_create(&m, ctx);
        if (r) {
-               CTX_ERROR(ctx, "Could not create the mirrorlist\n");
+               ERROR(ctx, "Could not create the mirrorlist\n");
                goto ERROR;
        }
 
@@ -372,11 +372,11 @@ static int pakfire_dist_add_sources(struct pakfire_ctx* ctx, struct pakfire* pak
        // Add all mirrors
        const char* source = strtok_r(sources, " ", &p);
        while (source) {
-               CTX_DEBUG(ctx, "Adding source file %s\n", source);
+               DEBUG(ctx, "Adding source file %s\n", source);
 
                r = pakfire_dist_add_source(pakfire, packager, pkg, ctx, mirrorlist, source);
                if (r) {
-                       CTX_ERROR(ctx, "Could not add '%s' to package: %m\n", source);
+                       ERROR(ctx, "Could not add '%s' to package: %m\n", source);
                        goto ERROR;
                }
 
@@ -419,11 +419,11 @@ static int pakfire_dist_add_files(struct pakfire_ctx* ctx, struct pakfire* pakfi
        // Find the package directory
        r = pakfire_dist_find_root(root, file);
        if (r) {
-               CTX_ERROR(ctx, "Could not find package root directory: %s\n", strerror(r));
+               ERROR(ctx, "Could not find package root directory: %s\n", strerror(r));
                return r;
        }
 
-       CTX_DEBUG(ctx, "Adding all files in '%s' to package...\n", root);
+       DEBUG(ctx, "Adding all files in '%s' to package...\n", root);
 
        // Create a new filelist
        r = pakfire_filelist_create(&filelist, pakfire);
@@ -465,7 +465,7 @@ PAKFIRE_EXPORT int pakfire_dist(struct pakfire* pakfire, const char* path,
                if (error)
                        pakfire_parser_error_unref(error);
                else
-                       CTX_ERROR(ctx, "Could not read makefile: %m\n");
+                       ERROR(ctx, "Could not read makefile: %m\n");
 
                goto ERROR;
        }
@@ -473,7 +473,7 @@ PAKFIRE_EXPORT int pakfire_dist(struct pakfire* pakfire, const char* path,
        // The architecture is always "src"
        r = pakfire_parser_set(makefile, NULL, "arch", "src", 0);
        if (r) {
-               CTX_ERROR(ctx, "Could not set architecture to 'src': %m\n");
+               ERROR(ctx, "Could not set architecture to 'src': %m\n");
                goto ERROR;
        }
 
index a60f5676e183db3b82afc5bb83fa5aca3ac56292..2dd74b47ff6d6f0af5e5e99826b8a25be12649c2 100644 (file)
@@ -222,7 +222,7 @@ static const struct pakfire_fhs_check* pakfire_fhs_find_check(
 
                        // Match!
                        case 1:
-                               CTX_DEBUG(ctx, "%s matches check '%s'\n", path, check->path);
+                               DEBUG(ctx, "%s matches check '%s'\n", path, check->path);
 
                                return check;
 
@@ -233,7 +233,7 @@ static const struct pakfire_fhs_check* pakfire_fhs_find_check(
        }
 
 ERROR:
-       CTX_ERROR(ctx, "Could not find FHS entry for %s: %m\n", path);
+       ERROR(ctx, "Could not find FHS entry for %s: %m\n", path);
 
        return NULL;
 }
@@ -257,7 +257,7 @@ static int pakfire_fhs_check_world_writable(
 
        // Check that none of the executable bits are set
        if ((perms & (S_IWUSR|S_IWGRP|S_IWOTH)) == (S_IWUSR|S_IWGRP|S_IWOTH)) {
-               CTX_DEBUG(ctx, "%s is world-writable\n", path);
+               DEBUG(ctx, "%s is world-writable\n", path);
                return PAKFIRE_FHS_WORLDWRITABLE;
        }
 
@@ -277,7 +277,7 @@ static int pakfire_fhs_check_perms(struct pakfire_ctx* ctx,
 
        // Check if they match
        if (check->perms != perms) {
-               CTX_DEBUG(ctx, "%s: Permissions do not match\n", path);
+               DEBUG(ctx, "%s: Permissions do not match\n", path);
                return PAKFIRE_FHS_PERMS_MISMATCH;
        }
 
@@ -296,7 +296,7 @@ static int pakfire_fhs_check_ownership(struct pakfire_ctx* ctx,
                        return 1;
 
                if (strcmp(check->uname, uname) != 0) {
-                       CTX_DEBUG(ctx, "%s: uname does not match\n", path);
+                       DEBUG(ctx, "%s: uname does not match\n", path);
                        return PAKFIRE_FHS_UNAME_MISMATCH;
                }
        }
@@ -308,7 +308,7 @@ static int pakfire_fhs_check_ownership(struct pakfire_ctx* ctx,
                        return 1;
 
                if (strcmp(check->gname, gname) != 0) {
-                       CTX_DEBUG(ctx, "%s: gname does not match\n", path);
+                       DEBUG(ctx, "%s: gname does not match\n", path);
                        return PAKFIRE_FHS_GNAME_MISMATCH;
                }
        }
@@ -331,7 +331,7 @@ static int pakfire_fhs_check_noexec(struct pakfire_ctx* ctx,
 
        // Check that none of the executable bits are set
        if (perms & (S_IXUSR|S_IXGRP|S_IXOTH)) {
-               CTX_DEBUG(ctx, "%s must not be executable\n", path);
+               DEBUG(ctx, "%s must not be executable\n", path);
                return PAKFIRE_FHS_NOEXEC;
        }
 
@@ -359,13 +359,13 @@ int pakfire_fhs_check_file(struct pakfire_ctx* ctx, struct pakfire_file* file) {
        // Find a check
        check = pakfire_fhs_find_check(ctx, file);
        if (!check) {
-               CTX_ERROR(ctx, "Could not match file %s: %m\n", path);
+               ERROR(ctx, "Could not match file %s: %m\n", path);
                return -errno;
        }
 
        // Should this file exist at all?
        if (check->flags & PAKFIRE_FHS_CHECK_MUSTNOTEXIST) {
-               CTX_DEBUG(ctx, "%s must not exist here\n", path);
+               DEBUG(ctx, "%s must not exist here\n", path);
                return PAKFIRE_FHS_MUSTNOTEXIST;
        }
 
index b98650a56abadb838aa27e62e6982c6135896718..458e49a89759d84c0edd39fc3ea5dd3da4779333 100644 (file)
@@ -139,7 +139,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file,
        // Allocate capabilities
        file->caps = cap_init();
        if (!file->caps) {
-               CTX_ERROR(file->ctx, "Could not allocate capabilities: %m\n");
+               ERROR(file->ctx, "Could not allocate capabilities: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -173,7 +173,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file,
                if (cap_permitted) {
                        r = cap_set_flag(file->caps, CAP_PERMITTED, 1, caps, CAP_SET);
                        if (r) {
-                               CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
+                               ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
                                goto ERROR;
                        }
                }
@@ -181,7 +181,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file,
                if (cap_inheritable) {
                        r = cap_set_flag(file->caps, CAP_INHERITABLE, 1, caps, CAP_SET);
                        if (r) {
-                               CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
+                               ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
                                goto ERROR;
                        }
                }
@@ -189,7 +189,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file,
                if (cap_effective) {
                        r = cap_set_flag(file->caps, CAP_EFFECTIVE, 1, caps, CAP_SET);
                        if (r) {
-                               CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
+                               ERROR(file->ctx, "Could not set capability %u: %m\n", cap);
                                goto ERROR;
                        }
                }
@@ -198,7 +198,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file,
 #ifdef ENABLE_DEBUG
        char* text = cap_to_text(file->caps, NULL);
        if (text) {
-               CTX_DEBUG(file->ctx, "%s: Capabilities %s\n", pakfire_file_get_path(file), text);
+               DEBUG(file->ctx, "%s: Capabilities %s\n", pakfire_file_get_path(file), text);
                cap_free(text);
        }
 #endif
@@ -236,21 +236,21 @@ int pakfire_file_write_fcaps(struct pakfire_file* file, struct vfs_cap_data* cap
                // Fetch CAP_PERMITTED
                r = cap_get_flag(file->caps, cap, CAP_PERMITTED, &cap_permitted);
                if (r) {
-                       CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
+                       ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
                        goto ERROR;
                }
 
                // Fetch CAP_INHERITABLE
                r = cap_get_flag(file->caps, cap, CAP_INHERITABLE, &cap_inheritable);
                if (r) {
-                       CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
+                       ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
                        goto ERROR;
                }
 
                // Fetch CAP_EFFECTIVE
                r = cap_get_flag(file->caps, cap, CAP_EFFECTIVE, &cap_effective);
                if (r) {
-                       CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
+                       ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap);
                        goto ERROR;
                }
 
@@ -360,7 +360,7 @@ static int pakfire_file_from_archive_entry(struct pakfire_file* file, struct arc
                                goto ERROR;
 
                } else {
-                       CTX_DEBUG(file->ctx, "Received an unknown extended attribute: %s\n", attr);
+                       DEBUG(file->ctx, "Received an unknown extended attribute: %s\n", attr);
                }
        }
 
@@ -511,7 +511,7 @@ struct archive_entry* pakfire_file_archive_entry(struct pakfire_file* file, int
        if (file->caps) {
                r = pakfire_file_write_fcaps(file, &cap_data);
                if (r) {
-                       CTX_ERROR(file->ctx, "Could not export capabilities: %m\n");
+                       ERROR(file->ctx, "Could not export capabilities: %m\n");
                        goto ERROR;
                }
 
@@ -587,7 +587,7 @@ int pakfire_file_set_fd(struct pakfire_file* file, int fd) {
        // Duplicate the file descriptor
        file->fd = dup(fd);
        if (file->fd < 0) {
-               CTX_ERROR(file->ctx, "Could not duplicate file descriptor: %m\n");
+               ERROR(file->ctx, "Could not duplicate file descriptor: %m\n");
                return -errno;
        }
 
@@ -1081,7 +1081,7 @@ PAKFIRE_EXPORT int pakfire_file_set_digest(struct pakfire_file* file,
 
        // Check buffer length
        if (pakfire_digest_length(type) != length) {
-               CTX_ERROR(file->ctx, "Digest has an incorrect length of %zu byte(s)\n", length);
+               ERROR(file->ctx, "Digest has an incorrect length of %zu byte(s)\n", length);
                return -ENOMSG;
        }
 
@@ -1134,7 +1134,7 @@ PAKFIRE_EXPORT char* pakfire_file_get_caps(struct pakfire_file* file) {
        if (file->caps) {
                text = cap_to_text(file->caps, &length);
                if (!text) {
-                       CTX_ERROR(file->ctx, "Could not export capabilities: %m\n");
+                       ERROR(file->ctx, "Could not export capabilities: %m\n");
                        goto ERROR;
                }
 
@@ -1173,7 +1173,7 @@ FILE* pakfire_file_open(struct pakfire_file* file) {
 
        FILE* f = fopen(path, "r+");
        if (!f)
-               CTX_ERROR(file->ctx, "Could not open %s: %m\n", path);
+               ERROR(file->ctx, "Could not open %s: %m\n", path);
 
        return f;
 }
@@ -1272,7 +1272,7 @@ static int pakfire_file_remove(struct pakfire_file* file) {
        const char* path    = pakfire_file_get_path(file);
        const char* abspath = pakfire_file_get_abspath(file);
 
-       CTX_DEBUG(file->ctx, "Removing %s...\n", path);
+       DEBUG(file->ctx, "Removing %s...\n", path);
 
        // We cannot delete if we don't have the absolute path
        if (!abspath)
@@ -1301,7 +1301,7 @@ static int pakfire_file_remove(struct pakfire_file* file) {
 
                                        // Log anything else
                                        default:
-                                               CTX_ERROR(file->ctx, "Could not remove directory %s: %m\n", path);
+                                               ERROR(file->ctx, "Could not remove directory %s: %m\n", path);
                                                break;
                                }
                        }
@@ -1318,7 +1318,7 @@ static int pakfire_file_remove(struct pakfire_file* file) {
                                                break;
 
                                        default:
-                                               CTX_ERROR(file->ctx, "Could not remove %s: %m\n", path);
+                                               ERROR(file->ctx, "Could not remove %s: %m\n", path);
                                                break;
                                }
                        }
@@ -1365,12 +1365,12 @@ int pakfire_file_detect_mimetype(struct pakfire_file* file) {
        // Check the file
        const char* mimetype = magic_file(magic, path);
        if (!mimetype) {
-               CTX_ERROR(file->ctx, "Could not classify %s: %s\n",
+               ERROR(file->ctx, "Could not classify %s: %s\n",
                        pakfire_file_get_path(file), magic_error(magic));
                return 1;
        }
 
-       CTX_DEBUG(file->ctx, "Classified %s as %s\n", pakfire_file_get_path(file), mimetype);
+       DEBUG(file->ctx, "Classified %s as %s\n", pakfire_file_get_path(file), mimetype);
 
        // Store the value
        return pakfire_file_set_mimetype(file, mimetype);
@@ -1397,7 +1397,7 @@ PAKFIRE_EXPORT int pakfire_file_set_mimetype(
 static int setup_libelf(struct pakfire_ctx* ctx) {
        // Initialize libelf
        if (elf_version(EV_CURRENT) == EV_NONE) {
-               CTX_ERROR(ctx, "Could not initialize libelf: %s\n", elf_errmsg(-1));
+               ERROR(ctx, "Could not initialize libelf: %s\n", elf_errmsg(-1));
 
                return 1;
        }
@@ -1518,7 +1518,7 @@ static int pakfire_file_classify_elf(struct pakfire_file* file) {
        // Open the file
        f = pakfire_file_open(file);
        if (!f) {
-               CTX_ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_path(file));
+               ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_path(file));
                return 1;
        }
 
@@ -1624,7 +1624,7 @@ int pakfire_file_cleanup(struct pakfire_file* file, int flags) {
                        if (!*path)
                                break;
 
-                       CTX_DEBUG(file->ctx, "Trying to remove parent directory %s\n", path);
+                       DEBUG(file->ctx, "Trying to remove parent directory %s\n", path);
 
                        r = rmdir(path);
 
@@ -1644,7 +1644,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat
        if (type != (st->st_mode & S_IFMT)) {
                file->verify_status |= PAKFIRE_FILE_TYPE_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: File Type changed\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: File Type changed\n", pakfire_file_get_path(file));
        }
 
        const mode_t perms = pakfire_file_get_perms(file);
@@ -1653,7 +1653,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat
        if (perms != (st->st_mode & 0777)) {
                file->verify_status |= PAKFIRE_FILE_PERMISSIONS_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Permissions changed\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Permissions changed\n", pakfire_file_get_path(file));
        }
 
 #if 0
@@ -1666,7 +1666,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat
                if (dev != st->st_dev) {
                        file->verify_status |= PAKFIRE_FILE_DEV_CHANGED;
 
-                       CTX_DEBUG(file->ctx, "%s: Device Node changed\n", pakfire_file_get_path(file));
+                       DEBUG(file->ctx, "%s: Device Node changed\n", pakfire_file_get_path(file));
                }
        }
 #endif
@@ -1684,7 +1684,7 @@ static int pakfire_file_verify_size(struct pakfire_file* file, const struct stat
        // Size differs
        file->verify_status |= PAKFIRE_FILE_SIZE_CHANGED;
 
-       CTX_DEBUG(file->ctx, "%s: Filesize differs (expected %zd, got %zd byte(s))\n",
+       DEBUG(file->ctx, "%s: Filesize differs (expected %zd, got %zd byte(s))\n",
                pakfire_file_get_path(file), size, st->st_size);
 
        return 0;
@@ -1711,14 +1711,14 @@ static int pakfire_file_verify_ownership(struct pakfire_file* file, const struct
        if (!owner || owner->pw_uid != uid) {
                file->verify_status |= PAKFIRE_FILE_OWNER_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Owner differs\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Owner differs\n", pakfire_file_get_path(file));
        }
 
        // Check if group matches
        if (!group || group->gr_gid != gid) {
                file->verify_status |= PAKFIRE_FILE_GROUP_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Group differs\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Group differs\n", pakfire_file_get_path(file));
        }
 
        return 0;
@@ -1732,14 +1732,14 @@ static int pakfire_file_verify_timestamps(struct pakfire_file* file, const struc
        if (ctime != st->st_ctime) {
                file->verify_status |= PAKFIRE_FILE_CTIME_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Creation time changed\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Creation time changed\n", pakfire_file_get_path(file));
        }
 
        // Check modification time
        if (mtime != st->st_mtime) {
                file->verify_status |= PAKFIRE_FILE_MTIME_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Modification time changed\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Modification time changed\n", pakfire_file_get_path(file));
        }
 
        return 0;
@@ -1765,7 +1765,7 @@ static int pakfire_file_verify_payload(struct pakfire_file* file, const struct s
        digest_types = pakfire_digest_has_any(&file->digests);
 
        if (!digest_types) {
-               CTX_ERROR(file->ctx, "%s: No digests available\n", pakfire_file_get_path(file));
+               ERROR(file->ctx, "%s: No digests available\n", pakfire_file_get_path(file));
                return 0;
        }
 
@@ -1779,7 +1779,7 @@ static int pakfire_file_verify_payload(struct pakfire_file* file, const struct s
        if (r) {
                file->verify_status |= PAKFIRE_FILE_PAYLOAD_CHANGED;
 
-               CTX_DEBUG(file->ctx, "%s: Digest(s) do not match\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s: Digest(s) do not match\n", pakfire_file_get_path(file));
        }
 
 ERROR:
@@ -1793,7 +1793,7 @@ int pakfire_file_verify(struct pakfire_file* file, int* status) {
        struct stat st;
        int r;
 
-       CTX_DEBUG(file->ctx, "Verifying %s...\n", pakfire_file_get_path(file));
+       DEBUG(file->ctx, "Verifying %s...\n", pakfire_file_get_path(file));
 
        const char* abspath = pakfire_file_get_abspath(file);
 
@@ -1872,14 +1872,14 @@ static int pakfire_file_open_elf(struct pakfire_file* file,
        // Open the file
        f = pakfire_file_open(file);
        if (!f) {
-               CTX_ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_abspath(file));
+               ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_abspath(file));
                return 1;
        }
 
        // Parse the ELF header
        elf = elf_begin(fileno(f), ELF_C_READ, NULL);
        if (!elf) {
-               CTX_ERROR(file->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
+               ERROR(file->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
                r = 1;
                goto ERROR;
        }
@@ -1890,7 +1890,7 @@ static int pakfire_file_open_elf(struct pakfire_file* file,
                        break;
 
                default:
-                       CTX_ERROR(file->ctx, "%s is not an ELF object\n", pakfire_file_get_path(file));
+                       ERROR(file->ctx, "%s is not an ELF object\n", pakfire_file_get_path(file));
                        r = 1;
                        goto ERROR;
        }
@@ -1987,7 +1987,7 @@ static int __pakfire_file_get_elf_type(struct pakfire_file* file, Elf* elf, void
 
        // Fetch the ELF header
        if (!gelf_getehdr(elf, &ehdr)) {
-               CTX_ERROR(file->ctx, "Could not parse ELF header: %s\n", elf_errmsg(-1));
+               ERROR(file->ctx, "Could not parse ELF header: %s\n", elf_errmsg(-1));
                return 1;
        }
 
@@ -2021,7 +2021,7 @@ static int pakfire_file_elf_dyn_walk(struct pakfire_file* file, Elf* elf,
        // Find the dynamic linking information
        r = pakfire_file_get_elf_section(file, elf, SHT_DYNAMIC, &dynamic, &shdr, &elf_data);
        if (r) {
-               CTX_DEBUG(file->ctx, "%s does not have a dynamic section\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s does not have a dynamic section\n", pakfire_file_get_path(file));
                return 0;
        }
 
@@ -2049,7 +2049,7 @@ static int __pakfire_file_check_debuginfo(struct pakfire_file* file, Elf* elf, v
 
        // Not found
        if (r) {
-               CTX_DEBUG(file->ctx, "%s has no debug sections\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s has no debug sections\n", pakfire_file_get_path(file));
 
                // Store the result
                file->issues |= PAKFIRE_FILE_MISSING_DEBUGINFO;
@@ -2084,7 +2084,7 @@ static int __pakfire_file_check_ssp(
        // Fetch the symbol table
        r = pakfire_file_get_elf_section(file, elf, SHT_SYMTAB, &symtab, &shdr, &elf_data);
        if (r) {
-               CTX_ERROR(file->ctx, "%s has no symbol table\n", pakfire_file_get_path(file));
+               ERROR(file->ctx, "%s has no symbol table\n", pakfire_file_get_path(file));
                return 1;
        }
 
@@ -2115,7 +2115,7 @@ static int __pakfire_file_check_ssp(
        // We do not perform the check for libraries that do not contain any functions.
        // Some packages use shared libraries to provide data.
        if (!counter) {
-               CTX_DEBUG(file->ctx, "%s: File has no functions. Skipping SSP check.\n",
+               DEBUG(file->ctx, "%s: File has no functions. Skipping SSP check.\n",
                        pakfire_file_get_path(file));
                return 0;
        }
@@ -2145,7 +2145,7 @@ static int pakfire_file_check_ssp(struct pakfire_file* file) {
        // Check if this file is whitelisted
        for (const char** path = whitelist; *path; path++) {
                if (pakfire_file_matches(file, *path)) {
-                       CTX_DEBUG(file->ctx, "Skipping SSP check for whitelisted file %s\n",
+                       DEBUG(file->ctx, "Skipping SSP check for whitelisted file %s\n",
                                pakfire_file_get_path(file));
                        return 0;
                }
@@ -2179,7 +2179,7 @@ static int __pakfire_file_check_execstack(
        // Fetch the total numbers of program headers
        r = elf_getphdrnum(elf, &phnum);
        if (r) {
-               CTX_ERROR(file->ctx, "Could not fetch number of program headers: %s\n",
+               ERROR(file->ctx, "Could not fetch number of program headers: %s\n",
                        elf_errmsg(-1));
                return 1;
        }
@@ -2187,13 +2187,13 @@ static int __pakfire_file_check_execstack(
        // Walk through all program headers
        for (unsigned int i = 0; i < phnum; i++) {
                if (!gelf_getphdr(elf, i, &phdr)) {
-                       CTX_ERROR(file->ctx, "Could not parse program header: %s\n", elf_errmsg(-1));
+                       ERROR(file->ctx, "Could not parse program header: %s\n", elf_errmsg(-1));
                        return 1;
                }
 
                switch (phdr.p_type) {
                        case PT_GNU_STACK:
-                               CTX_DEBUG(file->ctx,
+                               DEBUG(file->ctx,
                                        "%s: GNU_STACK flags: %c%c%c\n",
                                        pakfire_file_get_path(file),
                                        (phdr.p_flags & PF_R) ? 'R' : '-',
@@ -2308,7 +2308,7 @@ static int __pakfire_file_process_runpath(struct pakfire_file* file,
                        if (!value)
                                return 1;
 
-                       CTX_DEBUG(file->ctx, "%s has a RUNPATH: %s\n",
+                       DEBUG(file->ctx, "%s has a RUNPATH: %s\n",
                                pakfire_file_get_path(file), value);
 
                        // Copy the value into a buffer we can modify
@@ -2321,7 +2321,7 @@ static int __pakfire_file_process_runpath(struct pakfire_file* file,
 
                        // Iterate over all elements
                        while (runpath) {
-                               CTX_ERROR(file->ctx, "Checking RUNPATH %s\n", runpath);
+                               ERROR(file->ctx, "Checking RUNPATH %s\n", runpath);
 
                                // We do not allow any relative RUNPATHs
                                if (pakfire_path_match(runpath, "**/../**"))
@@ -2401,7 +2401,7 @@ static int pakfire_file_get_script_interpreter(struct pakfire_file* file, char**
 
        // Handle any reading errors
        if (bytes_read < 0) {
-               CTX_ERROR(file->ctx, "Could not read from file %s: %m\n",
+               ERROR(file->ctx, "Could not read from file %s: %m\n",
                        pakfire_file_get_path(file));
                r = 1;
                goto ERROR;
@@ -2414,12 +2414,12 @@ static int pakfire_file_get_script_interpreter(struct pakfire_file* file, char**
        }
 
        if (strncmp("#!", shebang, 2) == 0) {
-               CTX_DEBUG(file->ctx, "%s is a script\n", pakfire_file_get_path(file));
+               DEBUG(file->ctx, "%s is a script\n", pakfire_file_get_path(file));
 
                // Find the end of the first line (to be able to perform string operations)
                p = memchr(shebang, '\n', sizeof(shebang));
                if (!p) {
-                       CTX_ERROR(file->ctx, "%s: First line seems to be too long\n",
+                       ERROR(file->ctx, "%s: First line seems to be too long\n",
                                pakfire_file_get_path(file));
                        errno = ENOBUFS;
                        r = 1;
@@ -2477,12 +2477,12 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i
 
        const char* path = pakfire_file_get_path(file);
 
-       CTX_DEBUG(file->ctx, "%s: Fixing interpreter %s\n", path, interpreter);
+       DEBUG(file->ctx, "%s: Fixing interpreter %s\n", path, interpreter);
 
        // Open the file
        f = pakfire_file_open(file);
        if (!f) {
-               CTX_ERROR(file->ctx, "Could not open %s: %m\n", path);
+               ERROR(file->ctx, "Could not open %s: %m\n", path);
                r = -errno;
                goto ERROR;
        }
@@ -2494,7 +2494,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i
                        if (feof(f))
                                break;
 
-                       CTX_ERROR(file->ctx, "Could not read line from %s: %m\n", path);
+                       ERROR(file->ctx, "Could not read line from %s: %m\n", path);
                        goto ERROR;
                }
 
@@ -2538,18 +2538,18 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i
                                if (*p)
                                        args = p;
 
-                               CTX_DEBUG(file->ctx, "%s: Found command %s (%s)\n", path, interpreter, args);
+                               DEBUG(file->ctx, "%s: Found command %s (%s)\n", path, interpreter, args);
 
                                // Find the real path
                                r = pakfire_which(file->pakfire, command, interpreter);
                                if (r) {
-                                       CTX_ERROR(file->ctx, "%s: Could not resolve %s: %m\n", path, interpreter);
+                                       ERROR(file->ctx, "%s: Could not resolve %s: %m\n", path, interpreter);
                                        goto ERROR;
                                }
 
                                // If we could not resolve the command, this file has an invalid interpreter
                                if (!*command) {
-                                       CTX_ERROR(file->ctx, "%s: Could not find path for command %s\n", path, interpreter);
+                                       ERROR(file->ctx, "%s: Could not find path for command %s\n", path, interpreter);
 
                                        file->issues |= PAKFIRE_FILE_INVALID_INTERPRETER;
                                        r = 0;
@@ -2598,7 +2598,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i
        // Truncate the existing content
        r = ftruncate(fileno(f), 0);
        if (r) {
-               CTX_ERROR(file->ctx, "Could not truncate %s: %m\n", path);
+               ERROR(file->ctx, "Could not truncate %s: %m\n", path);
                r = -errno;
                goto ERROR;
        }
@@ -2607,7 +2607,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i
        if (buffer) {
                size_t bytes_written = fwrite(buffer, 1, l, f);
                if (bytes_written < l) {
-                       CTX_ERROR(file->ctx, "%s: Could not write the payload: %m\n", path);
+                       ERROR(file->ctx, "%s: Could not write the payload: %m\n", path);
                        r = -errno;
                        goto ERROR;
                }
@@ -2640,7 +2640,7 @@ static int pakfire_file_check_interpreter(struct pakfire_file* file) {
        if (!interpreter)
                return 0;
 
-       CTX_DEBUG(file->ctx, "%s: Interpreter: %s\n",
+       DEBUG(file->ctx, "%s: Interpreter: %s\n",
                pakfire_file_get_path(file), interpreter);
 
        // Paths must be absolute
@@ -2655,7 +2655,7 @@ static int pakfire_file_check_interpreter(struct pakfire_file* file) {
        else if (strcmp(interpreter, "/usr/bin/env") == 0) {
                r = pakfire_file_fix_interpreter(file, interpreter);
                if (r) {
-                       CTX_ERROR(file->ctx, "%s: Could not fix interpreter: %m\n",
+                       ERROR(file->ctx, "%s: Could not fix interpreter: %m\n",
                                pakfire_file_get_path(file));
                        goto ERROR;
                }
@@ -2715,7 +2715,7 @@ static int __pakfire_file_check_cf_protection_x86(struct pakfire_file* file,
 
        // Check for IBT
        if (!(property & GNU_PROPERTY_X86_FEATURE_1_IBT)) {
-               CTX_DEBUG(file->ctx, "%s: IBT property is not enabled\n",
+               DEBUG(file->ctx, "%s: IBT property is not enabled\n",
                        pakfire_file_get_path(file));
 
                // XXX TODO Actually modify any flags
@@ -2725,7 +2725,7 @@ static int __pakfire_file_check_cf_protection_x86(struct pakfire_file* file,
 
        // Check for Shadow Stack
        if (!(property & GNU_PROPERTY_X86_FEATURE_1_SHSTK)) {
-               CTX_DEBUG(file->ctx, "%s: Shadow Stack is not enabled\n",
+               DEBUG(file->ctx, "%s: Shadow Stack is not enabled\n",
                        pakfire_file_get_path(file));
 
                // XXX TODO Actually modify any flags
@@ -2753,7 +2753,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file,
 
        // Fetch the ELF header
        if (!gelf_getehdr(elf, &ehdr)) {
-               CTX_ERROR(file->ctx, "Could not fetch the ELF header for %s: %m\n",
+               ERROR(file->ctx, "Could not fetch the ELF header for %s: %m\n",
                        pakfire_file_get_path(file));
                return 1;
        }
@@ -2764,7 +2764,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file,
        // Fetch the .note header
        offset = gelf_getnote(data, offset, &nhdr, &offset_name, &offset_data);
        if (!offset) {
-               CTX_ERROR(file->ctx, "Could not read note section: %m\n");
+               ERROR(file->ctx, "Could not read note section: %m\n");
                return 1;
        }
 
@@ -2801,7 +2801,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file,
                payload += sizeof(type) + sizeof(size);
 
                if (length < size) {
-                       CTX_ERROR(file->ctx, "GNU Property note has an incorrect format\n");
+                       ERROR(file->ctx, "GNU Property note has an incorrect format\n");
                        return 1;
                }
 
@@ -2819,7 +2819,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file,
                                break;
 
                        default:
-                               CTX_ERROR(file->ctx, "Unsupported ELF type (%d)\n", ehdr.e_machine);
+                               ERROR(file->ctx, "Unsupported ELF type (%d)\n", ehdr.e_machine);
                                return 1;
                }
 
index 166939c4e37453d1745004cfbe31484a4f16457c..b1e6a7b93a49dc78e49ea09b1765c3fbf7c8d453 100644 (file)
@@ -164,7 +164,7 @@ PAKFIRE_EXPORT int pakfire_filelist_add(struct pakfire_filelist* list, struct pa
        // Allocate a new element
        element = calloc(1, sizeof *element);
        if (!element) {
-               CTX_ERROR(list->ctx, "Could not allocate a new filelist element: %m\n");
+               ERROR(list->ctx, "Could not allocate a new filelist element: %m\n");
                return 1;
        }
 
@@ -326,25 +326,25 @@ int pakfire_filelist_scan(struct pakfire_filelist* list, const char* root,
                return 1;
        }
 
-       CTX_DEBUG(list->ctx, "Scanning %s...\n", root);
+       DEBUG(list->ctx, "Scanning %s...\n", root);
 
        if (includes) {
-               CTX_DEBUG(list->ctx, "  Includes:\n");
+               DEBUG(list->ctx, "  Includes:\n");
 
                for (const char** include = includes; *include; include++)
-                       CTX_DEBUG(list->ctx, "    %s\n", *include);
+                       DEBUG(list->ctx, "    %s\n", *include);
        }
 
        if (excludes) {
-               CTX_DEBUG(list->ctx, "  Excludes:\n");
+               DEBUG(list->ctx, "  Excludes:\n");
 
                for (const char** exclude = excludes; *exclude; exclude++)
-                       CTX_DEBUG(list->ctx, "    %s\n", *exclude);
+                       DEBUG(list->ctx, "    %s\n", *exclude);
        }
 
        // Check if the path exists
        if (!pakfire_path_exists(root)) {
-               CTX_DEBUG(list->ctx, "Path to scan (%s) does not exist\n", root);
+               DEBUG(list->ctx, "Path to scan (%s) does not exist\n", root);
                r = 0;
                goto ERROR;
        }
@@ -357,7 +357,7 @@ int pakfire_filelist_scan(struct pakfire_filelist* list, const char* root,
        // Start reading from here
        r = archive_read_disk_open(reader, root);
        if (r) {
-               CTX_ERROR(list->ctx, "Could not open %s: %s\n",
+               ERROR(list->ctx, "Could not open %s: %s\n",
                        root, archive_error_string(reader));
                goto ERROR;
        }
@@ -366,7 +366,7 @@ int pakfire_filelist_scan(struct pakfire_filelist* list, const char* root,
        r = archive_read_disk_set_metadata_filter_callback(reader,
                pakfire_filelist_scan_filter, &matches);
        if (r) {
-               CTX_ERROR(list->ctx, "Could not set filter callback: %s\n",
+               ERROR(list->ctx, "Could not set filter callback: %s\n",
                        archive_error_string(reader));
                goto ERROR;
        }
@@ -388,7 +388,7 @@ int pakfire_filelist_scan(struct pakfire_filelist* list, const char* root,
 
                        // Raise any other errors
                        default:
-                               CTX_ERROR(list->ctx, "Could not read next file: %s\n",
+                               ERROR(list->ctx, "Could not read next file: %s\n",
                                        archive_error_string(reader));
                                goto ERROR;
                }
@@ -494,7 +494,7 @@ static int __pakfire_filelist_dump(
 
        char* s = pakfire_file_dump(file, *flags);
        if (s) {
-               CTX_INFO(ctx, "%s\n", s);
+               INFO(ctx, "%s\n", s);
                free(s);
        }
 
@@ -516,7 +516,7 @@ int pakfire_filelist_verify(struct pakfire_filelist* list, struct pakfire_fileli
 
        const size_t length = pakfire_filelist_length(list);
 
-       CTX_DEBUG(list->ctx, "Verifying filelist (%zu file(s))...\n", length);
+       DEBUG(list->ctx, "Verifying filelist (%zu file(s))...\n", length);
 
        // Setup progress
        r = pakfire_progress_create(&progress, list->ctx,
index 9fd9723b70868fa356e4627700638e99ec8d4430..f16d73606d744a685b47091705486f8ebcd22c08 100644 (file)
@@ -152,7 +152,7 @@ static int pakfire_httpclient_check(struct pakfire_httpclient* client) {
                                break;
 
                        default:
-                               CTX_ERROR(client->ctx, "Received unhandled cURL message %u\n", msg->msg);
+                               ERROR(client->ctx, "Received unhandled cURL message %u\n", msg->msg);
                                break;
                }
        }
@@ -168,7 +168,7 @@ static int __pakfire_httpclient_timer(sd_event_source* s, uint64_t usec, void* d
        struct pakfire_httpclient* client = data;
        int r;
 
-       CTX_DEBUG(client->ctx, "cURL timer fired\n");
+       DEBUG(client->ctx, "cURL timer fired\n");
 
        r = curl_multi_socket_action(client->curl, CURL_SOCKET_TIMEOUT, 0, &client->still_running);
        if (r)
@@ -191,7 +191,7 @@ static int pakfire_httpclient_timer(CURLM* multi, long timeout_ms, void* data) {
                if (client->timer) {
                        r = sd_event_source_set_enabled(client->timer, SD_EVENT_OFF);
                        if (r < 0)
-                               CTX_ERROR(client->ctx, "Could not disarm the timer: %s\n", strerror(-r));
+                               ERROR(client->ctx, "Could not disarm the timer: %s\n", strerror(-r));
                }
 
                return 0;
@@ -200,7 +200,7 @@ static int pakfire_httpclient_timer(CURLM* multi, long timeout_ms, void* data) {
        // Set the timer
        r = sd_event_source_set_time_relative(client->timer, timeout_ms * 1000);
        if (r < 0) {
-               CTX_ERROR(client->ctx, "Could not set timer: %s\n", strerror(-r));
+               ERROR(client->ctx, "Could not set timer: %s\n", strerror(-r));
 
                return r;
        }
@@ -208,12 +208,12 @@ static int pakfire_httpclient_timer(CURLM* multi, long timeout_ms, void* data) {
        // Have the timer fire once
        r = sd_event_source_set_enabled(client->timer, SD_EVENT_ONESHOT);
        if (r < 0) {
-               CTX_ERROR(client->ctx, "Could not enable the timer: %s\n", strerror(-r));
+               ERROR(client->ctx, "Could not enable the timer: %s\n", strerror(-r));
 
                return r;
        }
 
-       CTX_DEBUG(client->ctx, "cURL set a timer for %ldms\n", timeout_ms);
+       DEBUG(client->ctx, "cURL set a timer for %ldms\n", timeout_ms);
 
        return 0;
 }
@@ -230,7 +230,7 @@ static int __pakfire_httpclient_socket(sd_event_source* s, int fd, uint32_t even
        if (events & EPOLLOUT)
                action |= CURL_CSELECT_OUT;
 
-       //CTX_DEBUG(client->ctx, "cURL has activity on socket %d\n", fd);
+       //DEBUG(client->ctx, "cURL has activity on socket %d\n", fd);
 
        // Inform cURL about some socket activity
        r = curl_multi_socket_action(client->curl, fd, action, &client->still_running);
@@ -247,7 +247,7 @@ static int __pakfire_httpclient_socket(sd_event_source* s, int fd, uint32_t even
                if (client->timer) {
                        r = sd_event_source_set_enabled(client->timer, SD_EVENT_OFF);
                        if (r < 0) {
-                               CTX_ERROR(client->ctx, "Could not disarm the timer: %s\n", strerror(-r));
+                               ERROR(client->ctx, "Could not disarm the timer: %s\n", strerror(-r));
 
                                return r;
                        }
@@ -268,9 +268,9 @@ static int pakfire_httpclient_socket(CURL* e, curl_socket_t fd, int what, void*
                // Disable the event
                r = sd_event_source_set_enabled(s, SD_EVENT_OFF);
                if (r < 0)
-                       CTX_ERROR(client->ctx, "Could not disable fd %d: %s\n", fd, strerror(-r));
+                       ERROR(client->ctx, "Could not disable fd %d: %s\n", fd, strerror(-r));
 
-               CTX_DEBUG(client->ctx, "cURL deregistered socket %d\n", fd);
+               DEBUG(client->ctx, "cURL deregistered socket %d\n", fd);
 
                return r;
        }
@@ -287,13 +287,13 @@ static int pakfire_httpclient_socket(CURL* e, curl_socket_t fd, int what, void*
        if (s) {
                r = sd_event_source_set_io_events(s, events);
                if (r < 0) {
-                       CTX_ERROR(client->ctx, "Could not change events for socket %d: %s\n",
+                       ERROR(client->ctx, "Could not change events for socket %d: %s\n",
                                fd, strerror(-r));
 
                        return r;
                }
 
-               CTX_DEBUG(client->ctx, "cURL changed socket %d\n", fd);
+               DEBUG(client->ctx, "cURL changed socket %d\n", fd);
 
                return 0;
        }
@@ -301,7 +301,7 @@ static int pakfire_httpclient_socket(CURL* e, curl_socket_t fd, int what, void*
        // Add the socket to the event loop
        r = sd_event_add_io(client->loop, &s, fd, events, __pakfire_httpclient_socket, client);
        if (r < 0) {
-               CTX_ERROR(client->ctx, "Could not register socket %d: %s\n", fd, strerror(-r));
+               ERROR(client->ctx, "Could not register socket %d: %s\n", fd, strerror(-r));
 
                goto ERROR;
        }
@@ -309,7 +309,7 @@ static int pakfire_httpclient_socket(CURL* e, curl_socket_t fd, int what, void*
        // Store the event source
        curl_multi_assign(client->curl, fd, sd_event_source_ref(s));
 
-       CTX_DEBUG(client->ctx, "cURL registered socket %d\n", fd);
+       DEBUG(client->ctx, "cURL registered socket %d\n", fd);
 
 ERROR:
        if (s)
@@ -329,7 +329,7 @@ static int pakfire_httpclient_setup_loop(struct pakfire_httpclient* client, sd_e
        } else {
                r = sd_event_new(&client->loop);
                if (r < 0) {
-                       CTX_ERROR(client->ctx, "Could not setup event loop: %s\n", strerror(-r));
+                       ERROR(client->ctx, "Could not setup event loop: %s\n", strerror(-r));
 
                        return r;
                }
@@ -339,7 +339,7 @@ static int pakfire_httpclient_setup_loop(struct pakfire_httpclient* client, sd_e
        r = sd_event_add_time_relative(client->loop, &client->timer, CLOCK_MONOTONIC, 0, 0,
                __pakfire_httpclient_timer, client);
        if (r < 0) {
-               CTX_ERROR(client->ctx, "Could not set timer: %s\n", strerror(-r));
+               ERROR(client->ctx, "Could not set timer: %s\n", strerror(-r));
 
                return r;
        }
@@ -353,21 +353,21 @@ static int pakfire_httpclient_setup_curl(struct pakfire_httpclient* client) {
        // Initialize cURL
        r = curl_global_init(CURL_GLOBAL_DEFAULT);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not initialize cURL: %d\n", r);
+               ERROR(client->ctx, "Could not initialize cURL: %d\n", r);
                return r;
        }
 
        // Create a new multi handle
        client->curl = curl_multi_init();
        if (!client->curl) {
-               CTX_ERROR(client->ctx, "Could not create cURL multi handle\n");
+               ERROR(client->ctx, "Could not create cURL multi handle\n");
                return 1;
        }
 
        // Register with the event loop
        r = curl_multi_setopt(client->curl, CURLMOPT_TIMERFUNCTION, pakfire_httpclient_timer);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not register the timer function: %s\n",
+               ERROR(client->ctx, "Could not register the timer function: %s\n",
                        curl_multi_strerror(r));
 
                return r;
@@ -375,7 +375,7 @@ static int pakfire_httpclient_setup_curl(struct pakfire_httpclient* client) {
 
        r = curl_multi_setopt(client->curl, CURLMOPT_TIMERDATA, client);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not register the timer data: %s\n",
+               ERROR(client->ctx, "Could not register the timer data: %s\n",
                        curl_multi_strerror(r));
 
                return r;
@@ -383,7 +383,7 @@ static int pakfire_httpclient_setup_curl(struct pakfire_httpclient* client) {
 
        r = curl_multi_setopt(client->curl, CURLMOPT_SOCKETFUNCTION, pakfire_httpclient_socket);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not register the socket function: %s\n",
+               ERROR(client->ctx, "Could not register the socket function: %s\n",
                        curl_multi_strerror(r));
 
                return r;
@@ -391,7 +391,7 @@ static int pakfire_httpclient_setup_curl(struct pakfire_httpclient* client) {
 
        r = curl_multi_setopt(client->curl, CURLMOPT_SOCKETDATA, client);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not register the socket data: %s\n",
+               ERROR(client->ctx, "Could not register the socket data: %s\n",
                        curl_multi_strerror(r));
 
                return r;
@@ -400,7 +400,7 @@ static int pakfire_httpclient_setup_curl(struct pakfire_httpclient* client) {
        // Limit parallel transfers
        r = curl_multi_setopt(client->curl, CURLMOPT_MAXCONNECTS, client->max_parallel);
        if (r) {
-               CTX_ERROR(client->ctx, "Could not set max parallel transfers: %s\n",
+               ERROR(client->ctx, "Could not set max parallel transfers: %s\n",
                        curl_multi_strerror(r));
 
                return r;
@@ -539,7 +539,7 @@ int pakfire_httpclient_enqueue_xfer(struct pakfire_httpclient* client,
        // Add the handle to cURL
        r = curl_multi_add_handle(client->curl, pakfire_xfer_handle(xfer));
        if (r) {
-               CTX_ERROR(client->ctx, "Adding handle failed: %s\n", curl_multi_strerror(r));
+               ERROR(client->ctx, "Adding handle failed: %s\n", curl_multi_strerror(r));
                goto ERROR;
        }
 
@@ -573,7 +573,7 @@ int pakfire_httpclient_remove_xfer(struct pakfire_httpclient* client,
        // Remove the handle
        r = curl_multi_remove_handle(client->curl, pakfire_xfer_handle(xfer));
        if (r) {
-               CTX_ERROR(client->ctx, "Could not remove the handle: %s\n", curl_multi_strerror(r));
+               ERROR(client->ctx, "Could not remove the handle: %s\n", curl_multi_strerror(r));
                goto ERROR;
        }
 
@@ -592,7 +592,7 @@ int pakfire_httpclient_run(struct pakfire_httpclient* client, const char* title)
 
        // Cannot run without any transfers
        if (!client->total_xfers) {
-               CTX_DEBUG(client->ctx, "Skipping running HTTP client without any transfers\n");
+               DEBUG(client->ctx, "Skipping running HTTP client without any transfers\n");
                return 0;
        }
 
@@ -609,7 +609,7 @@ int pakfire_httpclient_run(struct pakfire_httpclient* client, const char* title)
        // Run the event loop
        r = sd_event_loop(client->loop);
        if (r < 0) {
-               CTX_ERROR(client->ctx, "Event loop failed: %s\n", strerror(-r));
+               ERROR(client->ctx, "Event loop failed: %s\n", strerror(-r));
                goto ERROR;
        }
 
index 9beab05924f2d324e40c8c79a2a763802fed84c6..79f6254aa77032d7a5add0ffe4a8e2436f846d44 100644 (file)
@@ -50,13 +50,13 @@ void pakfire_log_syslog(void* data, int priority, const char* file,
 static inline void __attribute__((always_inline, format(printf, 2, 3)))
        pakfire_ctx_log_null(struct pakfire_ctx* ctx, const char *format, ...) {}
 
-#define CTX_INFO(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_INFO, ## arg)
-#define CTX_ERROR(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_ERR, ## arg)
+#define INFO(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_INFO, ## arg)
+#define ERROR(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_ERR, ## arg)
 
 #ifdef ENABLE_DEBUG
-#      define CTX_DEBUG(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_DEBUG, ## arg)
+#      define DEBUG(ctx, arg...) pakfire_ctx_log_condition(ctx, LOG_DEBUG, ## arg)
 #else
-#      define CTX_DEBUG pakfire_ctx_log_null
+#      define DEBUG pakfire_ctx_log_null
 #endif
 
 #endif /* PAKFIRE_PRIVATE */
index 4e45878a74dfa77a26624425e894be6bb03f0fe2..55938bb2c2a4aa7e1bf4dbbd1633f96c8a31f1a2 100644 (file)
@@ -158,7 +158,7 @@ static int pakfire_jail_exec_has_flag(
 }
 
 static void pakfire_jail_free(struct pakfire_jail* jail) {
-       CTX_DEBUG(jail->ctx, "Freeing jail at %p\n", jail);
+       DEBUG(jail->ctx, "Freeing jail at %p\n", jail);
 
        // Free environment
        for (unsigned int i = 0; jail->env[i]; i++)
@@ -202,7 +202,7 @@ int pakfire_jail_create(struct pakfire_jail** jail, struct pakfire* pakfire) {
        // Generate a random UUID
        uuid_generate_random(j->uuid);
 
-       CTX_DEBUG(j->ctx, "Allocated new jail at %p\n", j);
+       DEBUG(j->ctx, "Allocated new jail at %p\n", j);
 
        // Set default environment
        for (const struct environ* e = ENV; e->key; e++) {
@@ -278,7 +278,7 @@ int pakfire_jail_set_cgroup(struct pakfire_jail* jail, struct pakfire_cgroup* cg
 
        // Set any new cgroup
        if (cgroup) {
-               CTX_DEBUG(jail->ctx, "Setting cgroup %p\n", cgroup);
+               DEBUG(jail->ctx, "Setting cgroup %p\n", cgroup);
 
                jail->cgroup = pakfire_cgroup_ref(cgroup);
        }
@@ -351,7 +351,7 @@ int pakfire_jail_set_env(struct pakfire_jail* jail,
        // Format and set environment variable
        asprintf(&jail->env[i], "%s=%s", key, value);
 
-       CTX_DEBUG(jail->ctx, "Set environment variable: %s\n", jail->env[i]);
+       DEBUG(jail->ctx, "Set environment variable: %s\n", jail->env[i]);
 
        return 0;
 }
@@ -395,9 +395,9 @@ int pakfire_jail_set_timeout(
        jail->timeout = timeout;
 
        if (timeout > 0)
-               CTX_DEBUG(jail->ctx, "Timeout set to %u second(s)\n", timeout);
+               DEBUG(jail->ctx, "Timeout set to %u second(s)\n", timeout);
        else
-               CTX_DEBUG(jail->ctx, "Timeout disabled\n");
+               DEBUG(jail->ctx, "Timeout disabled\n");
 
        return 0;
 }
@@ -442,14 +442,14 @@ static void pakfire_jail_log_redirect(void* data, int priority, const char* file
 static int pakfire_jail_INFO(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
-       CTX_INFO(jail->ctx, "%.*s", (int)length, line);
+       INFO(jail->ctx, "%.*s", (int)length, line);
        return 0;
 }
 
 static int pakfire_jail_ERROR(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
-       CTX_ERROR(jail->ctx, "%.*s", (int)length, line);
+       ERROR(jail->ctx, "%.*s", (int)length, line);
        return 0;
 }
 
@@ -457,7 +457,7 @@ static int pakfire_jail_ERROR(struct pakfire_log_stream* stream, const char* lin
 static int pakfire_jail_DEBUG(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
-       CTX_DEBUG(jail->ctx, "%.*s", (int)length, line);
+       DEBUG(jail->ctx, "%.*s", (int)length, line);
        return 0;
 }
 #endif /* ENABLE_DEBUG */
@@ -479,12 +479,12 @@ static int pakfire_jail_show_capabilities(struct pakfire_jail* jail) {
        // Fetch all capabilities
        caps = cap_get_proc();
        if (!caps) {
-               CTX_ERROR(jail->ctx, "Could not fetch capabilities: %m\n");
+               ERROR(jail->ctx, "Could not fetch capabilities: %m\n");
                r = 1;
                goto ERROR;
        }
 
-       CTX_DEBUG(jail->ctx, "Capabilities of PID %d:\n", pid);
+       DEBUG(jail->ctx, "Capabilities of PID %d:\n", pid);
 
        // Iterate over all capabilities
        for (unsigned int cap = 0; cap_valid(cap); cap++) {
@@ -505,7 +505,7 @@ static int pakfire_jail_show_capabilities(struct pakfire_jail* jail) {
                if (r)
                        goto ERROR;
 
-               CTX_DEBUG(jail->ctx,
+               DEBUG(jail->ctx,
                        "  %-24s : %c%c%c\n",
                        name,
                        (value_e == CAP_SET) ? 'e' : '-',
@@ -538,7 +538,7 @@ static int pakfire_jail_set_capabilities(struct pakfire_jail* jail) {
        // Fetch capabilities
        caps = cap_get_proc();
        if (!caps) {
-               CTX_ERROR(jail->ctx, "Could not read capabilities: %m\n");
+               ERROR(jail->ctx, "Could not read capabilities: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -552,19 +552,19 @@ static int pakfire_jail_set_capabilities(struct pakfire_jail* jail) {
 
                r = cap_set_flag(caps, CAP_EFFECTIVE, 1, _caps, CAP_SET);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not set %s: %m\n", name);
+                       ERROR(jail->ctx, "Could not set %s: %m\n", name);
                        goto ERROR;
                }
 
                r = cap_set_flag(caps, CAP_INHERITABLE, 1, _caps, CAP_SET);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not set %s: %m\n", name);
+                       ERROR(jail->ctx, "Could not set %s: %m\n", name);
                        goto ERROR;
                }
 
                r = cap_set_flag(caps, CAP_PERMITTED, 1, _caps, CAP_SET);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not set %s: %m\n", name);
+                       ERROR(jail->ctx, "Could not set %s: %m\n", name);
                        goto ERROR;
                }
 
@@ -576,7 +576,7 @@ static int pakfire_jail_set_capabilities(struct pakfire_jail* jail) {
        // Restore all capabilities
        r = cap_set_proc(caps);
        if (r) {
-               CTX_ERROR(jail->ctx, "Restoring capabilities failed: %m\n");
+               ERROR(jail->ctx, "Restoring capabilities failed: %m\n");
                goto ERROR;
        }
 
@@ -587,7 +587,7 @@ static int pakfire_jail_set_capabilities(struct pakfire_jail* jail) {
                // Raise the capability
                r = prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not set ambient capability %s: %m\n", name);
+                       ERROR(jail->ctx, "Could not set ambient capability %s: %m\n", name);
                        goto ERROR;
                }
 
@@ -627,12 +627,12 @@ static int pakfire_jail_limit_syscalls(struct pakfire_jail* jail) {
        };
        int r = 1;
 
-       CTX_DEBUG(jail->ctx, "Applying syscall filter...\n");
+       DEBUG(jail->ctx, "Applying syscall filter...\n");
 
        // Setup a syscall filter which allows everything by default
        scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ALLOW);
        if (!ctx) {
-               CTX_ERROR(jail->ctx, "Could not setup seccomp filter: %m\n");
+               ERROR(jail->ctx, "Could not setup seccomp filter: %m\n");
                goto ERROR;
        }
 
@@ -640,7 +640,7 @@ static int pakfire_jail_limit_syscalls(struct pakfire_jail* jail) {
        for (const int* syscall = syscalls; *syscall; syscall++) {
                r = seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), *syscall, 0);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not configure syscall %d: %m\n", *syscall);
+                       ERROR(jail->ctx, "Could not configure syscall %d: %m\n", *syscall);
                        goto ERROR;
                }
        }
@@ -648,7 +648,7 @@ static int pakfire_jail_limit_syscalls(struct pakfire_jail* jail) {
        // Load syscall filter into the kernel
        r = seccomp_load(ctx);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not load syscall filter into the kernel: %m\n");
+               ERROR(jail->ctx, "Could not load syscall filter into the kernel: %m\n");
                goto ERROR;
        }
 
@@ -684,14 +684,14 @@ int pakfire_jail_bind(struct pakfire_jail* jail,
        // Copy source
        r = pakfire_string_set(mp->source, source);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not copy source: %m\n");
+               ERROR(jail->ctx, "Could not copy source: %m\n");
                return r;
        }
 
        // Copy target
        r = pakfire_string_set(mp->target, target);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not copy target: %m\n");
+               ERROR(jail->ctx, "Could not copy target: %m\n");
                return r;
        }
 
@@ -789,12 +789,12 @@ static int pakfire_jail_setup_loopback(struct pakfire_jail* jail) {
        struct rtnl_link* change = NULL;
        int r;
 
-       CTX_DEBUG(jail->ctx, "Setting up loopback...\n");
+       DEBUG(jail->ctx, "Setting up loopback...\n");
 
        // Allocate a netlink socket
        nl = nl_socket_alloc();
        if (!nl) {
-               CTX_ERROR(jail->ctx, "Could not allocate a netlink socket: %m\n");
+               ERROR(jail->ctx, "Could not allocate a netlink socket: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -802,21 +802,21 @@ static int pakfire_jail_setup_loopback(struct pakfire_jail* jail) {
        // Connect the socket
        r = nl_connect(nl, NETLINK_ROUTE);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not connect netlink socket: %s\n", nl_geterror(r));
+               ERROR(jail->ctx, "Could not connect netlink socket: %s\n", nl_geterror(r));
                goto ERROR;
        }
 
        // Allocate the netlink cache
        r = rtnl_link_alloc_cache(nl, AF_UNSPEC, &cache);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Unable to allocate netlink cache: %s\n", nl_geterror(r));
+               ERROR(jail->ctx, "Unable to allocate netlink cache: %s\n", nl_geterror(r));
                goto ERROR;
        }
 
        // Fetch loopback interface
        link = rtnl_link_get_by_name(cache, "lo");
        if (!link) {
-               CTX_ERROR(jail->ctx, "Could not find lo interface. Ignoring.\n");
+               ERROR(jail->ctx, "Could not find lo interface. Ignoring.\n");
                r = 0;
                goto ERROR;
        }
@@ -824,7 +824,7 @@ static int pakfire_jail_setup_loopback(struct pakfire_jail* jail) {
        // Allocate a new link
        change = rtnl_link_alloc();
        if (!change) {
-               CTX_ERROR(jail->ctx, "Could not allocate change link\n");
+               ERROR(jail->ctx, "Could not allocate change link\n");
                r = 1;
                goto ERROR;
        }
@@ -835,7 +835,7 @@ static int pakfire_jail_setup_loopback(struct pakfire_jail* jail) {
        // Apply any changes
        r = rtnl_link_change(nl, link, change, 0);
        if (r) {
-               CTX_ERROR(jail->ctx, "Unable to activate loopback: %s\n", nl_geterror(r));
+               ERROR(jail->ctx, "Unable to activate loopback: %s\n", nl_geterror(r));
                goto ERROR;
        }
 
@@ -888,7 +888,7 @@ static int pakfire_jail_setup_uid_mapping(struct pakfire_jail* jail, pid_t pid)
        }
 
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not map UIDs: %m\n");
+               ERROR(jail->ctx, "Could not map UIDs: %m\n");
                return r;
        }
 
@@ -926,7 +926,7 @@ static int pakfire_jail_setup_gid_mapping(struct pakfire_jail* jail, pid_t pid)
        }
 
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not map GIDs: %m\n");
+               ERROR(jail->ctx, "Could not map GIDs: %m\n");
                return r;
        }
 
@@ -944,7 +944,7 @@ static int pakfire_jail_setgroups(struct pakfire_jail* jail, pid_t pid) {
 
        r = pakfire_file_write(jail->pakfire, path, 0, 0, 0, "deny\n");
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not set setgroups to deny: %s\n", strerror(errno));
+               ERROR(jail->ctx, "Could not set setgroups to deny: %s\n", strerror(errno));
                r = -errno;
        }
 
@@ -955,12 +955,12 @@ static int pakfire_jail_send_signal(struct pakfire_jail* jail, int fd) {
        const uint64_t val = 1;
        int r = 0;
 
-       CTX_DEBUG(jail->ctx, "Sending signal...\n");
+       DEBUG(jail->ctx, "Sending signal...\n");
 
        // Write to the file descriptor
        r = eventfd_write(fd, val);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not send signal: %s\n", strerror(errno));
+               ERROR(jail->ctx, "Could not send signal: %s\n", strerror(errno));
                r = -errno;
        }
 
@@ -974,11 +974,11 @@ static int pakfire_jail_wait_for_signal(struct pakfire_jail* jail, int fd) {
        uint64_t val = 0;
        int r = 0;
 
-       CTX_DEBUG(jail->ctx, "Waiting for signal...\n");
+       DEBUG(jail->ctx, "Waiting for signal...\n");
 
        r = eventfd_read(fd, &val);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Error waiting for signal: %s\n", strerror(errno));
+               ERROR(jail->ctx, "Error waiting for signal: %s\n", strerror(errno));
                r = -errno;
        }
 
@@ -1002,12 +1002,12 @@ static int pakfire_jail_timer(sd_event_source* s, uint64_t usec, void* data) {
        struct pakfire_jail* jail = ctx->jail;
        int r;
 
-       CTX_DEBUG(jail->ctx, "Timer has fired...\n");
+       DEBUG(jail->ctx, "Timer has fired...\n");
 
        // Send SIGKILL to the process
        r = pidfd_send_signal(ctx->pidfd, SIGKILL, NULL, 0);
        if (r)
-               CTX_ERROR(jail->ctx, "Could not send SIGKILL to the process: %m\n");
+               ERROR(jail->ctx, "Could not send SIGKILL to the process: %m\n");
 
        return r;
 }
@@ -1021,21 +1021,21 @@ static int pakfire_jail_exited(sd_event_source* source, const siginfo_t* si, voi
 
        switch (si->si_code) {
                case CLD_EXITED:
-                       CTX_DEBUG(jail->ctx, "Process has exited with status code %d\n", si->si_status);
+                       DEBUG(jail->ctx, "Process has exited with status code %d\n", si->si_status);
 
                        // Store the exit code
                        ctx->exit = si->si_status;
                        break;
 
                case CLD_KILLED:
-                       CTX_ERROR(jail->ctx, "Process has been killed by signal %d\n", si->si_signo);
+                       ERROR(jail->ctx, "Process has been killed by signal %d\n", si->si_signo);
 
                        // Store the exit code
                        ctx->exit = 139;
                        break;
 
                case CLD_DUMPED:
-                       CTX_ERROR(jail->ctx, "The child process terminated abnormally\n");
+                       ERROR(jail->ctx, "The child process terminated abnormally\n");
                        break;
        }
 
@@ -1055,7 +1055,7 @@ static int pakfire_jail_parent(struct pakfire_jail* jail, struct pakfire_jail_ex
        // Register the PID file descriptor
        r = sd_event_add_child_pidfd(ctx->loop, NULL, ctx->pidfd, WEXITED, pakfire_jail_exited, ctx);
        if (r < 0) {
-               CTX_DEBUG(jail->ctx, "Could not register the child process with the event loop: %s\n", strerror(-r));
+               DEBUG(jail->ctx, "Could not register the child process with the event loop: %s\n", strerror(-r));
                return r;
        }
 
@@ -1090,7 +1090,7 @@ static int pakfire_jail_parent(struct pakfire_jail* jail, struct pakfire_jail_ex
                return r;
 
        // Parent has finished initialisation
-       CTX_DEBUG(jail->ctx, "Parent has finished initialization\n");
+       DEBUG(jail->ctx, "Parent has finished initialization\n");
 
        // Send signal to client
        r = pakfire_jail_send_signal(jail, ctx->completed_fd);
@@ -1106,21 +1106,21 @@ static int pakfire_jail_switch_root(struct pakfire_jail* jail, const char* root)
        // Change to the new root
        r = chdir(root);
        if (r) {
-               CTX_ERROR(jail->ctx, "chdir(%s) failed: %m\n", root);
+               ERROR(jail->ctx, "chdir(%s) failed: %m\n", root);
                return r;
        }
 
        // Switch Root!
        r = pivot_root(".", ".");
        if (r) {
-               CTX_ERROR(jail->ctx, "Failed changing into the new root directory %s: %m\n", root);
+               ERROR(jail->ctx, "Failed changing into the new root directory %s: %m\n", root);
                return r;
        }
 
        // Umount the old root
        r = umount2(".", MNT_DETACH);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not umount the old root filesystem: %m\n");
+               ERROR(jail->ctx, "Could not umount the old root filesystem: %m\n");
                return r;
        }
 
@@ -1141,26 +1141,26 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        // Fetch my own PID
        pid_t pid = getpid();
 
-       CTX_DEBUG(jail->ctx, "Launched child process in jail with PID %d\n", pid);
+       DEBUG(jail->ctx, "Launched child process in jail with PID %d\n", pid);
 
        // Die with parent
        r = prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not configure to die with parent: %m\n");
+               ERROR(jail->ctx, "Could not configure to die with parent: %m\n");
                return 126;
        }
 
        // Make this process dumpable
        r = prctl (PR_SET_DUMPABLE, 1, 0, 0, 0);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not make the process dumpable: %m\n");
+               ERROR(jail->ctx, "Could not make the process dumpable: %m\n");
                return 126;
        }
 
        // Don't drop any capabilities on setuid()
        r = prctl(PR_SET_KEEPCAPS, 1);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not set PR_SET_KEEPCAPS: %m\n");
+               ERROR(jail->ctx, "Could not set PR_SET_KEEPCAPS: %m\n");
                return 126;
        }
 
@@ -1177,21 +1177,21 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        uid_t euid = geteuid();
        gid_t egid = getegid();
 
-       CTX_DEBUG(jail->ctx, "  UID: %u (effective %u)\n", uid, euid);
-       CTX_DEBUG(jail->ctx, "  GID: %u (effective %u)\n", gid, egid);
+       DEBUG(jail->ctx, "  UID: %u (effective %u)\n", uid, euid);
+       DEBUG(jail->ctx, "  GID: %u (effective %u)\n", gid, egid);
 
        // Log all mountpoints
        pakfire_mount_list(jail->ctx);
 
        // Fail if we are not PID 1
        if (pid != 1) {
-               CTX_ERROR(jail->ctx, "Child process is not PID 1\n");
+               ERROR(jail->ctx, "Child process is not PID 1\n");
                return 126;
        }
 
        // Fail if we are not running as root
        if (uid || gid || euid || egid) {
-               CTX_ERROR(jail->ctx, "Child process is not running as root\n");
+               ERROR(jail->ctx, "Child process is not running as root\n");
                return 126;
        }
 
@@ -1236,7 +1236,7 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        if (persona) {
                r = personality(persona);
                if (r < 0) {
-                       CTX_ERROR(jail->ctx, "Could not set personality (%x)\n", (unsigned int)persona);
+                       ERROR(jail->ctx, "Could not set personality (%x)\n", (unsigned int)persona);
                        return 1;
                }
        }
@@ -1250,11 +1250,11 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
 
        // Set nice level
        if (jail->nice) {
-               CTX_DEBUG(jail->ctx, "Setting nice level to %d\n", jail->nice);
+               DEBUG(jail->ctx, "Setting nice level to %d\n", jail->nice);
 
                r = setpriority(PRIO_PROCESS, pid, jail->nice);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not set nice level: %m\n");
+                       ERROR(jail->ctx, "Could not set nice level: %m\n");
                        return 1;
                }
        }
@@ -1262,14 +1262,14 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        // Create a new session
        r = setsid();
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not create a new session: %s\n", strerror(errno));
+               ERROR(jail->ctx, "Could not create a new session: %s\n", strerror(errno));
                return r;
        }
 
        // Open a new PTY
        r = pakfire_pty_open(ctx->pty);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not open a new PTY: %s\n", strerror(-r));
+               ERROR(jail->ctx, "Could not open a new PTY: %s\n", strerror(-r));
                return r;
        }
 
@@ -1308,12 +1308,12 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        if (r)
                return r;
 
-       CTX_DEBUG(jail->ctx, "Child process initialization done\n");
-       CTX_DEBUG(jail->ctx, "Launching command:\n");
+       DEBUG(jail->ctx, "Child process initialization done\n");
+       DEBUG(jail->ctx, "Launching command:\n");
 
        // Log argv
        for (unsigned int i = 0; argv[i]; i++)
-               CTX_DEBUG(jail->ctx, "  argv[%u] = %s\n", i, argv[i]);
+               DEBUG(jail->ctx, "  argv[%u] = %s\n", i, argv[i]);
 
        // exec() command
        r = execvpe(argv[0], (char**)argv, jail->env);
@@ -1333,7 +1333,7 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
                                r = 1;
                }
 
-               CTX_ERROR(jail->ctx, "Could not execve(%s): %m\n", argv[0]);
+               ERROR(jail->ctx, "Could not execve(%s): %m\n", argv[0]);
        }
 
        // We should not get here
@@ -1367,12 +1367,12 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
                .exit  = -1,
        };
 
-       CTX_DEBUG(jail->ctx, "Executing jail...\n");
+       DEBUG(jail->ctx, "Executing jail...\n");
 
        // Create a new event loop
        r = sd_event_new(&ctx.loop);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not create a new event loop: %s\n", strerror(-r));
+               ERROR(jail->ctx, "Could not create a new event loop: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -1380,7 +1380,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
        r = sd_event_add_signal(ctx.loop, NULL, SIGCHLD|SD_EVENT_SIGNAL_PROCMASK,
                pakfire_jail_SIGCHLD, NULL);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not register handling SIGCHLD: %s\n", strerror(-r));
+               ERROR(jail->ctx, "Could not register handling SIGCHLD: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -1394,7 +1394,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
 
                // We cannot capture the output in interactive mode
                if (output) {
-                       CTX_ERROR(jail->ctx, "Cannot capture output in interactive mode\n");
+                       ERROR(jail->ctx, "Cannot capture output in interactive mode\n");
                        r = -ENOTSUP;
                        goto ERROR;
                }
@@ -1418,7 +1418,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
        */
        ctx.completed_fd = eventfd(0, EFD_CLOEXEC);
        if (ctx.completed_fd < 0) {
-               CTX_ERROR(jail->ctx, "eventfd() failed: %m\n");
+               ERROR(jail->ctx, "eventfd() failed: %m\n");
                return -1;
        }
 
@@ -1456,7 +1456,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
                r = sd_event_add_time_relative(ctx.loop, &ctx.timeout, CLOCK_MONOTONIC,
                                jail->timeout * 1000000, 0, pakfire_jail_timer, &ctx);
                if (r < 0) {
-                       CTX_ERROR(jail->ctx, "Could not setup timer: %s\n", strerror(-r));
+                       ERROR(jail->ctx, "Could not setup timer: %s\n", strerror(-r));
                        goto ERROR;
                }
        }
@@ -1486,7 +1486,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
                // Create a temporary cgroup
                r = pakfire_cgroup_child(&ctx.cgroup, jail->cgroup, uuid, 0);
                if (r) {
-                       CTX_ERROR(jail->ctx, "Could not create cgroup for jail: %m\n");
+                       ERROR(jail->ctx, "Could not create cgroup for jail: %m\n");
                        goto ERROR;
                }
 
@@ -1502,7 +1502,7 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
        // Fork this process
        ctx.pid = clone3(&args, sizeof(args));
        if (ctx.pid < 0) {
-               CTX_ERROR(jail->ctx, "Could not clone: %m\n");
+               ERROR(jail->ctx, "Could not clone: %m\n");
                return -1;
 
        // Child process
@@ -1516,12 +1516,12 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
        if (r)
                goto ERROR;
 
-       CTX_DEBUG(jail->ctx, "Entering main loop...\n");
+       DEBUG(jail->ctx, "Entering main loop...\n");
 
        // Main Loop
        r = sd_event_loop(ctx.loop);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not run the event loop: %s\n", strerror(-r));
+               ERROR(jail->ctx, "Could not run the event loop: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -1602,23 +1602,23 @@ int pakfire_jail_exec_script(struct pakfire_jail* jail,
        // Create a temporary file
        f = pakfire_mktemp(path, 0700);
        if (!f) {
-               CTX_ERROR(jail->ctx, "Could not create temporary file: %m\n");
+               ERROR(jail->ctx, "Could not create temporary file: %m\n");
                goto ERROR;
        }
 
-       CTX_DEBUG(jail->ctx, "Writing script to %s:\n%.*s\n", path, (int)size, script);
+       DEBUG(jail->ctx, "Writing script to %s:\n%.*s\n", path, (int)size, script);
 
        // Write data
        r = fprintf(f, "%s", script);
        if (r < 0) {
-               CTX_ERROR(jail->ctx, "Could not write script to file %s: %m\n", path);
+               ERROR(jail->ctx, "Could not write script to file %s: %m\n", path);
                goto ERROR;
        }
 
        // Close file
        r = fclose(f);
        if (r) {
-               CTX_ERROR(jail->ctx, "Could not close script file %s: %m\n", path);
+               ERROR(jail->ctx, "Could not close script file %s: %m\n", path);
                goto ERROR;
        }
 
@@ -1633,7 +1633,7 @@ int pakfire_jail_exec_script(struct pakfire_jail* jail,
 
        argv = calloc(argc + 1, sizeof(*argv));
        if (!argv) {
-               CTX_ERROR(jail->ctx, "Could not allocate argv: %m\n");
+               ERROR(jail->ctx, "Could not allocate argv: %m\n");
                goto ERROR;
        }
 
@@ -1753,7 +1753,7 @@ static int pakfire_jail_run_if_possible(struct pakfire* pakfire, const char** ar
        // Check if the file is executable
        r = access(path, X_OK);
        if (r) {
-               CTX_DEBUG(ctx, "%s is not executable. Skipping...\n", *argv);
+               DEBUG(ctx, "%s is not executable. Skipping...\n", *argv);
                goto ERROR;
        }
 
index 12486cd8f413a932cea30c87b6b914d7e7ede43d..6cebb8a605becc91890eb2006ef2954ee6a7a503 100644 (file)
@@ -111,7 +111,7 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
 
        // Fetch the Job ID
        if (!json_object_object_get_ex(data, "id", &o)) {
-               CTX_ERROR(job->ctx, "Job does not have an ID\n");
+               ERROR(job->ctx, "Job does not have an ID\n");
 
                return -EINVAL;
        }
@@ -121,14 +121,14 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
        // Parse the Job ID
        r = uuid_parse(s, job->job_id);
        if (r) {
-               CTX_ERROR(job->ctx, "Could not parse the Job ID (%s)\n", s);
+               ERROR(job->ctx, "Could not parse the Job ID (%s)\n", s);
 
                return -EINVAL;
        }
 
        // Fetch the name
        if (!json_object_object_get_ex(data, "name", &o)) {
-               CTX_ERROR(job->ctx, "Job does not have a name\n");
+               ERROR(job->ctx, "Job does not have a name\n");
 
                return -EINVAL;
        }
@@ -136,14 +136,14 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
        // Store the name
        r = pakfire_string_set(job->name, json_object_get_string(o));
        if (r) {
-               CTX_ERROR(job->ctx, "Could not store name: %m\n");
+               ERROR(job->ctx, "Could not store name: %m\n");
 
                return r;
        }
 
        // Fetch the arch
        if (!json_object_object_get_ex(data, "arch", &o)) {
-               CTX_ERROR(job->ctx, "Job does not have an architecture\n");
+               ERROR(job->ctx, "Job does not have an architecture\n");
 
                return -EINVAL;
        }
@@ -151,7 +151,7 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
        // Store the arch
        r = pakfire_string_set(job->arch, json_object_get_string(o));
        if (r) {
-               CTX_ERROR(job->ctx, "Could not store arch: %m\n");
+               ERROR(job->ctx, "Could not store arch: %m\n");
 
                return r;
        }
@@ -168,7 +168,7 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
                if (json_object_object_get_ex(ccache, "path", &o)) {
                        r = pakfire_string_set(job->ccache_path, json_object_get_string(o));
                        if (r) {
-                               CTX_ERROR(job->ctx, "Could not store the ccache path: %m\n");
+                               ERROR(job->ctx, "Could not store the ccache path: %m\n");
 
                                return r;
                        }
@@ -184,7 +184,7 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
 
        // Fetch the configuration
        if (!json_object_object_get_ex(data, "conf", &o)) {
-               CTX_ERROR(job->ctx, "Job does not have a configuration\n");
+               ERROR(job->ctx, "Job does not have a configuration\n");
 
                return -EINVAL;
        }
@@ -192,14 +192,14 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
        // Store the configuration
        r = pakfire_string_set(job->conf, json_object_get_string(o));
        if (r) {
-               CTX_ERROR(job->ctx, "Could not store the configuration: %m\n");
+               ERROR(job->ctx, "Could not store the configuration: %m\n");
 
                return r;
        }
 
        // Fetch the package URL
        if (!json_object_object_get_ex(data, "pkg", &o)) {
-               CTX_ERROR(job->ctx, "Job does not have a package URL\n");
+               ERROR(job->ctx, "Job does not have a package URL\n");
 
                return -EINVAL;
        }
@@ -207,20 +207,20 @@ static int pakfire_parse_job(struct pakfire_job* job, json_object* data) {
        // Store the package URL
        r = pakfire_string_set(job->pkg, json_object_get_string(o));
        if (r) {
-               CTX_ERROR(job->ctx, "Could not store the package URL: %m\n");
+               ERROR(job->ctx, "Could not store the package URL: %m\n");
 
                return r;
        }
 
-       CTX_DEBUG(job->ctx, "Job parsing completed\n");
+       DEBUG(job->ctx, "Job parsing completed\n");
 
        // Format the Job ID as string
        uuid_unparse_lower(job->job_id, job_id);
 
-       CTX_INFO(job->ctx, "Received a new job:\n");
-       CTX_INFO(job->ctx, "  ID   : %s\n", job_id);
-       CTX_INFO(job->ctx, "  Name : %s\n", job->name);
-       CTX_INFO(job->ctx, "  Arch : %s\n", job->arch);
+       INFO(job->ctx, "Received a new job:\n");
+       INFO(job->ctx, "  ID   : %s\n", job_id);
+       INFO(job->ctx, "  Name : %s\n", job->name);
+       INFO(job->ctx, "  Arch : %s\n", job->arch);
 
        return 0;
 }
@@ -255,7 +255,7 @@ int pakfire_job_exited(sd_event_source* s, const siginfo_t* si, void* data) {
 
        switch (si->si_code) {
                case CLD_EXITED:
-                       CTX_DEBUG(job->ctx, "Job %s has exited with status code %d\n",
+                       DEBUG(job->ctx, "Job %s has exited with status code %d\n",
                                job_id, si->si_status);
 
                        // Update state
@@ -264,7 +264,7 @@ int pakfire_job_exited(sd_event_source* s, const siginfo_t* si, void* data) {
                        break;
 
                case CLD_KILLED:
-                       CTX_ERROR(job->ctx, "Job %s has been killed by signal %d\n",
+                       ERROR(job->ctx, "Job %s has been killed by signal %d\n",
                                job_id, si->si_signo);
 
                        // Update state
@@ -283,14 +283,14 @@ static int pakfire_job_send_log(struct pakfire_job* job, int priority, const cha
 
        // Bail if we don't have a control connection
        if (!job->control) {
-               CTX_DEBUG(job->ctx, "Cannot send log message because the control connection is down\n");
+               DEBUG(job->ctx, "Cannot send log message because the control connection is down\n");
                return 0;
        }
 
        // Create a new JSON object
        data = json_object_new_object();
        if (!data) {
-               CTX_ERROR(job->ctx, "Could not create a new JSON object: %m\n");
+               ERROR(job->ctx, "Could not create a new JSON object: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -329,7 +329,7 @@ static int pakfire_job_send_log(struct pakfire_job* job, int priority, const cha
        // Send the message
        r = pakfire_xfer_send_message(job->control, m, length);
        if (r) {
-               CTX_ERROR(job->ctx, "Could not send log message: %s\n", strerror(-r));
+               ERROR(job->ctx, "Could not send log message: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -367,7 +367,7 @@ static int pakfire_job_parent(struct pakfire_job* job) {
        // Register the PID file descriptor
        r = sd_event_add_child_pidfd(job->loop, NULL, job->pidfd, WEXITED, pakfire_job_exited, job);
        if (r < 0) {
-               CTX_DEBUG(job->ctx, "Could not register the job with the event loop: %s\n", strerror(-r));
+               DEBUG(job->ctx, "Could not register the job with the event loop: %s\n", strerror(-r));
 
                return r;
        }
@@ -427,7 +427,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        // Fetch our PID
        pid_t pid = getpid();
 
-       CTX_DEBUG(job->ctx, "Launched job child as PID %d\n", pid);
+       DEBUG(job->ctx, "Launched job child as PID %d\n", pid);
 
        // Format the job ID as string
        uuid_unparse(job->job_id, job_id);
@@ -445,7 +445,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        // Replace the context with a new one
        r = pakfire_ctx_create(&ctx, NULL);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not create a new context: %s\n", strerror(-r));
+               ERROR(ctx, "Could not create a new context: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -458,7 +458,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        // Map the configuration
        conf = fmemopen(job->conf, strlen(job->conf), "r");
        if (!conf) {
-               CTX_ERROR(ctx, "Could not map the configuration into memory: %m\n");
+               ERROR(ctx, "Could not map the configuration into memory: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -466,7 +466,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        // Create a new Pakfire instance
        r = pakfire_create(&pakfire, ctx, NULL, job->arch, conf, PAKFIRE_FLAGS_BUILD);
        if (r) {
-               CTX_ERROR(ctx, "Could not initialize Pakfire: %m\n");
+               ERROR(ctx, "Could not initialize Pakfire: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -480,7 +480,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        // Create a new build environment
        r = pakfire_build_create(&build, pakfire, job_id, build_flags);
        if (r) {
-               CTX_ERROR(ctx, "Could not setup the build environment: %m\n");
+               ERROR(ctx, "Could not setup the build environment: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -491,7 +491,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
                        // XXX THIS NEEDS TO BE PREFIXED WITH THE BASE PATH
                        r = pakfire_build_set_ccache_path(build, job->ccache_path);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not set ccache path: %m\n");
+                               ERROR(ctx, "Could not set ccache path: %m\n");
                                r = -errno;
                                goto ERROR;
                        }
@@ -527,7 +527,7 @@ static int pakfire_job_launch(struct pakfire_job* job) {
        // Format the job ID as string
        uuid_unparse(job->job_id, job_id);
 
-       CTX_DEBUG(job->ctx, "Launching job %s\n", job_id);
+       DEBUG(job->ctx, "Launching job %s\n", job_id);
 
        // Update state
        job->state = PAKFIRE_JOB_STATE_LAUNCHED;
@@ -535,14 +535,14 @@ static int pakfire_job_launch(struct pakfire_job* job) {
        // Setup standard output
        r = pakfire_log_stream_create(&job->log.stdout, job->ctx, pakfire_job_stdout, job);
        if (r < 0) {
-               CTX_ERROR(job->ctx, "Could not setup standard output: %s\n", strerror(-r));
+               ERROR(job->ctx, "Could not setup standard output: %s\n", strerror(-r));
                return -errno;
        }
 
        // Setup standard error
        r = pakfire_log_stream_create(&job->log.stderr, job->ctx, pakfire_job_stderr, job);
        if (r < 0) {
-               CTX_ERROR(job->ctx, "Could not setup standard error: %s\n", strerror(-r));
+               ERROR(job->ctx, "Could not setup standard error: %s\n", strerror(-r));
                return -errno;
        }
 
@@ -556,7 +556,7 @@ static int pakfire_job_launch(struct pakfire_job* job) {
        // Fork this process
        pid = clone3(&args, sizeof(args));
        if (pid < 0) {
-               CTX_ERROR(job->ctx, "Could not clone: %m\n");
+               ERROR(job->ctx, "Could not clone: %m\n");
 
                return -errno;
 
@@ -585,20 +585,20 @@ static int pakfire_job_closed(struct pakfire_xfer* xfer, int code, void* data) {
                job->control = NULL;
        }
 
-       CTX_INFO(job->ctx, "Will attempt to reconnect in %u second(s)\n",
+       INFO(job->ctx, "Will attempt to reconnect in %u second(s)\n",
                job->reconnect_holdoff / 1000000);
 
        // Set the reconnection timer
        r = sd_event_source_set_time_relative(job->connect_timer, job->reconnect_holdoff);
        if (r < 0) {
-               CTX_ERROR(job->ctx, "Could not set the reconnection timer: %s\n", strerror(-r));
+               ERROR(job->ctx, "Could not set the reconnection timer: %s\n", strerror(-r));
                return r;
        }
 
        // Activate the timer
        r = sd_event_source_set_enabled(job->connect_timer, SD_EVENT_ONESHOT);
        if (r < 0) {
-               CTX_ERROR(job->ctx, "Could not activate the connect timer: %s\n", strerror(-r));
+               ERROR(job->ctx, "Could not activate the connect timer: %s\n", strerror(-r));
                return r;
        }
 
@@ -647,7 +647,7 @@ ERROR:
 static int pakfire_job_connected(struct pakfire_xfer* xfer, void* data) {
        struct pakfire_job* job = data;
 
-       CTX_DEBUG(job->ctx, "Connected!\n");
+       DEBUG(job->ctx, "Connected!\n");
 
        // Store a reference to the control connection
        job->control = pakfire_xfer_ref(xfer);
@@ -675,7 +675,7 @@ static int pakfire_job_connect(sd_event_source* s, uint64_t usec, void* data) {
        // Format the job ID as string
        uuid_unparse(job->job_id, job_id);
 
-       CTX_INFO(job->ctx, "Connecting to job %s...\n", job_id);
+       INFO(job->ctx, "Connecting to job %s...\n", job_id);
 
        // Fetch a reference to the HTTP client
        client = pakfire_daemon_httpclient(job->daemon);
@@ -738,7 +738,7 @@ int pakfire_job_create(struct pakfire_job** job, struct pakfire_ctx* ctx,
        // Fetch a reference to the event loop
        j->loop = pakfire_daemon_loop(daemon);
        if (!j->loop) {
-               CTX_ERROR(j->ctx, "Could not fetch the event loop: %m\n");
+               ERROR(j->ctx, "Could not fetch the event loop: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -763,7 +763,7 @@ int pakfire_job_create(struct pakfire_job** job, struct pakfire_ctx* ctx,
        r = sd_event_add_time_relative(j->loop, &j->connect_timer,
                CLOCK_MONOTONIC, 0, 0, pakfire_job_connect, j);
        if (r < 0) {
-               CTX_ERROR(j->ctx, "Could not register the connection timer: %s\n", strerror(-r));
+               ERROR(j->ctx, "Could not register the connection timer: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -805,7 +805,7 @@ int pakfire_job_terminate(struct pakfire_job* job, int signal) {
        // Send a signal to the child process
        r = pidfd_send_signal(job->pidfd, signal, NULL, 0);
        if (r) {
-               CTX_ERROR(job->ctx, "Could not terminate job: %m\n");
+               ERROR(job->ctx, "Could not terminate job: %m\n");
                return r;
        }
 
index b3ca9b7ff5be34270d078573f98cadeb9bb9fdb8..9658c239423ff6884591b2ecb08542396c421a51 100644 (file)
@@ -120,7 +120,7 @@ static int pakfire_key_create(struct pakfire_key** key, struct pakfire_ctx* ctx,
                        break;
 
                default:
-                       CTX_ERROR(k->ctx, "Unsupported key algorithm %u\n", algo);
+                       ERROR(k->ctx, "Unsupported key algorithm %u\n", algo);
                        r = -ENOTSUP;
                        goto ERROR;
        }
@@ -210,14 +210,14 @@ PAKFIRE_EXPORT int pakfire_key_generate(struct pakfire_key** key, struct pakfire
                        break;
 
                default:
-                       CTX_ERROR(ctx, "Invalid key algorithm %u\n", algo);
+                       ERROR(ctx, "Invalid key algorithm %u\n", algo);
                        return -EINVAL;
        }
 
        // Generate a random key ID
        r = RAND_bytes((unsigned char*)&key_id, sizeof(key_id));
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not generate the key ID\n");
+               ERROR(ctx, "Could not generate the key ID\n");
                r = -EINVAL;
                goto ERROR;
        }
@@ -225,7 +225,7 @@ PAKFIRE_EXPORT int pakfire_key_generate(struct pakfire_key** key, struct pakfire
        // Setup the context
        pctx = EVP_PKEY_CTX_new_id(id, NULL);
        if (!pctx) {
-               CTX_ERROR(ctx, "Could not allocate the OpenSSL context: %m\n");
+               ERROR(ctx, "Could not allocate the OpenSSL context: %m\n");
                r = -ENOMEM;
                goto ERROR;
        }
@@ -235,7 +235,7 @@ PAKFIRE_EXPORT int pakfire_key_generate(struct pakfire_key** key, struct pakfire
        if (r < 1) {
                ERR_error_string_n(r, error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not prepare the context: %s\n", error);
+               ERROR(ctx, "Could not prepare the context: %s\n", error);
                r = -EINVAL;
                goto ERROR;
        }
@@ -245,7 +245,7 @@ PAKFIRE_EXPORT int pakfire_key_generate(struct pakfire_key** key, struct pakfire
        if (r < 1) {
                ERR_error_string_n(r, error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not generate the key: %s\n", error);
+               ERROR(ctx, "Could not generate the key: %s\n", error);
                r = -EINVAL;
                goto ERROR;
        }
@@ -290,21 +290,21 @@ static int pakfire_key_import_secret_key(struct pakfire_key** key,
 
        // Check the signature algorithm
        if (buffer->sig_algo[0] != 'E' || buffer->sig_algo[1] != 'd') {
-               CTX_ERROR(ctx, "Unsupported signature algorithm\n");
+               ERROR(ctx, "Unsupported signature algorithm\n");
                r = -ENOTSUP;
                goto ERROR;
        }
 
        // Check the KDF algorithm
        if (buffer->kdf_algo[0] != 'B' || buffer->kdf_algo[1] != 'K') {
-               CTX_ERROR(ctx, "Unsupported KDF algorithm\n");
+               ERROR(ctx, "Unsupported KDF algorithm\n");
                r = -ENOTSUP;
                goto ERROR;
        }
 
        // We don't support encrypted keys here
        if (buffer->kdf_rounds) {
-               CTX_ERROR(ctx, "Encrypted keys are not supported\n");
+               ERROR(ctx, "Encrypted keys are not supported\n");
                r = -ENOTSUP;
                goto ERROR;
        }
@@ -312,13 +312,13 @@ static int pakfire_key_import_secret_key(struct pakfire_key** key,
        // Compute a SHA512 checksum over the key material
        r = EVP_Digest(&buffer->keys, sizeof(buffer->keys), checksum, &length, EVP_sha512(), NULL);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not compute the checksum: %m\n");
+               ERROR(ctx, "Could not compute the checksum: %m\n");
                goto ERROR;
        }
 
        // Compare the checksum
        if (memcmp(buffer->checksum, checksum, sizeof(buffer->checksum)) != 0) {
-               CTX_ERROR(ctx, "Checksum mismatch\n");
+               ERROR(ctx, "Checksum mismatch\n");
                r = -EINVAL;
                goto ERROR;
        }
@@ -329,7 +329,7 @@ static int pakfire_key_import_secret_key(struct pakfire_key** key,
        if (!pkey) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not load secret key: %s\n", error);
+               ERROR(ctx, "Could not load secret key: %s\n", error);
                r = -EINVAL;
                goto ERROR;
        }
@@ -360,7 +360,7 @@ static int pakfire_key_import_public_key(struct pakfire_key** key,
 
        // Check the signature algorithm
        if (buffer->sig_algo[0] != 'E' || buffer->sig_algo[1] != 'd') {
-               CTX_ERROR(ctx, "Unsupported signature algorithm\n");
+               ERROR(ctx, "Unsupported signature algorithm\n");
                r = -ENOTSUP;
                goto ERROR;
        }
@@ -371,7 +371,7 @@ static int pakfire_key_import_public_key(struct pakfire_key** key,
        if (!pkey) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not load public key: %s\n", error);
+               ERROR(ctx, "Could not load public key: %s\n", error);
                r = -EINVAL;
                goto ERROR;
        }
@@ -412,7 +412,7 @@ PAKFIRE_EXPORT int pakfire_key_import(struct pakfire_key** key,
                        // The first line must start with "untrusted comment:"
                        case 1:
                                if (!pakfire_string_startswith(line, "untrusted comment: ")) {
-                                       CTX_ERROR(ctx, "The first line must start with 'untrusted comment: '"
+                                       ERROR(ctx, "The first line must start with 'untrusted comment: '"
                                                " and not %s\n", line);
                                        r = -EINVAL;
                                        goto ERROR;
@@ -421,7 +421,7 @@ PAKFIRE_EXPORT int pakfire_key_import(struct pakfire_key** key,
                                // Copy the comment
                                r = pakfire_string_set(comment, line + strlen("untrusted comment: "));
                                if (r < 0) {
-                                       CTX_ERROR(ctx, "Could not copy comment: %m\n");
+                                       ERROR(ctx, "Could not copy comment: %m\n");
                                        goto ERROR;
                                }
 
@@ -432,7 +432,7 @@ PAKFIRE_EXPORT int pakfire_key_import(struct pakfire_key** key,
                                // Decode the key
                                r = pakfire_b64decode(ctx, &buffer, &buffer_length, line);
                                if (r) {
-                                       CTX_ERROR(ctx, "Could not decode the key: %m\n");
+                                       ERROR(ctx, "Could not decode the key: %m\n");
                                        r = -EINVAL;
                                        goto ERROR;
                                }
@@ -457,7 +457,7 @@ PAKFIRE_EXPORT int pakfire_key_import(struct pakfire_key** key,
 
                                        // Unknown key
                                        default:
-                                               CTX_ERROR(ctx, "Unsupported key type\n");
+                                               ERROR(ctx, "Unsupported key type\n");
                                                r = -ENOTSUP;
                                                goto ERROR;
                                }
@@ -491,7 +491,7 @@ int pakfire_key_import_from_string(struct pakfire_key** key,
        // Map the data to a file
        f = fmemopen((char*)data, length, "r");
        if (!f) {
-               CTX_ERROR(ctx, "Could not map the key to file: %m\n");
+               ERROR(ctx, "Could not map the key to file: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -518,12 +518,12 @@ static int pakfire_key_get_public_key(struct pakfire_key* key,
        if (r < 0) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(key->ctx, "Could not extract the public key: %s\n", error);
+               ERROR(key->ctx, "Could not extract the public key: %s\n", error);
                return -EINVAL;
        }
 
        if (l > length) {
-               CTX_ERROR(key->ctx, "The buffer was too small to write the public key\n");
+               ERROR(key->ctx, "The buffer was too small to write the public key\n");
                return -ENOBUFS;
        }
 
@@ -542,12 +542,12 @@ static int pakfire_key_get_secret_key(struct pakfire_key* key,
        if (r < 0) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(key->ctx, "Could not extract the secret key: %s\n", error);
+               ERROR(key->ctx, "Could not extract the secret key: %s\n", error);
                return -EINVAL;
        }
 
        if (l > length) {
-               CTX_ERROR(key->ctx, "The buffer was too small to write the secret key\n");
+               ERROR(key->ctx, "The buffer was too small to write the secret key\n");
                return -ENOBUFS;
        }
 
@@ -577,14 +577,14 @@ static int pakfire_key_export_private_key(struct pakfire_key* key,
                        break;
 
                default:
-                       CTX_ERROR(key->ctx, "Unknown algorithm\n");
+                       ERROR(key->ctx, "Unknown algorithm\n");
                        return -ENOTSUP;
        }
 
        // Generate a salt
        r = RAND_bytes(buffer->kdf_salt, sizeof(buffer->kdf_salt));
        if (r < 1) {
-               CTX_ERROR(key->ctx, "Could not generate salt\n");
+               ERROR(key->ctx, "Could not generate salt\n");
                return -EINVAL;
        }
 
@@ -594,21 +594,21 @@ static int pakfire_key_export_private_key(struct pakfire_key* key,
        // Write the public key
        r = pakfire_key_get_public_key(key, buffer->keys.public, sizeof(buffer->keys.public));
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not export the public key: %m\n");
+               ERROR(key->ctx, "Could not export the public key: %m\n");
                return r;
        }
 
        // Write the secret key
        r = pakfire_key_get_secret_key(key, buffer->keys.secret, sizeof(buffer->keys.secret));
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not export the secret key: %m\n");
+               ERROR(key->ctx, "Could not export the secret key: %m\n");
                return r;
        }
 
        // Compute a SHA512 checksum over the key material
        r = EVP_Digest(&buffer->keys, sizeof(buffer->keys), checksum, &length, EVP_sha512(), NULL);
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not compute the checksum: %m\n");
+               ERROR(key->ctx, "Could not compute the checksum: %m\n");
                return r;
        }
 
@@ -631,7 +631,7 @@ static int pakfire_key_export_public_key(struct pakfire_key* key,
                        break;
 
                default:
-                       CTX_ERROR(key->ctx, "Unknown algorithm\n");
+                       ERROR(key->ctx, "Unknown algorithm\n");
                        return -ENOTSUP;
        }
 
@@ -641,7 +641,7 @@ static int pakfire_key_export_public_key(struct pakfire_key* key,
        // Write the public key
        r = pakfire_key_get_public_key(key, buffer->pubkey, sizeof(buffer->pubkey));
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not export the public key: %m\n");
+               ERROR(key->ctx, "Could not export the public key: %m\n");
                return r;
        }
 
@@ -662,7 +662,7 @@ PAKFIRE_EXPORT int pakfire_key_export(struct pakfire_key* key, FILE* f,
        if (*key->comment) {
                r = fprintf(f, "untrusted comment: %s\n", key->comment);
                if (r < 0) {
-                       CTX_ERROR(key->ctx, "Could not write comment: %m\n");
+                       ERROR(key->ctx, "Could not write comment: %m\n");
                        r = 1;
                        goto ERROR;
                }
@@ -671,7 +671,7 @@ PAKFIRE_EXPORT int pakfire_key_export(struct pakfire_key* key, FILE* f,
        // Setup the base64 encoder
        b64 = BIO_new(BIO_f_base64());
        if (!b64) {
-               CTX_ERROR(key->ctx, "Could not setup the base64 encoder\n");
+               ERROR(key->ctx, "Could not setup the base64 encoder\n");
                r = 1;
                goto ERROR;
        }
@@ -681,7 +681,7 @@ PAKFIRE_EXPORT int pakfire_key_export(struct pakfire_key* key, FILE* f,
 
        bio = BIO_new_fp(f, BIO_NOCLOSE);
        if (!bio) {
-               CTX_ERROR(key->ctx, "Could not open BIO\n");
+               ERROR(key->ctx, "Could not open BIO\n");
                r = 1;
                goto ERROR;
        }
@@ -697,7 +697,7 @@ PAKFIRE_EXPORT int pakfire_key_export(struct pakfire_key* key, FILE* f,
                        // Write the output
                        r = BIO_write(b64, &public_key, sizeof(public_key));
                        if (r < 0) {
-                               CTX_ERROR(key->ctx, "Could not write the public key\n");
+                               ERROR(key->ctx, "Could not write the public key\n");
                                r = 1;
                                goto ERROR;
                        }
@@ -711,7 +711,7 @@ PAKFIRE_EXPORT int pakfire_key_export(struct pakfire_key* key, FILE* f,
                        // Write the output
                        r = BIO_write(b64, &private_key, sizeof(private_key));
                        if (r < 0) {
-                               CTX_ERROR(key->ctx, "Could not write the private key\n");
+                               ERROR(key->ctx, "Could not write the private key\n");
                                goto ERROR;
                        }
                        break;
@@ -748,7 +748,7 @@ PAKFIRE_EXPORT char* pakfire_key_dump(struct pakfire_key* key) {
        // Allocate a buffer in memory
        fd = memfd_create("pakfire-key-dump", MFD_CLOEXEC);
        if (fd < 0) {
-               CTX_ERROR(key->ctx, "Could not allocate a temporary file: %m\n");
+               ERROR(key->ctx, "Could not allocate a temporary file: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -756,7 +756,7 @@ PAKFIRE_EXPORT char* pakfire_key_dump(struct pakfire_key* key) {
        // Re-open as FILE handle
        f = fdopen(fd, "r+");
        if (!f) {
-               CTX_ERROR(key->ctx, "Could not open file handle for temporary file: %m\n");
+               ERROR(key->ctx, "Could not open file handle for temporary file: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -764,7 +764,7 @@ PAKFIRE_EXPORT char* pakfire_key_dump(struct pakfire_key* key) {
        // Export the public part of the key
        r = pakfire_key_export(key, f, PAKFIRE_KEY_EXPORT_MODE_PUBLIC);
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not export key: %m\n");
+               ERROR(key->ctx, "Could not export key: %m\n");
                goto ERROR;
        }
 
@@ -777,7 +777,7 @@ PAKFIRE_EXPORT char* pakfire_key_dump(struct pakfire_key* key) {
        // Allocate a buffer
        buffer = calloc(1, length + 1);
        if (!buffer) {
-               CTX_ERROR(key->ctx, "Could not allocate buffer of %zu byte(s)\n", length + 1);
+               ERROR(key->ctx, "Could not allocate buffer of %zu byte(s)\n", length + 1);
                r = -errno;
                goto ERROR;
        }
@@ -785,7 +785,7 @@ PAKFIRE_EXPORT char* pakfire_key_dump(struct pakfire_key* key) {
        // Read everything into the buffer
        size_t bytes_read = fread(buffer, 1, length, f);
        if (bytes_read < length) {
-               CTX_ERROR(key->ctx, "Could not read back the buffer: %m\n");
+               ERROR(key->ctx, "Could not read back the buffer: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -832,7 +832,7 @@ static int __pakfire_key_sign(struct pakfire_key* key,
        // Create a message digest context
        mdctx = EVP_MD_CTX_new();
        if (!mdctx) {
-               CTX_ERROR(key->ctx, "Could not initialize the message digest context: %m\n");
+               ERROR(key->ctx, "Could not initialize the message digest context: %m\n");
                r = -ENOMEM;
                goto ERROR;
        }
@@ -840,7 +840,7 @@ static int __pakfire_key_sign(struct pakfire_key* key,
        // Setup the context
        r = EVP_DigestSignInit(mdctx, NULL, NULL, NULL, key->pkey);
        if (r < 1) {
-               CTX_ERROR(key->ctx, "Could not setup context\n");
+               ERROR(key->ctx, "Could not setup context\n");
                r = -EINVAL;
                goto ERROR;
        }
@@ -852,7 +852,7 @@ static int __pakfire_key_sign(struct pakfire_key* key,
        if (r < 1) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(key->ctx, "Could not sign content: %s\n", error);
+               ERROR(key->ctx, "Could not sign content: %s\n", error);
                goto ERROR;
        }
 
@@ -881,7 +881,7 @@ PAKFIRE_EXPORT int pakfire_key_sign(struct pakfire_key* key,
        if (comment) {
                r = fprintf(f, "untrusted comment: %s\n", comment);
                if (r < 0) {
-                       CTX_ERROR(key->ctx, "Could not write comment: %m\n");
+                       ERROR(key->ctx, "Could not write comment: %m\n");
                        r = -errno;
                        goto ERROR;
                }
@@ -895,7 +895,7 @@ PAKFIRE_EXPORT int pakfire_key_sign(struct pakfire_key* key,
        // Write the signature
        r = fprintf(f, "%s\n", s);
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not write the signature: %m\n");
+               ERROR(key->ctx, "Could not write the signature: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -955,7 +955,7 @@ static int pakfire_key_read_signature(struct pakfire_key* key,
                        // The first line must start with "untrusted comment:"
                        case 1:
                                if (!pakfire_string_startswith(line, "untrusted comment:")) {
-                                       CTX_ERROR(key->ctx, "The first line must start with 'untrusted comment:'\n");
+                                       ERROR(key->ctx, "The first line must start with 'untrusted comment:'\n");
                                        r = -EINVAL;
                                        goto ERROR;
                                }
@@ -966,7 +966,7 @@ static int pakfire_key_read_signature(struct pakfire_key* key,
                                // Decode the key
                                r = pakfire_b64decode(key->ctx, &buffer, &buffer_length, line);
                                if (r) {
-                                       CTX_ERROR(key->ctx, "Could not decode the signature: %m\n");
+                                       ERROR(key->ctx, "Could not decode the signature: %m\n");
                                        r = -EINVAL;
                                        goto ERROR;
                                }
@@ -979,14 +979,14 @@ static int pakfire_key_read_signature(struct pakfire_key* key,
 
                                                // Check if we support the signature type
                                                if (signature->sig_algo[0] != 'E' || signature->sig_algo[1] != 'd') {
-                                                       CTX_ERROR(key->ctx, "Unknown signature type\n");
+                                                       ERROR(key->ctx, "Unknown signature type\n");
                                                        r = -ENOTSUP;
                                                        goto ERROR;
                                                }
                                                break;
 
                                        default:
-                                               CTX_ERROR(key->ctx, "Unknown signature type\n");
+                                               ERROR(key->ctx, "Unknown signature type\n");
                                                r = -ENOTSUP;
                                                goto ERROR;
                                }
@@ -1012,11 +1012,11 @@ static int pakfire_key_verify_signature(struct pakfire_key* key,
        EVP_MD_CTX* mdctx = NULL;
        int r;
 
-       CTX_DEBUG(key->ctx, "Verifying signature...\n");
+       DEBUG(key->ctx, "Verifying signature...\n");
 
        // Check the key ID
        if (!pakfire_key_id_equals(&key->id, &signature->key_id)) {
-               CTX_ERROR(key->ctx, "The signature has been created with a different key\n");
+               ERROR(key->ctx, "The signature has been created with a different key\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -1024,7 +1024,7 @@ static int pakfire_key_verify_signature(struct pakfire_key* key,
        // Create message digest context
        mdctx = EVP_MD_CTX_new();
        if (!mdctx) {
-               CTX_ERROR(key->ctx, "Could not create the message digest context\n");
+               ERROR(key->ctx, "Could not create the message digest context\n");
                r = -ENOMEM;
                goto ERROR;
        }
@@ -1032,7 +1032,7 @@ static int pakfire_key_verify_signature(struct pakfire_key* key,
        // Setup the context for verification
        r = EVP_DigestVerifyInit(mdctx, NULL, NULL, NULL, key->pkey);
        if (r < 1) {
-               CTX_ERROR(key->ctx, "Could not setup the verification context\n");
+               ERROR(key->ctx, "Could not setup the verification context\n");
                goto ERROR;
        }
 
@@ -1042,19 +1042,19 @@ static int pakfire_key_verify_signature(struct pakfire_key* key,
        switch (r) {
                // Fail
                case 0:
-                       CTX_ERROR(key->ctx, "Signature verification failed\n");
+                       ERROR(key->ctx, "Signature verification failed\n");
                        r = -EBADMSG;
                        break;
 
                // Success
                case 1:
-                       CTX_DEBUG(key->ctx, "Signature verification successful\n");
+                       DEBUG(key->ctx, "Signature verification successful\n");
                        r = 0;
                        break;
 
                // Error
                default:
-                       CTX_ERROR(key->ctx, "Could not perform signature verification\n");
+                       ERROR(key->ctx, "Could not perform signature verification\n");
                        r = -ENOTSUP;
                        goto ERROR;
        }
@@ -1074,14 +1074,14 @@ PAKFIRE_EXPORT int pakfire_key_verify(struct pakfire_key* key, FILE* f,
        // Read the signature
        r = pakfire_key_read_signature(key, &signature, f);
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not read signature: %m\n");
+               ERROR(key->ctx, "Could not read signature: %m\n");
                return r;
        }
 
        // Verify signature
        r = pakfire_key_verify_signature(key, &signature, data, length);
        if (r < 0) {
-               CTX_ERROR(key->ctx, "Could not verify signature: %m\n");
+               ERROR(key->ctx, "Could not verify signature: %m\n");
                return r;
        }
 
index fd8e193b18c71d76df710bb32fdd0742e7eed35f..a70baa3340aaebf0196a1f2343ddfc8010634a73 100644 (file)
@@ -113,7 +113,7 @@ static int pakfire_linter_result(
        TAILQ_INSERT_TAIL(&linter->results, result, nodes);
 
        // Log the result
-       CTX_DEBUG(linter->ctx, "%s: %s",
+       DEBUG(linter->ctx, "%s: %s",
                pakfire_archive_get_path(linter->archive), result->comment);
 
        // Call the callback
@@ -121,7 +121,7 @@ static int pakfire_linter_result(
                r = linter->result_callback(linter->ctx, linter->archive, linter->pkg,
                        priority, result->comment, linter->result_data);
                if (r < 0) {
-                       CTX_ERROR(linter->ctx, "Linter result callback failed: %s\n", strerror(-r));
+                       ERROR(linter->ctx, "Linter result callback failed: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -164,7 +164,7 @@ int pakfire_linter_create(struct pakfire_linter** linter,
        // Fetch the package
        r = pakfire_archive_make_package(l->archive, NULL, &l->pkg);
        if (r < 0) {
-               CTX_ERROR(l->ctx, "Could not open the package in %s: %s\n",
+               ERROR(l->ctx, "Could not open the package in %s: %s\n",
                        pakfire_archive_get_path(l->archive), strerror(-r));
                goto ERROR;
        }
@@ -230,7 +230,7 @@ void pakfire_linter_set_result_callback(struct pakfire_linter* linter,
 static int pakfire_linter_init_libelf(struct pakfire_linter* linter) {
        // Initialize libelf
        if (elf_version(EV_CURRENT) == EV_NONE) {
-               CTX_ERROR(linter->ctx, "Could not initialize libelf: %s\n", elf_errmsg(-1));
+               ERROR(linter->ctx, "Could not initialize libelf: %s\n", elf_errmsg(-1));
                return -EINVAL;
        }
 
@@ -253,7 +253,7 @@ static int pakfire_linter_file_is_elf(
        // Parse the ELF header
        elf = elf_begin(fd, ELF_C_READ, NULL);
        if (!elf) {
-               CTX_ERROR(linter->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
+               ERROR(linter->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
                r = -EINVAL;
                goto ERROR;
        }
@@ -299,7 +299,7 @@ static int pakfire_linter_elf(struct pakfire_linter* linter, struct pakfire_file
        // Parse the ELF header
        elf = elf_begin(fd, ELF_C_READ, NULL);
        if (!elf) {
-               CTX_ERROR(linter->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
+               ERROR(linter->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1));
                r = -EINVAL;
                goto ERROR;
        }
@@ -310,7 +310,7 @@ static int pakfire_linter_elf(struct pakfire_linter* linter, struct pakfire_file
                        break;
 
                default:
-                       CTX_ERROR(linter->ctx, "%s is not an ELF object\n", pakfire_file_get_path(file));
+                       ERROR(linter->ctx, "%s is not an ELF object\n", pakfire_file_get_path(file));
                        r = -EINVAL;
                        goto ERROR;
        }
@@ -333,7 +333,7 @@ static int __pakfire_linter_get_elf_type(struct pakfire_linter* linter,
 
        // Fetch the ELF header
        if (!gelf_getehdr(elf, &ehdr)) {
-               CTX_ERROR(linter->ctx, "Could not parse ELF header: %s\n", elf_errmsg(-1));
+               ERROR(linter->ctx, "Could not parse ELF header: %s\n", elf_errmsg(-1));
                return -EINVAL;
        }
 
@@ -382,7 +382,7 @@ static int pakfire_linter_read_file(
        // Allocate a new buffer
        fd = memfd_create(path, MFD_ALLOW_SEALING|MFD_CLOEXEC);
        if (fd < 0) {
-               CTX_ERROR(linter->ctx, "memfd_create() failed: %m\n");
+               ERROR(linter->ctx, "memfd_create() failed: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -393,7 +393,7 @@ static int pakfire_linter_read_file(
        // Tell the kernel how large the file would be
        r = ftruncate(fd, size);
        if (r < 0) {
-               CTX_ERROR(linter->ctx, "fallocate() failed: %m\n");
+               ERROR(linter->ctx, "fallocate() failed: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -401,7 +401,7 @@ static int pakfire_linter_read_file(
        // Read the payload into the file descriptor
        r = archive_read_data_into_fd(a, fd);
        if (r) {
-               CTX_ERROR(linter->ctx, "Could not read %s: %s\n", path, archive_error_string(a));
+               ERROR(linter->ctx, "Could not read %s: %s\n", path, archive_error_string(a));
                r = -errno;
                goto ERROR;
        }
@@ -409,12 +409,12 @@ static int pakfire_linter_read_file(
        // Check how much data we have read
        off_t offset = lseek(fd, 0, SEEK_CUR);
        if (offset < 0) {
-               CTX_ERROR(linter->ctx, "lseek() failed: %m\n");
+               ERROR(linter->ctx, "lseek() failed: %m\n");
                r = -errno;
                goto ERROR;
        }
 
-       CTX_DEBUG(linter->ctx, "Read %jd byte(s)\n", offset);
+       DEBUG(linter->ctx, "Read %jd byte(s)\n", offset);
 
        // Check if we didn't read too little data
        if ((size_t)offset < size) {
@@ -432,7 +432,7 @@ static int pakfire_linter_read_file(
        // Rewind
        offset = lseek(fd, 0, SEEK_SET);
        if (offset) {
-               CTX_ERROR(linter->ctx, "Could not rewind: %m\n");
+               ERROR(linter->ctx, "Could not rewind: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -441,7 +441,7 @@ static int pakfire_linter_read_file(
        r = fcntl(fd, F_ADD_SEALS,
                        F_SEAL_SEAL|F_SEAL_SHRINK|F_SEAL_GROW|F_SEAL_WRITE|F_SEAL_FUTURE_WRITE);
        if (r < 0) {
-               CTX_ERROR(linter->ctx, "Could not seal the file: %m\n");
+               ERROR(linter->ctx, "Could not seal the file: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -465,7 +465,7 @@ static int pakfire_linter_payload(
        // Fetch path
        const char* path = pakfire_file_get_path(file);
 
-       CTX_DEBUG(linter->ctx, "Checking payload of %s\n", path);
+       DEBUG(linter->ctx, "Checking payload of %s\n", path);
 
        // Read the file
        r = pakfire_linter_read_file(linter, file, a);
@@ -573,7 +573,7 @@ static int pakfire_linter_file(struct pakfire_archive* archive,
        if (r < 0)
                goto ERROR;
 
-       CTX_DEBUG(linter->ctx, "Linting %s...\n", pakfire_file_get_path(file));
+       DEBUG(linter->ctx, "Linting %s...\n", pakfire_file_get_path(file));
 
        // Source Packages
        if (pakfire_package_is_source(linter->pkg)) {
index cd5f6daf73c7d9fc6afee7fa28114629dfb8189f..2eeea58316da76229e40acccf6987a21457be238 100644 (file)
@@ -83,7 +83,7 @@ int pakfire_log_stream_create(struct pakfire_log_stream** stream, struct pakfire
        // Create a new pipe
        r = pipe2(s->pipe, O_CLOEXEC);
        if (r < 0) {
-               CTX_ERROR(s->ctx, "Could not create a pipe: %m\n");
+               ERROR(s->ctx, "Could not create a pipe: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -134,7 +134,7 @@ static int pakfire_log_stream_drain_buffer(struct pakfire_log_stream* stream) {
 
        // Log a message if we don't have a callback
        if (!stream->callback) {
-               CTX_ERROR(stream->ctx, "Log stream has no callback set\n");
+               ERROR(stream->ctx, "Log stream has no callback set\n");
                return -EINVAL;
        }
 
@@ -203,7 +203,7 @@ int pakfire_log_stream_in_parent(struct pakfire_log_stream* stream, sd_event* lo
        r = sd_event_add_io(loop, &stream->event, stream->pipe[0],
                        EPOLLIN|EPOLLHUP, __pakfire_log_stream, stream);
        if (r < 0) {
-               CTX_ERROR(stream->ctx, "Could not register fd %d: %s\n", stream->pipe[0], strerror(-r));
+               ERROR(stream->ctx, "Could not register fd %d: %s\n", stream->pipe[0], strerror(-r));
                return r;
        }
 
index c643599b762808faeba8085a6388eb75fd20ef7f..6eeb10515fd5f7d518641dfaf212c81df2ac7469 100644 (file)
@@ -106,7 +106,7 @@ int pakfire_mirror_is_broken(struct pakfire_mirror* mirror) {
 }
 
 void pakfire_mirror_mark_as_broken(struct pakfire_mirror* mirror) {
-       CTX_DEBUG(mirror->ctx, "Mirror %s has been marked as broken\n", mirror->url);
+       DEBUG(mirror->ctx, "Mirror %s has been marked as broken\n", mirror->url);
 
        mirror->is_broken = 1;
 }
index d3b468adb2b9507661f30f5a81c7269cd1a43609..8e262a783a585cd6c148586cd9febac645496059 100644 (file)
@@ -97,18 +97,18 @@ static int pakfire_mirrorlist_check_mirrorlist(struct pakfire_mirrorlist* list,
 
        r = json_object_object_get_ex(root, "type", &typeobj);
        if (!r) {
-               CTX_ERROR(list->ctx, "mirrorlist does not have a 'type' attribute\n");
+               ERROR(list->ctx, "mirrorlist does not have a 'type' attribute\n");
                goto ERROR;
        }
 
        const char* type = json_object_get_string(typeobj);
        if (!type) {
-               CTX_ERROR(list->ctx, "mirrorlist has an empty or unknown 'type' attribute\n");
+               ERROR(list->ctx, "mirrorlist has an empty or unknown 'type' attribute\n");
                goto ERROR;
        }
 
        if (strcmp(type, "mirrorlist") != 0) {
-               CTX_ERROR(list->ctx, "Unexpected type: %s\n", type);
+               ERROR(list->ctx, "Unexpected type: %s\n", type);
                goto ERROR;
        }
 
@@ -150,7 +150,7 @@ int pakfire_mirrorlist_read(struct pakfire_mirrorlist* list, const char* path) {
                return 1;
        }
 
-       CTX_DEBUG(list->ctx, "Reading mirrorlist from %s\n", path);
+       DEBUG(list->ctx, "Reading mirrorlist from %s\n", path);
 
        struct json_object* json = pakfire_json_parse_from_file(list->ctx, path);
        if (!json) {
@@ -158,7 +158,7 @@ int pakfire_mirrorlist_read(struct pakfire_mirrorlist* list, const char* path) {
                if (errno == ENOENT)
                        return 0;
 
-               CTX_ERROR(list->ctx, "Could not parse mirrorlist from %s: %m\n", path);
+               ERROR(list->ctx, "Could not parse mirrorlist from %s: %m\n", path);
                return 1;
        }
 
@@ -175,7 +175,7 @@ int pakfire_mirrorlist_read(struct pakfire_mirrorlist* list, const char* path) {
        // Add the new mirrors
        r = json_object_object_get_ex(json, "mirrors", &mirrors);
        if (!r) {
-               CTX_DEBUG(list->ctx, "Mirrorlist has no mirrors\n");
+               DEBUG(list->ctx, "Mirrorlist has no mirrors\n");
                r = 0;
                goto ERROR;
        }
@@ -198,7 +198,7 @@ int pakfire_mirrorlist_read(struct pakfire_mirrorlist* list, const char* path) {
                // Add the mirror to the downloader
                r = pakfire_mirrorlist_add_mirror_from_url(list, url);
                if (r) {
-                       CTX_ERROR(list->ctx, "Could not add mirror %s: %m\n", url);
+                       ERROR(list->ctx, "Could not add mirror %s: %m\n", url);
                        goto ERROR;
                }
        }
index 8ae94ee923f15ab6f859e45fe0642ebe519cf212..7b65cd3400f18f9e9e36154b8e45b060292073e9 100644 (file)
@@ -262,11 +262,11 @@ static const struct pakfire_symlink {
 };
 
 int pakfire_mount_change_propagation(struct pakfire_ctx* ctx, const char* path, int propagation) {
-       CTX_DEBUG(ctx, "Changing mount propagation on %s\n", path);
+       DEBUG(ctx, "Changing mount propagation on %s\n", path);
 
        int r = mount(NULL, path, NULL, propagation|MS_REC, NULL);
        if (r)
-               CTX_ERROR(ctx, "Failed to change mount propagation on %s: %m\n", path);
+               ERROR(ctx, "Failed to change mount propagation on %s: %m\n", path);
 
        return r;
 }
@@ -291,14 +291,14 @@ int pakfire_mount_make_mounpoint(struct pakfire_ctx* ctx, const char* path) {
                        break;
 
                default:
-                       CTX_ERROR(ctx, "Could not determine whether %s is a mountpoint: %m\n", path);
+                       ERROR(ctx, "Could not determine whether %s is a mountpoint: %m\n", path);
                        return r;
        }
 
        // Bind-mount to self
        r = mount(path, path, NULL, MS_BIND|MS_REC, NULL);
        if (r) {
-               CTX_ERROR(ctx, "Could not make %s a mountpoint: %m\n", path);
+               ERROR(ctx, "Could not make %s a mountpoint: %m\n", path);
                return r;
        }
 
@@ -315,12 +315,12 @@ static int pakfire_mount(struct pakfire_ctx* ctx, const char* source, const char
                return 1;
        }
 
-       CTX_DEBUG(ctx, "Mounting %s from %s (%s - %s)\n", target, source, fstype, options);
+       DEBUG(ctx, "Mounting %s from %s (%s - %s)\n", target, source, fstype, options);
 
        // Perform mount()
        int r = mount(source, target, fstype, mflags, data);
        if (r) {
-               CTX_ERROR(ctx, "Could not mount %s: %m\n", target);
+               ERROR(ctx, "Could not mount %s: %m\n", target);
        }
 
        return r;
@@ -330,13 +330,13 @@ static int __pakfire_mount_list(char* line, size_t length, void* data) {
        struct pakfire_ctx* ctx = data;
 
        // Send the line to the logger
-       CTX_DEBUG(ctx, "  %.*s", (int)length, line);
+       DEBUG(ctx, "  %.*s", (int)length, line);
 
        return 0;
 }
 
 int pakfire_mount_list(struct pakfire_ctx* ctx) {
-       CTX_DEBUG(ctx, "Mountpoints:\n");
+       DEBUG(ctx, "Mountpoints:\n");
 
        return pakfire_parse_file("/proc/self/mounts", __pakfire_mount_list, ctx);
 }
@@ -346,7 +346,7 @@ int pakfire_populate_dev(struct pakfire_ctx* ctx, struct pakfire* pakfire, int f
 
        // Create device nodes
        for (const struct pakfire_devnode* devnode = devnodes; devnode->path; devnode++) {
-               CTX_DEBUG(ctx, "Creating device node %s\n", devnode->path);
+               DEBUG(ctx, "Creating device node %s\n", devnode->path);
 
                // Check if flags match
                if (devnode->flags && !(flags & devnode->flags))
@@ -371,14 +371,14 @@ int pakfire_populate_dev(struct pakfire_ctx* ctx, struct pakfire* pakfire, int f
                        goto MOUNT;
 
                // Otherwise log an error and end
-               CTX_ERROR(ctx, "Could not create %s: %m\n", devnode->path);
+               ERROR(ctx, "Could not create %s: %m\n", devnode->path);
                return r;
 
 MOUNT:
                // Create an empty file
                r = pakfire_touch(path, 0444);
                if (r) {
-                       CTX_ERROR(ctx, "Could not create %s: %m\n", path);
+                       ERROR(ctx, "Could not create %s: %m\n", path);
                        return r;
                }
 
@@ -390,7 +390,7 @@ MOUNT:
 
        // Create symlinks
        for (const struct pakfire_symlink* s = symlinks; s->target; s++) {
-               CTX_DEBUG(ctx, "Creating symlink %s -> %s\n", s->path, s->target);
+               DEBUG(ctx, "Creating symlink %s -> %s\n", s->path, s->target);
 
                int r = pakfire_path(pakfire, path, "%s", s->path);
                if (r)
@@ -398,7 +398,7 @@ MOUNT:
 
                r = symlink(s->target, path);
                if (r) {
-                       CTX_ERROR(ctx, "Could not create symlink %s: %m\n", s->path);
+                       ERROR(ctx, "Could not create symlink %s: %m\n", s->path);
                        return r;
                }
        }
@@ -419,7 +419,7 @@ int pakfire_mount_interpreter(struct pakfire_ctx* ctx, struct pakfire* pakfire)
        if (!interpreter)
                return 0;
 
-       CTX_DEBUG(ctx, "Mounting interpreter %s for %s\n", interpreter, arch);
+       DEBUG(ctx, "Mounting interpreter %s for %s\n", interpreter, arch);
 
        // Where to mount this?
        int r = pakfire_path(pakfire, target, "%s", interpreter);
@@ -439,7 +439,7 @@ int pakfire_mount_interpreter(struct pakfire_ctx* ctx, struct pakfire* pakfire)
 
        r = pakfire_mount(ctx, interpreter, target, NULL, MS_BIND|MS_RDONLY, NULL);
        if (r)
-               CTX_ERROR(ctx, "Could not mount interpreter %s to %s: %m\n", interpreter, target);
+               ERROR(ctx, "Could not mount interpreter %s to %s: %m\n", interpreter, target);
 
        return r;
 }
@@ -467,7 +467,7 @@ int pakfire_mount_all(struct pakfire_ctx* ctx, struct pakfire* pakfire, pakfire_
                if (!pakfire_path_exists(target)) {
                        r = pakfire_mkdir(target, 0755);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not create %s: %m\n", target);
+                               ERROR(ctx, "Could not create %s: %m\n", target);
                                return r;
                        }
                }
@@ -493,11 +493,11 @@ int pakfire_bind(struct pakfire_ctx* ctx, struct pakfire* pakfire,
        if (r)
                return r;
 
-       CTX_DEBUG(ctx, "Bind-mounting %s to %s\n", src, mountpoint);
+       DEBUG(ctx, "Bind-mounting %s to %s\n", src, mountpoint);
 
        r = stat(src, &st);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not stat %s: %m\n", src);
+               ERROR(ctx, "Could not stat %s: %m\n", src);
                return 1;
        }
 
index 4158bbd7eca27891b28a5fd35feaad80ca359db8..afcc05a4f6085c54d8e6c23cc1fd5cdc12c22ca1 100644 (file)
@@ -212,7 +212,7 @@ PAKFIRE_EXPORT int pakfire_package_create(struct pakfire_package** package,
        // Allocate a new solvable
        Id id = pakfire_repo_add_solvable(repo);
        if (!id) {
-               CTX_ERROR(ctx, "Could not allocate a solvable: %m\n");
+               ERROR(ctx, "Could not allocate a solvable: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -228,28 +228,28 @@ PAKFIRE_EXPORT int pakfire_package_create(struct pakfire_package** package,
        // Set the name
        r = pakfire_package_set_string(*package, PAKFIRE_PKG_NAME, name);
        if (r) {
-               CTX_ERROR(ctx, "Could not set package name '%s': %m\n", name);
+               ERROR(ctx, "Could not set package name '%s': %m\n", name);
                goto ERROR;
        }
 
        // Set EVR
        r = pakfire_package_set_string(*package, PAKFIRE_PKG_EVR, evr);
        if (r) {
-               CTX_ERROR(ctx, "Could not set package EVR '%s': %m\n", evr);
+               ERROR(ctx, "Could not set package EVR '%s': %m\n", evr);
                goto ERROR;
        }
 
        // Set arch
        r = pakfire_package_set_string(*package, PAKFIRE_PKG_ARCH, arch);
        if (r) {
-               CTX_ERROR(ctx, "Could not set package arch '%s': %m\n", arch);
+               ERROR(ctx, "Could not set package arch '%s': %m\n", arch);
                goto ERROR;
        }
 
        // Add self-provides
        r = pakfire_package_add_self_provides(*package);
        if (r) {
-               CTX_ERROR(ctx, "Could not create self-provides: %m\n");
+               ERROR(ctx, "Could not create self-provides: %m\n");
                goto ERROR;
        }
 
@@ -441,14 +441,14 @@ static int pakfire_package_make_cache_path(struct pakfire_package* pkg) {
        // Fetch the filename
        const char* filename = pakfire_package_get_string(pkg, PAKFIRE_PKG_FILENAME);
        if (!filename) {
-               CTX_ERROR(pkg->ctx, "Could not fetch filename for %s: %m\n", nevra);
+               ERROR(pkg->ctx, "Could not fetch filename for %s: %m\n", nevra);
                return 1;
        }
 
        // Fetch UUID
        const char* uuid = pakfire_package_get_string(pkg, PAKFIRE_PKG_UUID);
        if (!uuid) {
-               CTX_ERROR(pkg->ctx, "Could not fetch UUID for %s: %m\n", nevra);
+               ERROR(pkg->ctx, "Could not fetch UUID for %s: %m\n", nevra);
                return 1;
        }
 
@@ -1830,7 +1830,7 @@ PAKFIRE_EXPORT struct pakfire_archive* pakfire_package_get_archive(struct pakfir
        // Open archive
        r = pakfire_archive_open(&archive, pkg->pakfire, path);
        if (r) {
-               CTX_ERROR(pkg->ctx, "Could not open archive for %s (at %s): %m\n",
+               ERROR(pkg->ctx, "Could not open archive for %s (at %s): %m\n",
                        pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA), path);
                goto ERROR;
        }
@@ -1940,7 +1940,7 @@ int pakfire_package_append_file(struct pakfire_package* pkg, const char* path) {
        // Fetch repodata
        struct pakfire_repo* repo = pakfire_package_get_repo(pkg);
        if (!repo) {
-               CTX_ERROR(pkg->ctx, "Could not find repository for %s: %m\n",
+               ERROR(pkg->ctx, "Could not find repository for %s: %m\n",
                        pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA));
                return 1;
        }
@@ -2149,7 +2149,7 @@ static int pakfire_package_add_json_filelist(
        // Fetch the filelist
        filelist = pakfire_package_get_filelist(pkg);
        if (!filelist) {
-               CTX_ERROR(pkg->ctx, "Could not fetch package filelist\n");
+               ERROR(pkg->ctx, "Could not fetch package filelist\n");
                r = 1;
                goto ERROR;
        }
@@ -2157,7 +2157,7 @@ static int pakfire_package_add_json_filelist(
        // Create a new JSON array
        object = json_object_new_array();
        if (!object) {
-               CTX_ERROR(pkg->ctx, "Could not create a JSON array\n");
+               ERROR(pkg->ctx, "Could not create a JSON array\n");
                r = 1;
                goto ERROR;
        }
@@ -2191,14 +2191,14 @@ static int __pakfire_package_add_build_packages(struct pakfire_ctx* ctx,
        const char* evr = pakfire_package_get_string(pkg, PAKFIRE_PKG_EVR);
 
        if (!name || !evr) {
-               CTX_ERROR(ctx, "Could not fetch package information: %m\n");
+               ERROR(ctx, "Could not fetch package information: %m\n");
                return 1;
        }
 
        // Add package information to the list
        r = pakfire_json_add_string(object, name, evr);
        if (r) {
-               CTX_ERROR(ctx, "Could not add package to packages list: %m\n");
+               ERROR(ctx, "Could not add package to packages list: %m\n");
                return r;
        }
 
@@ -2215,7 +2215,7 @@ static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
        // Create a new JSON array
        object = json_object_new_object();
        if (!object) {
-               CTX_ERROR(pkg->ctx, "Could not create a new JSON object: %m\n");
+               ERROR(pkg->ctx, "Could not create a new JSON object: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -2223,7 +2223,7 @@ static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
        // Fetch the installed repository
        repo = pakfire_get_installed_repo(pkg->pakfire);
        if (!repo) {
-               CTX_ERROR(pkg->ctx, "Could not fetch the installed repository: %m\n");
+               ERROR(pkg->ctx, "Could not fetch the installed repository: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -2236,7 +2236,7 @@ static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
        // Fetch all installed packages
        r = pakfire_repo_to_packagelist(repo, packages);
        if (r) {
-               CTX_ERROR(pkg->ctx, "Could not fetch packages from installed repository: %m\n");
+               ERROR(pkg->ctx, "Could not fetch packages from installed repository: %m\n");
                goto ERROR;
        }
 
@@ -2504,14 +2504,14 @@ PAKFIRE_EXPORT int pakfire_package_installcheck(struct pakfire_package* pkg,
        r = pakfire_transaction_request_package(transaction,
                PAKFIRE_JOB_INSTALL, pkg, PAKFIRE_JOB_ESSENTIAL);
        if (r) {
-               CTX_ERROR(pkg->ctx, "Could not add package %s to the request\n", nevra);
+               ERROR(pkg->ctx, "Could not add package %s to the request\n", nevra);
                goto ERROR;
        }
 
        // Solve the transaction
        r = pakfire_transaction_solve(transaction, PAKFIRE_TRANSACTION_WITHOUT_RECOMMENDED, &p);
        if (r) {
-               CTX_DEBUG(pkg->ctx, "Could not install %s:\n%s\n", nevra, p);
+               DEBUG(pkg->ctx, "Could not install %s:\n%s\n", nevra, p);
 
                // Copy the problem string
                if (p)
index f77b76df18e2edc209a0c6a65c78545722c2b82f..4bdc5466253c9d0bb30d0302858c2866f73cade1 100644 (file)
@@ -133,7 +133,7 @@ PAKFIRE_EXPORT int pakfire_packagelist_push(struct pakfire_packagelist* list, st
        // Allocate a new element
        element = calloc(1, sizeof *element);
        if (!element) {
-               CTX_ERROR(list->ctx, "Could not allocate a new packagelist element: %m\n");
+               ERROR(list->ctx, "Could not allocate a new packagelist element: %m\n");
                return 1;
        }
 
index 3572dbb691cba29122984b2be728b9c24642082a..e910000af26f928dddaa6969c7e50ff7cac5c858 100644 (file)
@@ -122,7 +122,7 @@ int pakfire_packager_create(struct pakfire_packager** packager,
        // Set distribution
        const char* tag = pakfire_get_distro_tag(p->pakfire);
        if (!tag) {
-               CTX_ERROR(p->ctx, "Distribution tag is not configured: %m\n");
+               ERROR(p->ctx, "Distribution tag is not configured: %m\n");
                goto ERROR;
        }
 
@@ -131,14 +131,14 @@ int pakfire_packager_create(struct pakfire_packager** packager,
        // Fetch the hostname
        r = gethostname(hostname, sizeof(hostname));
        if (r) {
-               CTX_ERROR(p->ctx, "Could not determine the hostname: %m\n");
+               ERROR(p->ctx, "Could not determine the hostname: %m\n");
                goto ERROR;
        }
 
        // Set build host
        r = pakfire_package_set_string(pkg, PAKFIRE_PKG_BUILD_HOST, hostname);
        if (r) {
-               CTX_ERROR(p->ctx, "Could not set the hostname: %s\n", strerror(r));
+               ERROR(p->ctx, "Could not set the hostname: %s\n", strerror(r));
                goto ERROR;
        }
 
@@ -275,21 +275,21 @@ static int pakfire_packager_write_file_from_buffer(struct pakfire_packager* pack
        // Create a new file
        struct archive_entry* entry = pakfire_packager_create_file(packager, filename, size, mode);
        if (!entry) {
-               CTX_ERROR(packager->ctx, "Could not create file '%s'\n", filename);
+               ERROR(packager->ctx, "Could not create file '%s'\n", filename);
                return 1;
        }
 
        // This is the end of the header
        int r = archive_write_header(a, entry);
        if (r) {
-               CTX_ERROR(packager->ctx, "Error writing header: %s\n", archive_error_string(a));
+               ERROR(packager->ctx, "Error writing header: %s\n", archive_error_string(a));
                goto ERROR;
        }
 
        // Write content
        r = archive_write_data(a, buffer, strlen(buffer));
        if (r < 0) {
-               CTX_ERROR(packager->ctx, "Error writing data: %s\n", archive_error_string(a));
+               ERROR(packager->ctx, "Error writing data: %s\n", archive_error_string(a));
                goto ERROR;
        }
 
@@ -306,7 +306,7 @@ static int pakfire_packager_write_format(struct pakfire_packager* packager,
                struct archive* a) {
        const char buffer[] = TO_STRING(PACKAGE_FORMAT) "\n";
 
-       CTX_DEBUG(packager->ctx, "Writing package format\n");
+       DEBUG(packager->ctx, "Writing package format\n");
 
        int r = pakfire_packager_write_file_from_buffer(packager, a,
                "pakfire-format", 0444, buffer);
@@ -355,7 +355,7 @@ static int pakfire_packager_write_metadata(struct pakfire_packager* packager,
        if (!buffer)
                return 1;
 
-       CTX_DEBUG(packager->ctx, "Generated package metadata:\n%s\n", buffer);
+       DEBUG(packager->ctx, "Generated package metadata:\n%s\n", buffer);
 
        // Write buffer
        int r = pakfire_packager_write_file_from_buffer(packager, a,
@@ -375,7 +375,7 @@ static int pakfire_packager_write_scriptlet(struct pakfire_packager* packager,
        // Fetch type
        const char* type = pakfire_scriptlet_get_type(scriptlet);
 
-       CTX_DEBUG(packager->ctx, "Writing scriptlet '%s' to package\n", type);
+       DEBUG(packager->ctx, "Writing scriptlet '%s' to package\n", type);
 
        // Make filename
        r = pakfire_string_format(filename, ".scriptlets/%s", type);
@@ -440,7 +440,7 @@ int pakfire_packager_finish(struct pakfire_packager* packager, FILE* f) {
        // Start with the format file
        r = pakfire_packager_write_format(packager, a);
        if (r) {
-               CTX_ERROR(packager->ctx, "Could not add format file to archive: %s\n",
+               ERROR(packager->ctx, "Could not add format file to archive: %s\n",
                        archive_error_string(a));
                goto ERROR;
        }
@@ -448,7 +448,7 @@ int pakfire_packager_finish(struct pakfire_packager* packager, FILE* f) {
        // Write the metadata
        r = pakfire_packager_write_metadata(packager, a);
        if (r) {
-               CTX_ERROR(packager->ctx, "Could not add metadata file to archive: %s\n",
+               ERROR(packager->ctx, "Could not add metadata file to archive: %s\n",
                        archive_error_string(a));
                goto ERROR;
        }
@@ -457,7 +457,7 @@ int pakfire_packager_finish(struct pakfire_packager* packager, FILE* f) {
        for (unsigned int i = 0; i < packager->num_scriptlets; i++) {
                r = pakfire_packager_write_scriptlet(packager, a, packager->scriptlets[i]);
                if (r) {
-                       CTX_ERROR(packager->ctx, "Could not add scriptlet to the archive: %m\n");
+                       ERROR(packager->ctx, "Could not add scriptlet to the archive: %m\n");
                        goto ERROR;
                }
        }
@@ -497,7 +497,7 @@ int pakfire_packager_finish_to_directory(struct pakfire_packager* packager,
        // Get the filename of the package
        const char* filename = pakfire_packager_filename(packager);
        if (!filename) {
-               CTX_ERROR(packager->ctx, "Could not generate filename for package: %m\n");
+               ERROR(packager->ctx, "Could not generate filename for package: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -525,18 +525,18 @@ int pakfire_packager_finish_to_directory(struct pakfire_packager* packager,
        // Write the finished package
        r = pakfire_packager_finish(packager, f);
        if (r) {
-               CTX_ERROR(packager->ctx, "pakfire_packager_finish() failed: %m\n");
+               ERROR(packager->ctx, "pakfire_packager_finish() failed: %m\n");
                goto ERROR;
        }
 
        // Move the temporary file to destination
        r = rename(tmppath, path);
        if (r) {
-               CTX_ERROR(packager->ctx, "Could not move %s to %s: %m\n", tmppath, path);
+               ERROR(packager->ctx, "Could not move %s to %s: %m\n", tmppath, path);
                goto ERROR;
        }
 
-       CTX_DEBUG(packager->ctx, "Package written to %s\n", path);
+       DEBUG(packager->ctx, "Package written to %s\n", path);
 
        // Store result path if requested
        if (result) {
@@ -575,18 +575,18 @@ int pakfire_packager_add_file(struct pakfire_packager* packager, struct pakfire_
 
        // Files cannot have an empty path
        if (!path || !*path) {
-               CTX_ERROR(packager->ctx, "Cannot add a file with an empty path\n");
+               ERROR(packager->ctx, "Cannot add a file with an empty path\n");
                errno = EPERM;
                return 1;
 
        // Hidden files cannot be added
        } else if (*path == '.') {
-               CTX_ERROR(packager->ctx, "Hidden files cannot be added to a package: %s\n", path);
+               ERROR(packager->ctx, "Hidden files cannot be added to a package: %s\n", path);
                errno = EPERM;
                return 1;
        }
 
-       CTX_DEBUG(packager->ctx, "Adding file to payload: %s\n", path);
+       DEBUG(packager->ctx, "Adding file to payload: %s\n", path);
 
        // Detect the MIME type
        r = pakfire_file_detect_mimetype(file);
@@ -651,7 +651,7 @@ int pakfire_packager_add(struct pakfire_packager* packager,
        // Read everything
        r = archive_read_disk_entry_from_file(packager->reader, entry, -1, NULL);
        if (r) {
-               CTX_ERROR(packager->ctx, "Could not read %s: %s\n",
+               ERROR(packager->ctx, "Could not read %s: %s\n",
                        sourcepath, archive_error_string(packager->reader));
                r = -errno;
                goto ERROR;
@@ -660,7 +660,7 @@ int pakfire_packager_add(struct pakfire_packager* packager,
        // Create a new file object from the archive entry
        r = pakfire_file_create_from_archive_entry(&file, packager->pakfire, entry);
        if (r < 0) {
-               CTX_ERROR(packager->ctx, "Could not create file object: %s\n", strerror(-r));
+               ERROR(packager->ctx, "Could not create file object: %s\n", strerror(-r));
                goto ERROR;
        }
 
index cf47b02c48a8d591618cd5b85998c8ec300a2bb7..451b3713f62a2163a754995a2affc37d785634df 100644 (file)
@@ -187,7 +187,7 @@ static unsigned int pakfire_map_id(struct pakfire* pakfire,
 
        // Check if the ID is in range
        if (id > subid->length) {
-               CTX_ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
+               ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
                mapped_id = subid->id;
        }
 
@@ -205,7 +205,7 @@ static unsigned int pakfire_unmap_id(struct pakfire* pakfire,
 
        // Check if the ID is in range
        if (unmapped_id < 0) {
-               CTX_ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
+               ERROR(pakfire->ctx, "Mapped ID is out of range. Setting to %u\n", subid->id);
                unmapped_id = subid->id;
        }
 
@@ -215,7 +215,7 @@ static unsigned int pakfire_unmap_id(struct pakfire* pakfire,
 static void pool_log(Pool* pool, void* data, int type, const char* s) {
        struct pakfire* pakfire = (struct pakfire*)data;
 
-       CTX_DEBUG(pakfire->ctx, "pool: %s", s);
+       DEBUG(pakfire->ctx, "pool: %s", s);
 }
 
 static Id pakfire_handle_ns_pakfire(struct pakfire* pakfire, const char* name) {
@@ -241,7 +241,7 @@ static Id pakfire_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
        const char* namespace = pool_id2str(pool, ns);
        const char* name = pakfire_dep2str(pakfire, id);
 
-       CTX_DEBUG(pakfire->ctx, "Namespace callback called for %s(%s)\n", namespace, name);
+       DEBUG(pakfire->ctx, "Namespace callback called for %s(%s)\n", namespace, name);
 
        // Handle the pakfire() namespace
        if (strcmp(namespace, "pakfire") == 0)
@@ -263,11 +263,11 @@ static int pakfire_lock_running_kernel(struct pakfire* pakfire) {
        // Call uname()
        int r = uname(&utsname);
        if (r) {
-               CTX_ERROR(pakfire->ctx, "uname() failed: %m\n");
+               ERROR(pakfire->ctx, "uname() failed: %m\n");
                return r;
        }
 
-       CTX_DEBUG(pakfire->ctx, "Locking running kernel %s\n", utsname.release);
+       DEBUG(pakfire->ctx, "Locking running kernel %s\n", utsname.release);
 
        r = pakfire_string_format(buffer, "kernel(%s)", utsname.release);
        if (r)
@@ -392,7 +392,7 @@ static void pakfire_free(struct pakfire* pakfire) {
        if (repo) {
                r = pakfire_repo_clean(repo, PAKFIRE_REPO_CLEAN_FLAGS_DESTROY);
                if (r)
-                       CTX_ERROR(pakfire->ctx, "Could not cleanup %s repository: %m\n", PAKFIRE_REPO_COMMANDLINE);
+                       ERROR(pakfire->ctx, "Could not cleanup %s repository: %m\n", PAKFIRE_REPO_COMMANDLINE);
 
                pakfire_repo_unref(repo);
        }
@@ -401,7 +401,7 @@ static void pakfire_free(struct pakfire* pakfire) {
        if (pakfire->snapshot) {
                r = pakfire_snapshot_umount(pakfire->snapshot);
                if (r)
-                       CTX_ERROR(pakfire->ctx, "Could not umount the snapshot: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not umount the snapshot: %s\n", strerror(-r));
 
                pakfire_snapshot_unref(pakfire->snapshot);
        }
@@ -410,17 +410,17 @@ static void pakfire_free(struct pakfire* pakfire) {
        if (pakfire->internal_flags & PAKFIRE_UMOUNT_PATH) {
                r = umount2(pakfire->path, 0);
                if (r)
-                       CTX_ERROR(pakfire->ctx, "Could not umount ramdisk at %s: %m\n", pakfire->path);
+                       ERROR(pakfire->ctx, "Could not umount ramdisk at %s: %m\n", pakfire->path);
        }
 
        // Destroy path
        if (pakfire->internal_flags & PAKFIRE_DESTROY_ON_FREE) {
-               CTX_DEBUG(pakfire->ctx, "Destroying %s\n", pakfire->path);
+               DEBUG(pakfire->ctx, "Destroying %s\n", pakfire->path);
 
                // Destroy the temporary directory
                r = pakfire_rmtree(pakfire->path, 0);
                if (r)
-                       CTX_ERROR(pakfire->ctx, "Could not destroy %s: %s\n", pakfire->path, strerror(-r));
+                       ERROR(pakfire->ctx, "Could not destroy %s: %s\n", pakfire->path, strerror(-r));
        }
 
        pakfire_repo_free_all(pakfire);
@@ -445,7 +445,7 @@ static int pakfire_safety_checks(struct pakfire* pakfire) {
 
        // We must be root in order to operate in /
        if (pakfire->user.uid) {
-               CTX_ERROR(pakfire->ctx, "Must be running as root on /\n");
+               ERROR(pakfire->ctx, "Must be running as root on /\n");
                return -EPERM;
        }
 
@@ -486,7 +486,7 @@ static int pakfire_read_repo_config(struct pakfire* pakfire) {
        if (r)
                return r;
 
-       CTX_DEBUG(pakfire->ctx, "Reading repository configuration from %s\n", path);
+       DEBUG(pakfire->ctx, "Reading repository configuration from %s\n", path);
 
        // Open path
        DIR* dir = opendir(path);
@@ -496,7 +496,7 @@ static int pakfire_read_repo_config(struct pakfire* pakfire) {
                                return 0;
 
                        default:
-                               CTX_ERROR(pakfire->ctx, "Could not open %s: %m\n", path);
+                               ERROR(pakfire->ctx, "Could not open %s: %m\n", path);
                                return -errno;
                }
        }
@@ -593,7 +593,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (name) {
                r = pakfire_string_set(pakfire->distro.name, name);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro name: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro name: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -603,7 +603,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (id) {
                r = pakfire_string_set(pakfire->distro.id, id);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro ID: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro ID: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -613,7 +613,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (version_id) {
                r = pakfire_string_set(pakfire->distro.version_id, version_id);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro version ID: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro version ID: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -623,7 +623,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (codename) {
                r = pakfire_string_set(pakfire->distro.version_codename, codename);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro codename: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro codename: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -633,13 +633,13 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
                r = pakfire_string_format(pakfire->distro.version, "%s (%s)",
                                pakfire->distro.version_id, pakfire->distro.version_codename);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
                        return r;
                }
        } else {
                r = pakfire_string_set(pakfire->distro.version, pakfire->distro.version_id);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro version: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -648,7 +648,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        r = pakfire_string_format(pakfire->distro.pretty_name, "%s %s",
                        pakfire->distro.name, pakfire->distro.version);
        if (r < 0) {
-               CTX_ERROR(pakfire->ctx, "Could not set distro pretty name: %s\n", strerror(-r));
+               ERROR(pakfire->ctx, "Could not set distro pretty name: %s\n", strerror(-r));
                return r;
        }
 
@@ -657,7 +657,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (vendor) {
                r = pakfire_string_set(pakfire->distro.vendor, vendor);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro vendor: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro vendor: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -667,7 +667,7 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        if (slogan) {
                r = pakfire_string_set(pakfire->distro.slogan, slogan);
                if (r < 0) {
-                       CTX_ERROR(pakfire->ctx, "Could not set distro slogan: %s\n", strerror(-r));
+                       ERROR(pakfire->ctx, "Could not set distro slogan: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -692,7 +692,7 @@ static int pakfire_read_os_release(struct pakfire* pakfire, const char* path) {
                                return 0;
 
                        default:
-                               CTX_ERROR(pakfire->ctx, "Could not read /etc/os-release: %s\n", strerror(-r));
+                               ERROR(pakfire->ctx, "Could not read /etc/os-release: %s\n", strerror(-r));
                                break;
                }
        }
@@ -809,14 +809,14 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        if (path) {
                // Check that we don't have path set when using snapshots
                if (flags & PAKFIRE_USE_SNAPSHOT) {
-                       CTX_ERROR(ctx, "Cannot use path with snapshots\n");
+                       ERROR(ctx, "Cannot use path with snapshots\n");
                        r = -EINVAL;
                        goto ERROR;
                }
 
                // Path must be absolute
                if (!pakfire_string_startswith(path, "/")) {
-                       CTX_ERROR(ctx, "Invalid path: %s\n", path);
+                       ERROR(ctx, "Invalid path: %s\n", path);
                        r = -EINVAL;
                        goto ERROR;
                }
@@ -844,7 +844,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        // Determine the effective architecture
        p->arches.effective = pakfire_arch_is_supported_by_host(arch);
        if (!p->arches.effective) {
-               CTX_ERROR(p->ctx, "Unsupported architecture: %s\n", arch);
+               ERROR(p->ctx, "Unsupported architecture: %s\n", arch);
                r = -ENOTSUP;
                goto ERROR;
        }
@@ -852,7 +852,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        // Setup user/group
        r = pakfire_setup_user(p);
        if (r < 0) {
-               CTX_ERROR(p->ctx, "Could not parse user information: %s\n", strerror(-r));
+               ERROR(p->ctx, "Could not parse user information: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -869,7 +869,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        if (conf) {
                r = pakfire_config_read(p->config, conf);
                if (r < 0) {
-                       CTX_ERROR(p->ctx, "Could not read configuration: %s\n", strerror(-r));
+                       ERROR(p->ctx, "Could not read configuration: %s\n", strerror(-r));
                        goto ERROR;
                }
        }
@@ -877,7 +877,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        // Import distro configuration
        r = pakfire_config_import_distro(p);
        if (r < 0) {
-               CTX_ERROR(p->ctx, "Could not parse distribution from configuration: %s\n", strerror(-r));
+               ERROR(p->ctx, "Could not parse distribution from configuration: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -896,7 +896,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
        // Set cache path
        r = pakfire_set_cache_path(p);
        if (r < 0) {
-               CTX_ERROR(p->ctx, "Could not set cache path: %m\n");
+               ERROR(p->ctx, "Could not set cache path: %m\n");
                goto ERROR;
        }
 
@@ -905,7 +905,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
                // Find the most recent snapshot
                r = pakfire_snapshot_find(&p->snapshot, p);
                if (r < 0) {
-                       CTX_ERROR(p->ctx, "Could not find a snapshot: %s\n", strerror(-r));
+                       ERROR(p->ctx, "Could not find a snapshot: %s\n", strerror(-r));
                        goto ERROR;
                }
        }
@@ -927,7 +927,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
                if (p->snapshot) {
                        r = pakfire_snapshot_mount(p->snapshot, path);
                        if (r < 0) {
-                               CTX_ERROR(p->ctx, "Could not mount snapshot: %s\n", strerror(-r));
+                               ERROR(p->ctx, "Could not mount snapshot: %s\n", strerror(-r));
                                goto ERROR;
                        }
 
@@ -935,7 +935,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
                } else {
                        r = mount("pakfire_root", path, "tmpfs", 0, NULL);
                        if (r) {
-                               CTX_ERROR(p->ctx, "Could not mount tmpfs: %m\n");
+                               ERROR(p->ctx, "Could not mount tmpfs: %m\n");
                                r = -errno;
                                goto ERROR;
                        }
@@ -967,32 +967,32 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
                        goto ERROR;
        }
 
-       CTX_DEBUG(p->ctx, "Pakfire initialized at %p\n", p);
-       CTX_DEBUG(p->ctx, "  user   = %s (%u)\n", p->user.name, p->user.uid);
-       CTX_DEBUG(p->ctx, "  group  = %s (%u)\n", p->group.name, p->group.gid);
-       CTX_DEBUG(p->ctx, "  arch   = %s (%s)\n", pakfire_get_arch(p), pakfire_get_effective_arch(p));
-       CTX_DEBUG(p->ctx, "  path   = %s\n", pakfire_get_path(p));
+       DEBUG(p->ctx, "Pakfire initialized at %p\n", p);
+       DEBUG(p->ctx, "  user   = %s (%u)\n", p->user.name, p->user.uid);
+       DEBUG(p->ctx, "  group  = %s (%u)\n", p->group.name, p->group.gid);
+       DEBUG(p->ctx, "  arch   = %s (%s)\n", pakfire_get_arch(p), pakfire_get_effective_arch(p));
+       DEBUG(p->ctx, "  path   = %s\n", pakfire_get_path(p));
        if (p->user.subuids.id)
-               CTX_DEBUG(p->ctx, "  subuid = %u (%zu)\n", p->user.subuids.id, p->user.subuids.length);
+               DEBUG(p->ctx, "  subuid = %u (%zu)\n", p->user.subuids.id, p->user.subuids.length);
        if (p->group.subgids.id)
-               CTX_DEBUG(p->ctx, "  subgid = %u (%zu)\n", p->group.subgids.id, p->group.subgids.length);
+               DEBUG(p->ctx, "  subgid = %u (%zu)\n", p->group.subgids.id, p->group.subgids.length);
 
        // Dump distribution configuration
-       CTX_DEBUG(p->ctx, "  Distribution: %s\n", p->distro.pretty_name);
-       CTX_DEBUG(p->ctx, "    name       = %s\n", p->distro.name);
-       CTX_DEBUG(p->ctx, "    id         = %s\n", p->distro.id);
-       CTX_DEBUG(p->ctx, "    version    = %s\n", p->distro.version);
-       CTX_DEBUG(p->ctx, "    version_id = %s\n", p->distro.version_id);
+       DEBUG(p->ctx, "  Distribution: %s\n", p->distro.pretty_name);
+       DEBUG(p->ctx, "    name       = %s\n", p->distro.name);
+       DEBUG(p->ctx, "    id         = %s\n", p->distro.id);
+       DEBUG(p->ctx, "    version    = %s\n", p->distro.version);
+       DEBUG(p->ctx, "    version_id = %s\n", p->distro.version_id);
        if (*p->distro.version_codename)
-               CTX_DEBUG(p->ctx, "    codename   = %s\n", p->distro.version_codename);
+               DEBUG(p->ctx, "    codename   = %s\n", p->distro.version_codename);
        if (*p->distro.vendor)
-               CTX_DEBUG(p->ctx, "    vendor     = %s\n", p->distro.vendor);
+               DEBUG(p->ctx, "    vendor     = %s\n", p->distro.vendor);
        if (*p->distro.slogan)
-               CTX_DEBUG(p->ctx, "    slogan     = %s\n", p->distro.slogan);
+               DEBUG(p->ctx, "    slogan     = %s\n", p->distro.slogan);
 
        // Check if the distribution has been configured
        if (!*p->distro.id || !*p->distro.version_id) {
-               CTX_ERROR(p->ctx, "Invalid distribution configuration\n");
+               ERROR(p->ctx, "Invalid distribution configuration\n");
                r = -EINVAL;
                goto ERROR;
        }
@@ -1082,7 +1082,7 @@ int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length,
 
        // Check if path is set
        if (!*pakfire->path) {
-               CTX_ERROR(pakfire->ctx, "pakfire_path() called without path being set\n");
+               ERROR(pakfire->ctx, "pakfire_path() called without path being set\n");
                return -ENOTSUP;
        }
 
@@ -1335,7 +1335,7 @@ int pakfire_commandline_add(struct pakfire* pakfire, const char* path,
        // Find the commandline repository
        repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_COMMANDLINE);
        if (!repo) {
-               CTX_ERROR(pakfire->ctx, "Could not find the commandline repository: %m\n");
+               ERROR(pakfire->ctx, "Could not find the commandline repository: %m\n");
                return 1;
        }
 
@@ -1533,16 +1533,16 @@ static const char* pakfire_user_lookup(void* data, la_int64_t uid) {
        if (uid == 0)
                return "root";
 
-       CTX_DEBUG(pakfire->ctx, "Looking up name for UID %ld\n", uid);
+       DEBUG(pakfire->ctx, "Looking up name for UID %ld\n", uid);
 
        // Find a matching entry in /etc/passwd
        struct passwd* entry = pakfire_getpwuid(pakfire, uid);
        if (!entry) {
-               CTX_ERROR(pakfire->ctx, "Could not retrieve uname for %ld: %m\n", uid);
+               ERROR(pakfire->ctx, "Could not retrieve uname for %ld: %m\n", uid);
                return 0;
        }
 
-       CTX_DEBUG(pakfire->ctx, "Mapping UID %ld to %s\n", uid, entry->pw_name);
+       DEBUG(pakfire->ctx, "Mapping UID %ld to %s\n", uid, entry->pw_name);
 
        return entry->pw_name;
 }
@@ -1557,16 +1557,16 @@ static const char* pakfire_group_lookup(void* data, la_int64_t gid) {
        if (gid == 0)
                return "root";
 
-       CTX_DEBUG(pakfire->ctx, "Looking up name for GID %ld\n", gid);
+       DEBUG(pakfire->ctx, "Looking up name for GID %ld\n", gid);
 
        // Find a matching entry in /etc/group
        struct group* entry = pakfire_getgrgid(pakfire, gid);
        if (!entry) {
-               CTX_ERROR(pakfire->ctx, "Could not retrieve gname for %ld: %m\n", gid);
+               ERROR(pakfire->ctx, "Could not retrieve gname for %ld: %m\n", gid);
                return 0;
        }
 
-       CTX_DEBUG(pakfire->ctx, "Mapping GID %ld to %s\n", gid, entry->gr_name);
+       DEBUG(pakfire->ctx, "Mapping GID %ld to %s\n", gid, entry->gr_name);
 
        return entry->gr_name;
 }
@@ -1578,14 +1578,14 @@ struct archive* pakfire_get_disk_reader(struct pakfire* pakfire) {
        // Create a new reader
        reader = archive_read_disk_new();
        if (!reader) {
-               CTX_ERROR(pakfire->ctx, "Could not set up reader: %m\n");
+               ERROR(pakfire->ctx, "Could not set up reader: %m\n");
                return NULL;
        }
 
        // Do not read fflags
        r = archive_read_disk_set_behavior(reader, ARCHIVE_READDISK_NO_FFLAGS);
        if (r) {
-               CTX_ERROR(pakfire->ctx, "Could not change behavior of reader: %s\n",
+               ERROR(pakfire->ctx, "Could not change behavior of reader: %s\n",
                        archive_error_string(reader));
                goto ERROR;
        }
@@ -1614,16 +1614,16 @@ static la_int64_t pakfire_uid_lookup(void* data, const char* name, la_int64_t ui
        if (strcmp(name, "root") == 0)
                goto ERROR;
 
-       CTX_DEBUG(pakfire->ctx, "Looking up UID for '%s' (%ld)\n", name, uid);
+       DEBUG(pakfire->ctx, "Looking up UID for '%s' (%ld)\n", name, uid);
 
        // Find a matching entry in /etc/passwd
        struct passwd* entry = pakfire_getpwnam(pakfire, name);
        if (!entry) {
-               CTX_ERROR(pakfire->ctx, "Could not retrieve UID for '%s': %m\n", name);
+               ERROR(pakfire->ctx, "Could not retrieve UID for '%s': %m\n", name);
                goto ERROR;
        }
 
-       CTX_DEBUG(pakfire->ctx, "Mapping %s to UID %u\n", name, entry->pw_uid);
+       DEBUG(pakfire->ctx, "Mapping %s to UID %u\n", name, entry->pw_uid);
 
        return pakfire_map_id(pakfire, &pakfire->user.subuids, entry->pw_uid);
 
@@ -1643,16 +1643,16 @@ static la_int64_t pakfire_gid_lookup(void* data, const char* name, la_int64_t gi
        if (strcmp(name, "root") == 0)
                goto ERROR;
 
-       CTX_DEBUG(pakfire->ctx, "Looking up GID for '%s' (%ld)\n", name, gid);
+       DEBUG(pakfire->ctx, "Looking up GID for '%s' (%ld)\n", name, gid);
 
        // Find a matching entry in /etc/group
        struct group* entry = pakfire_getgrnam(pakfire, name);
        if (!entry) {
-               CTX_ERROR(pakfire->ctx, "Could not retrieve GID for '%s': %m\n", name);
+               ERROR(pakfire->ctx, "Could not retrieve GID for '%s': %m\n", name);
                goto ERROR;
        }
 
-       CTX_DEBUG(pakfire->ctx, "Mapping %s to GID %u\n", name, entry->gr_gid);
+       DEBUG(pakfire->ctx, "Mapping %s to GID %u\n", name, entry->gr_gid);
 
        return pakfire_map_id(pakfire, &pakfire->group.subgids, entry->gr_gid);
 
@@ -1675,7 +1675,7 @@ struct archive* pakfire_get_disk_writer(struct pakfire* pakfire) {
                // Create a new writer
                pakfire->writer = archive_write_disk_new();
                if (!pakfire->writer) {
-                       CTX_ERROR(pakfire->ctx, "Could not set up writer: %m\n");
+                       ERROR(pakfire->ctx, "Could not set up writer: %m\n");
                        return NULL;
                }
 
index 6d2301832d35c67f44a1a92870fcb1970ae9b240..b2fed50b9c640e0e27eacc49a78086bd7ed248db 100644 (file)
@@ -182,9 +182,9 @@ static struct pakfire_parser_declaration* pakfire_parser_get_declaration(
 
 #ifdef PAKFIRE_DEBUG_PARSER
        if (*namespace)
-               CTX_DEBUG(parser->ctx, "%p: Looking up %s.%s\n", parser, namespace, name);
+               DEBUG(parser->ctx, "%p: Looking up %s.%s\n", parser, namespace, name);
        else
-               CTX_DEBUG(parser->ctx, "%p: Looking up %s\n", parser, name);
+               DEBUG(parser->ctx, "%p: Looking up %s\n", parser, name);
 #endif /* PAKFIRE_DEBUG_PARSER */
 
        struct pakfire_parser_declaration* d;
@@ -196,7 +196,7 @@ static struct pakfire_parser_declaration* pakfire_parser_get_declaration(
                // Return if namespace and name match
                if ((strcmp(d->namespace, namespace) == 0) && (strcmp(d->name, name) == 0)) {
 #ifdef PAKFIRE_DEBUG_PARSER
-                       CTX_DEBUG(parser->ctx, "%p: Found result = %s\n", parser, d->value);
+                       DEBUG(parser->ctx, "%p: Found result = %s\n", parser, d->value);
 #endif /* PAKFIRE_DEBUG_PARSER */
 
                        return d;
@@ -204,7 +204,7 @@ static struct pakfire_parser_declaration* pakfire_parser_get_declaration(
        }
 
 #ifdef PAKFIRE_DEBUG_PARSER
-       CTX_DEBUG(parser->ctx, "%p: Nothing found\n", parser);
+       DEBUG(parser->ctx, "%p: Nothing found\n", parser);
 #endif /* PAKFIRE_DEBUG_PARSER */
 
        return NULL;
@@ -308,7 +308,7 @@ int pakfire_parser_set(struct pakfire_parser* parser,
                if (flags)
                        d->flags = flags;
 
-               CTX_DEBUG(parser->ctx, "%p: Updated declaration: %s.%s = %s\n",
+               DEBUG(parser->ctx, "%p: Updated declaration: %s.%s = %s\n",
                        parser, d->namespace, d->name, d->value);
 
                // All done
@@ -331,7 +331,7 @@ int pakfire_parser_set(struct pakfire_parser* parser,
        // Import flags
        d->flags = flags;
 
-       CTX_DEBUG(parser->ctx, "%p: New declaration (%u): %s.%s %s= %s\n",
+       DEBUG(parser->ctx, "%p: New declaration (%u): %s.%s %s= %s\n",
                parser,
                d->flags,
                d->namespace,
@@ -355,7 +355,7 @@ int pakfire_parser_apply_declaration(struct pakfire_parser* parser,
 
 static int pakfire_parser_find_template(struct pakfire_parser* parser,
                char* template, const size_t length, const char* namespace) {
-       CTX_DEBUG(parser->ctx, "Looking up template in namespace '%s'\n", namespace);
+       DEBUG(parser->ctx, "Looking up template in namespace '%s'\n", namespace);
 
        struct pakfire_parser_declaration* d = pakfire_parser_get_declaration(
                        parser, namespace, "template");
@@ -410,7 +410,7 @@ int pakfire_parser_append(struct pakfire_parser* parser,
        // Fetch the value of the current declaration
        const char* old_value = pakfire_parser_get_raw(parser, namespace, name);
 
-       CTX_DEBUG(parser->ctx, "%p: Old value for %s.%s = %s\n",
+       DEBUG(parser->ctx, "%p: Old value for %s.%s = %s\n",
                parser, namespace, name, old_value);
 
        // Set the new value when there is no old one
@@ -436,7 +436,7 @@ static int pakfire_parser_expand_commands(struct pakfire_parser* parser, char**
        PCRE2_UCHAR* pattern = NULL;
        PCRE2_SIZE pattern_length;
 
-       CTX_DEBUG(parser->ctx, "Searching for commands in:\n%s\n", *buffer);
+       DEBUG(parser->ctx, "Searching for commands in:\n%s\n", *buffer);
 
        // Allocate memory for results
        pcre2_match_data* match = pcre2_match_data_create_from_pattern(
@@ -454,7 +454,7 @@ static int pakfire_parser_expand_commands(struct pakfire_parser* parser, char**
 
                // End loop when we have expanded all variables
                if (r == PCRE2_ERROR_NOMATCH) {
-                       CTX_DEBUG(parser->ctx, "No (more) matches found\n");
+                       DEBUG(parser->ctx, "No (more) matches found\n");
                        r = 0;
                        break;
                }
@@ -465,7 +465,7 @@ static int pakfire_parser_expand_commands(struct pakfire_parser* parser, char**
                        goto ERROR;
 
 #ifdef PAKFIRE_DEBUG_PARSER
-               CTX_DEBUG(parser->ctx, "Expanding command: %s\n", command);
+               DEBUG(parser->ctx, "Expanding command: %s\n", command);
 #endif /* PAKFIRE_DEBUG_PARSER */
 
                // Update argv
@@ -479,7 +479,7 @@ static int pakfire_parser_expand_commands(struct pakfire_parser* parser, char**
                r = pakfire_jail_run(parser->pakfire, argv, 0, &output, &length);
                if (r) {
                        // Just log this and continue
-                       CTX_DEBUG(parser->ctx, "Command '%s' failed with return code %d\n", command, r);
+                       DEBUG(parser->ctx, "Command '%s' failed with return code %d\n", command, r);
                }
 
                // Strip newline from output
@@ -558,7 +558,7 @@ static int pakfire_parser_expand_variables(struct pakfire_parser* parser,
 
                // End loop when we have expanded all variables
                if (r == PCRE2_ERROR_NOMATCH) {
-                       CTX_DEBUG(parser->ctx, "No (more) matches found in: %s\n", *buffer);
+                       DEBUG(parser->ctx, "No (more) matches found in: %s\n", *buffer);
                        r = 0;
                        break;
                }
@@ -574,7 +574,7 @@ static int pakfire_parser_expand_variables(struct pakfire_parser* parser,
                        goto ERROR;
 
 #ifdef PAKFIRE_DEBUG_PARSER
-               CTX_DEBUG(parser->ctx, "Expanding variable: %s\n", variable);
+               DEBUG(parser->ctx, "Expanding variable: %s\n", variable);
 #endif /* PAKFIRE_DEBUG_PARSER */
 
                // Search for a declaration of this variable
@@ -582,7 +582,7 @@ static int pakfire_parser_expand_variables(struct pakfire_parser* parser,
 
                // Is this a recursive pattern?
                if (repl && pakfire_string_matches(repl, (const char*)pattern)) {
-                       CTX_DEBUG(parser->ctx, "Recursion detected in %s\n", pattern);
+                       DEBUG(parser->ctx, "Recursion detected in %s\n", pattern);
 
                        // Move up one step and lookup there
                        if (namespace && *namespace) {
@@ -600,9 +600,9 @@ static int pakfire_parser_expand_variables(struct pakfire_parser* parser,
 #ifdef PAKFIRE_DEBUG_PARSER
                // What is its value?
                if (repl) {
-                       CTX_DEBUG(parser->ctx, "Replacing %%{%s} with '%s'\n", variable, repl);
+                       DEBUG(parser->ctx, "Replacing %%{%s} with '%s'\n", variable, repl);
                } else {
-                       CTX_DEBUG(parser->ctx, "Replacing %%{%s} with an empty string\n", variable);
+                       DEBUG(parser->ctx, "Replacing %%{%s} with an empty string\n", variable);
                }
 #endif /* PAKFIRE_DEBUG_PARSER */
 
@@ -653,14 +653,14 @@ char* pakfire_parser_expand(struct pakfire_parser* parser,
        // Compile all regular expressions
        int r = pakfire_parser_compile_regexes(parser);
        if (r) {
-               CTX_DEBUG(parser->ctx, "Could not compile regular expressions: %m\n");
+               DEBUG(parser->ctx, "Could not compile regular expressions: %m\n");
                goto ERROR;
        }
 
        // Expand all variables
        r = pakfire_parser_expand_variables(parser, namespace, &buffer);
        if (r) {
-               CTX_DEBUG(parser->ctx, "Failed to expand variables in '%s': %m\n", value);
+               DEBUG(parser->ctx, "Failed to expand variables in '%s': %m\n", value);
                goto ERROR;
        }
 
@@ -668,7 +668,7 @@ char* pakfire_parser_expand(struct pakfire_parser* parser,
        if (parser->flags & PAKFIRE_PARSER_FLAGS_EXPAND_COMMANDS) {
                r = pakfire_parser_expand_commands(parser, &buffer);
                if (r) {
-                       CTX_DEBUG(parser->ctx, "Failed to expand commands in '%s': %m\n", value);
+                       DEBUG(parser->ctx, "Failed to expand commands in '%s': %m\n", value);
                        goto ERROR;
                }
        }
@@ -773,7 +773,7 @@ char** pakfire_parser_list_namespaces(struct pakfire_parser* parser,
 
                        // Check for any errors
                        else if (r > 0) {
-                               CTX_ERROR(parser->ctx, "fnmatch failed: %m\n");
+                               ERROR(parser->ctx, "fnmatch failed: %m\n");
                                if (namespaces)
                                        free(namespaces);
 
@@ -815,7 +815,7 @@ int pakfire_parser_merge(struct pakfire_parser* parser1, struct pakfire_parser*
        char* value = NULL;
        int r;
 
-       CTX_DEBUG(parser1->ctx, "Merging parsers %p and %p\n", parser1, parser2);
+       DEBUG(parser1->ctx, "Merging parsers %p and %p\n", parser1, parser2);
 
        if (!parser2) {
                errno = EINVAL;
@@ -895,7 +895,7 @@ int pakfire_parser_read(struct pakfire_parser* parser, FILE* f,
 
 int pakfire_parser_read_file(struct pakfire_parser* parser, const char* path,
                struct pakfire_parser_error** error) {
-       CTX_DEBUG(parser->ctx, "Parsing %s...\n", path);
+       DEBUG(parser->ctx, "Parsing %s...\n", path);
 
        FILE* f = fopen(path, "r");
        if (!f)
@@ -948,7 +948,7 @@ int pakfire_parser_set_namespace(struct pakfire_parser* parser, const char* name
        else
                parser->namespace = NULL;
 
-       CTX_DEBUG(parser->ctx, "%p: Set namespace to: %s\n", parser, parser->namespace);
+       DEBUG(parser->ctx, "%p: Set namespace to: %s\n", parser, parser->namespace);
 
        return 0;
 }
@@ -1008,19 +1008,19 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
        char* deps = NULL;
        char* build_arches = NULL;
 
-       CTX_DEBUG(parser->ctx, "Building package from namespace '%s'\n", namespace);
+       DEBUG(parser->ctx, "Building package from namespace '%s'\n", namespace);
 
        // Fetch name
        name = pakfire_parser_get(parser, namespace, "name");
        if (!name || !*name) {
-               CTX_ERROR(parser->ctx, "Name is empty\n");
+               ERROR(parser->ctx, "Name is empty\n");
                goto CLEANUP;
        }
 
        // Fetch EVR
        evr = pakfire_parser_get(parser, namespace, "evr");
        if (!evr || !*evr) {
-               CTX_ERROR(parser->ctx, "EVR is empty\n");
+               ERROR(parser->ctx, "EVR is empty\n");
                goto CLEANUP;
        }
 
@@ -1032,7 +1032,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
                        if (!arch)
                                goto CLEANUP;
                } else {
-                       CTX_ERROR(parser->ctx, "Arch is empty\n");
+                       ERROR(parser->ctx, "Arch is empty\n");
                        goto CLEANUP;
                }
        }
@@ -1040,7 +1040,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
        // Create a new package object
        r = pakfire_package_create(pkg, parser->pakfire, repo, name, evr, arch);
        if (r) {
-               CTX_ERROR(parser->ctx, "Could not create package: %m\n");
+               ERROR(parser->ctx, "Could not create package: %m\n");
                goto CLEANUP;
        }
 
@@ -1050,7 +1050,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
        // Assign a new UUID to this package
        char* uuid = pakfire_generate_uuid();
        if (!uuid) {
-               CTX_ERROR(parser->ctx, "Generating a UUID failed: %m\n");
+               ERROR(parser->ctx, "Generating a UUID failed: %m\n");
                goto CLEANUP;
        }
 
@@ -1086,7 +1086,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
                free(value);
 
                if (r) {
-                       CTX_ERROR(parser->ctx, "Could not set %s: %m\n", a->name);
+                       ERROR(parser->ctx, "Could not set %s: %m\n", a->name);
                        goto CLEANUP;
                }
        }
@@ -1125,7 +1125,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
 
 CLEANUP:
        if (r)
-               CTX_ERROR(parser->ctx, "Could not create package: %m\n");
+               ERROR(parser->ctx, "Could not create package: %m\n");
 
        if (name)
                free(name);
index 2826f3a5868000f0eea6fa051faa59843d8bb78d..52a58d5a483b529473f1fb0726b67ae374999c9a 100644 (file)
@@ -82,13 +82,13 @@ static void yyerror(yyscan_t* scanner, struct pakfire_ctx* ctx, struct pakfire*
                struct pakfire_parser_error** error, const char* s) {
        const struct pakfire_parser_state* state = yyget_extra(scanner);
 
-       CTX_ERROR(ctx, "Error (line %u): %s\n", state->lineno, s);
+       ERROR(ctx, "Error (line %u): %s\n", state->lineno, s);
 
        // Create a new error object
        if (error) {
                int r = pakfire_parser_error_create(error, *parser, NULL, state->lineno, s);
                if (r) {
-                       CTX_ERROR(ctx, "Could not create error object: %s\n", strerror(errno));
+                       ERROR(ctx, "Could not create error object: %s\n", strerror(errno));
                }
        }
 }
@@ -424,7 +424,7 @@ int pakfire_parser_parse_data(struct pakfire_parser* parent, const char* data, s
        struct pakfire_ctx* ctx = pakfire_ctx(pakfire);
 
 #ifdef ENABLE_DEBUG
-       CTX_DEBUG(ctx, "Parsing the following data (%zu):\n%.*s\n", len, (int)len, data);
+       DEBUG(ctx, "Parsing the following data (%zu):\n%.*s\n", len, (int)len, data);
 
        // Save start time
        clock_t t_start = clock();
@@ -459,10 +459,10 @@ int pakfire_parser_parse_data(struct pakfire_parser* parent, const char* data, s
        // Log what we have in the parent parser now
        dump = pakfire_parser_dump(parent);
        if (dump)
-               CTX_DEBUG(ctx, "Status of the parser %p:\n%s\n", parent, dump);
+               DEBUG(ctx, "Status of the parser %p:\n%s\n", parent, dump);
 
        // Log time we needed to parse data
-       CTX_DEBUG(ctx, "Parser finished in %.4fms\n",
+       DEBUG(ctx, "Parser finished in %.4fms\n",
                (double)(t_end - t_start) * 1000 / CLOCKS_PER_SEC);
 #endif
 
@@ -482,13 +482,13 @@ static struct pakfire_parser* make_if_stmt(struct pakfire_ctx* ctx, const enum o
                const char* val1, const char* val2, struct pakfire_parser* if_block, struct pakfire_parser* else_block) {
        switch (op) {
                case OP_EQUALS:
-                       CTX_DEBUG(ctx, "Evaluating if statement: %s == %s?\n", val1, val2);
+                       DEBUG(ctx, "Evaluating if statement: %s == %s?\n", val1, val2);
                        break;
        }
 
        struct pakfire_parser* parent = pakfire_parser_get_parent(if_block);
 
-       CTX_DEBUG(ctx, "  parent = %p, if = %p, else = %p\n", parent, if_block, else_block);
+       DEBUG(ctx, "  parent = %p, if = %p, else = %p\n", parent, if_block, else_block);
 
        // Expand values
        char* v1 = pakfire_parser_expand(parent, NULL, val1);
@@ -498,7 +498,7 @@ static struct pakfire_parser* make_if_stmt(struct pakfire_ctx* ctx, const enum o
 
        switch (op) {
                case OP_EQUALS:
-                       CTX_DEBUG(ctx, "  '%s' == '%s'?\n", v1, v2);
+                       DEBUG(ctx, "  '%s' == '%s'?\n", v1, v2);
 
                        if (strcmp(v1, v2) == 0)
                                result = if_block;
index dc876bad66eef58b027a10085a6c20fd84812dea..7ff69caa89782b8cb2856faf662406a521060f0e 100644 (file)
@@ -302,7 +302,7 @@ PAKFIRE_EXPORT struct pakfire_solution** pakfire_problem_get_solutions(
        return solutions;
 
 ERROR:
-       CTX_ERROR(problem->ctx, "Could not import solutions: %s\n", strerror(r));
+       ERROR(problem->ctx, "Could not import solutions: %s\n", strerror(r));
 
        if (solutions) {
                for (struct pakfire_solution** s = solutions; *s; s++)
index 6c3a00beb93bff90831fe62b2fd12fac68a1bdab..2e3b6883d167cbd040bd248a184c222628910911 100644 (file)
@@ -90,7 +90,7 @@ static int pakfire_progress_default_start_callback(struct pakfire_ctx* ctx,
 
        // Log the title
        if (title)
-               CTX_INFO(ctx, "%s\n", title);
+               INFO(ctx, "%s\n", title);
 
        return 0;
 }
index 7256d89619b5ccde3fd599237ceaf678235f61d9..0025380ea5ff0c333594db0ad422b366ff2926d5 100644 (file)
@@ -116,11 +116,11 @@ static int pakfire_pty_store_output(struct pakfire_pty* pty) {
        // Stat the buffer
        r = fstat(pty->stdout.fd, &buffer);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not stat the output buffer: %m\n");
+               ERROR(pty->ctx, "Could not stat the output buffer: %m\n");
                return -errno;
        }
 
-       CTX_DEBUG(pty->ctx, "Read %jd byte(s) of output\n", buffer.st_size);
+       DEBUG(pty->ctx, "Read %jd byte(s) of output\n", buffer.st_size);
 
        // Don't try to map an empty buffer
        if (!buffer.st_size)
@@ -129,7 +129,7 @@ static int pakfire_pty_store_output(struct pakfire_pty* pty) {
        // Map the output into memory
        pty->output.iov_base = mmap(NULL, buffer.st_size, PROT_READ, MAP_SHARED, pty->stdout.fd, 0);
        if (pty->output.iov_base == MAP_FAILED) {
-               CTX_ERROR(pty->ctx, "Could not map the output into memory: %m\n");
+               ERROR(pty->ctx, "Could not map the output into memory: %m\n");
                return -errno;
        }
 
@@ -151,14 +151,14 @@ static int pakfire_pty_same_inode(struct pakfire_pty* pty, int fd1, int fd2) {
        // Stat the first file descriptor
        r = fstat(fd1, &stat1);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not stat fd %d: %m\n", fd1);
+               ERROR(pty->ctx, "Could not stat fd %d: %m\n", fd1);
                return -errno;
        }
 
        // Stat the second file descriptor
        r = fstat(fd2, &stat2);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not stat fd %d: %m\n", fd2);
+               ERROR(pty->ctx, "Could not stat fd %d: %m\n", fd2);
                return -errno;
        }
 
@@ -182,7 +182,7 @@ static int pakfire_pty_restore_attrs(struct pakfire_pty* pty,
        // Fetch the flags
        flags = fcntl(stdio->fd, F_GETFL, 0);
        if (flags < 0) {
-               CTX_ERROR(pty->ctx, "Could not set flags for file descriptor %d: %s\n",
+               ERROR(pty->ctx, "Could not set flags for file descriptor %d: %s\n",
                        stdio->fd, strerror(errno));
                return -errno;
        }
@@ -190,7 +190,7 @@ static int pakfire_pty_restore_attrs(struct pakfire_pty* pty,
        // Turn on non-blocking mode again
        r = fcntl(stdio->fd, F_SETFL, flags & ~O_NONBLOCK);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not set flags for file descriptor %d: %s\n",
+               ERROR(pty->ctx, "Could not set flags for file descriptor %d: %s\n",
                        stdio->fd, strerror(errno));
                return -errno;
        }
@@ -199,7 +199,7 @@ static int pakfire_pty_restore_attrs(struct pakfire_pty* pty,
        if (stdio->attrs_saved) {
                r = tcsetattr(stdio->fd, TCSANOW, &stdio->attrs);
                if (r) {
-                       CTX_ERROR(pty->ctx, "Could not restore terminal attributes for %d, ignoring: %s\n",
+                       ERROR(pty->ctx, "Could not restore terminal attributes for %d, ignoring: %s\n",
                                stdio->fd, strerror(errno));
                        return -errno;
                }
@@ -226,7 +226,7 @@ static int pakfire_pty_store_attrs(struct pakfire_pty* pty,
                                return 0;
 
                        default:
-                               CTX_ERROR(pty->ctx, "Could not fetch terminal attributes from fd %d: %s\n",
+                               ERROR(pty->ctx, "Could not fetch terminal attributes from fd %d: %s\n",
                                        stdio->fd, strerror(errno));
 
                                return -errno;
@@ -282,7 +282,7 @@ static int pakfire_pty_drained(struct pakfire_pty* pty) {
        // Is there anything in the input buffer?
        r = ioctl(pty->master.fd, TIOCINQ, &q);
        if (r < 0) {
-               CTX_DEBUG(pty->ctx, "TIOCINQ failed on master fd %d: %m\n", pty->master.fd);
+               DEBUG(pty->ctx, "TIOCINQ failed on master fd %d: %m\n", pty->master.fd);
                return -errno;
        }
 
@@ -292,7 +292,7 @@ static int pakfire_pty_drained(struct pakfire_pty* pty) {
        // Is there anything in the output buffer?
        r = ioctl(pty->master.fd, TIOCOUTQ, &q);
        if (r < 0) {
-               CTX_DEBUG(pty->ctx, "TIOCOUTQ failed on master fd %d: %m\n", pty->master.fd);
+               DEBUG(pty->ctx, "TIOCOUTQ failed on master fd %d: %m\n", pty->master.fd);
                return -errno;
        }
 
@@ -314,7 +314,7 @@ static int pakfire_pty_done(struct pakfire_pty* pty, int code) {
        if (pakfire_pty_has_flag(pty, PAKFIRE_PTY_CAPTURE_OUTPUT)) {
                r = pakfire_pty_store_output(pty);
                if (r < 0) {
-                       CTX_ERROR(pty->ctx, "Could not store output: %s\n", strerror(-r));
+                       ERROR(pty->ctx, "Could not store output: %s\n", strerror(-r));
                        return r;
                }
        }
@@ -332,7 +332,7 @@ static int pakfire_pty_send_eof(struct pakfire_pty* pty, int fd) {
        // Send EOF (Ctrl-D)
        r = write(fd, &eof, sizeof(eof));
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not write EOF: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Could not write EOF: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -438,7 +438,7 @@ static int pakfire_pty_drain_buffer(struct pakfire_pty* pty, int fd, struct pakf
                        if (!pakfire_pty_buffer_is_full(pty, stdio))
                                return -ENOMSG;
 
-                       CTX_DEBUG(pty->ctx, "Buffer is full. Sending all content\n");
+                       DEBUG(pty->ctx, "Buffer is full. Sending all content\n");
                        eol = stdio->buffer + stdio->buffered - 1;
                }
 
@@ -488,7 +488,7 @@ static int pakfire_pty_forward(struct pakfire_pty* pty) {
                        ((pty->master.io & PAKFIRE_PTY_READY_TO_READ) && !pakfire_pty_buffer_is_full(pty, &pty->stdout)) ||
                        ((pty->stdout.io & PAKFIRE_PTY_READY_TO_WRITE) && pakfire_pty_buffer_has_data(pty, &pty->stdout))
                ) {
-               // CTX_DEBUG(pty->ctx, "PTY forward stdin=%x %zu, stdout=%x %zu, %x\n",
+               // DEBUG(pty->ctx, "PTY forward stdin=%x %zu, stdout=%x %zu, %x\n",
                //      pty->stdin.io, pty->stdin.buffered, pty->stdout.io, pty->stdout.buffered, pty->master.io);
 
                // Read from standard input
@@ -506,14 +506,14 @@ static int pakfire_pty_forward(struct pakfire_pty* pty) {
                                                        break;
 
                                                default:
-                                                       CTX_ERROR(pty->ctx, "Failed reading from standard input: %s\n",
+                                                       ERROR(pty->ctx, "Failed reading from standard input: %s\n",
                                                                strerror(-r));
                                                        goto ERROR;
                                        }
 
                                // EOF?
                                } else if (r == 0) {
-                                       CTX_DEBUG(pty->ctx, "Received EOF from standard input\n");
+                                       DEBUG(pty->ctx, "Received EOF from standard input\n");
 
                                        // We are done reading
                                        pty->stdin.io &= ~PAKFIRE_PTY_READY_TO_READ;
@@ -541,7 +541,7 @@ static int pakfire_pty_forward(struct pakfire_pty* pty) {
                                                        break;
 
                                                default:
-                                                       CTX_ERROR(pty->ctx, "Failed writing to the PTY: %s\n", strerror(-r));
+                                                       ERROR(pty->ctx, "Failed writing to the PTY: %s\n", strerror(-r));
                                                        goto ERROR;
                                        }
                                }
@@ -577,7 +577,7 @@ static int pakfire_pty_forward(struct pakfire_pty* pty) {
                                                        break;
 
                                                default:
-                                                       CTX_ERROR(pty->ctx, "Failed reading from the PTY: %s\n", strerror(-r));
+                                                       ERROR(pty->ctx, "Failed reading from the PTY: %s\n", strerror(-r));
                                                        goto ERROR;
                                        }
                                }
@@ -607,7 +607,7 @@ static int pakfire_pty_forward(struct pakfire_pty* pty) {
                                                        return 0;
 
                                                default:
-                                                       CTX_ERROR(pty->ctx, "Failed writing to standard output: %s\n", strerror(-r));
+                                                       ERROR(pty->ctx, "Failed writing to standard output: %s\n", strerror(-r));
                                                        goto ERROR;
                                        }
                                }
@@ -769,7 +769,7 @@ static int pakfire_pty_enable_raw_mode(struct pakfire_pty* pty) {
        int same;
        int r;
 
-       CTX_DEBUG(pty->ctx, "Enabling raw mode\n");
+       DEBUG(pty->ctx, "Enabling raw mode\n");
 
        r = pakfire_pty_same_inode(pty, pty->stdin.fd, pty->stdout.fd);
        if (r < 0)
@@ -796,7 +796,7 @@ static int pakfire_pty_enable_raw_mode(struct pakfire_pty* pty) {
                // Restore the attributes
                r = tcsetattr(pty->stdin.fd, TCSANOW, &raw_attrs);
                if (r) {
-                       CTX_ERROR(pty->ctx, "Could not restore terminal attributes for fd %d: %s\n",
+                       ERROR(pty->ctx, "Could not restore terminal attributes for fd %d: %s\n",
                                pty->stdin.fd, strerror(errno));
                        return -errno;
                }
@@ -820,7 +820,7 @@ static int pakfire_pty_enable_raw_mode(struct pakfire_pty* pty) {
                // Restore the attributes
                r = tcsetattr(pty->stdout.fd, TCSANOW, &raw_attrs);
                if (r) {
-                       CTX_ERROR(pty->ctx, "Could not restore terminal attributes for fd %d: %s\n",
+                       ERROR(pty->ctx, "Could not restore terminal attributes for fd %d: %s\n",
                                pty->stdout.fd, strerror(errno));
                        return -errno;
                }
@@ -856,13 +856,13 @@ static int pakfire_pty_reopen(struct pakfire_pty* pty, int fd, int flags) {
        if (fd < 0)
                return fd;
 
-       CTX_DEBUG(pty->ctx, "Re-opened %s as fd %d\n", path, fd);
+       DEBUG(pty->ctx, "Re-opened %s as fd %d\n", path, fd);
 
        // Try to re-apply the offset to the new file descriptor
        if (offset > 0) {
                r = lseek(fd, offset, SEEK_SET);
                if (r < 0)
-                       CTX_DEBUG(pty->ctx, "Failed to apply offset: %m\n");
+                       DEBUG(pty->ctx, "Failed to apply offset: %m\n");
        }
 
        return fd;
@@ -875,7 +875,7 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
        struct winsize size;
        int r;
 
-       CTX_DEBUG(pty->ctx, "Setting up PTY Forwarding...\n");
+       DEBUG(pty->ctx, "Setting up PTY Forwarding...\n");
 
        // Mark as forwarding
        pty->state = PAKFIRE_PTY_STATE_FORWARDING;
@@ -884,7 +884,7 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
        if (pty->flags & PAKFIRE_PTY_CONNECT_STDIN) {
                pty->stdin.fd = pakfire_pty_reopen(pty, STDIN_FILENO, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
                if (pty->stdin.fd < 0) {
-                       CTX_DEBUG(pty->ctx, "Could not re-open standard input: %s. Ignoring.\n", strerror(-pty->stdin.fd));
+                       DEBUG(pty->ctx, "Could not re-open standard input: %s. Ignoring.\n", strerror(-pty->stdin.fd));
 
                        // Use the original file descriptor
                        pty->stdin.fd = STDIN_FILENO;
@@ -899,7 +899,7 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
        if (pakfire_pty_has_flag(pty, PAKFIRE_PTY_CAPTURE_OUTPUT)) {
                pty->stdout.fd = memfd_create("pty-output", MFD_CLOEXEC);
                if (pty->stdout.fd < 0) {
-                       CTX_ERROR(pty->ctx, "Could not create the output buffer: %m\n");
+                       ERROR(pty->ctx, "Could not create the output buffer: %m\n");
                        return -errno;
                }
 
@@ -913,7 +913,7 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
        } else if (pty->flags & PAKFIRE_PTY_CONNECT_STDOUT) {
                pty->stdout.fd = pakfire_pty_reopen(pty, STDOUT_FILENO, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
                if (pty->stdout.fd < 0) {
-                       CTX_DEBUG(pty->ctx, "Could not re-open standard output: %s. Ignoring.\n", strerror(-pty->stdout.fd));
+                       DEBUG(pty->ctx, "Could not re-open standard output: %s. Ignoring.\n", strerror(-pty->stdout.fd));
 
                        // Use the original file descriptor
                        pty->stdout.fd = STDOUT_FILENO;
@@ -929,14 +929,14 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
                // Fetch dimensions
                r = ioctl(pty->stdout.fd, TIOCGWINSZ, &size);
                if (r) {
-                       CTX_ERROR(pty->ctx, "Failed to determine terminal dimensions: %s\n", strerror(errno));
+                       ERROR(pty->ctx, "Failed to determine terminal dimensions: %s\n", strerror(errno));
                        return -errno;
                }
 
                // Set dimensions
                r = ioctl(pty->master.fd, TIOCSWINSZ, &size);
                if (r) {
-                       CTX_ERROR(pty->ctx, "Failed setting dimensions: %s\n", strerror(errno));
+                       ERROR(pty->ctx, "Failed setting dimensions: %s\n", strerror(errno));
                        return -errno;
                }
        }
@@ -969,7 +969,7 @@ static int pakfire_pty_setup_forwarding(struct pakfire_pty* pty) {
                                        break;
 
                                default:
-                                       CTX_ERROR(pty->ctx,
+                                       ERROR(pty->ctx,
                                                "Could not add standard output to the event loop: %s\n", strerror(-r));
                                        return r;
                        }
@@ -990,7 +990,7 @@ static int pakfire_pty_send_master(struct pakfire_pty* pty) {
        char buffer[CMSG_SPACE(payload_length)];
        int r;
 
-       CTX_DEBUG(pty->ctx, "Sending fd %d to parent\n", pty->master.fd);
+       DEBUG(pty->ctx, "Sending fd %d to parent\n", pty->master.fd);
 
        // Header
        struct msghdr msg = {
@@ -1010,7 +1010,7 @@ static int pakfire_pty_send_master(struct pakfire_pty* pty) {
        // Send the message
        r = sendmsg(pty->socket[1], &msg, 0);
        if (r) {
-               CTX_ERROR(pty->ctx, "Could not send file descriptor: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Could not send file descriptor: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -1037,7 +1037,7 @@ static int pakfire_pty_recv_master(struct pakfire_pty* pty) {
        // Receive the message
        r = recvmsg(pty->socket[0], &msg, 0);
        if (r) {
-               CTX_ERROR(pty->ctx, "Could not receive file descriptor: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Could not receive file descriptor: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -1049,7 +1049,7 @@ static int pakfire_pty_recv_master(struct pakfire_pty* pty) {
        // Store the file descriptor
        pty->master.fd = *((int*)CMSG_DATA(cmsg));
 
-       CTX_DEBUG(pty->ctx, "Received fd %d from socket %d\n", pty->master.fd, pty->socket[0]);
+       DEBUG(pty->ctx, "Received fd %d from socket %d\n", pty->master.fd, pty->socket[0]);
 
        // We can close the socket now
        close(pty->socket[0]);
@@ -1074,7 +1074,7 @@ static int pakfire_pty_setup(sd_event_source* source, int fd, uint32_t events, v
        r = sd_event_add_io(pty->loop, &pty->master.event,
                        pty->master.fd, EPOLLIN|EPOLLOUT|EPOLLET, pakfire_pty_master, pty);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not add the master file descriptor: %s\n", strerror(-r));
+               ERROR(pty->ctx, "Could not add the master file descriptor: %s\n", strerror(-r));
                return r;
        }
 
@@ -1140,7 +1140,7 @@ int pakfire_pty_create(struct pakfire_pty** pty, struct pakfire_ctx* ctx,
        // Create a UNIX domain socket
        r = socketpair(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, p->socket);
        if (r < 0) {
-               CTX_ERROR(p->ctx, "Could not create a UNIX socket: %m\n");
+               ERROR(p->ctx, "Could not create a UNIX socket: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -1149,7 +1149,7 @@ int pakfire_pty_create(struct pakfire_pty** pty, struct pakfire_ctx* ctx,
        r = sd_event_add_io(p->loop, NULL, p->socket[0], EPOLLIN|EPOLLHUP,
                pakfire_pty_setup, p);
        if (r < 0) {
-               CTX_ERROR(p->ctx, "Could not listen to socket: %s\n", strerror(-r));
+               ERROR(p->ctx, "Could not listen to socket: %s\n", strerror(-r));
                r = -errno;
                goto ERROR;
        }
@@ -1190,30 +1190,30 @@ static int pakfire_pty_setup_terminal(struct pakfire_pty* pty) {
        // Open a new terminal
        fd = open("/dev/console", O_RDWR|O_NOCTTY);
        if (fd < 0) {
-               CTX_ERROR(pty->ctx, "Failed to open a new terminal: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Failed to open a new terminal: %s\n", strerror(errno));
                return -errno;
        }
 
-       CTX_DEBUG(pty->ctx, "Opened a new terminal %d\n", fd);
+       DEBUG(pty->ctx, "Opened a new terminal %d\n", fd);
 
        // Connect the new terminal to standard input
        r = dup2(fd, STDIN_FILENO);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Failed to open standard input: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Failed to open standard input: %s\n", strerror(errno));
                return -errno;
        }
 
        // Connect the new terminal to standard output
        r = dup2(fd, STDOUT_FILENO);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Failed to open standard output: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Failed to open standard output: %s\n", strerror(errno));
                return -errno;
        }
 
        // Connect the new terminal to standard error
        r = dup2(fd, STDERR_FILENO);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Failed to open standard error: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Failed to open standard error: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -1236,12 +1236,12 @@ int pakfire_pty_open(struct pakfire_pty* pty) {
        if (r)
                return -r;
 
-       CTX_DEBUG(pty->ctx, "Allocated console at %s (%d)\n", pty->path, pty->master.fd);
+       DEBUG(pty->ctx, "Allocated console at %s (%d)\n", pty->path, pty->master.fd);
 
        // Unlock the master device
        r = unlockpt(pty->master.fd);
        if (r) {
-               CTX_ERROR(pty->ctx, "Could not unlock the PTY: %s\n", strerror(errno));
+               ERROR(pty->ctx, "Could not unlock the PTY: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -1268,7 +1268,7 @@ int pakfire_pty_open(struct pakfire_pty* pty) {
        r = sd_event_add_signal(pty->loop, &pty->sigwinch_event,
                        SIGWINCH|SD_EVENT_SIGNAL_PROCMASK, pakfire_pty_SIGWINCH, pty);
        if (r < 0) {
-               CTX_ERROR(pty->ctx, "Could not register SIGWINCH: %s\n", strerror(-r));
+               ERROR(pty->ctx, "Could not register SIGWINCH: %s\n", strerror(-r));
                return r;
        }
 
index c606700c91d411b5a28a37ba3e926d4855d46be0..90ef47edce308b35e81d3b8e772dfb06bdf5f285 100644 (file)
@@ -175,13 +175,13 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* owner,
 
        r = subid_init(PACKAGE_NAME, stderr);
        if (r) {
-               CTX_ERROR(ctx, "Could not setup subid: %m\n");
+               ERROR(ctx, "Could not setup subid: %m\n");
                goto ERROR;
        }
 
        count = callback(owner, &ranges);
        if (count < 0) {
-               CTX_ERROR(ctx, "Could not fetch subids for %s: %m\n", owner);
+               ERROR(ctx, "Could not fetch subids for %s: %m\n", owner);
                goto ERROR;
        }
 
@@ -262,7 +262,7 @@ static int pakfire_fgetsubid(struct pakfire* pakfire, struct pakfire_subid* subi
 
        // Check if length is greater than zero
        if (subid->length == 0) {
-               CTX_DEBUG(ctx, "Length equals zero: %s\n", line);
+               DEBUG(ctx, "Length equals zero: %s\n", line);
                r = 1;
                goto ERROR;
        }
@@ -275,7 +275,7 @@ ERROR:
                free(line);
 
        if (!r)
-               CTX_DEBUG(ctx, "Parsed SUBID entry: name=%s, id=%u, length=%zu\n",
+               DEBUG(ctx, "Parsed SUBID entry: name=%s, id=%u, length=%zu\n",
                        subid->name, subid->id, subid->length);
 
        if (ctx)
@@ -302,7 +302,7 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const cha
 
        struct pakfire_ctx* ctx = pakfire_ctx(pakfire);
 
-       CTX_DEBUG(ctx, "Fetching SUBID from %s for %s\n", path, owner);
+       DEBUG(ctx, "Fetching SUBID from %s for %s\n", path, owner);
 
        // Open /etc/subuid
        FILE* f = fopen(path, "r");
@@ -312,7 +312,7 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const cha
                                break;
 
                        default:
-                               CTX_ERROR(ctx, "Could not open %s: %m\n", path);
+                               ERROR(ctx, "Could not open %s: %m\n", path);
                                break;
                }
 
@@ -347,7 +347,7 @@ static int pakfire_getsubid(struct pakfire* pakfire, const char* path, const cha
        }
 
        // No match found
-       CTX_DEBUG(ctx, "No match found for %s\n", owner);
+       DEBUG(ctx, "No match found for %s\n", owner);
        r = 1;
 
 END:
index 18136e8695740163ed56d618137a37844305dd9c..52c2b05cb83dee071a8b91c2f183af762b96d8bc 100644 (file)
@@ -184,9 +184,9 @@ char* pakfire_repo_url_replace(struct pakfire_repo* repo, const char* url) {
 
 #ifdef ENABLE_DEBUG
        if (strcmp(url, buffer) != 0) {
-               CTX_DEBUG(repo->ctx, "Repository URL updated:");
-               CTX_DEBUG(repo->ctx, "  From: %s\n", url);
-               CTX_DEBUG(repo->ctx, "  To  : %s\n", buffer);
+               DEBUG(repo->ctx, "Repository URL updated:");
+               DEBUG(repo->ctx, "  From: %s\n", url);
+               DEBUG(repo->ctx, "  To  : %s\n", buffer);
        }
 #endif
 
@@ -287,7 +287,7 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, const char* data)
        // Import the key
        r = pakfire_key_import_from_string(&repo->key, repo->ctx, data, strlen(data));
        if (r < 0) {
-               CTX_ERROR(repo->ctx, "Could not import key for repository '%s': %s\n",
+               ERROR(repo->ctx, "Could not import key for repository '%s': %s\n",
                        pakfire_repo_get_name(repo), strerror(-r));
                goto ERROR;
        }
@@ -295,7 +295,7 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, const char* data)
        // If the key could be successfully imported, we will store it in the appdata
        r = pakfire_string_set(repo->appdata->key, data);
        if (r < 0) {
-               CTX_ERROR(repo->ctx, "Could not copy the key to appdata: %s\n", strerror(-r));
+               ERROR(repo->ctx, "Could not copy the key to appdata: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -322,12 +322,12 @@ static int __pakfire_repo_import( struct pakfire_config* config, const char* sec
        // Fetch context
        struct pakfire_ctx* ctx = pakfire_ctx(pakfire);
 
-       CTX_DEBUG(ctx, "Creating repository %s\n", name);
+       DEBUG(ctx, "Creating repository %s\n", name);
 
        // Create a new repository
        r = pakfire_repo_create(&repo, pakfire, name);
        if (r) {
-               CTX_ERROR(ctx, "Could not create repository '%s': %m\n", name);
+               ERROR(ctx, "Could not create repository '%s': %m\n", name);
                goto ERROR;
        }
 
@@ -418,14 +418,14 @@ struct pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* repo
 
                int r = pakfire_mirrorlist_create(&repo->mirrorlist, repo->ctx);
                if (r < 0) {
-                       CTX_ERROR(repo->ctx, "Could not create mirrorlist: %s\n", strerror(-r));
+                       ERROR(repo->ctx, "Could not create mirrorlist: %s\n", strerror(-r));
                        return NULL;
                }
 
                // Read the mirrorlist
                r = pakfire_mirrorlist_read(repo->mirrorlist, repo->appdata->mirrorlist);
                if (r < 0) {
-                       CTX_ERROR(repo->ctx, "Could not read mirrorlist %s: %s\n",
+                       ERROR(repo->ctx, "Could not read mirrorlist %s: %s\n",
                                repo->appdata->mirrorlist, strerror(-r));
 
                        // Destroy what we have created
@@ -447,7 +447,7 @@ static int pakfire_repo_download_database(struct pakfire_repo* repo,
 
        // Do nothing if the file already exists
        if (pakfire_path_exists(path)) {
-               CTX_DEBUG(repo->ctx, "Database %s already present. Skipping download\n", filename);
+               DEBUG(repo->ctx, "Database %s already present. Skipping download\n", filename);
                return 0;
        }
 
@@ -489,12 +489,12 @@ static int pakfire_repo_read_database(struct pakfire_repo* repo, const char* pat
        FILE* f = NULL;
        int r;
 
-       CTX_DEBUG(repo->ctx, "Read package database from %s...\n", path);
+       DEBUG(repo->ctx, "Read package database from %s...\n", path);
 
        // Open the database file
        f = fopen(path, "r");
        if (!f) {
-               CTX_ERROR(repo->ctx, "Could not open package database at %s: %m\n", path);
+               ERROR(repo->ctx, "Could not open package database at %s: %m\n", path);
                r = 1;
                goto ERROR;
        }
@@ -520,7 +520,7 @@ static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* pat
        char database_path[PATH_MAX];
        int r;
 
-       CTX_DEBUG(repo->ctx, "Reading repository metadata from %s...\n", path);
+       DEBUG(repo->ctx, "Reading repository metadata from %s...\n", path);
 
        struct json_object* json = pakfire_json_parse_from_file(repo->ctx, path);
        if (!json) {
@@ -528,7 +528,7 @@ static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* pat
                        case ENOENT:
                                // If the repository is local, we will just scan it
                                if (pakfire_repo_is_local(repo)) {
-                                       CTX_DEBUG(repo->ctx, "No metadata available on local repository."
+                                       DEBUG(repo->ctx, "No metadata available on local repository."
                                                " Falling back to scan...\n");
 
                                        return pakfire_repo_scan(repo, 0);
@@ -536,7 +536,7 @@ static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* pat
                                break;
                }
 
-               CTX_ERROR(repo->ctx, "Could not parse metadata from %s: %m\n", path);
+               ERROR(repo->ctx, "Could not parse metadata from %s: %m\n", path);
                return 1;
        }
 
@@ -545,7 +545,7 @@ static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* pat
        // Search for the database name
        int found = json_object_object_get_ex(json, "database", &database);
        if (!found) {
-               CTX_ERROR(repo->ctx, "Could not read database name from metadata\n");
+               ERROR(repo->ctx, "Could not read database name from metadata\n");
                r = 1;
                goto ERROR;
        }
@@ -604,7 +604,7 @@ static int pakfire_repo_refresh_mirrorlist(struct pakfire_repo* repo, const int
                time_t age = pakfire_path_age(repo->appdata->mirrorlist);
 
                if (age > 0 && age < REFRESH_AGE_MIRRORLIST) {
-                       CTX_DEBUG(repo->ctx, "Skip refreshing mirrorlist which is %lds old\n", age);
+                       DEBUG(repo->ctx, "Skip refreshing mirrorlist which is %lds old\n", age);
                        return 0;
                }
        }
@@ -612,7 +612,7 @@ static int pakfire_repo_refresh_mirrorlist(struct pakfire_repo* repo, const int
        // Replace any variables in the URL
        url = pakfire_repo_url_replace(repo, repo->appdata->mirrorlist_url);
        if (!url) {
-               CTX_ERROR(repo->ctx, "Could not expend the mirror list URL: %m\n");
+               ERROR(repo->ctx, "Could not expend the mirror list URL: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -664,7 +664,7 @@ static int pakfire_repo_download_metadata(struct pakfire_repo* repo, const char*
                time_t age = pakfire_path_age(path);
 
                if (age > 0 && age < refresh) {
-                       CTX_DEBUG(repo->ctx, "Skip refreshing metadata which is %lds old\n", age);
+                       DEBUG(repo->ctx, "Skip refreshing metadata which is %lds old\n", age);
                        return 0;
                }
        }
@@ -789,14 +789,14 @@ PAKFIRE_EXPORT int pakfire_repo_create(struct pakfire_repo** repo,
        // Allocate a libsolv repository
        rep->repo = repo_create(pool, name);
        if (!rep->repo) {
-               CTX_ERROR(rep->ctx, "Could not allocate repo: %m\n");
+               ERROR(rep->ctx, "Could not allocate repo: %m\n");
                goto ERROR;
        }
 
        // Allocate repository appdata
        rep->appdata = rep->repo->appdata = pakfire_repo_setup_appdata(rep);
        if (!rep->appdata) {
-               CTX_ERROR(rep->ctx, "Could not setup repository appdata for %s\n", name);
+               ERROR(rep->ctx, "Could not setup repository appdata for %s\n", name);
                goto ERROR;
        }
 
@@ -1076,7 +1076,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (description) {
                r = pakfire_config_set(config, section, "description", description);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set description: %m\n");
+                       ERROR(repo->ctx, "Could not set description: %m\n");
                        goto ERROR;
                }
        }
@@ -1085,7 +1085,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (!pakfire_repo_get_enabled(repo)) {
                r = pakfire_config_set(config, section, "enabled", "0");
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set enabled: %m\n");
+                       ERROR(repo->ctx, "Could not set enabled: %m\n");
                        goto ERROR;
                }
        }
@@ -1095,7 +1095,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (baseurl) {
                r = pakfire_config_set(config, section, "baseurl", baseurl);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set base URL: %m\n");
+                       ERROR(repo->ctx, "Could not set base URL: %m\n");
                        goto ERROR;
                }
        }
@@ -1107,7 +1107,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
                free(refresh);
 
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set refresh interval: %m\n");
+                       ERROR(repo->ctx, "Could not set refresh interval: %m\n");
                        goto ERROR;
                }
        }
@@ -1117,7 +1117,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (mirrorlist) {
                r = pakfire_config_set(config, section, "mirrors", mirrorlist);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set mirrors: %m\n");
+                       ERROR(repo->ctx, "Could not set mirrors: %m\n");
                        goto ERROR;
                }
        }
@@ -1127,7 +1127,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (key) {
                r = pakfire_key_export(key, f, PAKFIRE_KEY_EXPORT_MODE_PUBLIC);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not export the key: %m\n");
+                       ERROR(repo->ctx, "Could not export the key: %m\n");
                        goto ERROR;
                }
 
@@ -1136,7 +1136,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
                if (buffer) {
                        r = pakfire_config_set_format(config, section, "key", "%.*s", (int)length, buffer);
                        if (r) {
-                               CTX_ERROR(repo->ctx, "Could not set key: %m\n");
+                               ERROR(repo->ctx, "Could not set key: %m\n");
                                goto ERROR;
                        }
                }
@@ -1147,7 +1147,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
        if (priority) {
                r = pakfire_config_set_format(config, section, "priority", "%u", priority);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not set priority: %m\n");
+                       ERROR(repo->ctx, "Could not set priority: %m\n");
                        goto ERROR;
                }
        }
@@ -1197,14 +1197,14 @@ int pakfire_repo_download_package(struct pakfire_xfer** xfer,
        // Where do we store the package?
        cache_path = pakfire_package_get_string(pkg, PAKFIRE_PKG_CACHE_PATH);
        if (!cache_path) {
-               CTX_ERROR(repo->ctx, "Could not retrieve package cache path for %s: %m\n", nevra);
+               ERROR(repo->ctx, "Could not retrieve package cache path for %s: %m\n", nevra);
                goto ERROR;
        }
 
        // Where do we find the package on the server?
        url = pakfire_package_get_string(pkg, PAKFIRE_PKG_PATH);
        if (!url) {
-               CTX_ERROR(repo->ctx, "Could not retrieve package path for %s: %m\n", nevra);
+               ERROR(repo->ctx, "Could not retrieve package path for %s: %m\n", nevra);
                goto ERROR;
        }
 
@@ -1214,7 +1214,7 @@ int pakfire_repo_download_package(struct pakfire_xfer** xfer,
        // Retrieve package digest
        digest = pakfire_package_get_digest(pkg, &digest_type, &digest_length);
        if (!digest) {
-               CTX_ERROR(repo->ctx, "Package %s has no digest set: %m\n", nevra);
+               ERROR(repo->ctx, "Package %s has no digest set: %m\n", nevra);
                goto ERROR;
        }
 
@@ -1317,7 +1317,7 @@ int pakfire_repo_add(struct pakfire_repo* repo, const char* path,
        if (pakfire_string_is_url(path)) {
                r = pakfire_repo_download(repo, path, package);
                if (r)
-                       CTX_ERROR(repo->ctx, "Could not download %s\n", path);
+                       ERROR(repo->ctx, "Could not download %s\n", path);
 
                return r;
        }
@@ -1338,7 +1338,7 @@ int pakfire_repo_add(struct pakfire_repo* repo, const char* path,
                goto ERROR;
        }
 
-       CTX_DEBUG(repo->ctx, "Added %s to repository '%s'\n",
+       DEBUG(repo->ctx, "Added %s to repository '%s'\n",
                nevra, pakfire_repo_get_name(repo));
 
 ERROR:
@@ -1401,7 +1401,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_solv(struct pakfire_repo* repo, FILE *f, i
        // Create another repodata section for meta information
        meta = repo_add_repodata(repo->repo, 0);
        if (!meta) {
-               CTX_ERROR(repo->ctx, "Could not create meta repodata: %m\n");
+               ERROR(repo->ctx, "Could not create meta repodata: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -1434,7 +1434,7 @@ PAKFIRE_EXPORT int pakfire_repo_write_solv(struct pakfire_repo* repo, FILE *f, i
        // Flush buffers
        r = fflush(f);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not flush after writing repository: %m\n");
+               ERROR(repo->ctx, "Could not flush after writing repository: %m\n");
                goto ERROR;
        }
 
@@ -1470,12 +1470,12 @@ static int pakfire_repo_delete_all_packages(
                if (prefix && !pakfire_string_startswith(path, prefix))
                        goto NEXT;
 
-               CTX_DEBUG(repo->ctx, "Removing %s at %s\n", nevra, path);
+               DEBUG(repo->ctx, "Removing %s at %s\n", nevra, path);
 
                // Delete the file
                r = unlink(path);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not unlink %s at %s: %m\n", nevra, path);
+                       ERROR(repo->ctx, "Could not unlink %s at %s: %m\n", nevra, path);
                }
 
 NEXT:
@@ -1534,7 +1534,7 @@ static int pakfire_repo_scan_archive(struct pakfire_repo* repo, const char* path
        struct pakfire_package* package = NULL;
        int r;
 
-       CTX_DEBUG(repo->ctx, "Scanning %s...\n", path);
+       DEBUG(repo->ctx, "Scanning %s...\n", path);
 
        // Open archive
        r = pakfire_archive_open(&archive, repo->pakfire, path);
@@ -1667,14 +1667,14 @@ PAKFIRE_EXPORT int pakfire_repo_refresh(struct pakfire_repo* repo, int force) {
        // Do nothing if this repository is not enabled
        int enabled = pakfire_repo_get_enabled(repo);
        if (!enabled) {
-               CTX_DEBUG(repo->ctx, "Skip refreshing repository '%s'\n", name);
+               DEBUG(repo->ctx, "Skip refreshing repository '%s'\n", name);
                return 0;
        }
 
        // Refresh mirrorlist
        r = pakfire_repo_refresh_mirrorlist(repo, force);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not refresh mirrorlist, but will continue anyways...\n");
+               ERROR(repo->ctx, "Could not refresh mirrorlist, but will continue anyways...\n");
        }
 
        // Refresh metadata
@@ -1696,7 +1696,7 @@ static int pakfire_repo_sign_database(struct pakfire_repo* repo, struct pakfire_
        // Open the signature file for writing
        s = fopen(signature_path, "w");
        if (!s) {
-               CTX_ERROR(repo->ctx, "Could not open %s for writing: %m\n", signature_path);
+               ERROR(repo->ctx, "Could not open %s for writing: %m\n", signature_path);
                r = 1;
                goto ERROR;
        }
@@ -1704,7 +1704,7 @@ static int pakfire_repo_sign_database(struct pakfire_repo* repo, struct pakfire_
        // Open the database for reading
        f = fopen(database_path, "r");
        if (!f) {
-               CTX_ERROR(repo->ctx, "Could not open %s for reading: %m\n", database_path);
+               ERROR(repo->ctx, "Could not open %s for reading: %m\n", database_path);
                r = 1;
                goto ERROR;
        }
@@ -1712,7 +1712,7 @@ static int pakfire_repo_sign_database(struct pakfire_repo* repo, struct pakfire_
        // Create the signature
        r = pakfire_key_signf(key, s, f, "Database Signature");
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not sign the database: %m\n");
+               ERROR(repo->ctx, "Could not sign the database: %m\n");
                goto ERROR;
        }
 
@@ -1739,21 +1739,21 @@ static int pakfire_repo_write_database(struct pakfire_repo* repo, struct pakfire
        // Create a temporary file to write to
        FILE* f = pakfire_mktemp(tmp, 0644);
        if (!f) {
-               CTX_ERROR(repo->ctx, "Could not open temporary file for writing: %m\n");
+               ERROR(repo->ctx, "Could not open temporary file for writing: %m\n");
                return 1;
        }
 
        // Initialize the output being compressed
        f = pakfire_zstdfopen(f, "w");
        if (!f) {
-               CTX_ERROR(repo->ctx, "Could not initialize compression: %m\n");
+               ERROR(repo->ctx, "Could not initialize compression: %m\n");
                return 1;
        }
 
        // Write the SOLV database to the temporary file
        r = pakfire_repo_write_solv(repo, f, 0);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not write SOLV data: %m\n");
+               ERROR(repo->ctx, "Could not write SOLV data: %m\n");
                goto ERROR;
        }
 
@@ -1764,21 +1764,21 @@ static int pakfire_repo_write_database(struct pakfire_repo* repo, struct pakfire
        // Create a filename for the database file
        r = __pakfire_strftime_now(filename, length, "%Y-%m-%d-%H%M.%s.solv.zst");
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not format database filename: %m\n");
+               ERROR(repo->ctx, "Could not format database filename: %m\n");
                goto ERROR;
        }
 
        // Make final database path
        r = pakfire_string_format(database, "%s/repodata/%s", path, filename);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not join database path: %m\n");
+               ERROR(repo->ctx, "Could not join database path: %m\n");
                goto ERROR;
        }
 
        // Link database to its destination
        r = link(tmp, database);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not link database %s: %m\n", database);
+               ERROR(repo->ctx, "Could not link database %s: %m\n", database);
                goto ERROR;
        }
 
@@ -1786,7 +1786,7 @@ static int pakfire_repo_write_database(struct pakfire_repo* repo, struct pakfire
        if (key) {
                r = pakfire_repo_sign_database(repo, key, database);
                if (r) {
-                       CTX_ERROR(repo->ctx, "Could not sign the database: %m\n");
+                       ERROR(repo->ctx, "Could not sign the database: %m\n");
                        goto ERROR;
                }
        }
@@ -1827,7 +1827,7 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire
        // Compose JSON object
        repomd = json_object_new_object();
        if (!repomd) {
-               CTX_ERROR(repo->ctx, "Could not allocate a new JSON object: %m\n");
+               ERROR(repo->ctx, "Could not allocate a new JSON object: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -1835,14 +1835,14 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire
        // Set version
        struct json_object* repomd_version = json_object_new_int64(0);
        if (!repomd_version) {
-               CTX_ERROR(repo->ctx, "Could not create version: %m\n");
+               ERROR(repo->ctx, "Could not create version: %m\n");
                r = 1;
                goto ERROR;
        }
 
        r = json_object_object_add(repomd, "version", repomd_version);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not add version to repomd.json: %m\n");
+               ERROR(repo->ctx, "Could not add version to repomd.json: %m\n");
                goto ERROR;
        }
 
@@ -1851,28 +1851,28 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire
        // Set revision
        struct json_object* repomd_revision = json_object_new_int64(revision);
        if (!repomd_revision) {
-               CTX_ERROR(repo->ctx, "Could not create revision: %m\n");
+               ERROR(repo->ctx, "Could not create revision: %m\n");
                r = 1;
                goto ERROR;
        }
 
        r = json_object_object_add(repomd, "revision", repomd_revision);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not add revision to repomd.json: %m\n");
+               ERROR(repo->ctx, "Could not add revision to repomd.json: %m\n");
                goto ERROR;
        }
 
        // Set database
        struct json_object* repomd_database = json_object_new_string(database);
        if (!repomd_database) {
-               CTX_ERROR(repo->ctx, "Could not create database string: %m\n");
+               ERROR(repo->ctx, "Could not create database string: %m\n");
                r = 1;
                goto ERROR;
        }
 
        r = json_object_object_add(repomd, "database", repomd_database);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not add database to repomd.json: %m\n");
+               ERROR(repo->ctx, "Could not add database to repomd.json: %m\n");
                goto ERROR;
        }
 
@@ -1888,7 +1888,7 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire
        // Open repomd.json for writing
        f = fopen(repomd_path, "w");
        if (!f) {
-               CTX_ERROR(repo->ctx, "Could not open %s for writing: %m\n", repomd_path);
+               ERROR(repo->ctx, "Could not open %s for writing: %m\n", repomd_path);
                r = 1;
                goto ERROR;
        }
@@ -1896,7 +1896,7 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire
        // Write out repomd.json
        r = json_object_to_fd(fileno(f), repomd, JSON_C_TO_STRING_PRETTY);
        if (r) {
-               CTX_ERROR(repo->ctx, "Could not write repomd.json: %m\n");
+               ERROR(repo->ctx, "Could not write repomd.json: %m\n");
                goto ERROR;
        }
 
@@ -1953,21 +1953,21 @@ PAKFIRE_EXPORT int pakfire_repo_compose(struct pakfire* pakfire, const char* pat
        // Create a new temporary repository at path
        r = pakfire_repo_create(&repo, pakfire, "tmp");
        if (r) {
-               CTX_ERROR(ctx, "Could not create a temporary repository: %m\n");
+               ERROR(ctx, "Could not create a temporary repository: %m\n");
                goto ERROR;
        }
 
        // Set baseurl to path
        r = pakfire_repo_set_baseurl(repo, baseurl);
        if (r) {
-               CTX_ERROR(ctx, "Could not set baseurl %s: %m\n", baseurl);
+               ERROR(ctx, "Could not set baseurl %s: %m\n", baseurl);
                goto ERROR;
        }
 
        // Find everything that is already part of the repository
        r = pakfire_repo_scan(repo, 0);
        if (r) {
-               CTX_ERROR(ctx, "Could not refresh repository: %m\n");
+               ERROR(ctx, "Could not refresh repository: %m\n");
                goto ERROR;
        }
 
@@ -1978,31 +1978,31 @@ PAKFIRE_EXPORT int pakfire_repo_compose(struct pakfire* pakfire, const char* pat
        char destination_path[PATH_MAX];
        char repo_path[PATH_MAX];
 
-       CTX_DEBUG(ctx, "Adding %zu file(s) to the repository\n", num_files);
+       DEBUG(ctx, "Adding %zu file(s) to the repository\n", num_files);
 
        // Add more files
        if (files) {
                for (const char** file = files; *file; file++) {
-                       CTX_DEBUG(ctx, "Adding %s to repository...\n", *file);
+                       DEBUG(ctx, "Adding %s to repository...\n", *file);
 
                        // Open source archive
                        r = pakfire_archive_open(&archive, pakfire, *file);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not open %s: %m\n", *file);
+                               ERROR(ctx, "Could not open %s: %m\n", *file);
                                goto OUT;
                        }
 
                        // Add package metadata
                        r = pakfire_repo_add_archive(repo, archive, &package);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not add %s to the repository: %m\n", *file);
+                               ERROR(ctx, "Could not add %s to the repository: %m\n", *file);
                                goto OUT;
                        }
 
                        // Fetch the UUID
                        uuid = pakfire_package_get_string(package, PAKFIRE_PKG_UUID);
                        if (!uuid) {
-                               CTX_ERROR(ctx, "Could not retrieve the UUID of %s: %m\n", *file);
+                               ERROR(ctx, "Could not retrieve the UUID of %s: %m\n", *file);
                                r = -EINVAL;
                                goto OUT;
                        }
@@ -2010,7 +2010,7 @@ PAKFIRE_EXPORT int pakfire_repo_compose(struct pakfire* pakfire, const char* pat
                        // Fetch the filename
                        filename = pakfire_package_get_string(package, PAKFIRE_PKG_FILENAME);
                        if (!filename) {
-                               CTX_ERROR(ctx, "Could not retrieve filename of %s: %m\n", *file);
+                               ERROR(ctx, "Could not retrieve filename of %s: %m\n", *file);
                                r = -EINVAL;
                                goto OUT;
                        }
@@ -2028,7 +2028,7 @@ PAKFIRE_EXPORT int pakfire_repo_compose(struct pakfire* pakfire, const char* pat
                        // Copying archive to destination
                        r = pakfire_archive_link_or_copy(archive, destination_path);
                        if (r) {
-                               CTX_ERROR(ctx, "Could not copy archive to %s: %m\n", destination_path);
+                               ERROR(ctx, "Could not copy archive to %s: %m\n", destination_path);
                                goto OUT;
                        }
 
index a4f46fb34a18bfe4bee1d3c70ed9d3a81bb564ea..a28891d8aab321ce0693cfe321d57f369f0b4873 100644 (file)
@@ -183,6 +183,6 @@ int pakfire_scriptlet_execute(struct pakfire_scriptlet* scriptlet, struct pakfir
        if (pakfire_scriptlet_is_shell_script(scriptlet))
                return pakfire_jail_run_script(pakfire, scriptlet->data, scriptlet->size, NULL, 0);
 
-       CTX_ERROR(scriptlet->ctx, "Scriptlet is of an unknown kind\n");
+       ERROR(scriptlet->ctx, "Scriptlet is of an unknown kind\n");
        return -ENOTSUP;
 }
index 9117582756e01689ff1a3a2425848ac03b9cdfbc..cfe85b054f309af53b7656a9333da0d072fdab05 100644 (file)
@@ -102,7 +102,7 @@ int pakfire_snapshot_create(
        // Lock the snapshot
        r = flock(s->fd, LOCK_SH);
        if (r < 0) {
-               CTX_ERROR(s->ctx, "Could not lock %s: %m\n", s->path);
+               ERROR(s->ctx, "Could not lock %s: %m\n", s->path);
                r = -errno;
                goto ERROR;
        }
@@ -190,7 +190,7 @@ int pakfire_snapshot_find(struct pakfire_snapshot** snapshot, struct pakfire* pa
 
        // List what we have found
        for (int i = 0; i < num_paths; i++) {
-               CTX_DEBUG(ctx, "Found snapshot: %s\n", paths[i]->d_name);
+               DEBUG(ctx, "Found snapshot: %s\n", paths[i]->d_name);
        }
 
        // Build the path to the snapshot
@@ -198,7 +198,7 @@ int pakfire_snapshot_find(struct pakfire_snapshot** snapshot, struct pakfire* pa
        if (r < 0)
                goto ERROR;
 
-       CTX_DEBUG(ctx, "Selecting snapshot %s\n", path);
+       DEBUG(ctx, "Selecting snapshot %s\n", path);
 
        // Open the snapshot
        r = pakfire_snapshot_create(snapshot, ctx, path);
@@ -266,7 +266,7 @@ int pakfire_snapshot_mount(struct pakfire_snapshot* snapshot, const char* path)
        int fsfd = -EBADF;
        int r;
 
-       CTX_DEBUG(snapshot->ctx, "Mounting snapshot %s to %s\n", snapshot->path, path);
+       DEBUG(snapshot->ctx, "Mounting snapshot %s to %s\n", snapshot->path, path);
 
        // Mount the tmpfs
        r = pakfire_snapshot_mount_tmpfs(snapshot);
@@ -369,7 +369,7 @@ static int pakfire_snapshot_destroy(struct pakfire_snapshot* snapshot) {
        // Check if the snapshot is mounted
        switch (snapshot->state) {
                case PAKFIRE_SNAPSHOT_MOUNTED:
-                       CTX_DEBUG(snapshot->ctx, "Snapshot is mounted\n");
+                       DEBUG(snapshot->ctx, "Snapshot is mounted\n");
                        return -EBUSY;
 
                default:
@@ -385,22 +385,22 @@ static int pakfire_snapshot_destroy(struct pakfire_snapshot* snapshot) {
        if (r < 0) {
                switch (errno) {
                        case EWOULDBLOCK:
-                               CTX_DEBUG(snapshot->ctx, "Snapshot %s is used elsewhere\n", snapshot->path);
+                               DEBUG(snapshot->ctx, "Snapshot %s is used elsewhere\n", snapshot->path);
                                return -EBUSY;
 
                        default:
-                               CTX_DEBUG(snapshot->ctx,
+                               DEBUG(snapshot->ctx,
                                        "Could not acquire an exclusive lock on %s: %m\n", snapshot->path);
                                break;
                }
        }
 
-       CTX_INFO(snapshot->ctx, "Destroying snapshot %s\n", snapshot->path);
+       INFO(snapshot->ctx, "Destroying snapshot %s\n", snapshot->path);
 
        // Remove all files
        r = pakfire_rmtree(snapshot->path, 0);
        if (r < 0) {
-               CTX_ERROR(snapshot->ctx, "Could not destroy snapshot %s: %s\n",
+               ERROR(snapshot->ctx, "Could not destroy snapshot %s: %s\n",
                        snapshot->path, strerror(-r));
                return r;
        }
@@ -492,7 +492,7 @@ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pa
        // Clone the Pakfire instance
        r = pakfire_clone(&p, pakfire, tmp);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not clone pakfire: %s\n", strerror(-r));
+               ERROR(ctx, "Could not clone pakfire: %s\n", strerror(-r));
                goto ERROR;
        }
 
@@ -508,7 +508,7 @@ int pakfire_snapshot_make(struct pakfire_snapshot** snapshot, struct pakfire* pa
        // Move the snapshot to its final place
        r = rename(tmp, snapshot_path);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not move the snapshot to %s: %m\n", snapshot_path);
+               ERROR(ctx, "Could not move the snapshot to %s: %m\n", snapshot_path);
                r = -errno;
                goto ERROR;
        }
@@ -542,7 +542,7 @@ int pakfire_snapshot_clean(struct pakfire* pakfire) {
 
        struct pakfire_ctx* ctx = pakfire_ctx(pakfire);
 
-       CTX_DEBUG(ctx, "Cleaning up snapshots...\n");
+       DEBUG(ctx, "Cleaning up snapshots...\n");
 
        // Make the path
        r = pakfire_cache_path(pakfire, path, "%s", "snapshots");
index 388215adf114ff46461c28d7e0e625d481658624..f3dedf975c6d15b05ab0785836106b4ee8925d42 100644 (file)
@@ -199,7 +199,7 @@ static int pakfire_stripper_copy_sources(
                                goto ERROR;
 
                        default:
-                               CTX_ERROR(ctx, "Could not initialize DWARF context: %s\n", dwarf_errmsg(-1));
+                               ERROR(ctx, "Could not initialize DWARF context: %s\n", dwarf_errmsg(-1));
                                r = -errno;
                                goto ERROR;
                }
@@ -219,7 +219,7 @@ static int pakfire_stripper_copy_sources(
                // Fetch the source files
                r = dwarf_getsrcfiles(die, &files, &count);
                if (r < 0) {
-                       CTX_ERROR(ctx, "Could not fetch the source files: %s\n", dwarf_errmsg(-1));
+                       ERROR(ctx, "Could not fetch the source files: %s\n", dwarf_errmsg(-1));
                        r = -errno;
                        goto ERROR;
                }
@@ -242,12 +242,12 @@ static int pakfire_stripper_copy_sources(
                        if (pakfire_string_startswith(basename, "<") && pakfire_string_endswith(basename, ">"))
                                continue;
 
-                       CTX_DEBUG(ctx, "Found source file: %s\n", filename);
+                       DEBUG(ctx, "Found source file: %s\n", filename);
 
                        // Copy the file
                        r = pakfire_stripper_copy_source_file(stripper, filename);
                        if (r < 0) {
-                               CTX_ERROR(ctx, "Could not copy source file %s: %s\n", filename, strerror(-r));
+                               ERROR(ctx, "Could not copy source file %s: %s\n", filename, strerror(-r));
                                goto ERROR;
                        }
                }
index 1ff82b8464e71e1573dc58b7a191f0c85bac0df5..5a8339dfeace0521da918dfea5f273bc0a55230e 100644 (file)
@@ -136,7 +136,7 @@ static enum pakfire_steps pakfire_transaction_get_step_type(
                        return PAKFIRE_STEP_DOWNGRADED;
 
                default:
-                       CTX_ERROR(transaction->ctx,
+                       ERROR(transaction->ctx,
                                "Unhandled step type 0x%x. Ignoring.\n", (unsigned int)type);
 
                        return PAKFIRE_STEP_UNKNOWN;
@@ -170,7 +170,7 @@ static int pakfire_transaction_import_transaction(struct pakfire_transaction* tr
        // Clone the transaction to keep a copy of it
        transaction->transaction = solver_create_transaction(transaction->solver);
        if (!transaction->transaction) {
-               CTX_ERROR(transaction->ctx, "Could not create transaction from solver: %m\n");
+               ERROR(transaction->ctx, "Could not create transaction from solver: %m\n");
                return 1;
        }
 
@@ -229,7 +229,7 @@ static int pakfire_transaction_import_userinstalled(struct pakfire_transaction*
 
        transaction->userinstalled = calloc(userinstalled.count + 1, sizeof(*transaction->userinstalled));
        if (!transaction->userinstalled) {
-               CTX_ERROR(transaction->ctx, "Could not allocate userinstalled: %m\n");
+               ERROR(transaction->ctx, "Could not allocate userinstalled: %m\n");
                r = -errno;
                goto ERROR;
        }
@@ -274,7 +274,7 @@ static int pakfire_transaction_setup_solver(struct pakfire_transaction* transact
        // Allocate a new solver
        transaction->solver = solver_create(pool);
        if (!transaction->solver) {
-               CTX_ERROR(transaction->ctx, "Could not allocate solver: %m\n");
+               ERROR(transaction->ctx, "Could not allocate solver: %m\n");
                return -errno;
        }
 
@@ -458,7 +458,7 @@ PAKFIRE_EXPORT struct pakfire_problem** pakfire_transaction_get_problems(
        return problems;
 
 ERROR:
-       CTX_ERROR(transaction->ctx, "Could not import problems: %s\n", strerror(r));
+       ERROR(transaction->ctx, "Could not import problems: %s\n", strerror(r));
 
        if (problems) {
                for (struct pakfire_problem** p = problems; *p; p++)
@@ -579,7 +579,7 @@ PAKFIRE_EXPORT int pakfire_transaction_solve(struct pakfire_transaction* transac
 
        const char* selection = pool_selection2str(pool, &transaction->jobs, 0);
        if (selection)
-               CTX_DEBUG(transaction->ctx, "Solving: %s\n", selection);
+               DEBUG(transaction->ctx, "Solving: %s\n", selection);
 
 RETRY:
        // Save time when we starting solving
@@ -591,7 +591,7 @@ RETRY:
        // Save time when we finished solving
        solving_end = clock();
 
-       CTX_DEBUG(transaction->ctx, "Solved request in %.4fms\n",
+       DEBUG(transaction->ctx, "Solved request in %.4fms\n",
                (double)(solving_end - solving_start) * 1000 / CLOCKS_PER_SEC);
 
        switch (r) {
@@ -623,7 +623,7 @@ RETRY:
                        p = pakfire_transaction_get_problem_string(transaction, flags);
 
                        if (p) {
-                               CTX_DEBUG(transaction->ctx,
+                               DEBUG(transaction->ctx,
                                        "Could not solve request: %s\n%s\n", selection, p);
 
                                // Return the problems
@@ -780,7 +780,7 @@ static int pakfire_transaction_add_job(struct pakfire_transaction* transaction,
                queue_push2(&jobs, SOLVER_SOLVABLE_PROVIDES, id);
        }
 
-       CTX_DEBUG(transaction->ctx, "Found %d match(es) for '%s'\n", jobs.count / 2, what);
+       DEBUG(transaction->ctx, "Found %d match(es) for '%s'\n", jobs.count / 2, what);
 
        // Set action and global flags
        for (int i = 0; i < jobs.count; i += 2) {
@@ -1213,7 +1213,7 @@ PAKFIRE_EXPORT char* pakfire_transaction_dump(struct pakfire_transaction* transa
        }
 
        if (s)
-               CTX_DEBUG(transaction->ctx, "%s", s);
+               DEBUG(transaction->ctx, "%s", s);
 
 ERROR:
        queue_free(&classes);
@@ -1250,7 +1250,7 @@ static int pakfire_transaction_verify(struct pakfire_transaction* transaction,
 
        // Nothing to do if this step does not have an archive
        if (!archive) {
-               CTX_DEBUG(transaction->ctx, "Package %s requires no archive\n", nevra);
+               DEBUG(transaction->ctx, "Package %s requires no archive\n", nevra);
                return 0;
        }
 
@@ -1260,7 +1260,7 @@ static int pakfire_transaction_verify(struct pakfire_transaction* transaction,
        // Fetch digest from package
        const unsigned char* expected_digest = pakfire_package_get_digest(pkg, &digest_type, &length);
        if (!expected_digest) {
-               CTX_DEBUG(transaction->ctx, "Package %s has no digest\n", nevra);
+               DEBUG(transaction->ctx, "Package %s has no digest\n", nevra);
                return 0;
        }
 
@@ -1300,7 +1300,7 @@ static int pakfire_transaction_extract(struct pakfire_transaction* transaction,
        // Extract payload
        int r = pakfire_archive_extract(archive, NULL, 0);
        if (r) {
-               CTX_ERROR(transaction->ctx, "Could not extract package %s: %m\n",
+               ERROR(transaction->ctx, "Could not extract package %s: %m\n",
                        nevra);
                return r;
        }
@@ -1445,7 +1445,7 @@ static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
        const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
        const enum pakfire_steps type = pakfire_transaction_get_step_type(transaction, pkg);
 
-       CTX_DEBUG(transaction->ctx, "Running %s (%s) for %s\n",
+       DEBUG(transaction->ctx, "Running %s (%s) for %s\n",
                pakfire_action_type_string(action), pakfire_step_type_string(type), nevra);
 
        int r = 0;
@@ -1629,7 +1629,7 @@ static int pakfire_transaction_run_step(struct pakfire_transaction* transaction,
        }
 
        if (r)
-               CTX_ERROR(transaction->ctx, "Step %s (%u) for %s has failed: %m\n",
+               ERROR(transaction->ctx, "Step %s (%u) for %s has failed: %m\n",
                        pakfire_action_type_string(action), type, nevra);
 
        return r;
@@ -1664,7 +1664,7 @@ static int pakfire_transaction_run_steps(struct pakfire_transaction* transaction
 
                // End loop if action was unsuccessful
                if (r) {
-                       CTX_DEBUG(transaction->ctx, "Step %u failed: %m\n", i);
+                       DEBUG(transaction->ctx, "Step %u failed: %m\n", i);
                        break;
                }
        }
@@ -1731,11 +1731,11 @@ static int pakfire_usrmove_symlink(struct pakfire_ctx* ctx, struct pakfire* pakf
        // Create the symlink
        r = symlink(dst, link);
        if (r) {
-               CTX_DEBUG(ctx, "Could not create symlink %s to %s: %m\n", dst, link);
+               DEBUG(ctx, "Could not create symlink %s to %s: %m\n", dst, link);
                return r;
        }
 
-       CTX_DEBUG(ctx, "Created symlink %s --> %s\n", link, dst);
+       DEBUG(ctx, "Created symlink %s --> %s\n", link, dst);
 
        return 0;
 }
@@ -1772,7 +1772,7 @@ static int pakfire_transaction_perform(struct pakfire_transaction* transaction)
        struct pakfire_db* db;
        int r;
 
-       CTX_DEBUG(transaction->ctx, "Running Transaction %p\n", transaction);
+       DEBUG(transaction->ctx, "Running Transaction %p\n", transaction);
 
        // Open all archives
        r = pakfire_transaction_open_archives(transaction);
@@ -1782,7 +1782,7 @@ static int pakfire_transaction_perform(struct pakfire_transaction* transaction)
        // Open the database
        r = pakfire_db_open(&db, transaction->pakfire, PAKFIRE_DB_READWRITE);
        if (r) {
-               CTX_ERROR(transaction->ctx, "Could not open the database\n");
+               ERROR(transaction->ctx, "Could not open the database\n");
                return r;
        }
 
@@ -1810,7 +1810,7 @@ static int pakfire_transaction_perform(struct pakfire_transaction* transaction)
        if (r)
                goto ERROR;
 
-       CTX_DEBUG(transaction->ctx, "The transaction has finished successfully\n");
+       DEBUG(transaction->ctx, "The transaction has finished successfully\n");
 
        // Reload database for next transaction
 
@@ -1916,7 +1916,7 @@ PAKFIRE_EXPORT int pakfire_transaction_download(struct pakfire_transaction* tran
        // Initialize the HTTP client
        r = pakfire_httpclient_create(&httpclient, transaction->ctx, NULL);
        if (r) {
-               CTX_ERROR(transaction->ctx, "Could not initialize HTTP client: %m\n");
+               ERROR(transaction->ctx, "Could not initialize HTTP client: %m\n");
                return 1;
        }
 
@@ -1932,7 +1932,7 @@ PAKFIRE_EXPORT int pakfire_transaction_download(struct pakfire_transaction* tran
                if (r) {
                        const char* nevra = pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA);
 
-                       CTX_ERROR(transaction->ctx, "Could not add download to queue: %s: %m\n", nevra);
+                       ERROR(transaction->ctx, "Could not add download to queue: %s: %m\n", nevra);
                        goto ERROR;
                }
        }
@@ -1959,7 +1959,7 @@ PAKFIRE_EXPORT int pakfire_transaction_run(struct pakfire_transaction* transacti
 
        // Skip running an empty transaction
        if (!transaction->num) {
-               CTX_DEBUG(transaction->ctx, "Empty transaction. Skipping...\n");
+               DEBUG(transaction->ctx, "Empty transaction. Skipping...\n");
                return 0;
        }
 
@@ -1969,7 +1969,7 @@ PAKFIRE_EXPORT int pakfire_transaction_run(struct pakfire_transaction* transacti
        // Check if we should continue
        r = pakfire_ctx_confirm(transaction->ctx, transaction->pakfire, dump, _("Is this okay?"));
        if (r) {
-               CTX_ERROR(transaction->ctx, "Transaction aborted upon user request\n");
+               ERROR(transaction->ctx, "Transaction aborted upon user request\n");
                goto ERROR;
        }
 
@@ -2005,7 +2005,7 @@ int pakfire_transaction_compose_repo(struct pakfire_transaction* transaction,
        const char* files[transaction->num + 1];
        unsigned int num = 0;
 
-       CTX_DEBUG(transaction->ctx, "Writing transaction to %s...\n", path);
+       DEBUG(transaction->ctx, "Writing transaction to %s...\n", path);
 
        // Open all archives
        r = pakfire_transaction_open_archives(transaction);
index 072e49bf15fd1e1a2f994c5b3c7fdf46e404d3b8..56c6bea5e275bf3f16e7df15530ce989d929e2a5 100644 (file)
@@ -539,12 +539,12 @@ int pakfire_symlink(struct pakfire_ctx* ctx, const char* target, const char* lin
        if (r)
                return r;
 
-       CTX_DEBUG(ctx, "Creating symlink %s -> %s (%s)\n", target, linkpath, path);
+       DEBUG(ctx, "Creating symlink %s -> %s (%s)\n", target, linkpath, path);
 
        // Create the symlink
        r = symlink(path, linkpath);
        if (r) {
-               CTX_ERROR(ctx, "Could not create symlink %s (%s): %m\n", linkpath, path);
+               ERROR(ctx, "Could not create symlink %s (%s): %m\n", linkpath, path);
                return r;
        }
 
@@ -628,7 +628,7 @@ struct json_object* pakfire_json_parse(struct pakfire_ctx* ctx,
        // Create tokener
        tokener = json_tokener_new();
        if (!tokener) {
-               CTX_ERROR(ctx, "Could not allocate JSON tokener: %m\n");
+               ERROR(ctx, "Could not allocate JSON tokener: %m\n");
                goto ERROR;
        }
 
@@ -637,12 +637,12 @@ struct json_object* pakfire_json_parse(struct pakfire_ctx* ctx,
        if (!json) {
                enum json_tokener_error error = json_tokener_get_error(tokener);
 
-               CTX_ERROR(ctx, "JSON parsing error: %s\n", json_tokener_error_desc(error));
+               ERROR(ctx, "JSON parsing error: %s\n", json_tokener_error_desc(error));
                goto ERROR;
        }
 
        // Log what we have parsed
-       CTX_DEBUG(ctx, "Parsed JSON:\n%s\n",
+       DEBUG(ctx, "Parsed JSON:\n%s\n",
                json_object_to_json_string_ext(json,
                        JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY)
        );
@@ -783,7 +783,7 @@ int pakfire_rlimit_set(struct pakfire_ctx* ctx, int limit) {
        // Fetch current configuration
        r = getrlimit(RLIMIT_NOFILE, &rl);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not read RLIMIT_NOFILE: %m\n");
+               ERROR(ctx, "Could not read RLIMIT_NOFILE: %m\n");
                return -errno;
        }
 
@@ -796,11 +796,11 @@ int pakfire_rlimit_set(struct pakfire_ctx* ctx, int limit) {
        // Set the new limit
        r = setrlimit(RLIMIT_NOFILE, &rl);
        if (r < 0) {
-               CTX_ERROR(ctx, "Could not set RLIMIT_NOFILE to %lu: %m\n", rl.rlim_cur);
+               ERROR(ctx, "Could not set RLIMIT_NOFILE to %lu: %m\n", rl.rlim_cur);
                return -errno;
        }
 
-       CTX_DEBUG(ctx, "RLIMIT_NOFILE set to %d\n", limit);
+       DEBUG(ctx, "RLIMIT_NOFILE set to %d\n", limit);
        return 0;
 }
 
@@ -825,7 +825,7 @@ int pakfire_compile_regex(struct pakfire_ctx* ctx, pcre2_code** regex, const cha
 
        if (!*regex) {
                pcre2_get_error_message(pcre2_errno, errmsg, sizeof(errmsg));
-               CTX_ERROR(ctx, "PCRE2 compilation failed for '%s' at offset %zu: %s\n",
+               ERROR(ctx, "PCRE2 compilation failed for '%s' at offset %zu: %s\n",
                        pattern, pcre2_offset, errmsg);
                return 1;
        }
@@ -834,7 +834,7 @@ int pakfire_compile_regex(struct pakfire_ctx* ctx, pcre2_code** regex, const cha
        pcre2_errno = pcre2_jit_compile(*regex, PCRE2_JIT_COMPLETE);
        if (pcre2_errno) {
                pcre2_get_error_message(pcre2_errno, errmsg, sizeof(errmsg));
-               CTX_ERROR(ctx, "Enabling JIT on '%s' failed: %s\n", pattern, errmsg);
+               ERROR(ctx, "Enabling JIT on '%s' failed: %s\n", pattern, errmsg);
                return 1;
        }
 
@@ -858,7 +858,7 @@ int pakfire_b64encode(struct pakfire_ctx* ctx, char** output,
        if (!b64) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not initialize the base64 encoder: %s\n", error);
+               ERROR(ctx, "Could not initialize the base64 encoder: %s\n", error);
                r = 1;
                goto ERROR;
        }
@@ -868,7 +868,7 @@ int pakfire_b64encode(struct pakfire_ctx* ctx, char** output,
        if (!bio) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not initialize memory buffer: %s\n", error);
+               ERROR(ctx, "Could not initialize memory buffer: %s\n", error);
                r = 1;
                goto ERROR;
        }
@@ -884,7 +884,7 @@ int pakfire_b64encode(struct pakfire_ctx* ctx, char** output,
        if (r < 1) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "%s\n", error);
+               ERROR(ctx, "%s\n", error);
                r = 1;
                goto ERROR;
        }
@@ -898,7 +898,7 @@ int pakfire_b64encode(struct pakfire_ctx* ctx, char** output,
        // Copy the output to the heap
        *output = strndup(p, l);
        if (!*output) {
-               CTX_ERROR(ctx, "Could not copy base64 encoded string to heap: %m\n");
+               ERROR(ctx, "Could not copy base64 encoded string to heap: %m\n");
                r = 1;
                goto ERROR;
        }
@@ -930,7 +930,7 @@ int pakfire_b64decode(struct pakfire_ctx* ctx, void** output, size_t* length,
        if (!b64) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not initialize the base64 decoder: %s\n", error);
+               ERROR(ctx, "Could not initialize the base64 decoder: %s\n", error);
                r = 1;
                goto ERROR;
        }
@@ -942,7 +942,7 @@ int pakfire_b64decode(struct pakfire_ctx* ctx, void** output, size_t* length,
        if (!bio) {
                ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-               CTX_ERROR(ctx, "Could not initialize memory buffer: %s\n", error);
+               ERROR(ctx, "Could not initialize memory buffer: %s\n", error);
                r = 1;
                goto ERROR;
        }
@@ -958,7 +958,7 @@ int pakfire_b64decode(struct pakfire_ctx* ctx, void** output, size_t* length,
                if (bytes_read < 0) {
                        ERR_error_string_n(ERR_get_error(), error, sizeof(error));
 
-                       CTX_ERROR(ctx, "Could not read data: %s\n", error);
+                       ERROR(ctx, "Could not read data: %s\n", error);
                        r = -EINVAL;
                        goto ERROR;
 
@@ -974,7 +974,7 @@ int pakfire_b64decode(struct pakfire_ctx* ctx, void** output, size_t* length,
                        // Allocate an output buffer
                        p = pakfire_realloc(p, *length);
                        if (!p) {
-                               CTX_ERROR(ctx, "Could not allocate buffer: %m\n");
+                               ERROR(ctx, "Could not allocate buffer: %m\n");
                                r = -errno;
                                goto ERROR;
                        }
@@ -1016,14 +1016,14 @@ int pakfire_copy(struct pakfire_ctx* ctx, FILE* src, FILE* dst) {
 
                // Check for any errors
                if (ferror(src)) {
-                       CTX_ERROR(ctx, "Could not read data: %m\n");
+                       ERROR(ctx, "Could not read data: %m\n");
                        return 1;
                }
 
                // Write the data
                bytes_written = fwrite(buffer, 1, bytes_read, dst);
                if (bytes_written < bytes_read) {
-                       CTX_ERROR(ctx, "Could not write data: %m\n");
+                       ERROR(ctx, "Could not write data: %m\n");
                        return 1;
                }
        }
index 6909c2436286affb0bae6d12021a2e7cc7f2696c..a9200b9347f7b0a42af97c7f5d068fa2f307fe3a 100644 (file)
@@ -182,16 +182,16 @@ static int pakfire_xfer_debug_callback(CURL *handle, curl_infotype type,
 
        switch (type) {
                case CURLINFO_TEXT:
-                       CTX_DEBUG(ctx, "cURL: %.*s", (int)size, data);
+                       DEBUG(ctx, "cURL: %.*s", (int)size, data);
                        break;
 
                // Log headers
                case CURLINFO_HEADER_IN:
-                       CTX_DEBUG(ctx, "cURL: < %.*s", (int)size, data);
+                       DEBUG(ctx, "cURL: < %.*s", (int)size, data);
                        break;
 
                case CURLINFO_HEADER_OUT:
-                       CTX_DEBUG(ctx, "cURL: > %.*s", (int)size, data);
+                       DEBUG(ctx, "cURL: > %.*s", (int)size, data);
                        break;
 
                // Ignore everything else
@@ -235,7 +235,7 @@ static size_t pakfire_xfer_write(
        if (xfer->evp) {
                r = EVP_DigestUpdate(xfer->evp, data, nmemb);
                if (r != 1) {
-                       CTX_ERROR(ctx, "EVP_DigestUpdate failed: %s\n",
+                       ERROR(ctx, "EVP_DigestUpdate failed: %s\n",
                                ERR_error_string(ERR_get_error(), NULL));
                        return 0;
                }
@@ -259,7 +259,7 @@ static int pakfire_xfer_setup(struct pakfire_xfer* xfer) {
        // Configure the share handle
        r = curl_easy_setopt(xfer->handle, CURLOPT_SHARE, share);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not configure cURL share handle: %s\n",
+               ERROR(xfer->ctx, "Could not configure cURL share handle: %s\n",
                        curl_easy_strerror(r));
                return r;
        }
@@ -371,7 +371,7 @@ int pakfire_xfer_create(struct pakfire_xfer** xfer,
 
        // Fail if the context is flagged as offline
        if (pakfire_ctx_has_flag(ctx, PAKFIRE_CTX_OFFLINE)) {
-               CTX_ERROR(ctx, "Cannot initialize a transfer in offline mode\n");
+               ERROR(ctx, "Cannot initialize a transfer in offline mode\n");
                return -EPERM;
        }
 
@@ -579,7 +579,7 @@ int pakfire_xfer_add_param(struct pakfire_xfer* xfer,
                xfer->mime = curl_mime_init(xfer->handle);
 
                if (!xfer->mime) {
-                       CTX_ERROR(xfer->ctx, "Could not allocate the MIME object: %s\n",
+                       ERROR(xfer->ctx, "Could not allocate the MIME object: %s\n",
                                strerror(errno));
                        r = -errno;
                        goto ERROR;
@@ -598,7 +598,7 @@ int pakfire_xfer_add_param(struct pakfire_xfer* xfer,
        // Allocate another MIME part
        part = curl_mime_addpart(xfer->mime);
        if (!part) {
-               CTX_ERROR(xfer->ctx, "Could not allocate MIME part: %s\n",
+               ERROR(xfer->ctx, "Could not allocate MIME part: %s\n",
                        strerror(errno));
                r = errno;
                goto ERROR;
@@ -607,7 +607,7 @@ int pakfire_xfer_add_param(struct pakfire_xfer* xfer,
        // Set the key
        r = curl_mime_name(part, key);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not set parameter key (%s): %s\n",
+               ERROR(xfer->ctx, "Could not set parameter key (%s): %s\n",
                        key, curl_easy_strerror(r));
                goto ERROR;
        }
@@ -615,7 +615,7 @@ int pakfire_xfer_add_param(struct pakfire_xfer* xfer,
        // Set the data
        r = curl_mime_data(part, buffer, CURL_ZERO_TERMINATED);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not set parameter data (%s): %s\n",
+               ERROR(xfer->ctx, "Could not set parameter data (%s): %s\n",
                        key, curl_easy_strerror(r));
                goto ERROR;
        }
@@ -650,7 +650,7 @@ int pakfire_xfer_set_output_buffer(struct pakfire_xfer* xfer,
        // Open a memory stream
        f = open_memstream(buffer, length);
        if (!f) {
-               CTX_ERROR(xfer->ctx, "Could not open memory stream: %s\n", strerror(errno));
+               ERROR(xfer->ctx, "Could not open memory stream: %s\n", strerror(errno));
                return -errno;
        }
 
@@ -695,7 +695,7 @@ static int pakfire_xfer_allocate_tmpfile_legacy(struct pakfire_xfer* xfer, const
        // Create a temporary file
        f = pakfire_mktemp(xfer->tmpfile, 0600);
        if (!f) {
-               CTX_ERROR(xfer->ctx, "Could not open temporary file for %s: %s\n",
+               ERROR(xfer->ctx, "Could not open temporary file for %s: %s\n",
                        path, strerror(errno));
                return -errno;
        }
@@ -729,7 +729,7 @@ static int pakfire_xfer_allocate_tmpfile(struct pakfire_xfer* xfer, const char*
                                return pakfire_xfer_allocate_tmpfile_legacy(xfer, path);
 
                        default:
-                               CTX_ERROR(xfer->ctx, "Could not open temporary file in %s: %s\n",
+                               ERROR(xfer->ctx, "Could not open temporary file in %s: %s\n",
                                        dirname, strerror(errno));
                                return -errno;
                }
@@ -856,7 +856,7 @@ static pakfire_xfer_error_code_t pakfire_xfer_code(CURLcode code, int http_statu
 static int pakfire_xfer_fail(struct pakfire_xfer* xfer, int code) {
        int r;
 
-       CTX_DEBUG(xfer->ctx, "Xfer failed: %s\n", curl_easy_strerror(code));
+       DEBUG(xfer->ctx, "Xfer failed: %s\n", curl_easy_strerror(code));
 
        // Throw away any downloaded data
        if (xfer->fin) {
@@ -913,13 +913,13 @@ static int pakfire_xfer_select_mirror(struct pakfire_xfer* xfer) {
 
        // No mirror found
        if (!xfer->mirror) {
-               CTX_ERROR(xfer->ctx, "No mirrors left to try\n");
+               ERROR(xfer->ctx, "No mirrors left to try\n");
 
                // No mirrors left
                return ENOENT;
        }
 
-       CTX_DEBUG(xfer->ctx, "Selected mirror %s\n", pakfire_mirror_get_url(xfer->mirror));
+       DEBUG(xfer->ctx, "Selected mirror %s\n", pakfire_mirror_get_url(xfer->mirror));
 
        return 0;
 }
@@ -950,7 +950,7 @@ static int pakfire_xfer_allocate(struct pakfire_xfer* xfer, size_t size) {
        // Otherwise, we resize the buffer
        xfer->buffer.data = pakfire_realloc(xfer->buffer.data, size);
        if (!xfer->buffer.data) {
-               CTX_ERROR(xfer->ctx, "Could not allocate memory: %m\n");
+               ERROR(xfer->ctx, "Could not allocate memory: %m\n");
 
                return -errno;
        }
@@ -995,12 +995,12 @@ static int pakfire_xfer_socket_recv(struct pakfire_xfer* xfer) {
                        return pakfire_xfer_fail(xfer, PAKFIRE_XFER_TRANSPORT_ERROR);
 
                default:
-                       CTX_ERROR(xfer->ctx, "Could not read from WebSocket: %s\n", curl_easy_strerror(r));
+                       ERROR(xfer->ctx, "Could not read from WebSocket: %s\n", curl_easy_strerror(r));
 
                        return r;
        }
 
-       CTX_DEBUG(xfer->ctx, "Read %zu byte(s) from WebSocket\n", bytes_received);
+       DEBUG(xfer->ctx, "Read %zu byte(s) from WebSocket\n", bytes_received);
 
        // If we have not received anything, we will wait for being called again
        if (!bytes_received)
@@ -1018,12 +1018,12 @@ static int pakfire_xfer_socket_recv(struct pakfire_xfer* xfer) {
        if (meta->flags & CURLWS_CONT)
                return pakfire_xfer_socket_recv(xfer);
 
-       CTX_DEBUG(xfer->ctx, "We have received a message of %zu byte(s)\n", xfer->buffer.size);
+       DEBUG(xfer->ctx, "We have received a message of %zu byte(s)\n", xfer->buffer.size);
 
        if (meta->flags & CURLWS_TEXT) {
-               CTX_DEBUG(xfer->ctx, "The message is a text\n");
+               DEBUG(xfer->ctx, "The message is a text\n");
        } else if (meta->flags & CURLWS_BINARY) {
-               CTX_DEBUG(xfer->ctx, "The message is binary\n");
+               DEBUG(xfer->ctx, "The message is binary\n");
        }
 
        // Once we have received the entire message we call the callback
@@ -1072,11 +1072,11 @@ static pakfire_xfer_error_code_t pakfire_xfer_done_socket(struct pakfire_xfer* x
        // Fetch the socket
        r = curl_easy_getinfo(xfer->handle, CURLINFO_ACTIVESOCKET, &socket);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not fetch the socket: %s\n", curl_easy_strerror(r));
+               ERROR(xfer->ctx, "Could not fetch the socket: %s\n", curl_easy_strerror(r));
                goto ERROR;
        }
 
-       CTX_DEBUG(xfer->ctx, "Connection is using socket %d\n", socket);
+       DEBUG(xfer->ctx, "Connection is using socket %d\n", socket);
 
        // Check what callbacks we have
        if (xfer->callbacks.recv)
@@ -1088,12 +1088,12 @@ static pakfire_xfer_error_code_t pakfire_xfer_done_socket(struct pakfire_xfer* x
        // Register a callback with the event loop
        r = sd_event_add_io(loop, &xfer->event, socket, events, __pakfire_xfer_socket, xfer);
        if (r < 0) {
-               CTX_ERROR(xfer->ctx, "Could not register socket %d: %s\n", socket, strerror(-r));
+               ERROR(xfer->ctx, "Could not register socket %d: %s\n", socket, strerror(-r));
 
                goto ERROR;
        }
 
-       CTX_DEBUG(xfer->ctx, "WebSocket registered with event loop\n");
+       DEBUG(xfer->ctx, "WebSocket registered with event loop\n");
 
        // Call the open callback
        if (xfer->callbacks.open) {
@@ -1121,7 +1121,7 @@ static int pakfire_xfer_save(struct pakfire_xfer* xfer) {
        if (!*xfer->path)
                return 0;
 
-       CTX_DEBUG(xfer->ctx, "Download successful. Storing result in %s\n", xfer->path);
+       DEBUG(xfer->ctx, "Download successful. Storing result in %s\n", xfer->path);
 
        int fd = fileno(xfer->fin);
 
@@ -1137,13 +1137,13 @@ static int pakfire_xfer_save(struct pakfire_xfer* xfer) {
        if (*xfer->tmpfile) {
                r = link(xfer->tmpfile, xfer->path);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not link destination file %s: %m\n", xfer->path);
+                       ERROR(xfer->ctx, "Could not link destination file %s: %m\n", xfer->path);
                        return r;
                }
        } else {
                r = linkat(fd, "", AT_FDCWD, xfer->path, AT_EMPTY_PATH);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not link destination file %s: %m\n", xfer->path);
+                       ERROR(xfer->ctx, "Could not link destination file %s: %m\n", xfer->path);
                        return r;
                }
        }
@@ -1170,9 +1170,9 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                return r;
 
        // Log the result
-       CTX_DEBUG(xfer->ctx, "cURL xfer done: %d - %s\n", code, curl_easy_strerror(code));
+       DEBUG(xfer->ctx, "cURL xfer done: %d - %s\n", code, curl_easy_strerror(code));
        if (*xfer->error)
-               CTX_DEBUG(xfer->ctx, "  Error: %s\n", xfer->error);
+               DEBUG(xfer->ctx, "  Error: %s\n", xfer->error);
 
        // Protocol
        curl_easy_getinfo(h, CURLINFO_SCHEME, &scheme);
@@ -1180,21 +1180,21 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
        // Effective URL
        curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &xfer->effective_url);
        if (xfer->effective_url)
-               CTX_DEBUG(xfer->ctx, "  Effective URL: %s\n", xfer->effective_url);
+               DEBUG(xfer->ctx, "  Effective URL: %s\n", xfer->effective_url);
 
        // Response code
        curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &response_code);
        if (response_code)
-               CTX_DEBUG(xfer->ctx, "  Response code: %ld\n", response_code);
+               DEBUG(xfer->ctx, "  Response code: %ld\n", response_code);
 
        // HTTP Version
        curl_easy_getinfo(h, CURLINFO_HTTP_VERSION, &http_version);
        if (http_version)
-               CTX_DEBUG(xfer->ctx, "  HTTP Version: %s\n", curl_http_version(http_version));
+               DEBUG(xfer->ctx, "  HTTP Version: %s\n", curl_http_version(http_version));
 
        // Total Times
        curl_easy_getinfo(h, CURLINFO_TOTAL_TIME, &total_time);
-       CTX_DEBUG(xfer->ctx, "  Total Time: %.2fs\n", total_time);
+       DEBUG(xfer->ctx, "  Total Time: %.2fs\n", total_time);
 
        // Download Size
        r = curl_easy_getinfo(h, CURLINFO_SIZE_DOWNLOAD_T, &download_size);
@@ -1202,7 +1202,7 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                return r;
 
        if (download_size)
-               CTX_DEBUG(xfer->ctx, "  Download Size: %ld bytes\n", download_size);
+               DEBUG(xfer->ctx, "  Download Size: %ld bytes\n", download_size);
 
        // Download Speed
        r = curl_easy_getinfo(h, CURLINFO_SPEED_DOWNLOAD_T, &download_speed);
@@ -1210,7 +1210,7 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                return r;
 
        if (download_speed)
-               CTX_DEBUG(xfer->ctx, "  Download Speed: %ld bps\n", download_speed);
+               DEBUG(xfer->ctx, "  Download Speed: %ld bps\n", download_speed);
 
        // Upload Size
        r = curl_easy_getinfo(h, CURLINFO_SIZE_UPLOAD_T, &upload_size);
@@ -1218,7 +1218,7 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                return r;
 
        if (upload_size)
-               CTX_DEBUG(xfer->ctx, "  Upload Size: %ld bytes\n", upload_size);
+               DEBUG(xfer->ctx, "  Upload Size: %ld bytes\n", upload_size);
 
        // Upload Speed
        r = curl_easy_getinfo(h, CURLINFO_SPEED_UPLOAD_T, &upload_speed);
@@ -1226,14 +1226,14 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                return r;
 
        if (upload_speed)
-               CTX_DEBUG(xfer->ctx, "  Upload Speed: %ld bps\n", upload_speed);
+               DEBUG(xfer->ctx, "  Upload Speed: %ld bps\n", upload_speed);
 
        // Check if digests match
        if (xfer->evp) {
                // Finish message digest computation
                r = EVP_DigestFinal_ex(xfer->evp, xfer->computed_digest, &xfer->computed_digest_length);
                if (r != 1) {
-                       CTX_ERROR(xfer->ctx, "Could not finish message digest computation: %s\n",
+                       ERROR(xfer->ctx, "Could not finish message digest computation: %s\n",
                                ERR_error_string(ERR_get_error(), NULL));
                        return 1;
                }
@@ -1241,7 +1241,7 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                // Message Digest
                char* hexdigest = __pakfire_hexlify(xfer->computed_digest, xfer->computed_digest_length);
                if (hexdigest) {
-                       CTX_DEBUG(xfer->ctx, "  Message Digest: %s\n", hexdigest);
+                       DEBUG(xfer->ctx, "  Message Digest: %s\n", hexdigest);
                        free(hexdigest);
                }
 
@@ -1255,9 +1255,9 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code)
                        char* expected_hexdigest = __pakfire_hexlify(xfer->expected_digest,
                                xfer->expected_digest_length);
 
-                       CTX_ERROR(xfer->ctx, "Download checksum for %s didn't match:\n", xfer->effective_url);
-                       CTX_ERROR(xfer->ctx, "  Expected: %s\n", expected_hexdigest);
-                       CTX_ERROR(xfer->ctx, "  Computed: %s\n", computed_hexdigest);
+                       ERROR(xfer->ctx, "Download checksum for %s didn't match:\n", xfer->effective_url);
+                       ERROR(xfer->ctx, "  Expected: %s\n", expected_hexdigest);
+                       ERROR(xfer->ctx, "  Computed: %s\n", computed_hexdigest);
 
                        if (computed_hexdigest)
                                free(computed_hexdigest);
@@ -1436,7 +1436,7 @@ static int pakfire_xfer_prepare_url(struct pakfire_xfer* xfer) {
 
        // Fail if we could not set the URL
        } else {
-               CTX_ERROR(xfer->ctx, "Invalid xfer %s\n", xfer->url);
+               ERROR(xfer->ctx, "Invalid xfer %s\n", xfer->url);
                r = -EINVAL;
                goto ERROR;
        }
@@ -1446,7 +1446,7 @@ static int pakfire_xfer_prepare_url(struct pakfire_xfer* xfer) {
        if (xfer->direction == PAKFIRE_XFER_SOCKET) {
                r = curl_url_set(xfer->fullurl, CURLUPART_SCHEME, "wss", 0);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not change to WebSocket: %s\n", curl_url_strerror(r));
+                       ERROR(xfer->ctx, "Could not change to WebSocket: %s\n", curl_url_strerror(r));
                        goto ERROR;
                }
        }
@@ -1455,7 +1455,7 @@ static int pakfire_xfer_prepare_url(struct pakfire_xfer* xfer) {
        // Set the URL
        r = curl_easy_setopt(xfer->handle, CURLOPT_CURLU, xfer->fullurl);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not set the URL: %s\n", curl_easy_strerror(r));
+               ERROR(xfer->ctx, "Could not set the URL: %s\n", curl_easy_strerror(r));
                goto ERROR;
        }
 
@@ -1478,7 +1478,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
                        // Let cURL know that we are uploading things
                        r = curl_easy_setopt(xfer->handle, CURLOPT_UPLOAD, 1L);
                        if (r) {
-                               CTX_ERROR(xfer->ctx, "Could not enable upload\n");
+                               ERROR(xfer->ctx, "Could not enable upload\n");
                                return r;
                        }
 
@@ -1487,7 +1487,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
                                r = curl_easy_setopt(xfer->handle,
                                        CURLOPT_INFILESIZE_LARGE, (curl_off_t)xfer->expected_size);
                                if (r) {
-                                       CTX_ERROR(xfer->ctx, "Could not set upload size\n");
+                                       ERROR(xfer->ctx, "Could not set upload size\n");
                                        return r;
                                }
                        }
@@ -1501,7 +1501,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
                        // Ask cURL to connect and let us handle the rest
                        r = curl_easy_setopt(xfer->handle, CURLOPT_CONNECT_ONLY, 2L);
                        if (r) {
-                               CTX_ERROR(xfer->ctx, "Could not enable CONNECT_ONLY\n");
+                               ERROR(xfer->ctx, "Could not enable CONNECT_ONLY\n");
                                return r;
                        }
 
@@ -1512,7 +1512,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
        // Compose the URL
        r = pakfire_xfer_prepare_url(xfer);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not compose URL: %m\n");
+               ERROR(xfer->ctx, "Could not compose URL: %m\n");
                return r;
        }
 
@@ -1520,7 +1520,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
        if (xfer->headers) {
                r = curl_easy_setopt(xfer->handle, CURLOPT_HTTPHEADER, xfer->headers);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not set headers: %s\n", curl_easy_strerror(r));
+                       ERROR(xfer->ctx, "Could not set headers: %s\n", curl_easy_strerror(r));
                        return r;
                }
        }
@@ -1529,7 +1529,7 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
        if (xfer->mime) {
                r = curl_easy_setopt(xfer->handle, CURLOPT_MIMEPOST, xfer->mime);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not set POST payload: %s\n", curl_easy_strerror(r));
+                       ERROR(xfer->ctx, "Could not set POST payload: %s\n", curl_easy_strerror(r));
                        return r;
                }
        }
@@ -1539,14 +1539,14 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
                // Request SPNEGO
                r = curl_easy_setopt(xfer->handle, CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not enable SPNEGO\n");
+                       ERROR(xfer->ctx, "Could not enable SPNEGO\n");
                        return r;
                }
 
                // Set an empty username
                r = curl_easy_setopt(xfer->handle, CURLOPT_USERPWD, ":");
                if (r) {
-                       CTX_ERROR(xfer->ctx, "Could not set username\n");
+                       ERROR(xfer->ctx, "Could not set username\n");
                        return r;
                }
        }
@@ -1561,14 +1561,14 @@ int pakfire_xfer_prepare(struct pakfire_xfer* xfer, struct pakfire_progress* pro
        if (xfer->md) {
                xfer->evp = EVP_MD_CTX_new();
                if (!xfer->evp) {
-                       CTX_ERROR(xfer->ctx, "Could not create EVP context: %m\n");
+                       ERROR(xfer->ctx, "Could not create EVP context: %m\n");
                        return 1;
                }
 
                // Initialize the EVP context
                r = EVP_DigestInit_ex(xfer->evp, xfer->md, NULL);
                if (r != 1) {
-                       CTX_ERROR(xfer->ctx, "Could not initialize EVP context: %s\n",
+                       ERROR(xfer->ctx, "Could not initialize EVP context: %s\n",
                                ERR_error_string(ERR_get_error(), NULL));
                        return 1;
                }
@@ -1609,13 +1609,13 @@ int pakfire_xfer_send_message(struct pakfire_xfer* xfer,
        // Send the message
        r = curl_ws_send(xfer->handle, message, length, &bytes_sent, 0, CURLWS_TEXT);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not send message: %s\n", curl_easy_strerror(r));
+               ERROR(xfer->ctx, "Could not send message: %s\n", curl_easy_strerror(r));
 
                return r;
        }
 
        // Log success
-       CTX_DEBUG(xfer->ctx,
+       DEBUG(xfer->ctx,
                "Successfully sent a WebSocket message of %zu byte(s)\n", bytes_sent);
 
        return 0;
@@ -1628,7 +1628,7 @@ pakfire_xfer_error_code_t pakfire_xfer_run(struct pakfire_xfer* xfer, int flags)
        // Prepare the xfer
        r = pakfire_xfer_prepare(xfer, NULL, flags);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not prepare xfer %s: %s\n",
+               ERROR(xfer->ctx, "Could not prepare xfer %s: %s\n",
                        xfer->url, strerror(-r));
                return r;
        }
@@ -1676,7 +1676,7 @@ static int pakfire_xfer_handle_api_error(
        m = json_object_get_string(message);
 
        // Log the error
-       CTX_ERROR(xfer->ctx, "%s responded with error %u (%s):\n  %s\n",
+       ERROR(xfer->ctx, "%s responded with error %u (%s):\n  %s\n",
                url, c, strerror(c), m);
 
        return -c;
@@ -1693,7 +1693,7 @@ static int pakfire_xfer_parse_api_response(struct pakfire_xfer* xfer,
 
        // Check if we received any data
        if (!length) {
-               CTX_ERROR(xfer->ctx, "Received an empty response\n");
+               ERROR(xfer->ctx, "Received an empty response\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -1703,14 +1703,14 @@ static int pakfire_xfer_parse_api_response(struct pakfire_xfer* xfer,
        // Parse the buffer
        o = pakfire_json_parse(xfer->ctx, buffer, length);
        if (!o) {
-               CTX_ERROR(xfer->ctx, "Could not parse the response\n");
+               ERROR(xfer->ctx, "Could not parse the response\n");
                r = -EBADMSG;
                goto ERROR;
        }
 
        // Check if the response is a dictionary
        if (!json_object_is_type(o, json_type_object)) {
-               CTX_ERROR(xfer->ctx, "The received object is not a JSON dict\n");
+               ERROR(xfer->ctx, "The received object is not a JSON dict\n");
                r = -EBADMSG;
                goto ERROR;
        }
@@ -1752,7 +1752,7 @@ static pakfire_xfer_error_code_t pakfire_xfer_run_api_request_once(
        // Parse the response
        r = pakfire_xfer_parse_api_response(xfer, buffer, length, response);
        if (r) {
-               CTX_ERROR(xfer->ctx, "Could not parse the API response: %s\n", strerror(-r));
+               ERROR(xfer->ctx, "Could not parse the API response: %s\n", strerror(-r));
                goto ERROR;
        }