xbps_set_pkg_state_installed: added two new optional arguments: version and pkgver.

This can be used to avoid some rare cases where the pkg dictionary is regpkgdb
is in a state where code can be faulty if those objects are not found.
This commit is contained in:
Juan RP
2011-02-22 11:09:39 +01:00
parent 9abcb92e39
commit a306cebc96
6 changed files with 52 additions and 17 deletions

View File

@@ -174,6 +174,7 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
{
const struct xbps_handle *xhp;
prop_dictionary_t dict;
const char *pkgver;
char *buf;
int rv = 0;
bool rmfile_exists = false;
@@ -235,6 +236,7 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
free(buf);
return errno;
}
prop_dictionary_get_cstring_nocopy(dict, "pkgver", &pkgver);
/* Remove links */
if ((rv = xbps_remove_pkg_files(dict, "links")) != 0) {
@@ -278,7 +280,7 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
/*
* Set package state to "config-files".
*/
rv = xbps_set_pkg_state_installed(pkgname,
rv = xbps_set_pkg_state_installed(pkgname, version, pkgver,
XBPS_PKG_STATE_CONFIG_FILES);