pkg: improve conflicts handling

feature/tap-sh
William Pitcock 2012-07-30 02:46:03 -05:00
parent 391dbad713
commit 004adad048
2 changed files with 21 additions and 15 deletions

10
pkg.c
View File

@ -756,13 +756,18 @@ static inline unsigned int
pkg_walk_conflicts_list(pkg_t *root, pkg_dependency_t *deplist, unsigned int flags) pkg_walk_conflicts_list(pkg_t *root, pkg_dependency_t *deplist, unsigned int flags)
{ {
unsigned int eflags; unsigned int eflags;
pkg_dependency_t *node; pkg_dependency_t *node, *depnode;
PKG_FOREACH_LIST_ENTRY(deplist, node) PKG_FOREACH_LIST_ENTRY(deplist, node)
{
if (*node->package == '\0')
continue;
PKG_FOREACH_LIST_ENTRY(root->requires, depnode)
{ {
pkg_t *pkgdep; pkg_t *pkgdep;
if (*node->package == '\0') if (*depnode->package == '\0' || strcmp(depnode->package, node->package))
continue; continue;
pkgdep = pkg_verify_dependency(node, flags, &eflags); pkgdep = pkg_verify_dependency(node, flags, &eflags);
@ -781,6 +786,7 @@ pkg_walk_conflicts_list(pkg_t *root, pkg_dependency_t *deplist, unsigned int fla
pkg_free(pkgdep); pkg_free(pkgdep);
} }
}
return PKG_ERRF_OK; return PKG_ERRF_OK;
} }

View File

@ -129,7 +129,7 @@ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 PKG_CONFIG_SYSROOT_DIR=/test ${1} --cf
# 8) tests for 'Conflicts' # 8) tests for 'Conflicts'
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs conflicts; echo \$?" \ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs conflicts; echo \$?" \
'1' '0'
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --ignore-conflicts --libs conflicts; echo \$?" \ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --ignore-conflicts --libs conflicts; echo \$?" \
'-lconflicts' '0' '-lconflicts' '0'