Print bytes in human-readable format. #18

This commit is contained in:
Andrey Smirnov
2014-03-17 17:05:38 +04:00
parent 099806aa82
commit e5de8b9353
11 changed files with 11 additions and 11 deletions

View File

@@ -141,7 +141,7 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
}
context.progress.ShutdownBar()
context.progress.Printf("Disk space freed: %.2f GiB...\n", float64(totalSize)/1024.0/1024.0/1024.0)
context.progress.Printf("Disk space freed: %s...\n", utils.HumanBytes(totalSize))
}
context.progress.Printf("Compacting database...\n")

2
debian/remote.go vendored
View File

@@ -421,7 +421,7 @@ func (repo *RemoteRepo) Download(progress aptly.Progress, d aptly.Downloader, pa
// free up package list, we don't need it after this point
list = nil
progress.Printf("Download queue: %d items, %.2f GiB size\n", count, float64(downloadSize)/(1024.0*1024.0*1024.0))
progress.Printf("Download queue: %d items (%s)\n", count, utils.HumanBytes(downloadSize))
progress.InitBar(downloadSize, true)

View File

@@ -1,7 +1,7 @@
Building download queue...
Download queue: 27 items, 0.01 GiB size
Download queue: 27 items (10.40 MiB)
Downloading & parsing package files...
Downloading http://repo.varnish-cache.org/debian/dists/wheezy/Release...
Downloading http://repo.varnish-cache.org/debian/dists/wheezy/varnish-3.0/binary-amd64/Packages.bz2...

View File

@@ -4,7 +4,7 @@ Downloading ${url}dists/hardy/main/binary-amd64/Packages.bz2...
Downloading ${url}dists/hardy/main/binary-amd64/Packages.gz...
Downloading ${url}dists/hardy/main/binary-amd64/Packages...
Building download queue...
Download queue: 1 items, 0.00 GiB size
Download queue: 1 items (30 B)
Downloading ${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb...
ERROR: unable to update: download errors:
${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb: sha1 hash mismatch "8d3a014000038725d6daf8771b42a0784253688f" != "66b27417d37e024c46526c2f6d358a754fc552f3"

View File

@@ -4,7 +4,7 @@ Downloading ${url}dists/hardy/main/binary-amd64/Packages.bz2...
Downloading ${url}dists/hardy/main/binary-amd64/Packages.gz...
Downloading ${url}dists/hardy/main/binary-amd64/Packages...
Building download queue...
Download queue: 1 items, 0.00 GiB size
Download queue: 1 items (30 B)
Downloading ${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb...
WARNING: ${url}pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb: sha1 hash mismatch "8d3a014000038725d6daf8771b42a0784253688f" != "66b27417d37e024c46526c2f6d358a754fc552f3"

View File

@@ -1,7 +1,7 @@
Building download queue...
Download queue: 4 items, 0.00 GiB size
Download queue: 4 items (58.20 KiB)
Downloading & parsing package files...
Downloading http://download.opensuse.org/repositories/home:/DeepDiver1975/xUbuntu_10.04/InRelease...
Downloading http://download.opensuse.org/repositories/home:/DeepDiver1975/xUbuntu_10.04/Packages.bz2...

View File

@@ -9,6 +9,6 @@ Downloading http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/
Downloading http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/main/binary-i386/Packages.bz2...
Downloading http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/main/binary-powerpc/Packages.bz2...
Building download queue...
Download queue: 0 items, 0.00 GiB size
Download queue: 0 items (0 B)
Mirror `gnuplot-maverick-src` has been successfully updated.

View File

@@ -1,7 +1,7 @@
Building download queue...
Download queue: 7 items, 0.00 GiB size
Download queue: 7 items (97.48 KiB)
Downloading & parsing package files...
Downloading http://download.opensuse.org/repositories/home:/DeepDiver1975/xUbuntu_10.04/InRelease...
Downloading http://download.opensuse.org/repositories/home:/DeepDiver1975/xUbuntu_10.04/Packages.bz2...

View File

@@ -4,5 +4,5 @@ Deleting unreferenced packages (7)...
Building list of files referenced by packages...
Building list of files in package pool...
Deleting unreferenced files (9)...
Disk space freed: 0.01 GiB...
Disk space freed: 10.85 MiB...
Compacting database...

View File

@@ -4,5 +4,5 @@ Deleting unreferenced packages (7)...
Building list of files referenced by packages...
Building list of files in package pool...
Deleting unreferenced files (9)...
Disk space freed: 0.01 GiB...
Disk space freed: 10.85 MiB...
Compacting database...

View File

@@ -4,5 +4,5 @@ Deleting unreferenced packages (3)...
Building list of files referenced by packages...
Building list of files in package pool...
Deleting unreferenced files (5)...
Disk space freed: 0.00 GiB...
Disk space freed: 37.04 KiB...
Compacting database...