diff --git a/bin/xbps-rindex/index-add.c b/bin/xbps-rindex/index-add.c index a61e4e5e..5ef65ac0 100644 --- a/bin/xbps-rindex/index-add.c +++ b/bin/xbps-rindex/index-add.c @@ -117,6 +117,22 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force) xbps_dictionary_get_cstring(curpkgd, "pkgver", &opkgver); xbps_dictionary_get_cstring(curpkgd, "architecture", &oarch); ret = xbps_cmpver(pkgver, opkgver); + + /* + * If the current package reverts the package in the index, consider + * the current package as the newer one. + */ + if(ret < 0 && xbps_pkgver_is_reverted(pkgver, curpkgd)) { + ret = 1; + } + /* + * If package in the index reverts current package, consider the + * package in the index as the newer one. + */ + else if (ret < 0 && xbps_pkgver_is_reverted(opkgver, binpkgd)) { + ret = -1; + } + if (ret <= 0) { /* Same version or index version greater */ fprintf(stderr, "index: skipping `%s' (%s), already registered.\n", pkgver, arch);