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

@@ -89,7 +89,7 @@ xbps_configure_pkg(const char *pkgname,
const struct xbps_handle *xhp;
prop_dictionary_t pkgd;
const char *lver;
char *buf;
char *buf, *pkgver;
int rv = 0;
pkg_state_t state = 0;
bool reconfigure = false;
@@ -147,6 +147,13 @@ xbps_configure_pkg(const char *pkgname,
}
}
free(buf);
pkgver = xbps_xasprintf("%s-%s", pkgname, lver);
if (pkgver == NULL)
return ENOMEM;
return xbps_set_pkg_state_installed(pkgname, XBPS_PKG_STATE_INSTALLED);
rv = xbps_set_pkg_state_installed(pkgname, lver, pkgver,
XBPS_PKG_STATE_INSTALLED);
free(pkgver);
return rv;
}