Revert "lib/transaction_ops.c: remove updating all reverse dependencies"

This reverts commit 5e4d33a58f.
This commit is contained in:
Duncan Overbruck 2019-08-05 11:48:11 +02:00
parent 4f6a5a51de
commit cb28e7959a

View File

@ -342,6 +342,7 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
int int
xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg) xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg)
{ {
xbps_array_t rdeps;
int rv; int rv;
rv = xbps_autoupdate(xhp); rv = xbps_autoupdate(xhp);
@ -358,6 +359,20 @@ xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg)
break; break;
} }
rdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkg);
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
const char *curpkgver = NULL;
char *curpkgn;
xbps_array_get_cstring_nocopy(rdeps, i, &curpkgver);
curpkgn = xbps_pkg_name(curpkgver);
assert(curpkgn);
rv = trans_find_pkg(xhp, curpkgn, false, false);
free(curpkgn);
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, curpkgver, rv);
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV)
return rv;
}
rv = trans_find_pkg(xhp, pkg, false, false); rv = trans_find_pkg(xhp, pkg, false, false);
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv); xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
return rv; return rv;
@ -367,6 +382,7 @@ int
xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg,
bool reinstall) bool reinstall)
{ {
xbps_array_t rdeps;
int rv; int rv;
rv = xbps_autoupdate(xhp); rv = xbps_autoupdate(xhp);
@ -382,6 +398,20 @@ xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg,
break; break;
} }
rdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkg);
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
const char *curpkgver = NULL;
char *curpkgn;
xbps_array_get_cstring_nocopy(rdeps, i, &curpkgver);
curpkgn = xbps_pkg_name(curpkgver);
assert(curpkgn);
rv = trans_find_pkg(xhp, curpkgn, false, false);
free(curpkgn);
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, curpkgver, rv);
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV)
return rv;
}
rv = trans_find_pkg(xhp, pkg, reinstall, false); rv = trans_find_pkg(xhp, pkg, reinstall, false);
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv); xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
return rv; return rv;