Check if an update for conflicting pkg is in the transaction for revdeps in vpkgs.

This commit is contained in:
Juan RP 2013-07-05 10:09:32 +02:00
parent 6e37c02032
commit ecd15b7d57
2 changed files with 22 additions and 2 deletions

3
NEWS
View File

@ -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.

View File

@ -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;