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

@@ -36,7 +36,7 @@ int HIDDEN
xbps_repository_pkg_replaces(prop_dictionary_t transd,
prop_dictionary_t pkg_repod)
{
prop_array_t replaces, unsorted;
prop_array_t replaces, unsorted, instd_reqby;
prop_dictionary_t instd, reppkgd;
prop_object_t obj;
prop_object_iterator_t iter;
@@ -83,6 +83,20 @@ xbps_repository_pkg_replaces(prop_dictionary_t transd,
prop_object_release(instd);
continue;
}
/*
* If new package is providing a virtual package to the
* package that we want to replace we should respect
* its requiredby object, so copy it to the pkg's dictionary
* in transaction.
*/
if (xbps_match_virtual_pkg_in_dict(pkg_repod,
pattern, true)) {
instd_reqby = prop_dictionary_get(instd, "requiredby");
if (instd_reqby && prop_array_count(instd_reqby))
prop_dictionary_set(pkg_repod,
"requiredby", instd_reqby);
}
/*
* Add package dictionary into the transaction and mark it
* as to be "removed".