From b0be9f610c02bb2d5e681a3904940d311e9de298 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 3 Jun 2019 14:53:46 +0300 Subject: solver: fix common dependency merging to inherit pinning and flags Notably this fixes occasional issues when doing upgrade with multiple versions of same packages. Without this the upgrade flag is not always propagated properly down the dependency chain. --- src/solver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/solver.c b/src/solver.c index e10cf8b..2121dd9 100644 --- a/src/solver.c +++ b/src/solver.c @@ -462,6 +462,8 @@ static void reconsider_name(struct apk_solver_state *ss, struct apk_name *name) name->name, name0->name); name0->ss.requirers++; name_requirers_changed(ss, name0); + foreach_array_item(p, name0->providers) + inherit_pinning_and_flags(ss, p->pkg, pkg); } } } @@ -510,7 +512,6 @@ static int compare_providers(struct apk_solver_state *ss, unsigned int solver_flags; int r; - /* Prefer existing package */ if (pkgA == NULL || pkgB == NULL) return (pkgA != NULL) - (pkgB != NULL); @@ -675,8 +676,11 @@ static void select_package(struct apk_solver_state *ss, struct apk_name *name) if (name->ss.requirers || name->ss.has_iif) { foreach_array_item(p, name->providers) { - dbg_printf(" consider "PKG_VER_FMT" iif_triggered=%d, tag_ok=%d, selectable=%d, provider_priority=%d, installed=%d\n", - PKG_VER_PRINTF(p->pkg), p->pkg->ss.iif_triggered, p->pkg->ss.tag_ok, p->pkg->ss.pkg_selectable, + dbg_printf(" consider "PKG_VER_FMT" iif_triggered=%d, tag_ok=%d, selectable=%d, available=%d, flags=0x%x, provider_priority=%d, installed=%d\n", + PKG_VER_PRINTF(p->pkg), + p->pkg->ss.iif_triggered, p->pkg->ss.tag_ok, + p->pkg->ss.pkg_selectable, p->pkg->ss.pkg_available, + p->pkg->ss.solver_flags, p->pkg->provider_priority, p->pkg->ipkg != NULL); /* Ensure valid pinning and install-if trigger */ if (name->ss.requirers == 0 && -- cgit v1.2.3-70-g09d2