You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/05/18 09:30:29 UTC

[apisix] 01/05: ci: make it pass under OpenResty 1.21 (#7067)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch release/2.13
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 748e8fe5a2dc9e9b7ae9303f0196b643ad1de02f
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Wed May 18 11:17:53 2022 +0800

    ci: make it pass under OpenResty 1.21 (#7067)
    
    Signed-off-by: spacewander <sp...@gmail.com>
---
 bin/apisix                      | 10 +++++-----
 utils/linux-install-luarocks.sh |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bin/apisix b/bin/apisix
index d83b0ce4b..d1b17f5a2 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -31,11 +31,11 @@ fi
 # find the openresty
 OR_BIN=$(which openresty || exit 1)
 OR_EXEC=${OR_BIN:-'/usr/local/openresty-debug/bin/openresty'}
-OR_VER=$(openresty -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1"."$2}')
+OR_VER=$(openresty -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1 * 100 + $2}')
 LUA_VERSION=$(lua -v 2>&1| grep -E -o  "Lua [0-9]+.[0-9]+")
 
-if [[ -e $OR_EXEC && "$OR_VER" =~ "1.19" ]]; then
-    # OpenResty version is 1.19, use luajit by default
+if [[ -e $OR_EXEC && "$OR_VER" -ge 119 ]]; then
+    # OpenResty version is >= 1.19, use luajit by default
     # find the luajit binary of openresty
     LUAJIT_BIN=$(${OR_EXEC} -V 2>&1 | grep prefix | grep -Eo 'prefix=(.*)/nginx\s+--' | grep -Eo '/.*/')luajit/bin/luajit
 
@@ -43,9 +43,9 @@ if [[ -e $OR_EXEC && "$OR_VER" =~ "1.19" ]]; then
     echo "$LUAJIT_BIN $APISIX_LUA $*"
     exec $LUAJIT_BIN $APISIX_LUA $*
 elif [[ "$LUA_VERSION" =~ "Lua 5.1" ]]; then
-    # OpenResty version is not 1.19, use Lua 5.1 by default
+    # OpenResty version is < 1.19, use Lua 5.1 by default
     echo "lua $APISIX_LUA $*"
     exec lua $APISIX_LUA $*
 else
-    echo "ERROR: Please check the version of OpenResty and Lua, OpenResty 1.19 + LuaJIT or OpenResty before 1.19 + Lua 5.1 is required for Apache APISIX."
+    echo "ERROR: Please check the version of OpenResty and Lua, OpenResty 1.19+ + LuaJIT or OpenResty before 1.19 + Lua 5.1 is required for Apache APISIX."
 fi
diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh
index be738ce45..a8d1bafd0 100755
--- a/utils/linux-install-luarocks.sh
+++ b/utils/linux-install-luarocks.sh
@@ -29,8 +29,8 @@ rm -f v"$LUAROCKS_VER".tar.gz
 cd luarocks-"$LUAROCKS_VER" || exit
 
 OR_BIN="$OPENRESTY_PREFIX/bin/openresty"
-OR_VER=$($OR_BIN -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1"."$2}')
-if [[ -e $OR_BIN && "$OR_VER" == 1.19 ]]; then
+OR_VER=$($OR_BIN -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1 * 100 + $2}')
+if [[ -e $OR_BIN && "$OR_VER" -ge 119 ]]; then
     WITH_LUA_OPT="--with-lua=${OPENRESTY_PREFIX}/luajit"
 else
     # For old version OpenResty, we still need to install LuaRocks with Lua