Commit 2eef7be4 authored by Jakub Jirutka's avatar Jakub Jirutka

community/lua-busted: clean the mess with luajit condition

parent 1a7d38e1
......@@ -4,7 +4,7 @@ pkgname=lua-busted
_pkgname=busted
pkgver=2.0_rc12
_pkgver=${pkgver/_/.}-1
pkgrel=2
pkgrel=3
pkgdesc="Elegant Lua unit testing"
url="https://olivinelabs.com/busted/"
arch="noarch"
......@@ -12,7 +12,8 @@ license="MIT"
# Note: We have replaced dkjson with lua-cjson.
depends="lua-cliargs lua-filesystem lua-system lua-cjson lua-say
lua-luassert lua-term lua-penlight lua-mediator"
[ "$CARCH" == "s390x" ] && [ "$CARCH" == "ppc64le" ] && checkdepends="" || checkdepends="luajit"
checkdepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/Olivine-Labs/$_pkgname/archive/v$_pkgver.tar.gz
fix-tests.patch
use-cjson.patch"
......@@ -20,6 +21,12 @@ builddir="$srcdir/$_pkgname-$_pkgver"
# tests fail on x86_64 because cl_standalone.lua output is different, i don't know why --kaniini
options="!check"
# luajit is not available for selected arches
case "$CARCH" in
ppc64le | s390x) _luajit="";;
*) checkdepends="$checkdepends luajit" _luajit="jit";;
esac
_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
......@@ -31,7 +38,7 @@ prepare() {
cd "$builddir"
local lver; for lver in $_luaversions jit; do
local lver; for lver in $_luaversions $_luajit; do
sed "s|/usr/bin/env lua|/usr/bin/lua$lver|" \
bin/busted > bin/busted-$lver || return 1
done
......@@ -39,20 +46,19 @@ prepare() {
check() {
cd "$builddir"
# luajit not avail for selected arches
if printf "$checkdepends\n" | grep -q "luajit"; then
if [ "$CARCH" != "ppc64le" ] && [ "$CARCH" != "s390x" ]; then
mv bin/busted bin/busted.orig
local lver; for lver in $_luaversions jit; do
# Some specs invokes bin/busted as subprocess, so we must
# ensure that it will run on the correct Lua version.
install -m 755 bin/busted-$lver bin/busted || return 1
msg "Running tests on lua$lver..."
lua$lver bin/busted spec || return 1
done
mv bin/busted.orig bin/busted
fi
fi
mv bin/busted bin/busted.orig
local lver; for lver in $_luaversions $_luajit; do
# Some specs invokes bin/busted as subprocess, so we must
# ensure that it will run on the correct Lua version.
install -m 755 bin/busted-$lver bin/busted || return 1
msg "Running tests on lua$lver..."
lua$lver bin/busted spec || return 1
done
mv bin/busted.orig bin/busted
}
package() {
......
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