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:
parent
c3395a2f3b
commit
ead8d2460f
@ -55,7 +55,7 @@
|
||||
*/
|
||||
#define XBPS_PKGINDEX_VERSION "1.2"
|
||||
|
||||
#define XBPS_API_VERSION "20111012"
|
||||
#define XBPS_API_VERSION "20111015"
|
||||
#define XBPS_VERSION "0.10.0"
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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".
|
||||
|
Loading…
Reference in New Issue
Block a user