diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-10-04 06:52:19 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-10-04 06:52:19 +0000 |
commit | 9b3f778971df206cfd11e8760457fb533d213e66 (patch) | |
tree | b17de1f59de9920b0f2f8564344392df700ae7b6 /abuild.in | |
parent | 1fa61905d18b6fdbc9d71e6aaca01112174befbd (diff) | |
download | abuild-9b3f778971df206cfd11e8760457fb533d213e66.tar.gz abuild-9b3f778971df206cfd11e8760457fb533d213e66.tar.bz2 abuild-9b3f778971df206cfd11e8760457fb533d213e66.tar.xz abuild-9b3f778971df206cfd11e8760457fb533d213e66.zip |
abuild: show package size in human readable format
Diffstat (limited to 'abuild.in')
-rwxr-xr-x | abuild.in | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -995,8 +995,16 @@ scan_shared_objects() { done > "$controldir"/.needs-so } +# read size in bytes from stdin and show as human readable +human_size() { + awk '{ split("B KB MB GB TB PB", type) + for(i=5; y < 1; i--) + y = $1 / (2**(10*i)) + printf("%.1f %s\n", y, type[i+2]) }' +} + create_apks() { - local file= dir= name= ver= apk= datadir= + local file= dir= name= ver= apk= datadir= size= getpkgver || return 1 mkdir -p "$PKGDEST" if [ "$arch" != "noarch" ] && ! options_has "!tracedeps"; then @@ -1012,11 +1020,13 @@ create_apks() { dir="${file%/.PKGINFO}" name=$(pkginfo_val pkgname $file) ver=$(pkginfo_val pkgver $file) + size=$(pkginfo_val size $file | human_size) apk=$name-$ver.apk datadir="$pkgbasedir"/$name subpkgname=$name trace_apk_deps "$name" "$dir" || return 1 + msg "Package size: ${size}" msg "Compressing data..." ( cd "$datadir" |