diff options
Diffstat (limited to 'system/apk-tools/deep.patch')
-rw-r--r-- | system/apk-tools/deep.patch | 106 |
1 files changed, 36 insertions, 70 deletions
diff --git a/system/apk-tools/deep.patch b/system/apk-tools/deep.patch index f315339cc..b9e361717 100644 --- a/system/apk-tools/deep.patch +++ b/system/apk-tools/deep.patch @@ -1,84 +1,50 @@ -From e61635ada7901763919caeaa01fa62ead3f6e97f Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Fri, 31 May 2019 21:32:02 -0500 -Subject: [PATCH 1/1] upgrade: add --deep option to upgrade everything +From b0be9f610c02bb2d5e681a3904940d311e9de298 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +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/apk_solver.h | 1 + - src/solver.c | 10 ++++++++++ - src/upgrade.c | 5 +++++ - 3 files changed, 16 insertions(+) + src/solver.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) -diff --git a/src/apk_solver.h b/src/apk_solver.h -index b8b072d..908b3fd 100644 ---- a/src/apk_solver.h -+++ b/src/apk_solver.h -@@ -35,6 +35,7 @@ struct apk_changeset { - #define APK_SOLVERF_REINSTALL 0x0004 - #define APK_SOLVERF_LATEST 0x0008 - #define APK_SOLVERF_IGNORE_CONFLICT 0x0010 -+#define APK_SOLVERF_DEEP 0x0020 - - void apk_solver_set_name_flags(struct apk_name *name, - unsigned short solver_flags, diff --git a/src/solver.c b/src/solver.c -index e10cf8b..8437d61 100644 +index e10cf8b..2121dd9 100644 --- a/src/solver.c +++ b/src/solver.c -@@ -40,6 +40,7 @@ struct apk_solver_state { - unsigned int pinning_inherit; - unsigned int default_repos; - unsigned ignore_conflict : 1; -+ unsigned deep_upgrade : 1; - }; - - static struct apk_provider provider_none = { -@@ -510,6 +511,14 @@ static int compare_providers(struct apk_solver_state *ss, +@@ -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; -+ /* In deep upgrades, always return the greater version */ -+ if (ss->deep_upgrade) -+ switch (apk_version_compare_blob(*pA->version, *pB->version)) { -+ case APK_VERSION_LESS: -+ return -1; -+ case APK_VERSION_GREATER: -+ return 1; -+ } - +- /* Prefer existing package */ if (pkgA == NULL || pkgB == NULL) -@@ -1006,6 +1015,7 @@ restart: - ss->changeset = changeset; - ss->default_repos = apk_db_get_pinning_mask_repos(db, APK_DEFAULT_PINNING_MASK); - ss->ignore_conflict = !!(solver_flags & APK_SOLVERF_IGNORE_CONFLICT); -+ ss->deep_upgrade = !!(solver_flags & APK_SOLVERF_DEEP); - list_init(&ss->dirty_head); - list_init(&ss->unresolved_head); - -diff --git a/src/upgrade.c b/src/upgrade.c -index 14457b5..e48d8e3 100644 ---- a/src/upgrade.c -+++ b/src/upgrade.c -@@ -38,6 +38,9 @@ static int option_parse_applet(void *ctx, struct apk_db_options *dbopts, int opt - case 'a': - uctx->solver_flags |= APK_SOLVERF_AVAILABLE; - break; -+ case 'd': -+ uctx->solver_flags |= APK_SOLVERF_DEEP; -+ break; - case 'l': - uctx->solver_flags |= APK_SOLVERF_LATEST; - break; -@@ -59,6 +62,8 @@ static const struct apk_option options_applet[] = { - { 0x10000, "no-self-upgrade", - "Do not do early upgrade of 'apk-tools' package" }, - { 0x10001, "self-upgrade-only", "Only do self-upgrade" }, -+ { 'd', "deep", -+ "Include dependencies when upgrading world" }, - }; + return (pkgA != NULL) - (pkgB != NULL); +@@ -675,8 +676,11 @@ static void select_package(struct apk_solver_state *ss, struct apk_name *name) - static const struct apk_option_group optgroup_applet = { + 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 && -- -2.21.0 +cgit v1.2.1 |