commit f1ebe4c4988c5aa51dac6edce37ef0b130959be5 Author: CentOS Sources Date: Tue May 7 09:17:36 2019 -0400 import lua-socket-3.0-0.17.rc1.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f901436 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/v3.0-rc1.tar.gz diff --git a/.lua-socket.metadata b/.lua-socket.metadata new file mode 100644 index 0000000..5c947d2 --- /dev/null +++ b/.lua-socket.metadata @@ -0,0 +1 @@ +aff9122b26c01487c06a32133df78c1506af350f SOURCES/v3.0-rc1.tar.gz diff --git a/SOURCES/luasocket-3.0-settimeout.patch b/SOURCES/luasocket-3.0-settimeout.patch new file mode 100644 index 0000000..724ec24 --- /dev/null +++ b/SOURCES/luasocket-3.0-settimeout.patch @@ -0,0 +1,53 @@ +From 396e9e5ee67dd3169aef6ef734d1f5e6f0ec76a9 Mon Sep 17 00:00:00 2001 +From: Diego Nehab +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; + } diff --git a/SOURCES/luasocket-no-global-vars.patch b/SOURCES/luasocket-no-global-vars.patch new file mode 100644 index 0000000..e32f25d --- /dev/null +++ b/SOURCES/luasocket-no-global-vars.patch @@ -0,0 +1,31 @@ +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 diff --git a/SOURCES/luasocket-optflags.patch b/SOURCES/luasocket-optflags.patch new file mode 100644 index 0000000..d02908d --- /dev/null +++ b/SOURCES/luasocket-optflags.patch @@ -0,0 +1,60 @@ +--- 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) diff --git a/SPECS/lua-socket.spec b/SPECS/lua-socket.spec new file mode 100644 index 0000000..8359a44 --- /dev/null +++ b/SPECS/lua-socket.spec @@ -0,0 +1,227 @@ +%if 0%{?fedora} >= 22 || 0%{?rhel} > 7 +%define luaver 5.3 +%else +%if 0%{?fedora} >= 20 +%define luaver 5.2 +%else +%define luaver 5.1 +%endif +%endif + +%define luacompatver 5.1 +%define luacompatlibdir %{_libdir}/lua/%{luacompatver} +%define luacompatpkgdir %{_datadir}/lua/%{luacompatver} +%define lua51dir %{_builddir}/lua51-%{name}-%{version}-%{release} + +%define lualibdir %{_libdir}/lua/%{luaver} +%define luapkgdir %{_datadir}/lua/%{luaver} +%global baseversion 3.0-rc1 +%global upstreamname luasocket + +Name: lua-socket +Version: 3.0 +Release: 0.17.rc1%{?dist} +Summary: Network support for the Lua language + +Group: Development/Libraries +License: MIT +URL: http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/ +#Source0: http://luaforge.net/frs/download.php/2664/luasocket-%{baseversion}.tar.gz +Source0: https://github.com/diegonehab/%{upstreamname}/archive/v%{baseversion}.tar.gz +Patch0: luasocket-optflags.patch +# All changes in the upstream repo from %{baseversion} tag to the +# current master. Seems to be harmless. +Patch1: luasocket-no-global-vars.patch +Patch2: luasocket-3.0-settimeout.patch + +BuildRequires: lua >= %{luaver}, lua-devel >= %{luaver} +BuildRequires: /usr/bin/iconv +Requires: lua >= %{luaver} + +%package devel +Summary: Development files for %{name} +Group: Development/Languages +Requires: %{name}%{?_isa} = %{version}-%{release} + + +%description +LuaSocket is a Lua extension library that is composed by two parts: a C core +that provides support for the TCP and UDP transport layers, and a set of Lua +modules that add support for functionality commonly needed by applications +that deal with the Internet. + +Among the support modules, the most commonly used implement the SMTP, HTTP +and FTP. In addition there are modules for MIME, URL handling and LTN12. + +%description devel +Header files and libraries for building an extension library for the +Lua using %{name} + +%if 0%{?fedora} >= 20 +%package compat +Summary: Network support for the Lua language 5.1 +Group: Development/Libraries +BuildRequires: compat-lua >= %{luacompatver}, compat-lua-devel >= %{luacompatver} + +%description compat +LuaSocket is a Lua extension library that is composed by two parts: a C core +that provides support for the TCP and UDP transport layers, and a set of Lua +modules that add support for functionality commonly needed by applications +that deal with the Internet. + +Among the support modules, the most commonly used implement the SMTP, HTTP +and FTP. In addition there are modules for MIME, URL handling and LTN12. +%endif + +%prep +%setup -q -n %{upstreamname}-%{baseversion} +%patch0 -p1 -b .optflags +%patch1 -p1 -b .noglobal +%patch2 -p1 -b .settimeout + +%if 0%{?fedora} >= 20 +rm -rf %{lua51dir} +cp -a . %{lua51dir} +%endif + +%build +make %{?_smp_mflags} LUAV=%{luaver} OPTFLAGS="%{optflags} -fPIC" \ + LDFLAGS="%{build_ldflags} -shared -o " linux +/usr/bin/iconv -f ISO8859-1 -t UTF8 LICENSE >LICENSE.UTF8 +mv -f LICENSE.UTF8 LICENSE + +%if 0%{?fedora} >= 20 +pushd %{lua51dir} +make %{?_smp_mflags} LUAV=%{luacompatver} \ + LUAINC_linux=%{_includedir}/lua-%{luacompatver} \ + OPTFLAGS="%{optflags} -fPIC" \ + LDFLAGS="%{build_ldflags} -O -shared -fpic -o " linux +/usr/bin/iconv -f ISO8859-1 -t UTF8 LICENSE >LICENSE.UTF8 +mv -f LICENSE.UTF8 LICENSE +popd +%endif + +%install +rm -rf $RPM_BUILD_ROOT +make install-unix OPTFLAGS="%{optflags}" INSTALL_TOP=$RPM_BUILD_ROOT \ + INSTALL_TOP_CDIR=$RPM_BUILD_ROOT%{lualibdir} \ + INSTALL_TOP_LDIR=$RPM_BUILD_ROOT%{luapkgdir} + +# install development files +install -d $RPM_BUILD_ROOT%{_includedir}/%{upstreamname} +install -p src/*.h $RPM_BUILD_ROOT%{_includedir}/%{upstreamname} + +%if 0%{?fedora} >= 20 +pushd %{lua51dir} +make install-unix OPTFLAGS="%{optflags}" INSTALL_TOP=$RPM_BUILD_ROOT \ + INSTALL_TOP_CDIR=$RPM_BUILD_ROOT%{luacompatlibdir} \ + INSTALL_TOP_LDIR=$RPM_BUILD_ROOT%{luacompatpkgdir} +popd +%endif + + +%files +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc README doc/* +%{lualibdir}/* +%{luapkgdir}/* + +%files devel +%defattr(-,root,root,-) +%{_includedir}/%{upstreamname} + +%if 0%{?fedora} >= 20 +%files compat +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc README doc/* +%{luacompatlibdir}/* +%{luacompatpkgdir}/* +%endif + +%changelog +* Mon Apr 16 2018 Rafael dos Santos - 3.0-0.17.rc1 +- Use standard Fedora linker flags (bug #1548713) + +* Thu Feb 08 2018 Fedora Release Engineering - 3.0-0.16.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 3.0-0.15.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 3.0-0.14.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 3.0-0.13.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 04 2016 Fedora Release Engineering - 3.0-0.12.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 3.0-0.11.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun May 10 2015 Robert Scheck 3.0-0.10.rc1 +- Added upstream patch to fix settimeout() bug (#1220171) + +* Mon May 04 2015 Robert Scheck 3.0-0.9.rc1 +- Fix broken release tag + +* Fri Mar 20 2015 Bastien Nocera 3.0-0.8rc1.1 +- Rebuild for new lua + +* Fri Jan 16 2015 Tom Callaway - 3.0-0.8rc1 +- lua 5.3 + +* Sun Aug 17 2014 Fedora Release Engineering - 3.0-0.7rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 3.0-0.6rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu May 22 2014 Jan Kaluza - 3.0-0.5rc1 +- build -compat subpackage against compat-lua + +* Mon Sep 09 2013 Matěj Cepl - 3.0-0.4rc1 +- Add -devel package. + +* Fri Aug 23 2013 Matěj Cepl - 3.0-0.3rc1 +- update to the 3.0rc1 from git + +* Sat Aug 03 2013 Fedora Release Engineering - 2.1-0.2.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri May 10 2013 Tom Callaway - 2.1-0.1.rc1 +- update to 2.1rc1 from git + +* Thu Feb 14 2013 Fedora Release Engineering - 2.0.2-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 2.0.2-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 13 2012 Fedora Release Engineering - 2.0.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Oct 10 2011 Matthew Garrett - 2.0.2-6 +- Build support for Unix domain sockets (rhbz: #720692) + +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Jul 25 2009 Fedora Release Engineering - 2.0.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 2.0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Apr 05 2008 Tim Niemueller - 2.0.2-2 +- Pass proper CFLAGS to produce valid debuginfo +- Pass LICENSE file through iconv to produce proper UTF8 + +* Fri Apr 04 2008 Tim Niemueller - 2.0.2-1 +- Initial package +