libpkgconf: pkg: track conflict rule origins

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
Ariadne Conill 2026-01-18 20:50:18 -08:00
parent 5e26791ba5
commit 07dfbfffee
4 changed files with 7 additions and 1 deletions

View File

@ -211,6 +211,9 @@ pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
if (dep->version != NULL)
free(dep->version);
if (dep->why != NULL)
free(dep->why);
free(dep);
}

View File

@ -102,6 +102,8 @@ struct pkgconf_dependency_ {
int refcount;
pkgconf_client_t *owner;
char *why;
};
struct pkgconf_tuple_ {

View File

@ -1647,7 +1647,7 @@ pkgconf_pkg_walk_conflicts_list(pkgconf_client_t *client,
if (eflags == PKGCONF_PKG_ERRF_OK)
{
pkgconf_error(client, "Version '%s' of '%s' conflicts with '%s' due to satisfying conflict rule '%s %s%s%s'.\n",
pkgdep->version, pkgdep->realname, root->realname, parentnode->package, pkgconf_pkg_get_comparator(parentnode),
pkgdep->version, pkgdep->id, parentnode->why, parentnode->package, pkgconf_pkg_get_comparator(parentnode),
parentnode->version != NULL ? " " : "", parentnode->version != NULL ? parentnode->version : "");
if (!(client->flags & PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS))

View File

@ -277,6 +277,7 @@ pkgconf_queue_collect_conflicts(pkgconf_client_t *client,
pkgconf_dependency_t *conflict = cnode->data;
pkgconf_dependency_t *flattened_conflict = pkgconf_dependency_copy(client, conflict);
flattened_conflict->why = strdup(pkg->id);
pkgconf_node_insert(&flattened_conflict->iter, flattened_conflict, &world->conflicts);
}
}