buildsys: remove size_to_human
This was only ever used by paccache, and paccache has since been moved to pacman-contrib.
This commit is contained in:
parent
c41222837d
commit
926eb345c2
5 changed files with 1 additions and 30 deletions
|
@ -35,8 +35,7 @@ EXTRA_DIST = \
|
||||||
$(LIBMAKEPKG_DIST)
|
$(LIBMAKEPKG_DIST)
|
||||||
|
|
||||||
LIBRARY = \
|
LIBRARY = \
|
||||||
library/human_to_size.sh \
|
library/human_to_size.sh
|
||||||
library/size_to_human.sh
|
|
||||||
|
|
||||||
libmakepkgdir = $(datarootdir)/makepkg
|
libmakepkgdir = $(datarootdir)/makepkg
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,3 @@ successful, the converted byte value is written to stdout and the function
|
||||||
returns 0. If an error occurs, nothing in written and the function returns 1.
|
returns 0. If an error occurs, nothing in written and the function returns 1.
|
||||||
Results may be inaccurate when using a broken implementation of awk, such
|
Results may be inaccurate when using a broken implementation of awk, such
|
||||||
as mawk or busybox awk.
|
as mawk or busybox awk.
|
||||||
|
|
||||||
size_to_human.sh:
|
|
||||||
The reverse of human_to_size, this function takes an integer byte size and
|
|
||||||
prints its in human readable format, with SI prefixes (e.g. MiB, TiB).
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
size_to_human() {
|
|
||||||
awk -v size="$1" '
|
|
||||||
BEGIN {
|
|
||||||
suffix[1] = "B"
|
|
||||||
suffix[2] = "KiB"
|
|
||||||
suffix[3] = "MiB"
|
|
||||||
suffix[4] = "GiB"
|
|
||||||
suffix[5] = "TiB"
|
|
||||||
suffix[6] = "PiB"
|
|
||||||
suffix[7] = "EiB"
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
while (size > 1024) {
|
|
||||||
size /= 1024
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
|
|
||||||
sizestr = sprintf("%.2f", size)
|
|
||||||
sub(/\.?0+$/, "", sizestr)
|
|
||||||
printf("%s %s", sizestr, suffix[count])
|
|
||||||
}'
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ scripts = [
|
||||||
|
|
||||||
library_files = [
|
library_files = [
|
||||||
'library/human_to_size.sh',
|
'library/human_to_size.sh',
|
||||||
'library/size_to_human.sh',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
SCRIPT_EDITOR = find_program(configure_file(
|
SCRIPT_EDITOR = find_program(configure_file(
|
||||||
|
|
|
@ -67,4 +67,3 @@ scripts/libmakepkg/util/pkgbuild.sh.in
|
||||||
scripts/libmakepkg/util/source.sh.in
|
scripts/libmakepkg/util/source.sh.in
|
||||||
scripts/libmakepkg/util/util.sh.in
|
scripts/libmakepkg/util/util.sh.in
|
||||||
scripts/library/human_to_size.sh
|
scripts/library/human_to_size.sh
|
||||||
scripts/library/size_to_human.sh
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue