forked from ariadne/pkgconf
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;
|
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)
|
* pkg_traverse(root, func, data, maxdepth, flags)
|
||||||
*
|
*
|
||||||
|
@ -628,6 +659,13 @@ pkg_traverse(pkg_t *root,
|
||||||
if (maxdepth == 0)
|
if (maxdepth == 0)
|
||||||
return eflags;
|
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);
|
eflags = pkg_walk_list(root->requires, func, data, maxdepth, rflags);
|
||||||
if (eflags != PKG_ERRF_OK)
|
if (eflags != PKG_ERRF_OK)
|
||||||
return eflags;
|
return eflags;
|
||||||
|
|
1
pkg.h
1
pkg.h
|
@ -122,6 +122,7 @@ struct pkg_ {
|
||||||
#define PKG_ERRF_OK 0x0
|
#define PKG_ERRF_OK 0x0
|
||||||
#define PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
#define PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
||||||
#define PKG_ERRF_PACKAGE_VER_MISMATCH 0x2
|
#define PKG_ERRF_PACKAGE_VER_MISMATCH 0x2
|
||||||
|
#define PKG_ERRF_PACKAGE_CONFLICT 0x4
|
||||||
|
|
||||||
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
|
typedef void (*pkg_traverse_func_t)(pkg_t *pkg, void *data, unsigned int flags);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue