Use xbps_check_is_installed_pkg(), which performs version checking too.
--HG-- extra : convert_revision : 510a9bceec5e54791be76cc28f36f0e5b6d513eb
This commit is contained in:
parent
774d14ac93
commit
f3f5192d5b
2 changed files with 12 additions and 3 deletions
|
@ -106,7 +106,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
||||||
size_t len = 0, dirdepscnt = 0, indirdepscnt = 0;
|
size_t len = 0, dirdepscnt = 0, indirdepscnt = 0;
|
||||||
const char *pkgname, *version, *reqbyname, *reqbyver;
|
const char *pkgname, *version, *reqbyname, *reqbyver;
|
||||||
const char *repoloc, *binfile, *array_key, *originpkg, *short_desc;
|
const char *repoloc, *binfile, *array_key, *originpkg, *short_desc;
|
||||||
char *reqby;
|
char *reqby, *pkgnver;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
bool indirectdep = false;
|
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);
|
(void)snprintf(reqby, len, "%s-%s", reqbyname, reqbyver);
|
||||||
reqbystr = prop_string_create_cstring(reqby);
|
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
|
* Check if dependency is already installed to select the
|
||||||
* correct array object.
|
* correct array object.
|
||||||
*/
|
*/
|
||||||
if (xbps_check_is_installed_pkgname(pkgname)) {
|
if (xbps_check_is_installed_pkg(pkgnver) == 0) {
|
||||||
/*
|
/*
|
||||||
* Dependency is already installed.
|
* Dependency is already installed.
|
||||||
*/
|
*/
|
||||||
|
@ -234,6 +242,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(reqby);
|
free(reqby);
|
||||||
|
free(pkgnver);
|
||||||
prop_object_release(reqbystr);
|
prop_object_release(reqbystr);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -226,7 +226,7 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
|
||||||
/*
|
/*
|
||||||
* If package is installed, pass to the next one.
|
* 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);
|
free(pkgname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue