summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2018-09-18 16:47:19 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2018-09-18 16:47:19 +0000
commita4e11417870a4126f979f8c88c0f492969676fb0 (patch)
tree868ddd3c6a54065c2b00fbaec8323faa9432ee2c
parente3461d61350218b32d7e842a40fd506aa37bc365 (diff)
parente25cc595324f27bbaa1d5e90e1cfcd05981dd980 (diff)
downloadpackages-a4e11417870a4126f979f8c88c0f492969676fb0.tar.gz
packages-a4e11417870a4126f979f8c88c0f492969676fb0.tar.bz2
packages-a4e11417870a4126f979f8c88c0f492969676fb0.tar.xz
packages-a4e11417870a4126f979f8c88c0f492969676fb0.zip
Merge branch 'checkbashisms' into 'master'
Add shunit2 and checkbashisms See merge request !53
-rw-r--r--user/checkbashisms/APKBUILD43
-rw-r--r--user/shunit2/APKBUILD33
-rw-r--r--user/shunit2/dash-negative-lineno.patch197
3 files changed, 273 insertions, 0 deletions
diff --git a/user/checkbashisms/APKBUILD b/user/checkbashisms/APKBUILD
new file mode 100644
index 000000000..c85d7cc54
--- /dev/null
+++ b/user/checkbashisms/APKBUILD
@@ -0,0 +1,43 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=checkbashisms
+pkgver=2.18.4
+pkgrel=0
+pkgdesc="Check shell scripts for POSIX compliance"
+url="https://tracker.debian.org/pkg/devscripts"
+arch="noarch"
+license="GPL-2.0+"
+makedepends=""
+depends="perl"
+checkdepends="shunit2"
+subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
+source="http://cdn.debian.net/debian/pool/main/d/devscripts/devscripts_$pkgver.tar.xz"
+builddir="$srcdir/devscripts-$pkgver"
+
+prepare() {
+ default_prepare
+ sed -i "s/###VERSION###/$pkgver/" "scripts/$pkgname.pl"
+}
+
+check() {
+ cd "$builddir"
+ ./test/test_checkbashisms
+}
+
+package() {
+ cd "$builddir"
+ install -Dm755 "scripts/$pkgname.pl" "$pkgdir/usr/bin/$pkgname"
+ install -Dm644 "scripts/$pkgname.1" "$pkgdir/usr/share/man/man1/$pkgname.1"
+}
+
+bashcomp() {
+ pkgdesc="Bash completions for $pkgname"
+ depends=""
+ install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
+
+ cd "$builddir"
+ install -Dm644 "scripts/$pkgname.bash_completion" \
+ "$subpkgdir/usr/share/bash-completion/completions/$pkgname"
+}
+
+sha512sums="91a0ab2fa1f8d884d79f62d5cc8170c885c24af51de321a41f2111fe0fbc0fd8394e5fb3825eeee14d8090968be35761080a40cb55339b09522219d974f63897 devscripts_2.18.4.tar.xz"
diff --git a/user/shunit2/APKBUILD b/user/shunit2/APKBUILD
new file mode 100644
index 000000000..8a110ff6d
--- /dev/null
+++ b/user/shunit2/APKBUILD
@@ -0,0 +1,33 @@
+# Contributor: Max Rees <maxcrees@me.com>
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=shunit2
+pkgver=2.1.7
+pkgrel=0
+pkgdesc="xUnit-based unit test framework for Bourne shell scripts"
+url="https://github.com/kward/shunit2"
+arch="noarch"
+license="Apache-2.0"
+depends="/bin/sh"
+makedepends=""
+checkdepends="debianutils-which bash dash zsh"
+subpackages="$pkgname-doc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/kward/shunit2/archive/v$pkgver.tar.gz
+ dash-negative-lineno.patch"
+
+build() {
+ cd "$builddir"
+}
+
+check() {
+ cd "$builddir"
+ ./test_runner
+}
+
+package() {
+ cd "$builddir"
+ install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
+ install -Dm644 "doc/$pkgname.txt" "$pkgdir/usr/share/doc/$pkgname/$pkgname.rst"
+}
+
+sha512sums="35453cf2c469eb1bab2fff0624b8037a09d405c377fec0938875a6339749d5934fe246eec5691a121290ae9e4ee5cbf7768b740c5f0010a5345c4e111c50fbbd shunit2-2.1.7.tar.gz
+af2d3c65e9f3c86796b12832c403a869767b70da819f3cf6f69f0e2cf8445e85ec63db20c4b39430e35b7c2105e439abf6bbbd3fc3d880d23ee11d54339c61fd dash-negative-lineno.patch"
diff --git a/user/shunit2/dash-negative-lineno.patch b/user/shunit2/dash-negative-lineno.patch
new file mode 100644
index 000000000..2508be856
--- /dev/null
+++ b/user/shunit2/dash-negative-lineno.patch
@@ -0,0 +1,197 @@
+dash reports a negative $LINENO when using shunit2's macros - this isn't
+shunit2's fault, so allow for it in the test cases
+
+--- shunit2-2.1.7/shunit2_macros_test.sh
++++ shunit2-2.1.7/shunit2_macros_test.sh
+@@ -27,13 +27,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_EQUALS_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_EQUALS_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -44,13 +44,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_NOT_EQUALS_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_EQUALS_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -61,13 +61,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_SAME_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_SAME_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -78,13 +78,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_NOT_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_SAME_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -95,13 +95,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NULL_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_NULL_} '"some msg"' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NULL_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -113,13 +113,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_NOT_NULL_} '' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_NOT_NULL_} '"some msg"' '""' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_NOT_NULL_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stdoutF}" "${stderrF}" >&2
+@@ -130,13 +130,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_TRUE_} "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_TRUE_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_TRUE_} '"some msg"' "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_TRUE_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -147,13 +147,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_ASSERT_FALSE_} "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_FALSE_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_ASSERT_FALSE_} '"some msg"' "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_ASSERT_FALSE_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -164,13 +164,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_FAIL_} '"some msg"' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -182,13 +182,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_FAIL_NOT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_FAIL_NOT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_NOT_EQUALS_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -199,13 +199,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_SAME_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_FAIL_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_SAME_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+@@ -216,13 +216,13 @@
+ [ -z "${LINENO:-}" ] && startSkipping
+
+ ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2
+
+ ( ${_FAIL_NOT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" )
+- grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null
++ grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null
+ rtrn=$?
+ assertTrue '_FAIL_NOT_SAME_ w/ msg failure' ${rtrn}
+ [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2