diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-12 08:45:29 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-13 18:22:00 +0300 |
commit | 426a12686e6e6dcce11616c774176c01ad0985f9 (patch) | |
tree | 0fcad980e90c3d679b883c7840af91d5ffb0962e /src/commit.c | |
parent | b8c44536ca911418fee1c9ab4eecbb913a1ca852 (diff) | |
download | apk-tools-426a12686e6e6dcce11616c774176c01ad0985f9.tar.gz apk-tools-426a12686e6e6dcce11616c774176c01ad0985f9.tar.bz2 apk-tools-426a12686e6e6dcce11616c774176c01ad0985f9.tar.xz apk-tools-426a12686e6e6dcce11616c774176c01ad0985f9.zip |
solver: rewrite as deductive solver -- per name flags
Handle properly per-name preference flags, and add test cases
for testing those via fix applet.
Diffstat (limited to 'src/commit.c')
-rw-r--r-- | src/commit.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/commit.c b/src/commit.c index 660aab9..2c1d4b5 100644 --- a/src/commit.c +++ b/src/commit.c @@ -104,15 +104,16 @@ struct apk_stats { static void count_change(struct apk_change *change, struct apk_stats *stats) { - if (change->new_pkg != change->old_pkg) { + if (change->new_pkg != change->old_pkg || change->reinstall) { if (change->new_pkg != NULL) { stats->bytes += change->new_pkg->installed_size; - stats->packages ++; + stats->packages++; } if (change->old_pkg != NULL) - stats->packages ++; + stats->packages++; stats->changes++; - } else if (change->reinstall || change->new_repository_tag != change->old_repository_tag) { + } else if (change->new_repository_tag != change->old_repository_tag) { + stats->packages++; stats->changes++; } } @@ -157,12 +158,16 @@ static void update_progress(struct progress *prog, size_t percent, int force) static void progress_cb(void *ctx, size_t pkg_percent) { struct progress *prog = (struct progress *) ctx; - size_t partial = 0, percent; + size_t partial = 0, percent, total; if (prog->pkg != NULL) partial = muldiv(pkg_percent, prog->pkg->installed_size, APK_PROGRESS_SCALE); - percent = muldiv(100, prog->done.bytes + prog->done.packages + partial, - prog->total.bytes + prog->total.packages); + total = prog->total.bytes + prog->total.packages; + if (total > 0) + percent = muldiv(100, prog->done.bytes + prog->done.packages + partial, + prog->total.bytes + prog->total.packages); + else + percent = 0; update_progress(prog, percent, pkg_percent == 0); } |