diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-02-23 16:02:03 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-02-23 16:02:03 +0200 |
commit | a9a84215c70c746b2f6a6b3c58c338730100666c (patch) | |
tree | 9090c49b5876949bb83f842420315c4f03c3f694 /src | |
parent | 92d6e99144a4b7227ad29c69fe10e97478bc63bb (diff) | |
download | apk-tools-a9a84215c70c746b2f6a6b3c58c338730100666c.tar.gz apk-tools-a9a84215c70c746b2f6a6b3c58c338730100666c.tar.bz2 apk-tools-a9a84215c70c746b2f6a6b3c58c338730100666c.tar.xz apk-tools-a9a84215c70c746b2f6a6b3c58c338730100666c.zip |
solver: report size difference in kibi- or mebibytes
Diffstat (limited to 'src')
-rw-r--r-- | src/solver.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/solver.c b/src/solver.c index dc91a87..a81ed80 100644 --- a/src/solver.c +++ b/src/solver.c @@ -1763,7 +1763,7 @@ int apk_solver_commit_changeset(struct apk_database *db, { struct progress prog; struct apk_change *change; - int i, r = 0, size_diff = 0; + int i, r = 0, size_diff = 0, size_unit; if (apk_db_check_world(db, world) != 0) { apk_error("Not committing changes due to missing repository tags. Use --force to override."); @@ -1784,6 +1784,11 @@ int apk_solver_commit_changeset(struct apk_database *db, size_diff -= change->oldpkg->installed_size; } size_diff /= 1024; + size_unit = 'K'; + if (abs(size_diff) > 10000) { + size_diff /= 1024; + size_unit = 'M'; + } if (apk_verbosity > 1 || (apk_flags & APK_INTERACTIVE)) { r = dump_packages(changeset, cmp_remove, @@ -1795,10 +1800,11 @@ int apk_solver_commit_changeset(struct apk_database *db, "The following NEW packages will be installed"); dump_packages(changeset, cmp_upgrade, "The following packages will be upgraded"); - printf("After this operation, %d kB of %s\n", abs(size_diff), - (size_diff < 0) ? - "disk space will be freed." : - "additional disk space will be used."); + printf("After this operation, %d %ciB of %s\n", + abs(size_diff), size_unit, + (size_diff < 0) ? + "disk space will be freed." : + "additional disk space will be used."); } if (apk_flags & APK_INTERACTIVE) { printf("Do you want to continue [Y/n]? "); |