Created
September 22, 2014 17:16
-
-
Save Gottox/f82499986c818c8270e5 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..75ef7fd 100644 | |
--- a/lib/transaction_ops.c | |
+++ b/lib/transaction_ops.c | |
@@ -62,10 +62,11 @@ 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; | |
+ unsigned int i = 0; | |
pkg_state_t state = 0; | |
bool autoinst = false; | |
@@ -117,7 +118,22 @@ 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 && (reverts = xbps_dictionary_get(pkg_repod, "reverts"))) { | |
+ /* | |
+ * 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, &revertver); | |
+ if (strcmp(repopkgver, revertver) == 0) { | |
+ vcmp = 1; | |
+ break; | |
+ } | |
+ } | |
+ } | |
+ | |
+ if (vcmp <= 0) { | |
xbps_dbg_printf(xhp, "[rpool] Skipping `%s' " | |
"(installed: %s) from repository `%s'\n", | |
repopkgver, instpkgver, repoloc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment