From ebd614dff64e6d21da52bddf75d08d04de44ddea Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Mon, 22 Sep 2014 21:23:40 +0200 Subject: [PATCH] bin/xbps-rindex: take the revert field in account. - if the user wants to add a package which is older than the one in the index, xbps-rindex will check if the package reverts the one on the index. If so the package will be added regardless of its version - if the user wants to add a package which is newer than the one on the index, xbps-rindex will check if the package on the index reverts the one the user wants to add. If so the package will be skipped regardless of its version. --- bin/xbps-rindex/index-add.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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);