libxbps: handle the case to replace a vpkg with a pkg with same name.
This for example fixes reinstalling jpeg and libjpeg-turbo multiple times. Also if the "automatic-install" obj is in the pkg to be replaced, copy it to the new pkg to be preserved. Bumped XBPS_API_VERSION.
This commit is contained in:
parent
0f0c66fafb
commit
104bec27e5
@ -55,7 +55,7 @@
|
||||
*/
|
||||
#define XBPS_PKGINDEX_VERSION "1.2"
|
||||
|
||||
#define XBPS_API_VERSION "20111015"
|
||||
#define XBPS_API_VERSION "20111016"
|
||||
#define XBPS_VERSION "0.10.0"
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,7 @@ xbps_repository_pkg_replaces(prop_dictionary_t transd,
|
||||
prop_object_t obj;
|
||||
prop_object_iterator_t iter;
|
||||
const char *pattern, *pkgname, *curpkgname;
|
||||
bool instd_auto = false;
|
||||
|
||||
replaces = prop_dictionary_get(pkg_repod, "replaces");
|
||||
if (replaces == NULL || prop_array_count(replaces) == 0)
|
||||
@ -93,17 +94,22 @@ xbps_repository_pkg_replaces(prop_dictionary_t transd,
|
||||
/*
|
||||
* 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.
|
||||
* its requiredby and automatic-install objects, so copy
|
||||
* them to the pkg's dictionary in transaction.
|
||||
*/
|
||||
if (xbps_match_virtual_pkg_in_dict(pkg_repod,
|
||||
pattern, true)) {
|
||||
if (xbps_match_virtual_pkg_in_dict(pkg_repod, pattern, true) ||
|
||||
xbps_match_virtual_pkg_in_dict(instd, pkgname, false)) {
|
||||
instd_reqby = prop_dictionary_get(instd, "requiredby");
|
||||
if (instd_reqby && prop_array_count(instd_reqby))
|
||||
if (instd_reqby && prop_array_count(instd_reqby)) {
|
||||
prop_dictionary_set(pkg_repod,
|
||||
"requiredby", instd_reqby);
|
||||
}
|
||||
if (prop_dictionary_get_bool(instd,
|
||||
"automatic-install", &instd_auto)) {
|
||||
prop_dictionary_set_bool(pkg_repod,
|
||||
"automatic-install", instd_auto);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add package dictionary into the transaction and mark it
|
||||
* as to be "removed".
|
||||
|
Loading…
Reference in New Issue
Block a user