summaryrefslogtreecommitdiff
path: root/src/upgrade.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-03-19 14:21:58 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-03-19 14:21:58 +0200
commit7b6e44b11b4b419a6af91555270b1ddc981c5a74 (patch)
tree06fdb978c823c94cdd67ed1ec7f224320fd7a9ed /src/upgrade.c
parent4e72075fbab32e9368d1305431924f10e78c0546 (diff)
downloadapk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.gz
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.bz2
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.tar.xz
apk-tools-7b6e44b11b4b419a6af91555270b1ddc981c5a74.zip
upgrade: reset world dependencies during traversal
This allows us to get apk-tools dependencies get reset at proper time in world. As a bonus, it reduces code amount.
Diffstat (limited to 'src/upgrade.c')
-rw-r--r--src/upgrade.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/upgrade.c b/src/upgrade.c
index 795e62f..eb51457 100644
--- a/src/upgrade.c
+++ b/src/upgrade.c
@@ -33,21 +33,10 @@ static int upgrade_parse(void *ctx, struct apk_db_options *dbopts,
int apk_do_self_upgrade(struct apk_database *db, struct apk_state *state)
{
struct apk_dependency dep;
- int r, i;
+ int r;
apk_dep_from_blob(&dep, db, APK_BLOB_STR("apk-tools"));
- if (apk_flags & APK_PREFER_AVAILABLE) {
- for (i = 0; i < db->world->num; i++) {
- struct apk_dependency *dep0 = &db->world->item[i];
- if (dep0->name != dep.name)
- continue;
- dep0->version = apk_blob_atomize(APK_BLOB_NULL);
- dep0->result_mask = APK_DEPMASK_REQUIRE;
- break;
- }
- }
-
r = apk_state_lock_dependency(state, &dep);
if (r != 0 || state->num_changes == 0)
return r;
@@ -74,7 +63,6 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
{
struct apk_state *state = NULL;
struct apk_name_array *missing;
- apk_blob_t *null_atom = apk_blob_atomize(APK_BLOB_NULL);
int i, r = 0;
apk_flags |= APK_UPGRADE;
@@ -92,11 +80,7 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
for (i = 0; i < db->world->num; i++) {
struct apk_dependency *dep = &db->world->item[i];
- if (dep->version != null_atom &&
- (apk_flags & APK_PREFER_AVAILABLE)) {
- dep->result_mask = APK_DEPMASK_REQUIRE;
- dep->version = null_atom;
- }
+
if (dep->name->pkgs->num != 0)
r |= apk_state_lock_dependency(state, dep);
else