Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix upgrade chain processing heuristic.
Vsevolod Stakhov committed 11 years ago
commit adec4442e9638e42a8805f6c89dad0ab6a43abb0
parent ad0f68c
3 files changed +10 -4
modified libpkg/pkg_jobs.c
@@ -1462,6 +1462,7 @@ pkg_jobs_solve(struct pkg_jobs *j)
			waitpid(pchild, &pstatus, WNOHANG);
		}
		else {
+
			pkg_jobs_universe_process_upgrade_chains(j);
			problem = pkg_solve_jobs_to_sat(j);
			if (problem != NULL) {
				if ((solver = pkg_object_string(pkg_config_get("SAT_SOLVER"))) != NULL) {
modified libpkg/pkg_jobs_universe.c
@@ -785,7 +785,7 @@ pkg_jobs_universe_process_upgrade_chains(struct pkg_jobs *j)
			vercnt ++;
		}

-
		if (vercnt > 2) {
+
		if (vercnt > 1) {
			/*
			 * Here we have more than one upgrade candidate,
			 * if local == NULL, then we have two remote repos,
@@ -796,8 +796,8 @@ pkg_jobs_universe_process_upgrade_chains(struct pkg_jobs *j)
				/* Select the most recent or one of packages */
				struct pkg_job_universe_item *selected = NULL;
				LL_FOREACH(unit, cur) {
-
					if (selected != NULL && pkg_version_change_between(selected->pkg,
-
						cur->pkg) > 0) {
+
					if (selected != NULL && pkg_version_change_between(cur->pkg,
+
						selected->pkg) == PKG_UPGRADE) {
						selected = cur;
					}
					else if (selected == NULL) {
@@ -814,7 +814,7 @@ pkg_jobs_universe_process_upgrade_chains(struct pkg_jobs *j)
					}
				}
			}
-
			else {
+
			else if (vercnt > 2) {
				/*
				 * We have no ideas what to select, but we need to remove
				 * all install requests leaving only delete request for the
modified libpkg/private/pkg_jobs.h
@@ -222,4 +222,9 @@ void pkg_conflicts_register(struct pkg *p1, struct pkg *p2,
 */
bool pkg_jobs_need_upgrade(struct pkg *rp, struct pkg *lp);

+
/*
+
 * Pre-process universe to fix complex upgrade chains
+
 */
+
void pkg_jobs_universe_process_upgrade_chains(struct pkg_jobs *j);
+

#endif /* PKG_JOBS_H_ */