From 1c7e8d2617d93daac1fe0c38c0279435331bb152 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sat, 1 Jan 2011 16:58:58 +0200 Subject: pkg: dependencies to specific package checksum When package is installed from commandline, we should always install that specific instance of package (never favor repository version if it has difference identity). Otherwise we might not always end-up installing the .apk given on command line. The dependency is now against specific checksum identity (marked with >< dependency comparison). Fixes #492. --- src/state.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index ddfca57..408df72 100644 --- a/src/state.c +++ b/src/state.c @@ -130,8 +130,7 @@ static struct apk_name_choices *name_choices_new(struct apk_database *db, continue; for (j = 0; j < nc->num; ) { - if (apk_version_compare_blob(*nc->pkgs[j]->version, *dep->version) - & dep->result_mask) { + if (apk_dep_is_satisfied(dep, nc->pkgs[j])) { j++; } else { nc->pkgs[j] = nc->pkgs[nc->num - 1]; @@ -286,8 +285,7 @@ int apk_state_prune_dependency(struct apk_state *state, return -1; } } else { - if (!(apk_version_compare_blob(*pkg->version, *dep->version) - & dep->result_mask)) + if (!apk_dep_is_satisfied(dep, pkg)) return -1; } @@ -301,9 +299,8 @@ int apk_state_prune_dependency(struct apk_state *state, c = ns_to_choices(state->name[name->id]); i = 0; while (i < c->num) { - if (apk_version_compare_blob(*c->pkgs[i]->version, *dep->version) - & dep->result_mask) { - i++; + if (apk_dep_is_satisfied(dep, c->pkgs[i])) { + i++; continue; } @@ -444,8 +441,7 @@ static int call_if_dependency_broke(struct apk_state *state, dep->result_mask == APK_DEPMASK_CONFLICT) continue; if (dep_pkg != NULL && - (apk_version_compare_blob(*dep_pkg->version, *dep->version) - & dep->result_mask)) + apk_dep_is_satisfied(dep, dep_pkg)) continue; return cb(state, pkg, dep, ctx); } @@ -619,12 +615,11 @@ static void apk_print_change(struct apk_database *db, msg = "Downgrading"; break; case APK_VERSION_EQUAL: - if (newpkg == oldpkg) { + if (newpkg == oldpkg) msg = "Re-installing"; - break; - } - /* fallthrough - equal version, but different - * package is counted as upgrade */ + else + msg = "Replacing"; + break; case APK_VERSION_GREATER: msg = "Upgrading"; break; -- cgit v1.2.3-60-g2f50