From ecd15b7d57e1d271aa95581e97f1a6b11cd57235 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 5 Jul 2013 10:09:32 +0200 Subject: [PATCH] Check if an update for conflicting pkg is in the transaction for revdeps in vpkgs. --- NEWS | 3 +++ lib/transaction_revdeps.c | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ec6f96cc..024ef759 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.26 (???): + * Do not abort transaction if updates for conflicting packages are in + the transaction due to checks of reverse dependencies in virtual packages. + xbps-0.25 (2013-07-05): * Added support to validate reverse dependencies when updating packages. diff --git a/lib/transaction_revdeps.c b/lib/transaction_revdeps.c index 316d9371..b21c5b53 100644 --- a/lib/transaction_revdeps.c +++ b/lib/transaction_revdeps.c @@ -45,12 +45,13 @@ check_virtual_pkgs(struct xbps_handle *xhp, xbps_dictionary_t trans_pkgd, xbps_dictionary_t rev_pkgd) { - xbps_array_t provides, rundeps, mdeps; + xbps_array_t unsorted, provides, rundeps, mdeps; const char *pkgver, *revpkgver, *pkgpattern; - char *pkgname, *vpkgname, *vpkgver, *str; + char *pkgname, *pkgdepname, *vpkgname, *vpkgver, *str; unsigned int i, x; bool matched = false; + unsorted = xbps_dictionary_get(xhp->transd, "unsorted_deps"); provides = xbps_dictionary_get(trans_pkgd, "provides"); for (i = 0; i < xbps_array_count(provides); i++) { char *tmp = NULL; @@ -77,6 +78,21 @@ check_virtual_pkgs(struct xbps_handle *xhp, if (xbps_pkgpattern_match(vpkgver, pkgpattern)) continue; + /* + * Installed package conflicts with package + * in transaction being updated, check + * if a new version of this conflicting package + * is in the transaction. + */ + xbps_dictionary_get_cstring_nocopy(trans_pkgd, "pkgver", &pkgver); + pkgdepname = xbps_pkg_name(pkgver); + assert(pkgdepname); + if (xbps_find_pkg_in_array(unsorted, pkgdepname)) { + free(pkgdepname); + continue; + } + free(pkgdepname); + mdeps = xbps_dictionary_get(xhp->transd, "missing_deps"); xbps_dictionary_get_cstring_nocopy(trans_pkgd, "pkgver", &pkgver); xbps_dictionary_get_cstring_nocopy(rev_pkgd, "pkgver", &revpkgver); @@ -87,6 +103,7 @@ check_virtual_pkgs(struct xbps_handle *xhp, free(str); matched = true; } + free(vpkgname); free(vpkgver); } return matched;