libxbps: introduce the concept of "soft replace"; see the NEWS file.

This commit is contained in:
Juan RP
2012-05-25 17:24:36 +02:00
parent d075f7182a
commit 6a4de0127d
5 changed files with 45 additions and 7 deletions

View File

@ -40,7 +40,7 @@ xbps_transaction_package_replace(prop_dictionary_t transd)
prop_object_t obj;
prop_object_iterator_t iter;
const char *pattern, *pkgname, *curpkgname, *pkgver, *curpkgver;
bool instd_auto;
bool instd_auto, sr;
size_t idx;
assert(prop_object_type(transd) == PROP_TYPE_DICTIONARY);
@ -141,6 +141,22 @@ xbps_transaction_package_replace(prop_dictionary_t transd)
prop_dictionary_set_bool(pkg_repod,
"automatic-install", instd_auto);
}
/*
* Copy requiredby and automatic-install objects
* from replaced package into pkg's dictionary
* for "softreplace" packages.
*/
sr = false;
prop_dictionary_get_bool(pkg_repod, "softreplace", &sr);
if (sr) {
if (instd_reqby &&
prop_array_count(instd_reqby)) {
prop_dictionary_set(pkg_repod,
"requiredby", instd_reqby);
}
prop_dictionary_set_bool(pkg_repod,
"automatic-install", instd_auto);
}
/*
* Add package dictionary into the transaction and mark
* it as to be "removed".