summaryrefslogtreecommitdiff
path: root/src/solver.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-07-22 11:13:33 +0300
committerTimo Teräs <timo.teras@iki.fi>2016-07-22 11:13:33 +0300
commitac0a9659d1c86e9c0b4234a16486e084bcb0a555 (patch)
tree6daddc204773eaf3007c672de53109278e3cf0b4 /src/solver.c
parent22434a5ff03db80f329c90fc628f3332f87698d4 (diff)
downloadapk-tools-ac0a9659d1c86e9c0b4234a16486e084bcb0a555.tar.gz
apk-tools-ac0a9659d1c86e9c0b4234a16486e084bcb0a555.tar.bz2
apk-tools-ac0a9659d1c86e9c0b4234a16486e084bcb0a555.tar.xz
apk-tools-ac0a9659d1c86e9c0b4234a16486e084bcb0a555.zip
upgrade: improve self upgrade functionality a bit
trigger it only if apk-tools can be upgrade, add test cases
Diffstat (limited to 'src/solver.c')
-rw-r--r--src/solver.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/solver.c b/src/solver.c
index d287043..f41dffd 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -482,6 +482,7 @@ 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);
@@ -521,7 +522,7 @@ static int compare_providers(struct apk_solver_state *ss,
return r;
/* Prefer installed on self-upgrade */
- if (db->performing_self_update && !(solver_flags & APK_SOLVERF_UPGRADE)) {
+ if (db->performing_self_upgrade && !(solver_flags & APK_SOLVERF_UPGRADE)) {
r = (pkgA->ipkg != NULL) - (pkgB->ipkg != NULL);
if (r)
return r;
@@ -631,8 +632,8 @@ 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\n",
- PKG_VER_PRINTF(p->pkg), p->pkg->ss.iif_triggered, p->pkg->ss.tag_ok);
+ dbg_printf(" consider "PKG_VER_FMT" iif_triggered=%d, tag_ok=%d, selectable=%d\n",
+ PKG_VER_PRINTF(p->pkg), p->pkg->ss.iif_triggered, p->pkg->ss.tag_ok, p->pkg->ss.pkg_selectable);
/* Ensure valid pinning and install-if trigger */
if (name->ss.requirers == 0 &&
(!p->pkg->ss.iif_triggered ||
@@ -979,7 +980,7 @@ restart:
pkg = name->ss.chosen.pkg;
if (pkg == NULL || pkg->ss.error) {
d->broken = 1;
- dbg_printf("disabling broken world dep: %s", name->name);
+ dbg_printf("disabling broken world dep: %s\n", name->name);
}
}
apk_hash_foreach(&db->available.names, free_name, NULL);