Revert "transaction: keep last dep and remove dup matches while sorting deps."

This reverts commit b764f8e19a.
This commit is contained in:
Juan RP 2012-10-06 10:01:37 +02:00
parent 6592164010
commit c158acefac

View File

@ -51,7 +51,6 @@ struct pkgdep {
prop_dictionary_t d;
char *name;
const char *trans;
const char *pkgver;
};
static TAILQ_HEAD(pkgdep_head, pkgdep) pkgdep_list =
@ -135,8 +134,6 @@ pkgdep_alloc(prop_dictionary_t d, const char *name, const char *trans)
memcpy(pd->name, name, len-1);
pd->name[len-1] = '\0';
pd->trans = trans;
if (d != NULL)
prop_dictionary_get_cstring_nocopy(pd->d, "pkgver", &pd->pkgver);
return pd;
}
@ -146,11 +143,12 @@ pkgdep_end(struct xbps_handle *xhp, prop_array_t sorted)
{
prop_dictionary_t d;
struct pkgdep *pd;
const char *trans, *pkgver;
const char *trans;
while ((pd = TAILQ_FIRST(&pkgdep_list)) != NULL) {
TAILQ_REMOVE(&pkgdep_list, pd, pkgdep_entries);
if (pd->d != NULL && pd->pkgver != NULL) {
if (sorted != NULL && pd->d != NULL) {
/* do not add duplicates due to vpkgs */
d = xbps_find_pkg_in_array_by_name(xhp, sorted,
pd->name, NULL);
if (d == NULL) {
@ -165,14 +163,9 @@ pkgdep_end(struct xbps_handle *xhp, prop_array_t sorted)
}
prop_dictionary_get_cstring_nocopy(d,
"transaction", &trans);
prop_dictionary_get_cstring_nocopy(d,
"pkgver", &pkgver);
if ((strcmp(trans, pd->trans) == 0) &&
(strcmp(pkgver, pd->pkgver) == 0)) {
xbps_dbg_printf(xhp, "[sortdeps] removing dup "
"match '%s %s'\n", pd->pkgver, pd->trans);
xbps_remove_pkg_from_array_by_name(xhp,
sorted, pd->name, NULL);
if (strcmp(trans, pd->trans) == 0) {
pkgdep_release(pd);
continue;
}
prop_array_add(sorted, pd->d);
}