Created
September 22, 2014 16:46
-
-
Save Gottox/aa6286fdb1ba24c0202d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c | |
index 7dd52e4..38bfda6 100644 | |
--- a/lib/transaction_ops.c | |
+++ b/lib/transaction_ops.c | |
@@ -62,10 +62,10 @@ static int | |
trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall) | |
{ | |
xbps_dictionary_t pkg_pkgdb = NULL, pkg_repod = NULL; | |
- xbps_array_t unsorted, replaces; | |
- const char *repoloc, *repopkgver, *instpkgver, *reason; | |
+ xbps_array_t unsorted, replaces, reverts; | |
+ const char *repoloc, *repopkgver, *instpkgver, *reason, *revertver; | |
char *self_replaced, *pkgname; | |
- int action = 0, rv = 0; | |
+ int action = 0, rv = 0, vcmp = 0; | |
pkg_state_t state = 0; | |
bool autoinst = false; | |
@@ -109,6 +109,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall) | |
xbps_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &repopkgver); | |
xbps_dictionary_get_cstring_nocopy(pkg_repod, "repository", &repoloc); | |
+ reverts = xbps_dictionary_get(pkg_repod, "reverts"); | |
if (action == TRANS_UPDATE) { | |
/* | |
@@ -117,10 +118,27 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall) | |
*/ | |
xbps_dictionary_get_cstring_nocopy(pkg_pkgdb, | |
"pkgver", &instpkgver); | |
- if (xbps_cmpver(repopkgver, instpkgver) <= 0) { | |
+ vcmp = xbps_cmpver(repopkgver, instpkgver); | |
+ | |
+ if (vcmp < 0) { | |
+ /* | |
+ * Check if the pkg in the repo is explicitly marked to replace a | |
+ * specific installed version. This overwrites version comparision. | |
+ */ | |
+ for (i = 0; i < xbps_array_count(reverts); i++) { | |
+ xbps_array_get_cstring_nocopy(reverts, i, &revertsver); | |
+ if (strcmp(repopkgver, revertver) == 0) { | |
+ cmp = 1; | |
+ break; | |
+ } | |
+ } | |
+ } | |
+ | |
+ if (vcmp <= 0) { | |
xbps_dbg_printf(xhp, "[rpool] Skipping `%s' " | |
- "(installed: %s) from repository `%s'\n", | |
- repopkgver, instpkgver, repoloc); | |
+ "(installed: %s) from repository `%s'\n", | |
+ repopkgver, instpkgver, repoloc); | |
+ | |
return EEXIST; | |
} | |
} else if (action == TRANS_REINSTALL) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment