mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-08 15:50:38 +00:00
abuild: show package size in human readable format
This commit is contained in:
parent
1fa61905d1
commit
9b3f778971
12
abuild.in
12
abuild.in
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user