Upgrade to 3.1.0

This commit is contained in:
li-long315 2023-02-21 09:30:43 +08:00
parent 18ce811352
commit a81e4970ce
6 changed files with 9 additions and 154 deletions

View File

@ -1,16 +1,12 @@
Name: lua-socket
Version: 3.0
Release: 0.19
Version: 3.1.0
Release: 1
Summary: Network support for the Lua language
License: MIT
URL: https://www.tecgraf.puc-rio.br/~diego/professional/luasocket/
Source0: https://github.com/diegonehab/luasocket/archive/v3.0-rc1.tar.gz
Source0: https://github.com/diegonehab/luasocket/archive/luasocket-%{version}.tar.gz
Patch0: luasocket-optflags.patch
Patch1: luasocket-no-global-vars.patch
Patch2: luasocket-3.0-settimeout.patch
BuildRequires: gcc lua lua-devel /usr/bin/iconv
BuildRequires: gcc make lua lua-devel /usr/bin/iconv
Requires: lua >= 5.3
%description
@ -30,7 +26,7 @@ Lua using %{name}
%package_help
%prep
%autosetup -n luasocket-3.0-rc1 -p1
%setup -q -n luasocket-%{version}
%build
%make_build LUAV=5.3 OPTFLAGS="%{optflags} -fPIC" LDFLAGS="%{?__global_ldflags} -shared -o " linux
@ -58,8 +54,11 @@ install -p src/*.h $RPM_BUILD_ROOT%{_includedir}/luasocket
%files help
%defattr(-,root,root)
%doc README doc/*
%doc CHANGELOG.md README.md docs/*.html docs/*.css docs/*.png
%changelog
* Tue Feb 21 2023 li-long315 <lilong@kylinos.cn> - 3.1.0-1
- Upgrade to 3.1.0
* Mon Sep 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.0-0.19
- Package init

View File

@ -1,53 +0,0 @@
From 396e9e5ee67dd3169aef6ef734d1f5e6f0ec76a9 Mon Sep 17 00:00:00 2001
From: Diego Nehab <diego@impa.br>
Date: Mon, 9 Sep 2013 14:23:00 -0300
Subject: [PATCH] Fixed timeout bug introduced by commit e81a6ff
---
src/buffer.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index 4ef4e8e..423d804 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -78,9 +78,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
const char *data = luaL_checklstring(L, 2, &size);
long start = (long) luaL_optnumber(L, 3, 1);
long end = (long) luaL_optnumber(L, 4, -1);
-#ifdef LUASOCKET_DEBUG
- p_timeout tm = timeout_markstart(buf->tm);
-#endif
+ timeout_markstart(buf->tm);
if (start < 0) start = (long) (size+start+1);
if (end < 0) end = (long) (size+end+1);
if (start < 1) start = (long) 1;
@@ -98,7 +96,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
}
#ifdef LUASOCKET_DEBUG
/* push time elapsed during operation as the last return value */
- lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
+ lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
#endif
return lua_gettop(L) - top;
}
@@ -111,9 +109,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
luaL_Buffer b;
size_t size;
const char *part = luaL_optlstring(L, 3, "", &size);
-#ifdef LUASOCKET_DEBUG
- p_timeout tm = timeout_markstart(buf->tm);
-#endif
+ timeout_markstart(buf->tm);
/* initialize buffer with optional extra prefix
* (useful for concatenating previous partial results) */
luaL_buffinit(L, &b);
@@ -149,7 +145,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
}
#ifdef LUASOCKET_DEBUG
/* push time elapsed during operation as the last return value */
- lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
+ lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
#endif
return lua_gettop(L) - top;
}

BIN
luasocket-3.1.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,31 +0,0 @@
diff --git a/src/http.lua b/src/http.lua
index ac4b2d6..f83dcc5 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -22,7 +22,7 @@ local _M = socket.http
-- Program constants
-----------------------------------------------------------------------------
-- connection timeout in seconds
-TIMEOUT = 60
+_M.TIMEOUT = 60
-- default port for document retrieval
_M.PORT = 80
-- user agent field sent in request
@@ -186,7 +186,7 @@ end
local function adjusturi(reqt)
local u = reqt
-- if there is a proxy, we need the full url. otherwise, just a part.
- if not reqt.proxy and not PROXY then
+ if not reqt.proxy and not _M.PROXY then
u = {
path = socket.try(reqt.path, "invalid path 'nil'"),
params = reqt.params,
@@ -198,7 +198,7 @@ local function adjusturi(reqt)
end
local function adjustproxy(reqt)
- local proxy = reqt.proxy or PROXY
+ local proxy = reqt.proxy or _M.PROXY
if proxy then
proxy = url.parse(proxy)
return proxy.host, proxy.port or 3128

View File

@ -1,60 +0,0 @@
--- a/src/makefile
+++ b/src/makefile
@@ -53,7 +53,7 @@ CDIR_linux?=lib/lua/$(LUAV)
LDIR_linux?=share/lua/$(LUAV)
# where lua headers are found for mingw builds
-# LUAINC_mingw:
+# LUAINC_mingw:
# /opt/local/include
LUAINC_mingw_base?=/usr/include
LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV)
@@ -135,7 +135,7 @@ DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_
-DMIME_API='__attribute__((visibility("default")))'
CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
-fvisibility=hidden
-LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
+LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
SOCKET_macosx=usocket.o
@@ -149,9 +149,9 @@ DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(C
-DLUASOCKET_API='__attribute__((visibility("default")))' \
-DUNIX_API='__attribute__((visibility("default")))' \
-DMIME_API='__attribute__((visibility("default")))'
-CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \
- -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
-LDFLAGS_linux=-O -shared -fpic -o
+CFLAGS_linux= -I$(LUAINC) $(DEF) $(OPTFLAGS) \
+ -fvisibility=hidden
+LDFLAGS_linux=$(OPTFLAGS) -shared -o
LD_linux=gcc
SOCKET_linux=usocket.o
@@ -166,7 +166,7 @@ DEF_mingw= -DLUASOCKET_INET_PTON -DLUASO
-DMIME_API='__declspec(dllexport)'
CFLAGS_mingw= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
-fvisibility=hidden
-LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
+LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
LD_mingw=gcc
SOCKET_mingw=wsocket.o
@@ -181,7 +181,7 @@ DEF_win32= //D "WIN32" //D "NDEBUG" //D
//D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
//D "_WINDLL" //D "LUA_$(COMPAT)_MODULE" \
//D "MIME_API=__declspec(dllexport)" \
- //D "LUASOCKET_$(DEBUG)"
+ //D "LUASOCKET_$(DEBUG)"
CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
//MANIFEST //MANIFESTFILE:"intermediate.manifest" \
@@ -323,7 +323,7 @@ $(UNIX_SO): $(UNIX_OBJS)
$(SERIAL_SO): $(SERIAL_OBJS)
$(LD) $(SERIAL_OBJS) $(LDFLAGS)$@
-install:
+install:
$(INSTALL_DIR) $(INSTALL_TOP_LDIR)
$(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR)
$(INSTALL_DIR) $(INSTALL_SOCKET_LDIR)

Binary file not shown.