diff --git a/lib/cmpver.c b/lib/cmpver.c index d946f17e251..f7380b45206 100644 --- a/lib/cmpver.c +++ b/lib/cmpver.c @@ -292,7 +292,7 @@ xbps_cmpver_packages(const char *pkg1, const char *pkg2) result = (r1 < r2 ? -1 : 1); } - return result == -1 ? 1 : 0; + return result; } int @@ -300,5 +300,5 @@ xbps_cmpver_versions(const char *inst, const char *req) { int res = xbps_cmpver_packages(inst, req); - return res == -1 ? 1 : 0; + return res; } diff --git a/lib/depends.c b/lib/depends.c index 46b36764a5d..56425217f19 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -527,7 +527,7 @@ find_pkg_deps_from_repo(prop_dictionary_t repo, prop_dictionary_t pkg, /* * Check if required dep is satisfied and installed. */ - if (xbps_check_is_installed_pkg(reqpkg) == 0) { + if (xbps_check_is_installed_pkg(reqpkg) >= 0) { free(pkgname); continue; } diff --git a/lib/sortdeps.c b/lib/sortdeps.c index 5a96f28336c..14b55f21044 100644 --- a/lib/sortdeps.c +++ b/lib/sortdeps.c @@ -210,7 +210,7 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps) /* * If package is installed, pass to the next one. */ - if (xbps_check_is_installed_pkg(rundep) == 0) { + if (xbps_check_is_installed_pkg(rundep) >= 0) { free(pkgname); continue; } diff --git a/lib/util.c b/lib/util.c index 552432a290d..034f02851eb 100644 --- a/lib/util.c +++ b/lib/util.c @@ -125,7 +125,7 @@ xbps_check_is_installed_pkg(const char *pkg) dict = xbps_find_pkg_installed_from_plist(pkgname); if (dict == NULL) { free(pkgname); - return 1; /* not installed */ + return -1; /* not installed */ } /* Get version from installed package */ diff --git a/shutils/builddep_funcs.sh b/shutils/builddep_funcs.sh index 797e4937f11..88baa0ed381 100644 --- a/shutils/builddep_funcs.sh +++ b/shutils/builddep_funcs.sh @@ -166,7 +166,7 @@ check_installed_pkg() iver="$($XBPS_REGPKGDB_CMD version $pkgname)" if [ -n "$iver" ]; then xbps-cmpver $pkgname-$iver $pkgname-$reqver - [ $? -eq 0 ] && return 0 + [ $? -ge 0 ] && return 0 fi return 1