Use xbps_check_is_installed_pkg(), which performs version checking too.

--HG--
extra : convert_revision : 510a9bceec5e54791be76cc28f36f0e5b6d513eb
This commit is contained in:
Juan RP 2009-02-12 22:51:46 +01:00
parent 774d14ac93
commit f3f5192d5b
2 changed files with 12 additions and 3 deletions

View file

@ -106,7 +106,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
size_t len = 0, dirdepscnt = 0, indirdepscnt = 0;
const char *pkgname, *version, *reqbyname, *reqbyver;
const char *repoloc, *binfile, *array_key, *originpkg, *short_desc;
char *reqby;
char *reqby, *pkgnver;
int rv = 0;
bool indirectdep = false;
@ -134,11 +134,19 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
(void)snprintf(reqby, len, "%s-%s", reqbyname, reqbyver);
reqbystr = prop_string_create_cstring(reqby);
len = strlen(pkgname) + strlen(version) + 2;
pkgnver = malloc(len + 1);
if (pkgnver == NULL) {
free(reqby);
return ENOMEM;
}
(void)snprintf(pkgnver, len, "%s-%s", pkgname, version);
/*
* Check if dependency is already installed to select the
* correct array object.
*/
if (xbps_check_is_installed_pkgname(pkgname)) {
if (xbps_check_is_installed_pkg(pkgnver) == 0) {
/*
* Dependency is already installed.
*/
@ -234,6 +242,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
out:
free(reqby);
free(pkgnver);
prop_object_release(reqbystr);
return rv;

View file

@ -226,7 +226,7 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
/*
* If package is installed, pass to the next one.
*/
if (xbps_check_is_installed_pkgname(pkgname)) {
if (xbps_check_is_installed_pkg(rundep) == 0) {
free(pkgname);
continue;
}