Remove empty self replaced pkg arrays from pkgdb.

This commit is contained in:
Juan RP 2014-09-14 18:16:43 +02:00
parent ac2c517bd7
commit e902619220
2 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,8 @@ check_pkg_unneeded(struct xbps_handle *xhp _unused, const char *pkgname, void *a
buf = xbps_xasprintf("%s>=0", pkgname);
xbps_remove_string_from_array(replaces, buf);
free(buf);
if (!xbps_array_count(replaces))
xbps_dictionary_remove(pkgd, "replaces");
}
return 0;

View File

@ -110,6 +110,8 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
buf = xbps_xasprintf("%s>=0", pkgname);
xbps_remove_string_from_array(replaces, buf);
free(buf);
if (!xbps_array_count(replaces))
xbps_dictionary_remove(pkgd, "replaces");
}
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
xbps_dbg_printf(xhp,