Commit 9b3f7789 authored by Natanael Copa's avatar Natanael Copa

abuild: show package size in human readable format

parent 1fa61905
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment