diff --git a/include/xbps.h.in b/include/xbps.h.in index 5e7fb31c..90d7ef40 100644 --- a/include/xbps.h.in +++ b/include/xbps.h.in @@ -1635,7 +1635,8 @@ int xbps_file_hash_check(const char *file, const char *sha256); bool xbps_verify_file_signature(struct xbps_repo *repo, const char *fname); /** - * Checks if a package is currently installed by matching \a pkg. + * Checks if a package is currently installed in pkgdb by matching \a pkg. + * To be installed, the pkg must be in "installed" or "unpacked" state. * * @param[in] xhp The pointer to an xbps_handle struct. * @param[in] pkg Package name, version pattern or exact pkg to match. diff --git a/lib/util.c b/lib/util.c index d10bcee4..a34b7069 100644 --- a/lib/util.c +++ b/lib/util.c @@ -79,10 +79,10 @@ xbps_pkg_is_installed(struct xbps_handle *xhp, const char *pkg) */ if (xbps_pkg_state_dictionary(dict, &state) != 0) return -1; /* error */ - if (state != XBPS_PKG_STATE_INSTALLED) - return 0; /* not fully installed */ + if (state == XBPS_PKG_STATE_INSTALLED || state == XBPS_PKG_STATE_UNPACKED) + return 1; - return 1; + return 0; /* not fully installed */ } const char *