Fix some issues while matching for required pkgdeps.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091107154159-riikhswt1h3mm9xn
This commit is contained in:
Juan RP 2009-11-07 16:41:59 +01:00
parent 79d3f446fe
commit 795c2a58f5
3 changed files with 18 additions and 5 deletions

View File

@ -279,12 +279,23 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
/* /*
* Check if required dep is satisfied and installed. * Check if required dep is satisfied and installed.
*/ */
if (xbps_check_is_installed_pkg(reqpkg)) rv = xbps_check_is_installed_pkg(reqpkg);
if (rv == -1) {
/* There was an error checking it... */
break;
} else if (rv == 1) {
/* pkgdep is satisfied */
continue; continue;
}
pkgname = xbps_get_pkgdep_name(reqpkg); pkgname = xbps_get_pkgdep_name(reqpkg);
if (pkgname == NULL) {
rv = EINVAL;
break;
}
reqvers = xbps_get_pkgdep_version(reqpkg); reqvers = xbps_get_pkgdep_version(reqpkg);
if (pkgname == NULL || reqvers == NULL) { if (reqvers == NULL) {
free(pkgname);
rv = EINVAL; rv = EINVAL;
break; break;
} }

View File

@ -113,6 +113,8 @@ xbps_pkgdep_match(const char *instpkg, char *pattern)
char basefname[PATH_MAX], condchar = '\0', *condition; char basefname[PATH_MAX], condchar = '\0', *condition;
int rv = 0; int rv = 0;
memset(&basefname, 0, sizeof(basefname));
condition = strpbrk(pattern, "><="); condition = strpbrk(pattern, "><=");
if (condition) { if (condition) {
const char *ch; const char *ch;

View File

@ -141,16 +141,16 @@ xbps_check_is_installed_pkg(const char *pkg)
free(pkgname); free(pkgname);
return -1; return -1;
} }
free(pkgname);
if (state != XBPS_PKG_STATE_INSTALLED) { if (state != XBPS_PKG_STATE_INSTALLED) {
prop_object_release(dict); prop_object_release(dict);
return 0; free(pkgname);
return 0; /* not fully installed */
} }
/* Get version from installed package */ /* Get version from installed package */
prop_dictionary_get_cstring_nocopy(dict, "version", &instver); prop_dictionary_get_cstring_nocopy(dict, "version", &instver);
instpkg = xbps_xasprintf("%s-%s", pkgname, instver); instpkg = xbps_xasprintf("%s-%s", pkgname, instver);
free(pkgname);
if (instpkg == NULL) { if (instpkg == NULL) {
prop_object_release(dict); prop_object_release(dict);
return -1; return -1;