fulldeptree: make sure there are no dups.

Added a test case to verify that dup deps are discarded
completely.
This commit is contained in:
Juan RP
2019-04-20 19:04:13 +02:00
committed by Duncaen
parent 71775950e8
commit c658e41747
2 changed files with 44 additions and 4 deletions

View File

@@ -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 */
str = xbps_string_create_cstring(item->pkgver);
assert(str);
xbps_array_add_first(result, str);
xbps_object_release(str);
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;
}