xbps_transaction_install_pkg: on exact match properly detect if it's installed.

This commit is contained in:
Juan RP 2012-06-05 22:54:46 +02:00
parent efefa000b2
commit e75a524ee3
2 changed files with 11 additions and 4 deletions

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.5" #define XBPS_PKGINDEX_VERSION "1.5"
#define XBPS_API_VERSION "20120605-2" #define XBPS_API_VERSION "20120605-3"
#define XBPS_VERSION "0.16" #define XBPS_VERSION "0.16"
/** /**

View File

@ -239,8 +239,9 @@ xbps_transaction_update_pkg(const char *pkgname)
int int
xbps_transaction_install_pkg(const char *pkg, bool reinstall) xbps_transaction_install_pkg(const char *pkg, bool reinstall)
{ {
prop_dictionary_t pkgd; prop_dictionary_t pkgd = NULL;
pkg_state_t state; pkg_state_t state;
char *pkgname;
bool bypattern, best, exact; bool bypattern, best, exact;
int rv; int rv;
@ -248,7 +249,7 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall)
bypattern = true; bypattern = true;
best = false; best = false;
exact = false; exact = false;
} else if (xbps_pkg_name(pkg)) { } else if ((pkgname = xbps_pkg_name(pkg)) != NULL) {
exact = true; exact = true;
bypattern = false; bypattern = false;
best = false; best = false;
@ -258,7 +259,13 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall)
best = true; best = true;
} }
if ((pkgd = xbps_pkgdb_get_pkgd(pkg, bypattern)) != NULL) { if (exact) {
pkgd = xbps_pkgdb_get_pkgd(pkgname, false);
free(pkgname);
} else
pkgd = xbps_pkgdb_get_pkgd(pkg, bypattern);
if (pkgd) {
if (xbps_pkg_state_dictionary(pkgd, &state) != 0) { if (xbps_pkg_state_dictionary(pkgd, &state) != 0) {
prop_object_release(pkgd); prop_object_release(pkgd);
return EINVAL; return EINVAL;