diff --git a/src/commit.c b/src/commit.c index 08c2480..a6b841c 100644 --- a/src/commit.c +++ b/src/commit.c @@ -267,7 +267,7 @@ int apk_solver_commit_changeset(struct apk_database *db, struct apk_change *change; char buf[32]; const char *size_unit; - off_t humanized, size_diff = 0; + off_t humanized, size_diff = 0, download_size = 0; int r, errors = 0; assert(world); @@ -283,12 +283,15 @@ int apk_solver_commit_changeset(struct apk_database *db, /* Count what needs to be done */ foreach_array_item(change, changeset->changes) { count_change(change, &prog.total); - if (change->new_pkg) + if (change->new_pkg) { size_diff += change->new_pkg->installed_size; + if (change->new_pkg != change->old_pkg && + !(change->new_pkg->repos & db->local_repos)) + download_size += change->new_pkg->size; + } if (change->old_pkg) size_diff -= change->old_pkg->installed_size; } - size_unit = apk_get_human_size(llabs(size_diff), &humanized); if ((apk_out_verbosity(out) > 1 || (db->ctx->flags & APK_INTERACTIVE)) && !(db->ctx->flags & APK_SIMULATE)) { @@ -303,6 +306,12 @@ int apk_solver_commit_changeset(struct apk_database *db, "The following packages will be upgraded"); r += dump_packages(out, changeset, cmp_reinstall, "The following packages will be reinstalled"); + if (download_size) { + size_unit = apk_get_human_size(download_size, &humanized); + printf("Need to download %lld %s of packages.\n", + (long long)humanized, size_unit); + } + size_unit = apk_get_human_size(llabs(size_diff), &humanized); printf("After this operation, %lld %s of %s.\n", (long long)humanized, size_unit,