libxbps: respect reqdby obj when replacing a pkg with a virtual pkg.

Reverse dependencies weren't respected when replacing a pkg with
another pkg that is providing a virtual pkg for the former.

This resulted in reversedeps being completely lost when new pkg
is installed.
This commit is contained in:
Juan RP
2011-10-15 16:43:27 +02:00
parent c3395a2f3b
commit ead8d2460f
3 changed files with 23 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ xbps_register_pkg(prop_dictionary_t pkgrd)
{
struct xbps_handle *xhp;
prop_dictionary_t dict, pkgd;
prop_array_t array, provides = NULL;
prop_array_t array, provides = NULL, reqby;
const char *pkgname, *version, *desc, *pkgver;
char *plist;
int rv = 0;
@@ -62,6 +62,7 @@ xbps_register_pkg(prop_dictionary_t pkgrd)
prop_dictionary_get_cstring_nocopy(pkgrd, "pkgver", &pkgver);
prop_dictionary_get_bool(pkgrd, "automatic-install", &autoinst);
provides = prop_dictionary_get(pkgrd, "provides");
reqby = prop_dictionary_get(pkgrd, "requiredby");
assert(pkgname != NULL);
assert(version != NULL);
@@ -93,6 +94,11 @@ xbps_register_pkg(prop_dictionary_t pkgrd)
rv = EINVAL;
goto out;
}
if (reqby && !prop_dictionary_set(pkgd, "requiredby", reqby)) {
prop_object_release(pkgd);
rv = EINVAL;
goto out;
}
prop_dictionary_get_bool(pkgd, "automatic-install", &autoinst);
if (xhp->install_reason_auto)
autoinst = true;