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.
This commit is contained in:
parent
18204aeac1
commit
ebd614dff6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user