summaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch')
-rw-r--r--main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch b/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
new file mode 100644
index 00000000..2e20152d
--- /dev/null
+++ b/main/apk-tools/0002-upgrade-reset-versioned-deps-in-world-when-doing-upg.patch
@@ -0,0 +1,42 @@
+From 47bac8c29c9a3c3fbebfd20e907170f24f9d677c Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 11 May 2010 09:31:20 +0000
+Subject: [PATCH 2/5] upgrade: reset versioned deps in world when doing upgrade -a
+
+Doing "apk add file.apk" adds a versioned dependency to allow
+downgrading, and sticky version. Most often this is to install
+single packages from newer repository. So it would make sense
+to reset them to non-versioned if doing:
+
+ apk upgrade -a
+
+fixes #346
+---
+ src/upgrade.c | 9 +++++++--
+ 1 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/upgrade.c b/src/upgrade.c
+index f91e8cc..879e14c 100644
+--- a/src/upgrade.c
++++ b/src/upgrade.c
+@@ -41,10 +41,15 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
+ goto err;
+
+ for (i = 0; i < db->world->num; i++) {
+- r = apk_state_lock_dependency(state, &db->world->item[i]);
++ struct apk_dependency *dep = &db->world->item[i];
++ if (dep->version && (apk_flags & APK_PREFER_AVAILABLE)) {
++ dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER;
++ dep->version = NULL;
++ }
++ r = apk_state_lock_dependency(state, dep);
+ if (r != 0) {
+ apk_error("Unable to upgrade '%s'",
+- db->world->item[i].name->name);
++ dep->name->name);
+ goto err;
+ }
+ }
+--
+1.7.1
+