requiredby: skip adding same entry if already exists.
This commit is contained in:
parent
9e11ea950a
commit
d99c505811
@ -38,6 +38,7 @@ add_pkg_into_reqby(struct xbps_handle *xhp,
|
|||||||
{
|
{
|
||||||
prop_array_t reqby;
|
prop_array_t reqby;
|
||||||
prop_string_t reqstr;
|
prop_string_t reqstr;
|
||||||
|
const char *curpkgver;
|
||||||
char *pkgname;
|
char *pkgname;
|
||||||
bool alloc = false;
|
bool alloc = false;
|
||||||
|
|
||||||
@ -48,7 +49,11 @@ add_pkg_into_reqby(struct xbps_handle *xhp,
|
|||||||
if ((reqby = prop_array_create()) == NULL)
|
if ((reqby = prop_array_create()) == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* If the same entry already exist we are done.
|
||||||
|
*/
|
||||||
|
if (xbps_match_string_in_array(reqby, pkgver))
|
||||||
|
return 0;
|
||||||
/*
|
/*
|
||||||
* If an existing entry matching pkgname exists remove it
|
* If an existing entry matching pkgname exists remove it
|
||||||
* and add new pkgver object.
|
* and add new pkgver object.
|
||||||
@ -75,6 +80,9 @@ add_pkg_into_reqby(struct xbps_handle *xhp,
|
|||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &curpkgver);
|
||||||
|
xbps_dbg_printf(xhp, "%s: added reqby entry `%s'\n", curpkgver, pkgver);
|
||||||
|
|
||||||
if (!xbps_add_obj_to_array(reqby, reqstr)) {
|
if (!xbps_add_obj_to_array(reqby, reqstr)) {
|
||||||
if (alloc)
|
if (alloc)
|
||||||
prop_object_release(reqby);
|
prop_object_release(reqby);
|
||||||
@ -153,9 +161,6 @@ xbps_requiredby_pkg_add(struct xbps_handle *xhp, prop_dictionary_t pkgd)
|
|||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: adding reqby entry for %s\n",
|
|
||||||
__func__, str);
|
|
||||||
|
|
||||||
pkgd_pkgdb = xbps_find_virtualpkg_conf_in_array_by_pattern(
|
pkgd_pkgdb = xbps_find_virtualpkg_conf_in_array_by_pattern(
|
||||||
xhp, xhp->pkgdb, str);
|
xhp, xhp->pkgdb, str);
|
||||||
if (pkgd_pkgdb == NULL) {
|
if (pkgd_pkgdb == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user