Fix a couple of issues resolving deps with virtual packages.

This commit is contained in:
Juan RP 2012-03-24 09:21:28 +01:00
parent e698acf440
commit af593500c3
2 changed files with 8 additions and 38 deletions

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.4" #define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120313-1" #define XBPS_API_VERSION "20120324"
#define XBPS_VERSION "0.15" #define XBPS_VERSION "0.15"
/** /**

View File

@ -292,15 +292,18 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */
if (rv == 0) { if (rv == 0) {
/* /*
* Package is installed but does not match * Package is installed but does not match
* the dependency pattern. * the dependency pattern, update pkg.
*/ */
xbps_dbg_printf_append("installed `%s', "
"must be updated.\n", pkgver_q);
reason = "update";
} else if (rv == 1) { } else if (rv == 1) {
rv = 0; rv = 0;
if (state == XBPS_PKG_STATE_UNPACKED) { if (state == XBPS_PKG_STATE_UNPACKED) {
/* /*
* Package matches the dependency * Package matches the dependency
* pattern but was only unpacked, * pattern but was only unpacked,
* mark pkg to be configured. * configure pkg.
*/ */
xbps_dbg_printf_append("installed `%s'" xbps_dbg_printf_append("installed `%s'"
", must be configured.\n", ", must be configured.\n",
@ -310,7 +313,7 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */
/* /*
* Package matches the dependency * Package matches the dependency
* pattern and is fully installed, * pattern and is fully installed,
* skip and pass to next one. * skip to next one.
*/ */
xbps_dbg_printf_append("installed " xbps_dbg_printf_append("installed "
"`%s'.\n", pkgver_q); "`%s'.\n", pkgver_q);
@ -399,41 +402,8 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */
} }
} }
} }
/*
* Pass 4: check if new dependency is already installed, due
* to virtual packages.
*/
prop_dictionary_get_cstring_nocopy(curpkgd, "pkgver", &pkgver_q);
tmpd = xbps_find_pkg_dict_installed(pkgver_q, true);
if (tmpd == NULL)
tmpd = xbps_find_virtualpkg_dict_installed(pkgver_q, true);
if (tmpd == NULL) {
/* dependency not installed */
reason = "install";
xbps_dbg_printf_append("(found `%s')\n",
pkgver_q);
} else {
/* dependency installed, check its state */
state = 0;
if ((rv = xbps_pkg_state_dictionary(tmpd, &state)) != 0) {
prop_object_release(tmpd);
xbps_dbg_printf("failed to check pkg state "
"for `%s': %s\n", pkgver_q, strerror(rv));
break;
}
if (state == XBPS_PKG_STATE_INSTALLED) {
reason = "update";
xbps_dbg_printf_append("(found `%s')\n",
pkgver_q);
} else if (state == XBPS_PKG_STATE_UNPACKED) {
reason = "install";
xbps_dbg_printf_append("(found `%s')\n",
pkgver_q);
}
prop_object_release(tmpd);
}
prop_dictionary_set_cstring_nocopy(curpkgd, "transaction", reason); prop_dictionary_set_cstring_nocopy(curpkgd, "transaction", reason);
prop_dictionary_get_cstring_nocopy(curpkgd, "pkgver", &pkgver_q);
/* /*
* Package is on repo, add it into the transaction dictionary. * Package is on repo, add it into the transaction dictionary.
*/ */