From c158acefaceacd9bf3b1812b68e830429a2221e8 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 6 Oct 2012 10:01:37 +0200 Subject: [PATCH] Revert "transaction: keep last dep and remove dup matches while sorting deps." This reverts commit b764f8e19a108c2d86b0d283cab25508d9dcbd53. --- lib/transaction_sortdeps.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/transaction_sortdeps.c b/lib/transaction_sortdeps.c index 29a8965b..e70ef099 100644 --- a/lib/transaction_sortdeps.c +++ b/lib/transaction_sortdeps.c @@ -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); }