Hello community, here is the log from the commit of package lua-luv for openSUSE:Factory checked in at 2019-09-20 14:54:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua-luv (Old) and /work/SRC/openSUSE:Factory/.lua-luv.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua-luv" Fri Sep 20 14:54:49 2019 rev:4 rq:731966 version:1.30.1 Changes: -------- --- /work/SRC/openSUSE:Factory/lua-luv/lua-luv.changes 2019-08-13 13:27:20.337322472 +0200 +++ /work/SRC/openSUSE:Factory/.lua-luv.new.7948/lua-luv.changes 2019-09-20 14:54:53.102862445 +0200 @@ -1,0 +2,6 @@ +Thu Sep 19 15:33:38 CEST 2019 - Matej Cepl <[email protected]> + +- Update to 1.30.1-1: mostly bugfixes. Full log is only + https://github.com/luvit/luv/commits/master + +------------------------------------------------------------------- Old: ---- luv-1.30.0-0.tar.gz New: ---- luv-1.30.1-1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua-luv.spec ++++++ --- /var/tmp/diff_new_pack.rXgsWi/_old 2019-09-20 14:54:54.134862239 +0200 +++ /var/tmp/diff_new_pack.rXgsWi/_new 2019-09-20 14:54:54.142862238 +0200 @@ -20,11 +20,17 @@ %define flavor @BUILD_FLAVOR@ %define mod_name luv %define lua_value %(echo "%{flavor}" |sed -e 's:lua::') -%define upver 1.30.0-0 +%define upver 1.30.1-1 %define libluv_sover 1 %bcond_with public_lib -Version: 1.30.0 +%if "%{flavor}" == "" +Name: lua-%{mod_name} +ExclusiveArch: do_not_build +%else +Name: %{flavor}-%{mod_name} +%endif +Version: 1.30.1 Release: 0 Summary: Bare libuv bindings for lua License: Apache-2.0 @@ -44,12 +50,6 @@ BuildRequires: lua-devel BuildRequires: lua-filesystem %endif # suse_version -%if "%{flavor}" == "" -Name: lua-%{mod_name} -ExclusiveArch: do_not_build -%else -Name: %{flavor}-%{mod_name} -%endif %description This library makes libuv available to lua scripts. It was made ++++++ luv-1.30.0-0.tar.gz -> luv-1.30.1-1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/.ci/install.bat new/luv-1.30.1-1/.ci/install.bat --- old/luv-1.30.0-0/.ci/install.bat 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/.ci/install.bat 2019-09-05 02:39:51.000000000 +0200 @@ -25,7 +25,7 @@ :: Now we declare a scope Setlocal EnableDelayedExpansion EnableExtensions -if not defined LUAROCKS_URL set LUAROCKS_URL=https://keplerproject.github.io/luarocks/releases +if not defined LUAROCKS_URL set LUAROCKS_URL=https://luarocks.github.io/luarocks/releases if not defined LUAROCKS_REPO set LUAROCKS_REPO=https://luarocks.org if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp if defined NOCOMPAT ( @@ -164,9 +164,9 @@ cd downloads\luarocks-%LUAROCKS_VER%-win32 if "%Configuration%"=="MinGW" ( - call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" /MW + call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" /CONFIG "%LUAROCKS_INSTALL%" /MW ) else ( - call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" + call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%" /TREE "%LR_SYSTREE%" /CONFIG "%LUAROCKS_INSTALL%" ) :: Configures LuaRocks to instruct CMake the correct generator to use. Else, CMake will pick the highest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/.ci/make_rockspec.sh new/luv-1.30.1-1/.ci/make_rockspec.sh --- old/luv-1.30.0-0/.ci/make_rockspec.sh 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/.ci/make_rockspec.sh 2019-09-05 02:39:51.000000000 +0200 @@ -19,7 +19,7 @@ # .tar.gz rm -rf luv-${version} mkdir -p luv-${version}/deps -cp -r src cmake CMakeLists.txt LICENSE.txt README.md docs.md luv-${version}/ +cp -r src cmake CMakeLists.txt LICENSE.txt README.md docs.md libluv.pc.in luv-${version}/ cp -r deps/libuv deps/lua-compat-5.3 deps/*.cmake deps/lua_one.c luv-${version}/deps/ COPYFILE_DISABLE=true tar -czvf luv-${version}.tar.gz luv-${version} rm -rf luv-${version} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/.ci/setup_lua.sh new/luv-1.30.1-1/.ci/setup_lua.sh --- old/luv-1.30.0-0/.ci/setup_lua.sh 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/.ci/setup_lua.sh 2019-09-05 02:39:51.000000000 +0200 @@ -6,7 +6,7 @@ # luajit2.0 - master v2.0 # luajit2.1 - master v2.1 -set -eufo pipefail +set -eufxo pipefail LUAJIT_VERSION="2.0.4" LUAJIT_BASE="LuaJIT-$LUAJIT_VERSION" @@ -91,16 +91,25 @@ cd "$LUAROCKS_BASE" -if [ "$LUA" == "luajit" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; -elif [ "$LUA" == "luajit2.0" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; -elif [ "$LUA" == "luajit2.1" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR"; -else - ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR" +configure_args=("--prefix=$LR_HOME_DIR" "--with-lua=$LUA_HOME_DIR") + +if [ "${LUA#luajit}" != "$LUA" ]; then + # LuaJIT + if [ "${LUAROCKS#2.}" != "${LUAROCKS}" ]; then + configure_args+=('--lua-suffix=jit') + if [ "$LUA" = luajit ]; then + luajit_ver=2.0 + else + luajit_ver=${LUA#luajit} + fi + configure_args+=("--with-lua-include=$LUA_HOME_DIR/include/luajit-${luajit_ver}") + else + configure_args+=('--with-lua-interpreter=luajit') + fi fi +./configure "${configure_args[@]}" + make build && make install ln -s "$LR_HOME_DIR/bin/luarocks" "$HOME/.lua/luarocks" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/.travis.yml new/luv-1.30.1-1/.travis.yml --- old/luv-1.30.0-0/.travis.yml 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/.travis.yml 2019-09-05 02:39:51.000000000 +0200 @@ -14,6 +14,11 @@ matrix: - WITH_LUA_ENGINE=Lua LUA=lua5.3 - WITH_LUA_ENGINE=LuaJIT LUA=luajit2.1 + + # LuaRocks 3.1.3 + - LUAROCKS=3.1.3 WITH_LUA_ENGINE=Lua LUA=lua5.3 + - LUAROCKS=3.1.3 WITH_LUA_ENGINE=LuaJIT LUA=luajit2.1 + - PROCESS_CLEANUP_TEST=1 LUA=lua5.2 os: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/CMakeLists.txt new/luv-1.30.1-1/CMakeLists.txt --- old/luv-1.30.0-0/CMakeLists.txt 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/CMakeLists.txt 2019-09-05 02:39:51.000000000 +0200 @@ -8,7 +8,7 @@ set(LUV_VERSION_MAJOR 1) set(LUV_VERSION_MINOR 30) -set(LUV_VERSION_PATCH 0) +set(LUV_VERSION_PATCH 1) set(LUV_VERSION ${LUV_VERSION_MAJOR}.${LUV_VERSION_MINOR}.${LUV_VERSION_PATCH}) option(BUILD_MODULE "Build as module" ON) @@ -59,10 +59,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") if (WITH_SHARED_LIBUV) - find_package(Libuv) - if (LIBUV_FOUND) - include_directories(${LIBUV_INCLUDE_DIR}) - endif (LIBUV_FOUND) + find_package(Libuv REQUIRED) + include_directories(${LIBUV_INCLUDE_DIR}) else (WITH_SHARED_LIBUV) include_directories(deps/libuv/include) add_subdirectory(deps/libuv EXCLUDE_FROM_ALL) @@ -201,6 +199,14 @@ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) if (NOT BUILD_MODULE) + if(UNIX) + set(prefix ${CMAKE_INSTALL_PREFIX}) + set(includedir ${INSTALL_INC_DIR}) + set(libdir ${INSTALL_LIB_DIR}) + configure_file(libluv.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libluv.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libluv.pc + DESTINATION ${INSTALL_LIB_DIR}/pkgconfig) + endif() install( FILES src/luv.h src/util.h src/lhandle.h src/lreq.h DESTINATION "${INSTALL_INC_DIR}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/Makefile new/luv-1.30.1-1/Makefile --- old/luv-1.30.0-0/Makefile 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/Makefile 2019-09-05 02:39:51.000000000 +0200 @@ -25,6 +25,15 @@ -DLUA_BUILD_TYPE=$(LUA_BUILD_TYPE) \ -DLUA_COMPAT53_DIR=$(LUA_COMPAT53_DIR) +ifeq ($(MAKE),mingw32-make) +CMAKE_OPTIONS += -G"MinGW Makefiles" +LUV_EXT ?= .dll +LUV_CP ?= cp -f +endif + +LUV_EXT ?= .so +LUV_CP ?= ln -sf + all: luv deps/libuv/include: @@ -41,7 +50,10 @@ luv: build/Makefile cmake --build build --config Debug - ln -sf build/luv.so + $(LUV_CP) build/luv$(LUV_EXT) luv$(LUV_EXT) + +install: luv + $(MAKE) -C build install clean: rm -rf build luv.so @@ -58,3 +70,5 @@ github-release upload --user luvit --repo luv --tag ${LUV_TAG} \ --file luv-${LUV_TAG}.tar.gz --name luv-${LUV_TAG}.tar.gz luarocks upload luv-${LUV_TAG}.rockspec --api-key=${LUAROCKS_TOKEN} + +# vim: ts=8 sw=8 noet tw=79 fen fdm=marker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/README.md new/luv-1.30.1-1/README.md --- old/luv-1.30.0-0/README.md 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/README.md 2019-09-05 02:39:51.000000000 +0200 @@ -2,8 +2,9 @@ === [](https://travis-ci.org/luvit/luv) - [](https://ci.appveyor.com/project/racker-buildbot/luv/branch/master) +[](https://lgtm.com/projects/g/luvit/luv/context:cpp) +[](https://lgtm.com/projects/g/luvit/luv/alerts) [libuv](https://github.com/libuv/libuv) bindings for [luajit](http://luajit.org/) and [lua](http://www.lua.org/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/appveyor.yml new/luv-1.30.1-1/appveyor.yml --- old/luv-1.30.0-0/appveyor.yml 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/appveyor.yml 2019-09-05 02:39:51.000000000 +0200 @@ -7,11 +7,19 @@ # Test with the latest Lua and LuaJIT versions environment: - LUAROCKS_VER: 2.3.0 matrix: - - LUA_VER: 5.3.2 - NOCOMPAT: true # with compatibility flags disabled. - - LJ_VER: 2.1 + # LuaRocks 3.1.3 + - LUA_VER: 5.3.2 + NOCOMPAT: true # with compatibility flags disabled. + LUAROCKS_VER: 3.1.3 + - LJ_VER: 2.1 + LUAROCKS_VER: 3.1.3 + + - LUA_VER: 5.3.2 + NOCOMPAT: true # with compatibility flags disabled. + LUAROCKS_VER: 2.3.0 + - LJ_VER: 2.1 + LUAROCKS_VER: 2.3.0 platform: - x86 @@ -34,6 +42,7 @@ - call .ci\set_compiler_env.bat - call .ci\install.bat - luarocks make + - luarocks show luv - ps: if("$(Get-Location)" -eq $(lua -e "print(require'luv'.cwd())")) { "LuaRocks test OK" } else { "LuaRocks test failed"; exit 1 } - luarocks remove luv # Test the alternate rockspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/lgtm.yml new/luv-1.30.1-1/lgtm.yml --- old/luv-1.30.0-0/lgtm.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/luv-1.30.1-1/lgtm.yml 2019-09-05 02:39:51.000000000 +0200 @@ -0,0 +1,3 @@ +path_classifiers: + library: + - deps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/libluv.pc.in new/luv-1.30.1-1/libluv.pc.in --- old/luv-1.30.0-0/libluv.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ new/luv-1.30.1-1/libluv.pc.in 2019-09-05 02:39:51.000000000 +0200 @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +includedir=@includedir@ + +Name: libluv +Version: @LUV_VERSION@ +Description: Bare and full libuv bindings for Lua/LuaJIT. +URL: https://github.com/luvit/luv + +Libs: -L${libdir} -lluv @LIBS@ +Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/rockspecs/luv-scm-0.rockspec new/luv-1.30.1-1/rockspecs/luv-scm-0.rockspec --- old/luv-1.30.0-0/rockspecs/luv-scm-0.rockspec 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/rockspecs/luv-scm-0.rockspec 2019-09-05 02:39:51.000000000 +0200 @@ -23,7 +23,8 @@ external_dependencies = { LIBUV = { - header = 'uv.h' + header = 'uv.h', + library = 'uv', }, LUA_COMPAT53 = { header = "c-api/compat-5.3.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/lhandle.c new/luv-1.30.1-1/src/lhandle.c --- old/luv-1.30.0-0/src/lhandle.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/lhandle.c 2019-09-05 02:39:51.000000000 +0200 @@ -54,32 +54,6 @@ return data; } -static int luv_is_callable(lua_State* L, int index) { - if (luaL_getmetafield(L, index, "__call") != LUA_TNIL) { - // getmetatable(x).__call must be a function for x() to work - int callable = lua_isfunction(L, -1); - lua_pop(L, 1); - return callable; - } - return lua_isfunction(L, index); -} - -static void luv_check_callable(lua_State* L, int index) { - const char *msg; - const char *typearg; /* name for the type of the actual argument */ - if (luv_is_callable(L, index)) - return; - - if (luaL_getmetafield(L, index, "__name") == LUA_TSTRING) - typearg = lua_tostring(L, -1); /* use the given type name */ - else if (lua_type(L, index) == LUA_TLIGHTUSERDATA) - typearg = "light userdata"; /* special name for messages */ - else - typearg = luaL_typename(L, index); /* standard name */ - msg = lua_pushfstring(L, "function or callable table expected, got %s", typearg); - luaL_argerror(L, index, msg); -} - static void luv_check_callback(lua_State* L, luv_handle_t* data, luv_callback_id id, int index) { luv_check_callable(L, index); luaL_unref(L, LUA_REGISTRYINDEX, data->callbacks[id]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/lhandle.h new/luv-1.30.1-1/src/lhandle.h --- old/luv-1.30.0-0/src/lhandle.h 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/lhandle.h 2019-09-05 02:39:51.000000000 +0200 @@ -53,12 +53,6 @@ /* Setup the handle at the top of the stack */ static luv_handle_t* luv_setup_handle(lua_State* L, luv_ctx_t* ctx); -/* Return true if the object is a function or a callable table */ -static int luv_is_callable(lua_State* L, int index); - -/* Check if the argument is callable and throw an error if it's not */ -static void luv_check_callable(lua_State* L, int index); - /* Store a lua callback in a luv_handle for future callbacks. Either replace an existing callback by id or append a new one at the end. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/lreq.c new/luv-1.30.1-1/src/lreq.c --- old/luv-1.30.0-0/src/lreq.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/lreq.c 2019-09-05 02:39:51.000000000 +0200 @@ -19,7 +19,7 @@ static int luv_check_continuation(lua_State* L, int index) { if (lua_isnoneornil(L, index)) return LUA_NOREF; - luaL_checktype(L, index, LUA_TFUNCTION); + luv_check_callable(L, index); lua_pushvalue(L, index); return luaL_ref(L, LUA_REGISTRYINDEX); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/luv.c new/luv-1.30.1-1/src/luv.c --- old/luv-1.30.0-0/src/luv.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/luv.c 2019-09-05 02:39:51.000000000 +0200 @@ -15,6 +15,7 @@ * */ +#include <lua.h> #if (LUA_VERSION_NUM != 503) #include "c-api/compat-5.3.h" #endif @@ -250,6 +251,9 @@ {"cwd", luv_cwd}, {"exepath", luv_exepath}, {"get_process_title", luv_get_process_title}, +#if LUV_UV_VERSION_GEQ(1, 29, 0) + {"get_constrained_memory", luv_get_constrained_memory}, +#endif {"get_total_memory", luv_get_total_memory}, {"get_free_memory", luv_get_free_memory}, {"getpid", luv_getpid}, @@ -581,6 +585,14 @@ return ctx; } +LUALIB_API lua_State* luv_state(lua_State* L) { + return luv_context(L)->L; +} + +LUALIB_API uv_loop_t* luv_loop(lua_State* L) { + return luv_context(L)->loop; +} + // Set an external loop, before luaopen_luv LUALIB_API void luv_set_loop(lua_State* L, uv_loop_t* loop) { luv_ctx_t* ctx = luv_context(L); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/luv.h new/luv-1.30.1-1/src/luv.h --- old/luv-1.30.0-0/src/luv.h 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/luv.h 2019-09-05 02:39:51.000000000 +0200 @@ -88,30 +88,29 @@ void* extra; /* extra data */ } luv_ctx_t; -/* This is combined of old luv_state() and luv_loop() c apis, they are replaced - * with macro to this API */ +/* Retrieve all the luv context from a lua_State */ LUALIB_API luv_ctx_t* luv_context(lua_State* L); -/* There is a 1-1 relation between a lua_State and a uv_loop_t - These helpers will give you one if you have the other - These are exposed for extensions built with luv - This allows luv to be used in multithreaded applications. -*/ -#define luv_state(L) (luv_context(L)->L) +/* Retrieve the main thread of the given lua_State */ +LUALIB_API lua_State* luv_state(lua_State* L); -/* All libuv callbacks will lua_call directly from this root-per-thread state +/* Retrieve the uv_loop_t set for the given lua_State + Note: Each lua_State can have a custom uv_loop_t */ -#define luv_loop(L) (luv_context(L)->loop) +LUALIB_API uv_loop_t* luv_loop(lua_State* L); /* Set or clear an external uv_loop_t in a lua_State - This must be called before luaopen_luv, so luv doesn't init an own loop + When using a custom/external loop, this must be called before luaopen_luv + (otherwise luv will create and use its own loop) */ LUALIB_API void luv_set_loop(lua_State* L, uv_loop_t* loop); /* Set or clear an external c routine for luv event callback - This must be called before luaopen_luv, so luv doesn't init an own routine + When using a custom/external function, this must be called before luaopen_luv + (otherwise luv will use the default callback function: luv_cfpcall) */ LUALIB_API void luv_set_callback(lua_State* L, luv_CFpcall pcall); + /* This is the main hook to load the library. This can be called multiple times in a process as long as you use a different lua_State and thread for each. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/misc.c new/luv-1.30.1-1/src/misc.c --- old/luv-1.30.0-0/src/misc.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/misc.c 2019-09-05 02:39:51.000000000 +0200 @@ -300,6 +300,13 @@ return 1; } +#if LUV_UV_VERSION_GEQ(1, 29, 0) +static int luv_get_constrained_memory(lua_State* L) { + lua_pushnumber(L, uv_get_constrained_memory()); + return 1; +} +#endif + static int luv_get_total_memory(lua_State* L) { lua_pushnumber(L, uv_get_total_memory()); return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/process.c new/luv-1.30.1-1/src/process.c --- old/luv-1.30.0-0/src/process.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/process.c 2019-09-05 02:39:51.000000000 +0200 @@ -240,6 +240,18 @@ options.flags |= UV_PROCESS_WINDOWS_HIDE; } lua_pop(L, 1); +#if LUV_UV_VERSION_GEQ(1, 24, 0) + lua_getfield(L, 2, "hide_console"); + if (lua_toboolean(L, -1)) { + options.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE; + } + lua_pop(L, 1); + lua_getfield(L, 2, "hide_gui"); + if (lua_toboolean(L, -1)) { + options.flags |= UV_PROCESS_WINDOWS_HIDE_GUI; + } + lua_pop(L, 1); +#endif handle = (uv_process_t*)luv_newuserdata(L, sizeof(*handle)); handle->type = UV_PROCESS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/util.c new/luv-1.30.1-1/src/util.c --- old/luv-1.30.0-0/src/util.c 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/util.c 2019-09-05 02:39:51.000000000 +0200 @@ -55,6 +55,32 @@ } } +static int luv_is_callable(lua_State* L, int index) { + if (luaL_getmetafield(L, index, "__call") != LUA_TNIL) { + // getmetatable(x).__call must be a function for x() to work + int callable = lua_isfunction(L, -1); + lua_pop(L, 1); + return callable; + } + return lua_isfunction(L, index); +} + +static void luv_check_callable(lua_State* L, int index) { + const char *msg; + const char *typearg; /* name for the type of the actual argument */ + if (luv_is_callable(L, index)) + return; + + if (luaL_getmetafield(L, index, "__name") == LUA_TSTRING) + typearg = lua_tostring(L, -1); /* use the given type name */ + else if (lua_type(L, index) == LUA_TLIGHTUSERDATA) + typearg = "light userdata"; /* special name for messages */ + else + typearg = luaL_typename(L, index); /* standard name */ + msg = lua_pushfstring(L, "function or callable table expected, got %s", typearg); + luaL_argerror(L, index, msg); +} + #if LUV_UV_VERSION_GEQ(1, 10, 0) static int luv_translate_sys_error(lua_State* L) { int status = luaL_checkinteger(L, 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/src/util.h new/luv-1.30.1-1/src/util.h --- old/luv-1.30.0-0/src/util.h 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/src/util.h 2019-09-05 02:39:51.000000000 +0200 @@ -30,6 +30,12 @@ #ifdef LUV_SOURCE static int luv_error(lua_State* L, int ret); static void luv_status(lua_State* L, int status); + +/* Return true if the object is a function or a callable table */ +static int luv_is_callable(lua_State* L, int index); + +/* Check if the argument is callable and throw an error if it's not */ +static void luv_check_callable(lua_State* L, int index); #endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/tests/test-callbacks.lua new/luv-1.30.1-1/tests/test-callbacks.lua --- old/luv-1.30.0-0/tests/test-callbacks.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/luv-1.30.1-1/tests/test-callbacks.lua 2019-09-05 02:39:51.000000000 +0200 @@ -0,0 +1,55 @@ +return require('lib/tap')(function (test) + + -- Notes: + -- * When using a callable table as a callback, it will get itself as the first param when it is called. + -- This matches what happens when calling the callable table normally. + -- * expect wraps its argument in a function and returns the function, so expect should not be called on + -- a callable table directly. + + test("luv_handle_t: function", function (print, p, expect, uv) + local handle = uv.new_timer() + + local function onclose() + p("closed", handle) + end + local function ontimeout() + p("timeout", handle) + uv.close(handle, expect(onclose)) + end + + uv.timer_start(handle, 10, 0, expect(ontimeout)) + end) + + test("luv_handle_t: callable table", function (print, p, expect, uv) + local handle = uv.new_timer() + + local function onclose(self) + p("closed", self, handle) + end + local onCloseTable = setmetatable({}, {__call=expect(onclose)}) + + local function ontimeout(self) + p("timeout", self, handle) + uv.close(handle, onCloseTable) + end + local onTimeoutTable = setmetatable({}, {__call=expect(ontimeout)}) + + uv.timer_start(handle, 10, 0, onTimeoutTable) + end) + + test("luv_req_t: function", function (print, p, expect, uv) + local fn = function(err, path) + p(err, path) + end + assert(uv.fs_realpath('.', expect(fn))) + end) + + test("luv_req_t: callable table", function (print, p, expect, uv) + local fn = function(self, err, path) + p(self, err, path) + end + local callable = setmetatable({}, {__call=expect(fn)}) + assert(uv.fs_realpath('.', callable)) + end) + +end) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/tests/test-dns.lua new/luv-1.30.1-1/tests/test-dns.lua --- old/luv-1.30.0-0/tests/test-dns.lua 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/tests/test-dns.lua 2019-09-05 02:39:51.000000000 +0200 @@ -1,15 +1,32 @@ return require('lib/tap')(function (test) + local function errorAllowed(err) + -- allowed errors from gnulib's test-getaddrinfo.c + return err == "EAI_AGAIN" -- offline/no network connection + or err == "EAI_NONAME" -- IRIX returns this for "https" + or err == "EAI_SERVICE" -- Solaris returns this for "http"/"https" + or err == "EAI_NODATA" -- AIX returns this for "https" + end + test("Get all local http addresses", function (print, p, expect, uv) assert(uv.getaddrinfo(nil, "http", nil, expect(function (err, res) - p(res, #res) + if errorAllowed(err) then + print(err, "skipping") + return + end assert(not err, err) + p(res, #res) assert(res[1].port == 80) end))) end) test("Get all local http addresses sync", function (print, p, expect, uv) - local res = assert(uv.getaddrinfo(nil, "http")) + local res, errstr, err = uv.getaddrinfo(nil, "http") + if errorAllowed(err) then + print(err, "skipping") + return + end + assert(res, errstr) p(res, #res) assert(res[1].port == 80) end) @@ -19,8 +36,7 @@ socktype = "stream", family = "inet", }, expect(function (err, res) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end @@ -37,8 +53,7 @@ socktype = "stream", family = "inet6", }, expect(function (err, res) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end @@ -53,8 +68,7 @@ assert(uv.getaddrinfo("luvit.io", nil, { socktype = "stream", }, expect(function (err, res) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end @@ -66,8 +80,7 @@ test("Get all adresses for luvit.io", function (print, p, expect, uv) assert(uv.getaddrinfo("luvit.io", nil, nil, expect(function (err, res) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end @@ -81,8 +94,7 @@ assert(uv.getnameinfo({ family = "inet", }, expect(function (err, hostname, service) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end @@ -97,8 +109,7 @@ local hostname, service, err = uv.getnameinfo({ family = "inet", }) - -- allow failure when offline - if err == "EAI_AGAIN" then + if errorAllowed(err) then print(err, "skipping") return end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/tests/test-misc.lua new/luv-1.30.1-1/tests/test-misc.lua --- old/luv-1.30.0-0/tests/test-misc.lua 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/tests/test-misc.lua 2019-09-05 02:39:51.000000000 +0200 @@ -20,8 +20,12 @@ test("memory size", function (print, p, expect, uv) local rss = uv.resident_set_memory() local total = uv.get_total_memory() + local constrained = nil + if uv.get_constrained_memory then + constrained = uv.get_constrained_memory() + end local free = uv.get_free_memory() - p{rss=rss,total=total,free=free} + p{rss=rss,total=total,free=free, constrained=constrained} assert(rss < total) end) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luv-1.30.0-0/tests/test-process.lua new/luv-1.30.1-1/tests/test-process.lua --- old/luv-1.30.0-0/tests/test-process.lua 2019-06-29 13:04:12.000000000 +0200 +++ new/luv-1.30.1-1/tests/test-process.lua 2019-09-05 02:39:51.000000000 +0200 @@ -1,5 +1,7 @@ return require('lib/tap')(function (test) + local isWindows = _G.isWindows + test("test disable_stdio_inheritance", function (print, p, expect, uv) uv.disable_stdio_inheritance() end) @@ -9,7 +11,7 @@ local handle, pid handle, pid = uv.spawn(uv.exepath(), { - args = {"-e", "print 'Hello World'"}, + args = {"-e", "io.write 'Hello World'"}, stdio = {nil, stdout}, }, expect(function (code, signal) p("exit", {code=code, signal=signal}) @@ -24,21 +26,30 @@ uv.read_start(stdout, expect(function (err, chunk) p("stdout", {err=err,chunk=chunk}) assert(not err, err) + assert(chunk == "Hello World") uv.close(stdout) end)) end) - if _G.isWindows then return end + local cmd, options, expect_status = 'sleep', { args = {1} }, 0 + if isWindows then + cmd = "cmd.exe" + options.args = {"/c","pause"} + expect_status = 1 + end test("spawn and kill by pid", function (print, p, expect, uv) local handle, pid - handle, pid = uv.spawn("sleep", { - args = {1}, - }, expect(function (status, signal) + handle, pid = uv.spawn(cmd, options, expect(function (status, signal) p("exit", handle, {status=status,signal=signal}) - assert(status == 0) - assert(signal == 2) + assert(status == expect_status) + if isWindows then + -- just call TerminateProcess, ref uv__kill in libuv/src/win/process.c + assert(signal == 0) + else + assert(signal == 2) + end uv.close(handle) end)) p{handle=handle,pid=pid} @@ -47,11 +58,9 @@ test("spawn and kill by handle", function (print, p, expect, uv) local handle, pid - handle, pid = uv.spawn("sleep", { - args = {1}, - }, expect(function (status, signal) + handle, pid = uv.spawn(cmd, options, expect(function (status, signal) p("exit", handle, {status=status,signal=signal}) - assert(status == 0) + assert(status == expect_status) assert(signal == 15) uv.close(handle) end)) @@ -73,7 +82,8 @@ local stdout = uv.new_pipe(false) local handle, pid - handle, pid = uv.spawn("cat", { + handle, pid = uv.spawn(uv.exepath(), { + args = {"-"}, stdio = {stdin, stdout}, }, expect(function (code, signal) p("exit", {code=code, signal=signal}) @@ -88,10 +98,11 @@ uv.read_start(stdout, expect(function (err, chunk) p("stdout", {err=err,chunk=chunk}) assert(not err, err) + assert(chunk == "Hello World") uv.close(stdout) end)) - uv.write(stdin, "Hello World") + uv.write(stdin, "io.write('Hello World')") uv.shutdown(stdin, expect(function () uv.close(stdin) end))
