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 (???): 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): xbps-0.25 (2013-07-05):
* Added support to validate reverse dependencies when updating packages. * 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 trans_pkgd,
xbps_dictionary_t rev_pkgd) xbps_dictionary_t rev_pkgd)
{ {
xbps_array_t provides, rundeps, mdeps; xbps_array_t unsorted, provides, rundeps, mdeps;
const char *pkgver, *revpkgver, *pkgpattern; const char *pkgver, *revpkgver, *pkgpattern;
char *pkgname, *vpkgname, *vpkgver, *str; char *pkgname, *pkgdepname, *vpkgname, *vpkgver, *str;
unsigned int i, x; unsigned int i, x;
bool matched = false; bool matched = false;
unsorted = xbps_dictionary_get(xhp->transd, "unsorted_deps");
provides = xbps_dictionary_get(trans_pkgd, "provides"); provides = xbps_dictionary_get(trans_pkgd, "provides");
for (i = 0; i < xbps_array_count(provides); i++) { for (i = 0; i < xbps_array_count(provides); i++) {
char *tmp = NULL; char *tmp = NULL;
@ -77,6 +78,21 @@ check_virtual_pkgs(struct xbps_handle *xhp,
if (xbps_pkgpattern_match(vpkgver, pkgpattern)) if (xbps_pkgpattern_match(vpkgver, pkgpattern))
continue; 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"); mdeps = xbps_dictionary_get(xhp->transd, "missing_deps");
xbps_dictionary_get_cstring_nocopy(trans_pkgd, "pkgver", &pkgver); xbps_dictionary_get_cstring_nocopy(trans_pkgd, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(rev_pkgd, "pkgver", &revpkgver); xbps_dictionary_get_cstring_nocopy(rev_pkgd, "pkgver", &revpkgver);
@ -87,6 +103,7 @@ check_virtual_pkgs(struct xbps_handle *xhp,
free(str); free(str);
matched = true; matched = true;
} }
free(vpkgname);
free(vpkgver); free(vpkgver);
} }
return matched; return matched;