pkg: add conflicts graph node verification (issue #13)
parent
948e219075
commit
6c1ace0aa7
38
pkg.c
38
pkg.c
|
@ -610,6 +610,37 @@ pkg_walk_list(pkg_dependency_t *deplist,
|
|||
return eflags;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
pkg_walk_conflicts_list(pkg_t *root, pkg_dependency_t *deplist, unsigned int flags)
|
||||
{
|
||||
unsigned int eflags;
|
||||
pkg_dependency_t *node;
|
||||
|
||||
PKG_FOREACH_LIST_ENTRY(deplist, node)
|
||||
{
|
||||
pkg_t *pkgdep;
|
||||
|
||||
if (*node->package == '\0')
|
||||
continue;
|
||||
|
||||
pkgdep = pkg_verify_dependency(node, flags, &eflags);
|
||||
if (eflags == PKG_ERRF_OK)
|
||||
{
|
||||
fprintf(stderr, "Version '%s' of '%s' conflicts with '%s' due to satisfying conflict rule '%s %s%s%s'.\n",
|
||||
pkgdep->version, pkgdep->realname, root->realname, node->package, pkg_get_comparator(node),
|
||||
node->version != NULL ? " " : "", node->version != NULL ? node->version : "");
|
||||
fprintf(stderr, "It may be possible to ignore this conflict and continue, try the\n");
|
||||
fprintf(stderr, "PKG_CONFIG_IGNORE_CONFLICTS environment variable.\n");
|
||||
}
|
||||
|
||||
pkg_free(pkgdep);
|
||||
|
||||
return PKG_ERRF_PACKAGE_CONFLICT;
|
||||
}
|
||||
|
||||
return PKG_ERRF_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* pkg_traverse(root, func, data, maxdepth, flags)
|
||||
*
|
||||
|
@ -628,6 +659,13 @@ pkg_traverse(pkg_t *root,
|
|||
if (maxdepth == 0)
|
||||
return eflags;
|
||||
|
||||
if (!(flags & PKGF_SKIP_CONFLICTS))
|
||||
{
|
||||
eflags = pkg_walk_conflicts_list(root, root->conflicts, rflags);
|
||||
if (eflags != PKG_ERRF_OK)
|
||||
return eflags;
|
||||
}
|
||||
|
||||
eflags = pkg_walk_list(root->requires, func, data, maxdepth, rflags);
|
||||
if (eflags != PKG_ERRF_OK)
|
||||
return eflags;
|
||||
|
|
Loading…
Reference in New Issue