Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lua-luaunbound for openSUSE:Factory checked in at 2021-12-18 20:30:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua-luaunbound (Old) and /work/SRC/openSUSE:Factory/.lua-luaunbound.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua-luaunbound" Sat Dec 18 20:30:07 2021 rev:2 rq:941294 version:1.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/lua-luaunbound/lua-luaunbound.changes 2021-06-11 00:19:27.705399069 +0200 +++ /work/SRC/openSUSE:Factory/.lua-luaunbound.new.2520/lua-luaunbound.changes 2021-12-18 20:30:49.806262005 +0100 @@ -1,0 +2,10 @@ +Fri Dec 17 19:04:39 UTC 2021 - Callum Farmer <[email protected]> + +- Update to version 1.0.0: + * make: Allow overriding pkg-config name of Lua + * make: Get Lua install directory from pkg-config + * Reduce scope of 'new' C function + * Allow setting more than one upstream server + * Support forwarding + +------------------------------------------------------------------- Old: ---- luaunbound-0.5.tar.gz luaunbound-0.5.tar.gz.asc New: ---- luaunbound-1.0.0.tar.gz luaunbound-1.0.0.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua-luaunbound.spec ++++++ --- /var/tmp/diff_new_pack.8hOIa9/_old 2021-12-18 20:30:51.510262952 +0100 +++ /var/tmp/diff_new_pack.8hOIa9/_new 2021-12-18 20:30:51.514262954 +0100 @@ -23,12 +23,12 @@ %else Name: %{flavor}-%{mod_name} %endif -Version: 0.5 +Version: 1.0.0 Release: 0 License: MIT Group: Development/Languages/Other Summary: This is a binding to libunbound for Lua -Url: https://www.zash.se/luaunbound.html +URL: https://www.zash.se/luaunbound.html Source0: https://code.zash.se/dl/luaunbound/%{mod_name}-%{version}.tar.gz Source1: https://code.zash.se/dl/luaunbound/%{mod_name}-%{version}.tar.gz.asc Source2: lua-%{mod_name}.keyring @@ -44,8 +44,7 @@ %autosetup -n %{mod_name}-%{version} -p1 %build -sed 's|lua-$(LUA_VERSION)|lua$(LUA_VERSION)|g' -i GNUmakefile -%make_build CC=cc LUA_VERSION=%{lua_version} LDLIBS="-llua -lunbound" MYCFLAGS="%{optflags}" +%make_build CC=cc LUA_PC=lua%{lua_version} LDLIBS="-llua -lunbound" MYCFLAGS="%{optflags}" %install %make_install LUA_LIBDIR=%{lua_archdir} ++++++ luaunbound-0.5.tar.gz -> luaunbound-1.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/.hg_archival.txt new/luaunbound-1.0.0/.hg_archival.txt --- old/luaunbound-0.5/.hg_archival.txt 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/.hg_archival.txt 2021-07-10 22:22:54.000000000 +0200 @@ -1,5 +1,6 @@ repo: fc1c6ebfc967d435fd22a7c22ab39d8b76f7275b -node: e1aa69ee78c94739f03c09693919347b376cb9b0 +node: 56d9b20fa567139461ae6740da5aff5b6bb66292 branch: default -tag: 0.5 -tag: github/master +latesttag: 1.0.0 +latesttagdistance: 1 +changessincelatesttag: 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/.hgtags new/luaunbound-1.0.0/.hgtags --- old/luaunbound-0.5/.hgtags 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/.hgtags 2021-07-10 22:22:54.000000000 +0200 @@ -2,3 +2,5 @@ 06c3157d3c0fa36dc52c1669f1cb6dc4ca311e15 0.2 f744496fe4b0d3f09c4fd46d28c0e66cf21ed2aa 0.3 27c34ad0a1618d53aed6fdd649fbd96cbaa3cd6b 0.4 +e1aa69ee78c94739f03c09693919347b376cb9b0 0.5 +22af1dbd3e64b53e2069182d7b11f409b234b4ca 1.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/GNUmakefile new/luaunbound-1.0.0/GNUmakefile --- old/luaunbound-0.5/GNUmakefile 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/GNUmakefile 2021-07-10 22:22:54.000000000 +0200 @@ -3,11 +3,11 @@ .INTERMEDIATE: lunbound.o LUA_VERSION = 5.2 -LUA_DIR = /usr/local -LUA_LIBDIR = $(LUA_DIR)/lib/lua/$(LUA_VERSION) +LUA_PC = lua-$(LUA_VERSION) +LUA_LIBDIR = $(shell pkg-config --variable=INSTALL_CMOD $(LUA_PC)) CC = c99 -CFLAGS += -fPIC $(shell pkg-config --cflags lua-$(LUA_VERSION)) -Wall -Wextra -pedantic -ggdb +CFLAGS += -fPIC $(shell pkg-config --cflags $(LUA_PC)) -Wall -Wextra -pedantic -ggdb LDLIBS += -lunbound LDFLAGS += -shared @@ -16,6 +16,9 @@ OUTPUT = lunbound.so +MKDIR = install -d +INSTALL = install -m644 + default: lunbound.so all: $(OUTPUT) @@ -26,8 +29,8 @@ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) install: - install -d $(DESTDIR)$(LUA_LIBDIR)/ - install -m644 lunbound.so $(DESTDIR)$(LUA_LIBDIR)/ + $(MKDIR) $(DESTDIR)$(LUA_LIBDIR)/ + $(INSTALL) lunbound.so $(DESTDIR)$(LUA_LIBDIR)/ clean: -rm -v $(OUTPUT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/LICENSE new/luaunbound-1.0.0/LICENSE --- old/luaunbound-0.5/LICENSE 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/LICENSE 2021-07-10 22:22:54.000000000 +0200 @@ -1,6 +1,6 @@ -libunbound for Prosody +luaunbound -Copyright (C) 2012-2014 Kim Alvefur <[email protected]> +Copyright (C) 2012-2021 Kim Alvefur <[email protected]> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/README.markdown new/luaunbound-1.0.0/README.markdown --- old/luaunbound-0.5/README.markdown 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/README.markdown 2021-07-10 22:22:54.000000000 +0200 @@ -1,27 +1,25 @@ -libunbound -========== +# luaunbound This is a binding to [libunbound](https://unbound.net/) for [Lua](https://www.lua.org/) . -Downloading ------------ +## Downloading -Source can be downloaded with mercurial from +Source can be downloaded with Mercurial from <https://code.zash.se/luaunbound/>. +Signed releases can be found at <https://code.zash.se/dl/luaunbound/>. + It is also available from [luarocks](https://luarocks.org/) and can be installed by luarocks install luaunbound -Building --------- +## Building make -API ---- +## API ### Creating a new context @@ -43,6 +41,10 @@ : Path to resolver configuration. If set to `true` then the default system resolvers are used. Otherwise root hints are used. +`forward` +: IP address of an upstream resolver(s) to use, a string or array of + strings. + `trusted` : DNSSEC root trust anchors, a string or array of strings. @@ -52,7 +54,7 @@ The built-in defaults are as follows: -``` {.lua} +``` lua local resolver = require"luaunbound".new({ async = true; hoststxt = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luaunbound-0.5/lunbound.c new/luaunbound-1.0.0/lunbound.c --- old/luaunbound-0.5/lunbound.c 2019-01-20 01:11:12.000000000 +0100 +++ new/luaunbound-1.0.0/lunbound.c 2021-07-10 22:22:54.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2014-2018 - Kim Alvefur +/* Copyright (C) 2014-2021 - Kim Alvefur * * This file is MIT licensed. */ @@ -13,6 +13,9 @@ #define lua_pcallk(L, nargs, nresults, errfunc, ctx, k) lua_pcall(L, nargs, nresults, errfunc) #define LUA_OK 0 #endif +#if (LUA_VERSION_NUM < 504) +#define luaL_pushfail lua_pushnil +#endif enum cb_state { cb_pending, cb_ready, cb_done }; typedef struct { @@ -26,7 +29,7 @@ * Create a new context. * Takes an optional single table with options as argument. */ -int lub_new(lua_State *L) { +static int lub_new(lua_State *L) { int ret = 0; int i = 1; struct ub_ctx **ctx; @@ -109,6 +112,29 @@ luaL_argcheck(L, ret == 0, 1, ub_strerror(ret)); lua_pop(L, 1); + lua_getfield(L, 1, "forward"); + + if(lua_istable(L, -1)) { + lua_rawgeti(L, -1, i++); + + while(ret == 0 && lua_isstring(L, -1)) { + ret = ub_ctx_set_fwd(*ctx, (char *)lua_tostring(L, -1)); + lua_pop(L, 1); + lua_rawgeti(L, -1, i++); + } + lua_pop(L, 1); + + luaL_argcheck(L, ret == 0, 1, ub_strerror(ret)); + i = 1; + } else if(lua_isstring(L, -1)) { + ret = ub_ctx_set_fwd(*ctx, (char *)lua_tostring(L, -1)); + } else if(!lua_isnil(L, -1)) { + luaL_argerror(L, 1, "'forward' must be string or array"); + } + + luaL_argcheck(L, ret == 0, 1, ub_strerror(ret)); + lua_pop(L, 1); + /* List of trust anchors * ["trusted"] = ". IN DS ..." -- Single string or array of strings */ @@ -160,7 +186,7 @@ lua_pop(L, 1); } } else if(!lua_isnil(L, -1)) { - luaL_argerror(L, 1, "'options' must be string or array"); + luaL_argerror(L, 1, "'options' must be a table"); } lua_pop(L, 1); /* options table */ @@ -173,6 +199,14 @@ static int lub_ctx_destroy(lua_State *L) { struct ub_ctx **ctx = luaL_checkudata(L, 1, "ub_ctx"); lua_settop(L, 1); + + /* Cancel any outstanding queries so that they don't cause any interaction + * with the ub_ctx after it has been freed. + * + * TODO Better to have queries cancel themselves on __gc? + * They still need to reference the ub_ctx to ensure things gets collected in + * a sane order. + */ lua_getuservalue(L, 1); lua_pushnil(L); @@ -299,7 +333,7 @@ int ret = ub_resolve(*ctx, qname, rrtype, rrclass, &result); if(ret != 0) { - lua_pushnil(L); + luaL_pushfail(L); lua_pushstring(L, ub_strerror(ret)); return 2; } @@ -350,11 +384,14 @@ if(ret != 0) { my_data->state = cb_done; - lua_pushnil(L); + luaL_pushfail(L); lua_pushstring(L, ub_strerror(ret)); return 2; } + /* Anchor callback in cb_data so that it does not get garbage-collected + * before we need it */ + /* uservalue[my_data] = callback */ lua_getuservalue(L, 1); lua_pushvalue(L, 6); /* the cb_data userdata */ @@ -376,7 +413,7 @@ int ret = ub_cancel(*ctx, my_data->async_id); if(ret != 0) { - lua_pushnil(L); + luaL_pushfail(L); lua_pushstring(L, ub_strerror(ret)); return 2; } @@ -443,7 +480,7 @@ my_data->state = cb_done; if(my_data->err != 0) { - lua_pushnil(L); + luaL_pushfail(L); lua_pushstring(L, ub_strerror(my_data->err)); } else { lub_parse_result(L, my_data->result); @@ -454,7 +491,7 @@ lua_settable(L, 3); /* ub_ctx.uservalue[my_data] = nil */ if(lua_pcallk(L, my_data->err == 0 ? 1 : 2, 0, msgh, 0, SELF) != 0) { - lua_pushnil(L); + luaL_pushfail(L); lua_insert(L, 5); return 2; } @@ -569,6 +606,10 @@ /* Main module table */ lua_createtable(L, 0, 2); luaL_setfuncs(L, lub_lib_funcs, 0); + + lua_pushliteral(L, "1.0.0"); + lua_setfield(L, -2, "_VERSION"); + lua_pushstring(L, ub_version()); lua_setfield(L, -2, "_LIBVER"); ++++++ makefile.patch ++++++ --- /var/tmp/diff_new_pack.8hOIa9/_old 2021-12-18 20:30:51.606263005 +0100 +++ /var/tmp/diff_new_pack.8hOIa9/_new 2021-12-18 20:30:51.610263007 +0100 @@ -12,5 +12,5 @@ + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) install: - install -d $(DESTDIR)$(LUA_LIBDIR)/ + $(MKDIR) $(DESTDIR)$(LUA_LIBDIR)/
