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.
cute-signatures
Timo Teräs 2019-06-03 14:53:46 +03:00
parent 1c47f37443
commit b0be9f610c
1 changed files with 7 additions and 3 deletions

View File

@ -462,6 +462,8 @@ static void reconsider_name(struct apk_solver_state *ss, struct apk_name *name)
name->name, name0->name); name->name, name0->name);
name0->ss.requirers++; name0->ss.requirers++;
name_requirers_changed(ss, name0); 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; unsigned int solver_flags;
int r; int r;
/* Prefer existing package */ /* Prefer existing package */
if (pkgA == NULL || pkgB == NULL) if (pkgA == NULL || pkgB == NULL)
return (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) { if (name->ss.requirers || name->ss.has_iif) {
foreach_array_item(p, name->providers) { 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", 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, 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); p->pkg->provider_priority, p->pkg->ipkg != NULL);
/* Ensure valid pinning and install-if trigger */ /* Ensure valid pinning and install-if trigger */
if (name->ss.requirers == 0 && if (name->ss.requirers == 0 &&