]> git.ipfire.org Git - pakfire.git/commitdiff
deps: Revert all the braindead logging changes
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 Aug 2024 12:00:41 +0000 (12:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 Aug 2024 12:00:41 +0000 (12:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/db.c
src/libpakfire/dependencies.c
src/libpakfire/include/pakfire/dependencies.h
src/libpakfire/package.c
src/libpakfire/pakfire.c
src/libpakfire/parser.c
src/libpakfire/problem.c
src/libpakfire/transaction.c

index 1737a9304d9f01229530bad7ebd28c94194faaf2..bfc2b76ff53b35f6387cbceb12e8e73f8da3b808 100644 (file)
@@ -1985,7 +1985,7 @@ static int pakfire_db_load_package(struct pakfire_db* db, struct pakfire_repo* r
        for (const struct dependency* deps = dependencies; deps->field; deps++) {
                const char* relations = (const char*)sqlite3_column_text(stmt, deps->field);
                if (relations) {
-                       r = pakfire_str2deps(db->ctx, pkg, deps->key, relations);
+                       r = pakfire_str2deps(db->pakfire, pkg, deps->key, relations);
                        if (r)
                                goto ERROR;
                }
index fd24198fb7e18ef4ed1af4c1aec28af4f610493b..92811fa435e6fd349e23af1c526a80c04ac00086 100644 (file)
@@ -85,7 +85,9 @@ PAKFIRE_EXPORT int pakfire_static_version_compare(const char* evr1, const char*
        return r;
 }
 
-const char* pakfire_dep2str(struct pakfire_ctx* ctx, Pool* pool, Id id) {
+const char* pakfire_dep2str(struct pakfire* pakfire, Id id) {
+       Pool* pool = pakfire_get_solv_pool(pakfire);
+
        return pool_dep2str(pool, id);
 }
 
@@ -139,11 +141,14 @@ END:
 /*
        This function parses any namespaced dependencies
 */
-static Id pakfire_parse_namespace(Pool* pool, const char* s) {
+static Id pakfire_parse_namespace(struct pakfire* pakfire, const char* s) {
        const char* p = strchr(s, '(');
        if (!p)
                return 0;
 
+       // Fetch the pool
+       Pool* pool = pakfire_get_solv_pool(pakfire);
+
        // Store the namespace ID
        Id namespace = pool_strn2id(pool, s, p - s, 1);
 
@@ -161,7 +166,7 @@ static Id pakfire_parse_namespace(Pool* pool, const char* s) {
 /*
        This function parses a simple dependency like "foo = 1.2.3"
 */
-static Id pakfire_parse_dep(struct pakfire_ctx* ctx, Pool* pool, const char** s) {
+static Id pakfire_parse_dep(struct pakfire* pakfire, const char** s) {
        Id id = ID_NULL;
 
        if (!s) {
@@ -176,6 +181,9 @@ static Id pakfire_parse_dep(struct pakfire_ctx* ctx, Pool* pool, const char** s)
        if (!p)
                return ID_NULL;
 
+       // Fetch the pool
+       Pool* pool = pakfire_get_solv_pool(pakfire);
+
        // Consume any leading space
        while (isspace(*p))
                p++;
@@ -184,10 +192,11 @@ static Id pakfire_parse_dep(struct pakfire_ctx* ctx, Pool* pool, const char** s)
        size_t l = skip(&p, &n);
 
        // Add name to pool
-       if (pakfire_string_startswith(n, "pakfire(") || pakfire_string_startswith(n, "arch("))
-               id = pakfire_parse_namespace(pool, n);
-       else
+       if (pakfire_string_startswith(n, "pakfire(") || pakfire_string_startswith(n, "arch(")) {
+               id = pakfire_parse_namespace(pakfire, n);
+       } else {
                id = pool_strn2id(pool, n, l, 1);
+       }
 
        // Consume any more space
        while (isspace(*p))
@@ -239,8 +248,7 @@ static Id pakfire_parse_dep(struct pakfire_ctx* ctx, Pool* pool, const char** s)
 /*
        This function parses any rich dependencies
 */
-static Id pakfire_parse_rich_dep(struct pakfire_ctx* ctx,
-               Pool* pool, const char** dep, int flags) {
+static Id pakfire_parse_rich_dep(struct pakfire* pakfire, const char** dep, int flags) {
        const char* p = *dep;
        Id id;
 
@@ -255,7 +263,7 @@ static Id pakfire_parse_rich_dep(struct pakfire_ctx* ctx,
        switch (*p) {
                // A new rich dependency
                case '(':
-                       id = pakfire_parse_rich_dep(ctx, pool, &p, 0);
+                       id = pakfire_parse_rich_dep(pakfire, &p, 0);
                        if (!id)
                                return id;
                        break;
@@ -266,7 +274,7 @@ static Id pakfire_parse_rich_dep(struct pakfire_ctx* ctx,
 
                // Parse a regular dependency
                default:
-                       id = pakfire_parse_dep(ctx, pool, &p);
+                       id = pakfire_parse_dep(pakfire, &p);
                        if (!id)
                                return id;
                        break;
@@ -299,12 +307,15 @@ static Id pakfire_parse_rich_dep(struct pakfire_ctx* ctx,
                return ID_NULL;
 
        // Parse the next bit
-       Id evr = pakfire_parse_rich_dep(ctx, pool, &p, flags);
+       Id evr = pakfire_parse_rich_dep(pakfire, &p, flags);
 
        // Abort if there was a problem
        if (!evr)
                return ID_NULL;
 
+       // Fetch pool
+       Pool* pool = pakfire_get_solv_pool(pakfire);
+
        // Store until where we have parsed the string
        *dep = p;
 
@@ -312,7 +323,7 @@ static Id pakfire_parse_rich_dep(struct pakfire_ctx* ctx,
        return pool_rel2id(pool, id, evr, flags, 1);
 }
 
-Id pakfire_str2dep(struct pakfire_ctx* ctx, Pool* pool, const char* dep) {
+Id pakfire_str2dep(struct pakfire* pakfire, const char* dep) {
        Id id = ID_NULL;
 
        // Invalid input
@@ -337,20 +348,20 @@ Id pakfire_str2dep(struct pakfire_ctx* ctx, Pool* pool, const char* dep) {
 
        // Parse any rich dependencies
        if (*s == '(')
-               id = pakfire_parse_rich_dep(ctx, pool, &s, 0);
+               id = pakfire_parse_rich_dep(pakfire, &s, 0);
        else
-               id = pakfire_parse_dep(ctx, pool, &s);
+               id = pakfire_parse_dep(pakfire, &s);
 
        // Return nothing if we could not parse the entire string
        if (id && *s) {
-               CTX_DEBUG(ctx, "Invalid dependency: %s\n", dep);
+               PAKFIRE_DEBUG(pakfire, "Invalid dependency: %s\n", dep);
                id = ID_NULL;
        }
 
        return id;
 }
 
-int pakfire_str2deps(struct pakfire_ctx* ctx, struct pakfire_package* pkg,
+int pakfire_str2deps(struct pakfire* pakfire, struct pakfire_package* pkg,
                const enum pakfire_package_key key, const char* deps) {
        char* p = NULL;
        int r = 0;
index 8e8c1b988230443fdcf05baa82fd2cec5d84744b..3fb33f55ff60ce324ef882d0e874a708cf8890dd 100644 (file)
@@ -25,8 +25,6 @@ int pakfire_static_version_compare(const char* evr1, const char* evr2);
 
 #ifdef PAKFIRE_PRIVATE
 
-#include <solv/pool.h>
-
 #include <pakfire/ctx.h>
 #include <pakfire/package.h>
 
@@ -35,10 +33,10 @@ extern const struct pakfire_dep {
        const char* name;
 } pakfire_deps[];
 
-const char* pakfire_dep2str(struct pakfire_ctx* ctx, Pool* pool, Id id);
-Id pakfire_str2dep(struct pakfire_ctx* ctx, Pool* pool, const char* s);
+const char* pakfire_dep2str(struct pakfire* pakfire, Id id);
+Id pakfire_str2dep(struct pakfire* pakfire, const char* s);
 
-int pakfire_str2deps(struct pakfire_ctx* ctx, struct pakfire_package* pkg,
+int pakfire_str2deps(struct pakfire* pakfire, struct pakfire_package* pkg,
        const enum pakfire_package_key key, const char* deps);
 
 #endif /* PAKFIRE_PRIVATE */
index 173bb476aa36a58da4edd36e6416f8fd8cdaaee4..e41f0a1a6c0a3d4fb41485d70bf65fc160288bff 100644 (file)
@@ -58,8 +58,6 @@ struct pakfire_package {
        struct pakfire* pakfire;
        int nrefs;
 
-       Pool* pool;
-
        // Reference to this package in the SOLV pool
        Id id;
        struct pakfire_repo* repo;
@@ -173,9 +171,6 @@ int pakfire_package_create_from_solvable(struct pakfire_package** package,
        pkg->pakfire = pakfire_ref(pakfire);
        pkg->nrefs = 1;
 
-       // Store a reference to the pool
-       pkg->pool = pakfire_get_solv_pool(pkg->pakfire);
-
        // Store the ID
        pkg->id = id;
 
@@ -1341,7 +1336,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_deps(struct pakfire_package* pkg,
                goto ERROR;
 
        for (int i = 0; i < q.count; i++) {
-               dep = pakfire_dep2str(pkg->ctx, pkg->pool, q.elements[i]);
+               dep = pakfire_dep2str(pkg->pakfire, q.elements[i]);
                if (!dep)
                        goto ERROR;
 
@@ -1368,7 +1363,7 @@ SUCCESS:
 int pakfire_package_add_dep(struct pakfire_package* pkg,
                const enum pakfire_package_key key, const char* dep) {
        // Parse the dependency
-       Id id = pakfire_str2dep(pkg->ctx, pkg->pool, dep);
+       Id id = pakfire_str2dep(pkg->pakfire, dep);
 
        // Silently ignore any invalid dependencies
        if (!id)
@@ -1418,7 +1413,7 @@ static int pakfire_package_has_rich_deps_in_deparray(
                goto ERROR;
 
        for (int i = 0; i < q.count; i++) {
-               const char* dep = pakfire_dep2str(pkg->ctx, pkg->pool, q.elements[i]);
+               const char* dep = pakfire_dep2str(pkg->pakfire, q.elements[i]);
 
                // Is this a rich dependency?
                if (dep && *dep == '(') {
@@ -1470,7 +1465,7 @@ int pakfire_package_matches_dep(struct pakfire_package* pkg,
                return r;
 
        // Get the dependency
-       Id depid = pakfire_str2dep(pkg->ctx, pkg->pool, dep);
+       Id depid = pakfire_str2dep(pkg->pakfire, dep);
        if (!depid)
                return -1;
 
index 9478e4cb4b702124d57bd44e9956604a19a10025..fd674e113d045666c1a75385e4c033bb6a30d225 100644 (file)
@@ -235,7 +235,7 @@ static Id pakfire_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
        struct pakfire* pakfire = (struct pakfire*)data;
 
        const char* namespace = pool_id2str(pool, ns);
-       const char* name = pakfire_dep2str(pakfire->ctx, pool, id);
+       const char* name = pakfire_dep2str(pakfire, id);
 
        CTX_DEBUG(pakfire->ctx, "Namespace callback called for %s(%s)\n", namespace, name);
 
@@ -315,7 +315,7 @@ static int pakfire_populate_pool(struct pakfire* pakfire) {
        };
 
        for (const char** package = pakfire_multiinstall_packages; *package; package++) {
-               Id id = pakfire_str2dep(pakfire->ctx, pool, *package);
+               Id id = pakfire_str2dep(pakfire, *package);
                if (!id)
                        continue;
 
@@ -1373,7 +1373,7 @@ static int pakfire_search_dep(struct pakfire* pakfire, Id type, const char* what
        pakfire_pool_internalize(pakfire);
 
        // Translate dependency to ID
-       Id dep = pakfire_str2dep(pakfire->ctx, pakfire->pool, what);
+       Id dep = pakfire_str2dep(pakfire, what);
        if (!dep) {
                errno = EINVAL;
                return 1;
index e686855e8cc1c9bebfc23c634d019447cebb7c96..263001b7d693ec0d14f97d991bc620989d5d649b 100644 (file)
@@ -1082,7 +1082,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
        if (is_source) {
                deps = pakfire_parser_get(parser, "build", "requires");
                if (deps) {
-                       r = pakfire_str2deps(parser->ctx, *pkg, PAKFIRE_PKG_REQUIRES, deps);
+                       r = pakfire_str2deps(parser->pakfire, *pkg, PAKFIRE_PKG_REQUIRES, deps);
                        if (r)
                                goto CLEANUP;
                }
@@ -1090,7 +1090,7 @@ int pakfire_parser_create_package(struct pakfire_parser* parser,
                for (const struct pakfire_dep* dep = pakfire_deps; dep->key; dep++) {
                        deps = pakfire_parser_get(parser, namespace, dep->name);
                        if (deps) {
-                               r = pakfire_str2deps(parser->ctx, *pkg, dep->key, deps);
+                               r = pakfire_str2deps(parser->pakfire, *pkg, dep->key, deps);
                                if (r)
                                        goto CLEANUP;
                        }
index e392024396159deea3cbdca43b825df8e2d48fab..f9fd46042eed69981a8fa724f5bd5995cc623677 100644 (file)
@@ -91,17 +91,17 @@ static char* pakfire_problem_make_string(struct pakfire_problem* problem) {
 
                case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides requested %s"),
-                               pakfire_dep2str(problem->ctx, pool, dep));
+                               pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
                        r = asprintf(&s, _("package %s does not exist"),
-                               pakfire_dep2str(problem->ctx, pool, dep));
+                               pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
                        r = asprintf(&s, _("%s is provided by the system"),
-                               pakfire_dep2str(problem->ctx, pool, dep));
+                               pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_RPM:
@@ -123,7 +123,7 @@ static char* pakfire_problem_make_string(struct pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides %s needed by %s"),
-                               pakfire_dep2str(problem->ctx, pool, dep), pool_solvid2str(pool, source));
+                               pakfire_dep2str(problem->pakfire, dep), pool_solvid2str(pool, source));
                        break;
 
                case SOLVER_RULE_RPM_SAME_NAME:
@@ -133,42 +133,42 @@ static char* pakfire_problem_make_string(struct pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_PACKAGE_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_OBSOLETES:
                        r = asprintf(&s, _("package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES:
                        r = asprintf(&s, _("installed package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_IMPLICIT_OBSOLETES:
                        r = asprintf(&s, _("package %s implicitely obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_REQUIRES:
                        r = asprintf(&s, _("package %s requires %s, but none of the providers can be installed"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_RPM_SELF_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by itself"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_YUMOBS:
                        r = asprintf(&s, _("both package %s and %s obsolete %s"),
                                pool_solvid2str(pool, source), pool_solvid2str(pool, target),
-                               pakfire_dep2str(problem->ctx, pool, dep));
+                               pakfire_dep2str(problem->pakfire, dep));
                        break;
 
                case SOLVER_RULE_BLACK:
@@ -178,7 +178,7 @@ static char* pakfire_problem_make_string(struct pakfire_problem* problem) {
 
                case SOLVER_RULE_PKG_CONSTRAINS:
                        r = asprintf(&s, _("package %s has constraint %s conflicting with %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->ctx, pool, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(problem->pakfire, dep),
                                pool_solvid2str(pool, target));
                        break;
 
index 7d7415dfb6dacb6ac3fdb837df440ac5e3ad57b9..31b7e83f145a4936330a67cf8fdfc34eb62bf258 100644 (file)
@@ -765,7 +765,7 @@ static int pakfire_transaction_add_job(struct pakfire_transaction* transaction,
 
        // Did we find anything?
        if (jobs.count == 0) {
-               Id id = pakfire_str2dep(transaction->ctx, pool, what);
+               Id id = pakfire_str2dep(transaction->pakfire, what);
                if (!id) {
                        r = -errno;
                        goto ERROR;