Skip to content

Commit

Permalink
Upgrade to LuaRocks 2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xpol committed Dec 13, 2018
1 parent 7fa6366 commit eb0379c
Show file tree
Hide file tree
Showing 40 changed files with 336 additions and 88 deletions.
6 changes: 6 additions & 0 deletions luarocks/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
notify:
gitter:
default:
url: "https://webhooks.gitter.im/e/c8ee7e8a380f711aea39"
threshold: 1%
37 changes: 29 additions & 8 deletions luarocks/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
language: python

cache:
directories:
- lua_install
- test/testing_cache-5.1
- test/testing_cache-5.2
- test/testing_cache-5.3
- test/testing_cache-2.0
- test/testing_cache-2.1
- test/testing_server-5.1
- test/testing_server-5.2
- test/testing_server-5.3
- test/testing_server-2.0
- test/testing_server-2.1

matrix:
include:
- os: linux
Expand Down Expand Up @@ -40,19 +54,20 @@ matrix:


before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update;fi
- pip install hererocks
- hererocks lua_install -r^ --$LUA
- if [ ! -f lua_install/bin/luarocks ]; then pip2 install hererocks; fi
- if [ ! -f lua_install/bin/luarocks ]; then hererocks lua_install -r^ --$LUA; fi
- export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH

install:
- luarocks install busted
- luarocks install luacov
- luarocks install luacov-coveralls
- if [ ! -f lua_install/bin/busted ]; then luarocks install busted; fi
- if [ ! -f lua_install/bin/luacov ]; then luarocks install cluacov; fi

script:
- busted -Xhelper travis --verbose
- busted -Xhelper travis,env=full --verbose
- lua -v
- ./configure --with-lua=lua_install
- ./makedist scm
- busted -o gtest --verbose -Xhelper travis
- busted -o gtest --verbose -Xhelper travis,env=full

after_success:
- luacov -c $TRAVIS_BUILD_DIR/test/luacov.config
Expand All @@ -63,3 +78,9 @@ notifications:
email:
on_success: change
on_failure: change
webhooks:
urls:
- https://webhooks.gitter.im/e/3320fc3f28abbb06e1d8
on_success: change
on_failure: always
on_start: never
11 changes: 5 additions & 6 deletions luarocks/appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2.4.2.{build}-test
version: 2.4.4.{build}-test

shallow_clone: true

environment:
LUAROCKS_VER: 2.4.2
LUAROCKS_VER: 2.4.4

matrix:
- LUA: "lua 5.1"
Expand Down Expand Up @@ -38,18 +38,17 @@ init:
before_build:
- set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH
- pip install hererocks
- hererocks env --%LUA% -rlatest --target=%COMPILER%
- hererocks env --%LUA% -[email protected] --target=%COMPILER%
- call env\bin\activate

build_script:
- luarocks install busted 1> NUL 2> NUL
- luarocks install cluacov 1> NUL 2> NUL

test_script:
- busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper appveyor,%COMPILER%

after_test:
- if "%LUA%"=="lua 5.1" (luarocks show bit32 || luarocks install bit32)
- luarocks install luacov
- pip install codecov
- luacov -c test/luacov.config
- cd test && codecov
- cd test && codecov -f luacov.report.out -X gcov
2 changes: 1 addition & 1 deletion luarocks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ fi
if [ "$lua_interp_found" != "yes" ]
then
[ "$LUA_VERSION_SET" ] && { interp="Lua $LUA_VERSION" ;} || { interp="Lua" ;}
[ "$LUA_DIR_SET" -o "$LUA_BINDIR_SET" ] && { where="$LUA_BINDIR" ;} || { interp="\$PATH" ;}
[ "$LUA_DIR_SET" -o "$LUA_BINDIR_SET" ] && { where="$LUA_BINDIR" ;} || { where="\$PATH" ;}
echo "$interp interpreter not found in $where"
die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help."
fi
Expand Down
92 changes: 89 additions & 3 deletions luarocks/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ vars.LUA_SHORTV = nil -- "51"
vars.LUA_RUNTIME = nil
vars.UNAME_M = nil
vars.COMPILER_ENV_CMD = nil
vars.MINGW_BIN_PATH = nil
vars.MINGW_CC = nil
vars.MINGW_MAKE = nil
vars.MINGW_RC = nil
vars.MINGW_LD = nil
vars.MINGW_AR = nil
vars.MINGW_RANLIB = nil

local FORCE = false
local FORCE_CONFIG = false
Expand Down Expand Up @@ -617,6 +624,66 @@ local function restore_config_files()
vars.CONFBACKUPDIR = nil
end

-- Find GCC based toolchain
local find_gcc_suite = function()

-- read output os-command
local read_output = function(cmd)
local f = io.popen("type NUL && " .. cmd .. ' 2>NUL')
if not f then return nil, "failed to open command: " .. tostring(cmd) end
local lines = {}
while true do
local l = f:read()
if not l then
f:close()
return lines
end
table.insert(lines, l)
end
end

-- returns: full filename, path, filename
local find_file = function(mask, path)
local cmd
if path then
cmd = 'where.exe /R "' .. path .. '" ' .. mask
else
cmd = 'where.exe ' .. mask
end
local files, err = read_output(cmd)
if not files or not files[1] then
return nil, "couldn't find '".. mask .. "', " .. (err or "not found")
end
local path, file = string.match(files[1], "^(.+)%\\([^%\\]+)$")
return files[1], path, file
end

local first_one = "*gcc.exe" -- first file we're assuming to point to the compiler suite
local full, path, filename = find_file(first_one, nil)
if not full then
return nil, path
end
vars.MINGW_BIN_PATH = path

local result = {
gcc = full
}
for i, name in ipairs({"make", "ar", "windres", "ranlib"}) do
result[name] = find_file(name..".exe", path)
if not result[name] then
result[name] = find_file("*"..name.."*.exe", path)
end
end

vars.MINGW_MAKE = (result.make and '[['..result.make..']]') or "nil -- not found by installer"
vars.MINGW_CC = (result.gcc and '[['..result.gcc..']]') or "nil -- not found by installer"
vars.MINGW_RC = (result.windres and '[['..result.windres..']]') or "nil -- not found by installer"
vars.MINGW_LD = (result.gcc and '[['..result.gcc..']]') or "nil -- not found by installer"
vars.MINGW_AR = (result.ar and '[['..result.ar..']]') or "nil -- not found by installer"
vars.MINGW_RANLIB = (result.ranlib and '[['..result.ranlib..']]') or "nil -- not found by installer"
return true
end

-- ***********************************************************
-- Installer script start
-- ***********************************************************
Expand Down Expand Up @@ -765,7 +832,15 @@ if SELFCONTAINED then
vars.TREE_ROOT = vars.PREFIX..[[\systree]]
REGISTRY = false
end
vars.COMPILER_ENV_CMD = (USE_MINGW and "") or (USE_MSVC_MANUAL and "") or get_msvc_env_setup_cmd()
if USE_MINGW then
vars.COMPILER_ENV_CMD = ""
local found, err = find_gcc_suite()
if not found then
die("Failed to find MinGW/gcc based toolchain, make sure it is in your path: " .. tostring(err))
end
else
vars.COMPILER_ENV_CMD = (USE_MSVC_MANUAL and "") or get_msvc_env_setup_cmd()
end

print(S[[

Expand All @@ -787,7 +862,8 @@ Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER
]])

if USE_MINGW then
print("Compiler : MinGW (make sure it is in your path before using LuaRocks)")
print(S[[Compiler : MinGW/gcc (make sure it is in your path before using LuaRocks)]])
print(S[[ in: $MINGW_BIN_PATH]])
else
if vars.COMPILER_ENV_CMD == "" then
print("Compiler : Microsoft (make sure it is in your path before using LuaRocks)")
Expand Down Expand Up @@ -1012,7 +1088,17 @@ if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then
else
f:write(" MSVCRT = '"..vars.LUA_RUNTIME.."',\n")
end
f:write(S" LUALIB = '$LUA_LIBNAME'\n")
f:write(S" LUALIB = '$LUA_LIBNAME',\n")
if USE_MINGW then
f:write(S[[
CC = $MINGW_CC,
MAKE = $MINGW_MAKE,
RC = $MINGW_RC,
LD = $MINGW_LD,
AR = $MINGW_AR,
RANLIB = $MINGW_RANLIB,
]])
end
f:write("}\n")
f:write("verbose = false -- set to 'true' to enable verbose output\n")
f:close()
Expand Down
7 changes: 6 additions & 1 deletion luarocks/makedist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash -e

if ! [ "$1" ]
then
Expand All @@ -14,6 +14,9 @@ fi

make clean || exit 1

if [ "$1" != "scm" ]
then

grep -q "\"$1\"" rockspec || {
echo
echo "version in rockspec is incorrect. Please fix it."
Expand Down Expand Up @@ -53,6 +56,8 @@ grep -q "vars.VERSION = \"$program_series\"" install.bat || {
exit 1
}

fi

out="luarocks-$1"
rm -rf "$out"
mkdir "$out"
Expand Down
2 changes: 1 addition & 1 deletion luarocks/rockspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package = "LuaRocks"
local VER = "2.4.2"
local VER = "2.4.4"
version = VER .. "-1"

source = {
Expand Down
5 changes: 3 additions & 2 deletions luarocks/spec/make_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test_env.unload_luarocks()
local extra_rocks = {
"/luasocket-3.0rc1-2.src.rock",
"/luasocket-3.0rc1-2.rockspec",
"/lpeg-0.12-1.src.rock",
"/lxsh-0.8.6-2.src.rock",
"/lxsh-0.8.6-2.rockspec"
}
Expand Down Expand Up @@ -100,11 +101,11 @@ describe("LuaRocks make tests #blackbox #b_make", function()
end)

describe("LuaRocks make upgrading rockspecs with mixed deploy types", function()
setup(function()
before_each(function()
test_env.copy_dir(testing_paths.testing_dir .. "/testfiles/mixed_deploy_type", "mdt")
end)

teardown(function()
after_each(function()
test_env.remove_dir("mdt")
os.remove("mdt."..test_env.lib_extension)
end)
Expand Down
11 changes: 4 additions & 7 deletions luarocks/spec/upload_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ local testing_paths = test_env.testing_paths
test_env.unload_luarocks()

local extra_rocks = {
"/lua-cjson-2.1.0-1.src.rock",

-- rocks needed for mock-server
"/copas-2.0.1-1.src.rock",
"/coxpcall-1.16.0-1.src.rock",
Expand Down Expand Up @@ -42,18 +40,17 @@ describe("LuaRocks upload tests #blackbox #b_upload", function()
end)

it("LuaRocks upload api key invalid and skip-pack", function()
assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec"))
assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec"))
end)

it("LuaRocks upload force #unix", function()
assert.is_true(run.luarocks_bool("install lua-cjson"))
assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec"))
assert.is_true(run.luarocks_bool("install lua-cjson"))
assert.is_true(test_env.need_rock("dkjson"))
assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec"))
end)

describe("LuaRocks upload tests with Xavante server #mock", function()
before_each(function()
assert.is.truthy(test_env.need_rock("restserver-xavante"))
assert.is_true(test_env.need_rock("restserver-xavante"))
local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables)
os.execute(final_command)
end)
Expand Down
4 changes: 2 additions & 2 deletions luarocks/spec/util_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ describe("Basic tests #blackbox #b_util", function()
assert.is_true(os.remove(delete_path))

local output = run.luarocks("")
assert.is.falsy(output:find("LuaRocks scm, a module deployment system for Lua"))
assert.is.falsy(output:find("the Lua package manager"))
assert.is_true(lfs.chdir(main_path))

output = run.luarocks("")
assert.is.truthy(output:find("LuaRocks scm, a module deployment system for Lua"))
assert.is.truthy(output:find("the Lua package manager"))
end)

it("LuaRocks timeout", function()
Expand Down
13 changes: 12 additions & 1 deletion luarocks/src/luarocks/build/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function builtin.run(rockspec)

local build = rockspec.build
local variables = rockspec.variables
local checked_lua_h = false

local function add_flags(extras, flag, flags)
if flags then
Expand Down Expand Up @@ -112,8 +113,10 @@ function builtin.run(rockspec)
local basename = dir.base_name(library):gsub(".[^.]*$", "")
local deffile = basename .. ".def"
local def = io.open(dir.path(fs.current_dir(), deffile), "w+")
local exported_name = name:gsub("%.", "_")
exported_name = exported_name:match('^[^%-]+%-(.+)$') or exported_name
def:write("EXPORTS\n")
def:write("luaopen_"..name:gsub("%.", "_").."\n")
def:write("luaopen_"..exported_name.."\n")
def:close()
local ok = execute(variables.LD, "-dll", "-def:"..deffile, "-out:"..library, dir.path(variables.LUA_LIBDIR, variables.LUALIB), unpack(extras))
local basedir = ""
Expand Down Expand Up @@ -218,6 +221,14 @@ function builtin.run(rockspec)
end
end
if type(info) == "table" then
if not checked_lua_h then
local lua_incdir, lua_h = variables.LUA_INCDIR, "lua.h"
if not fs.exists(dir.path(lua_incdir, lua_h)) then
return nil, "Lua header file "..lua_h.." not found (looked in "..lua_incdir.."). \n" ..
"You need to install the Lua development package for your system."
end
checked_lua_h = true
end
local objects = {}
local sources = info.sources
if info[1] then sources = info end
Expand Down
Loading

0 comments on commit eb0379c

Please sign in to comment.