Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am4
-rw-r--r--scripts/library/README10
-rw-r--r--scripts/library/human_to_size.sh51
-rw-r--r--scripts/meson.build6
-rw-r--r--scripts/po/POTFILES.in1
5 files changed, 0 insertions, 72 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 191fc3d3..58dbcec4 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -31,13 +31,9 @@ EXTRA_DIST = \
repo-add.sh.in \
wrapper.sh.in \
$(COMPLETION_DIST) \
- $(LIBRARY) \
$(LIBMAKEPKG_DIST) \
po/meson.build
-LIBRARY = \
- library/human_to_size.sh
-
libmakepkgdir = $(datarootdir)/makepkg
LIBMAKEPKGDIRS = \
diff --git a/scripts/library/README b/scripts/library/README
deleted file mode 100644
index d20f117a..00000000
--- a/scripts/library/README
+++ /dev/null
@@ -1,10 +0,0 @@
-This directory contains code snippets that can be reused by multiple
-scripts. A brief description of each file follows.
-
-human_to_size.sh:
-A function to convert human readable sizes (such as "5.3 GiB") to raw byte
-equivalents. base10 and base2 suffixes are supported, case sensitively. If
-successful, the converted byte value is written to stdout and the function
-returns 0. If an error occurs, nothing is written and the function returns 1.
-Results may be inaccurate when using a broken implementation of awk, such
-as mawk or busybox awk.
diff --git a/scripts/library/human_to_size.sh b/scripts/library/human_to_size.sh
deleted file mode 100644
index 11613207..00000000
--- a/scripts/library/human_to_size.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-human_to_size() {
- awk -v human="$1" '
- function trim(s) {
- gsub(/^[[:space:]]+|[[:space:]]+$/, "", s)
- return s
- }
-
- function parse_units(units) {
- if (!units || units == "B")
- return 1
- if (match(units, /^.iB$/))
- return 1024
- if (match(units, /^.B$/))
- return 1000
- if (length(units) == 1)
- return 1024
-
- # parse failure: invalid base
- return -1
- }
-
- function parse_scale(s) {
- return index("BKMGTPE", s) - 1
- }
-
- function isnumeric(string) {
- return match(string, /^[-+]?[[:digit:]]*(\.[[:digit:]]*)?/)
- }
-
- BEGIN {
- # peel off the leading number as the size, fail on invalid number
- human = trim(human)
- if (isnumeric(human))
- size = substr(human, RSTART, RLENGTH)
- else
- exit 1
-
- # the trimmed remainder is assumed to be the units
- units = trim(substr(human, RLENGTH + 1))
-
- base = parse_units(units)
- if (base < 0)
- exit 1
-
- scale = parse_scale(substr(units, 1, 1))
- if (scale < 0)
- exit 1
-
- printf "%d\n", size * base^scale + (size + 0 > 0 ? 0.5 : -0.5)
- }'
-}
diff --git a/scripts/meson.build b/scripts/meson.build
index 7d533f35..56f31222 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -9,10 +9,6 @@ scripts = [
'makepkg-template.pl.in',
]
-library_files = [
- 'library/human_to_size.sh',
-]
-
SCRIPT_EDITOR = find_program(configure_file(
input : join_paths(meson.source_root(), 'build-aux/edit-script.sh.in'),
output : 'edit-script.sh',
@@ -32,7 +28,6 @@ foreach script : scripts
input : m4_edit.process(script),
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
output : script_shortname,
- depend_files : library_files,
install : true,
install_dir : get_option('bindir'))
endforeach
@@ -48,7 +43,6 @@ foreach script : wrapped_scripts
input : m4_edit.process(script),
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
output : script,
- depend_files : library_files,
build_by_default : true)
cdata = configuration_data()
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index 5f02393d..f7d8d93e 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -65,4 +65,3 @@ scripts/libmakepkg/util/parseopts.sh.in
scripts/libmakepkg/util/pkgbuild.sh.in
scripts/libmakepkg/util/source.sh.in
scripts/libmakepkg/util/util.sh.in
-scripts/library/human_to_size.sh