fulldeptree: make sure there are no dups.
Added a test case to verify that dup deps are discarded completely.
This commit is contained in:
parent
71775950e8
commit
c658e41747
@ -124,6 +124,7 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool)
|
||||
struct item *item, *xitem;
|
||||
const char *pkgver;
|
||||
char *pkgn;
|
||||
bool fdup = false;
|
||||
|
||||
assert(xhp);
|
||||
assert(pkgd);
|
||||
@ -173,11 +174,21 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool)
|
||||
free(curdepname);
|
||||
}
|
||||
/* all deps were processed, add item to head */
|
||||
for (unsigned int i = 0; i < xbps_array_count(result); i++) {
|
||||
const char *pkgdep;
|
||||
|
||||
xbps_array_get_cstring_nocopy(result, i, &pkgdep);
|
||||
if (strcmp(item->pkgver, pkgdep) == 0) {
|
||||
fdup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fdup) {
|
||||
str = xbps_string_create_cstring(item->pkgver);
|
||||
assert(str);
|
||||
xbps_array_add_first(result, str);
|
||||
xbps_object_release(str);
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,37 @@ incorrect_dep_issue45_body() {
|
||||
atf_check_equal $? 0
|
||||
}
|
||||
|
||||
atf_test_case incorrect_dep_dups
|
||||
|
||||
incorrect_dep_dups_head() {
|
||||
atf_set "descr" "Test for package deps: duplicated deps in fulldeptree"
|
||||
}
|
||||
|
||||
incorrect_dep_dups_body() {
|
||||
mkdir some_repo
|
||||
mkdir -p pkg_A/usr/bin pkg_B/usr/bin
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
|
||||
atf_check_equal $? 0
|
||||
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=0 A>=0" ../pkg_B
|
||||
atf_check_equal $? 0
|
||||
|
||||
xbps-rindex -d -a $PWD/*.xbps
|
||||
atf_check_equal $? 0
|
||||
cd ..
|
||||
|
||||
xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B
|
||||
atf_check_equal $? 0
|
||||
|
||||
xbps-query -C empty.conf -r root --fulldeptree -x B
|
||||
out=$(xbps-query -C empty.conf -r root --fulldeptree -x B)
|
||||
set -- $out
|
||||
atf_check_equal "$1 $2" "B-1.0_1 A-1.0_1"
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case incorrect_dep
|
||||
atf_add_test_case incorrect_dep_vpkg
|
||||
atf_add_test_case incorrect_dep_issue45
|
||||
atf_add_test_case incorrect_dep_dups
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user