diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 15 | ||||
m--------- | acvmod | 0 | ||||
-rwxr-xr-x | bootstrap | 2 | ||||
-rw-r--r-- | configure.ac | 75 | ||||
-rw-r--r-- | src/Makefile.am | 22 | ||||
-rw-r--r-- | src/binlog.c | 29 | ||||
-rw-r--r-- | src/vmod.vcc | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/test01.at | 2 | ||||
-rw-r--r-- | tests/test02.at | 2 |
13 files changed, 51 insertions, 119 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..00ae21c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "acvmod"] + path = acvmod + url = git://git.gnu.org.ua/acvmod.git diff --git a/Makefile.am b/Makefile.am index 75bb714..9c03c59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>. -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I acvmod SUBDIRS = libltdl src tests doc @@ -1,9 +1,18 @@ -Vmod-binlog NEWS -- history of user-visible changes. 2014-11-13 -Copyright (C) 2013-2014 Sergey Poznyakoff +Vmod-binlog NEWS -- history of user-visible changes. 2016-01-24 +Copyright (C) 2013-2016 Sergey Poznyakoff See the end of file for copying conditions. Please send Vmod-binlog bug reports to <gray@gnu.org> +Version 2.0.90-4.1.0 (Git) + +* Versioning changes + +Starting with this release, the version number includes version +of Varnish API the release was designed for. + +* Support for Varnish 4,1 + Version 2,0, 2014-11-13 Support for VCL 4.0 @@ -16,7 +25,7 @@ Initial release. * Copyright information: -Copyright (C) 2013-2014 Sergey Poznyakoff +Copyright (C) 2013-2016 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the diff --git a/acvmod b/acvmod new file mode 160000 +Subproject f064cf4d7aa1ead1f8607b8b72baf883f015ffc @@ -3,5 +3,7 @@ for dir in m4 build-aux do test -d $dir || mkdir $dir done +git submodule init +git submodule update test -f ChangeLog || touch ChangeLog autoreconf -f -i -s diff --git a/configure.ac b/configure.ac index d82cee6..3be0b79 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # This file is part of vmod-binlog -# Copyright (C) 2013, 2014 Sergey Poznyakoff +# Copyright (C) 2013, 2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([vmod-binlog], 2.0, [gray@gnu.org]) +AC_INIT([vmod-binlog], 2.0.90-4.1.0, [gray@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/binlog.c) @@ -23,7 +23,8 @@ AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM AC_LANG(C) -AM_INIT_AUTOMAKE([1.14 gnu tar-ustar subdir-objects]) +AM_INIT_AUTOMAKE([1.14 gnu tar-ustar subdir-objects silent-rules]) +AM_SILENT_RULES([yes]) AC_GNU_SOURCE AC_PROG_CC @@ -44,70 +45,13 @@ LT_INIT([dlopen]) LTDL_INIT([recursive]) AC_CONFIG_FILES([libltdl/Makefile]) -# Check for pkg-config -PKG_PROG_PKG_CONFIG - AC_SYS_LARGEFILE # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([sys/stdlib.h]) -# Check for python -AC_CHECK_PROGS(PYTHON, [python], [ - AC_MSG_ERROR([python is not found.])]) - -# Varnish source tree -AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree]) -AC_ARG_WITH([varnish-source], - AC_HELP_STRING([--with-varnish-source=DIR], - [Varnish sources are located in DIR]), - [VARNISHSRC=$withval]) - -if test -z "$VARNISHSRC"; then - AC_MSG_ERROR([no Varnish source tree specified]) -fi -case "$VARNISHSRC" in -/*) ;; -*) AC_MSG_ERROR([varnish source path must be absolute pathname]) -esac - -VARNISHSRC=`cd $VARNISHSRC && pwd` -VARNISHVERSION= -AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h], - [VARNISHVERSION=3], - [AC_CHECK_FILE([$VARNISHSRC/include/vapi/vsm.h], - [VARNISHVERSION=4], - [AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]) ]) - -AC_DEFINE_UNQUOTED([VARNISHVERSION],$VARNISHVERSION,[Varnish major version number]) -AM_CONDITIONAL([VARNISH3],[test $VARNISHVERSION -eq 3]) -AM_CONDITIONAL([VARNISH4],[test $VARNISHVERSION -eq 4]) - -# Check that varnishtest is built in the varnish source directory -AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest], - [], - [AC_MSG_FAILURE([cannot find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory])] -) - -# vmod installation dir -AC_ARG_VAR([VMODDIR], [vmod installation directory]) -AC_ARG_WITH([vmoddir], - AC_HELP_STRING([--with-vmoddir=DIR], - [install modules to DIR]), - [case "$withval" in - /*) VMODDIR=$withval;; - no) unset VMODDIR;; - *) AC_MSG_ERROR([argument to --with-vmoddir must be absolute pathname]) - esac],[VMODDIR=`pkg-config --variable=vmoddir varnishapi` - if test -z "$VMODDIR"; then - AC_MSG_FAILURE([cannot determine vmod installation directory]) - fi]) - - -if test -z "$VMODDIR"; then - VMODDIR='$(libdir)/varnish/mods' -fi +AM_VARNISHAPI AC_SUBST(BINLOGSEL_MODDIR,'$(libdir)/$(PACKAGE)') @@ -116,15 +60,6 @@ AC_CONFIG_TESTDIR(tests) AC_CONFIG_FILES([tests/Makefile tests/atlocal]) AM_MISSING_PROG([AUTOM4TE], [autom4te]) -AC_CONFIG_COMMANDS([status],[ -delim="-------------------------------------------------------------------" -echo "" -echo $delim -echo "Building for Varnish version $VARNISHVERSION" -echo $delim -], -[VARNISHVERSION=$VARNISHVERSION]) - AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 7917730..5a525de 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -49,24 +49,12 @@ binlog.lo: vcc_if.c vcc_if.h CLEANFILES = vcc_if.c vcc_if.h *.rst -if VARNISH4 - vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py - vmodtoolargs = --strict - vccfile = $(top_srcdir)/src/vmod.vcc -else - vmodtool = $(VARNISHSRC)/lib/libvmod_std/vmod.py - vmodtoolargs = - vccfile = vmod.vcc3 - -vmod.vcc3: $(top_srcdir)/src/vmod.vcc - CLEANFILES += vmod.vcc3 -endif - -.vcc.vcc3: - sed -n '/^\$$/{s///;s/\(Module *[^ ][^ ]*\).*/\1/;p}' $< > $@ +vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py +vmodtoolargs = --strict +vccfile = $(top_srcdir)/src/vmod.vcc vcc_if.c vcc_if.h: $(vmodtool) $(vccfile) - @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vccfile) + $(AM_V_GEN)$(PYTHON) $(vmodtool) $(vmodtoolargs) $(vccfile) EXTRA_DIST = vmod.vcc diff --git a/src/binlog.c b/src/binlog.c index e9fb16e..1bf5950 100644 --- a/src/binlog.c +++ b/src/binlog.c @@ -1,5 +1,5 @@ /* This file is part of vmod-binlog - Copyright (C) 2013, 2014 Sergey Poznyakoff + Copyright (C) 2013, 2014, 2016 Sergey Poznyakoff Vmod-binlog is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,19 +27,14 @@ #include <stdarg.h> #include <ctype.h> #include <time.h> +#include "vcl.h" #include "vrt.h" #include "vcc_if.h" -#if VARNISHVERSION == 3 -# include "bin/varnishd/cache.h" -# define VCL_VOID void -# define VCL_STRING const char * -# define MOD_CTX struct sess * -# define WSPTR(s) ((s)->wrk->ws) -#else -# include "bin/varnishd/cache/cache.h" -# define MOD_CTX const struct vrt_ctx * -# define WSPTR(s) ((s)->ws) -#endif + +#include "bin/varnishd/cache/cache.h" +#define MOD_CTX const struct vrt_ctx * +#define WSPTR(s) ((s)->ws) + #include "vmod-binlog.h" #include "pack.h" #include "pthread.h" @@ -155,11 +150,13 @@ packerror(const char *fmt, ...) } int -module_init(struct vmod_priv *priv, const struct VCL_conf *vclconf) +binlog_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { - struct binlog_config *conf = calloc(1, sizeof(*conf)); - AN(conf); - priv->priv = conf; + if (e == VCL_EVENT_LOAD) { + struct binlog_config *conf = calloc(1, sizeof(*conf)); + AN(conf); + priv->priv = conf; + } return 0; } diff --git a/src/vmod.vcc b/src/vmod.vcc index b090797..eb1a42c 100644 --- a/src/vmod.vcc +++ b/src/vmod.vcc @@ -1,5 +1,5 @@ # This file is part of vmod-binlog -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2014, 2016 Sergey Poznyakoff # # Vmod-binlog is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ to speed up searches, their names follow the strftime(3) pattern: Binary logs can be viewed using the binlogcat(1) and binlogsel(1) utilities. -$Init module_init +$Event binlog_event $Function VOID init(PRIV_VCL, STRING, STRING, STRING) Description diff --git a/tests/Makefile.am b/tests/Makefile.am index c77be03..ecaffca 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -50,17 +50,17 @@ M4=m4 AUTOTEST = $(AUTOM4TE) --language=autotest $(TESTSUITE): package.m4 $(TESTSUITE_AT) - $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp - mv $@.tmp $@ + $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp + $(AM_V_at)mv $@.tmp $@ atconfig: $(top_builddir)/config.status - cd $(top_builddir) && ./config.status tests/$@ + @cd $(top_builddir) && ./config.status tests/$@ clean-local: - test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean + @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean check-local: atconfig atlocal $(TESTSUITE) - $(SHELL) $(TESTSUITE) + @$(SHELL) $(TESTSUITE) # Run the test suite on the *installed* tree. #installcheck-local: diff --git a/tests/atlocal.in b/tests/atlocal.in index 96b2d47..176b83c 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -4,6 +4,4 @@ PATH=@abs_builddir@:@abs_top_builddir@/src:@abs_top_srcdir@/build-aux:$top_srcdir:$srcdir:$PATH VARNISHTEST="@VARNISHSRC@/bin/varnishtest/varnishtest -Dvarnishd=@VARNISHSRC@/bin/varnishd/varnishd" -@VARNISH4_FALSE@ret_vcl_recv=lookup -@VARNISH4_TRUE@ret_vcl_recv=hash diff --git a/tests/test01.at b/tests/test01.at index d965b3c..d92c726 100644 --- a/tests/test01.at +++ b/tests/test01.at @@ -42,7 +42,7 @@ varnish v1 -vcl+backend { binlog.pack(req.http.X-nid); binlog.pack(req.http.X-aid); binlog.commit(); - return ($ret_vcl_recv); + return (hash); } } -start diff --git a/tests/test02.at b/tests/test02.at index fb51ef3..0313719 100644 --- a/tests/test02.at +++ b/tests/test02.at @@ -42,7 +42,7 @@ varnish v1 -vcl+backend { binlog.pack(req.http.X-nid); binlog.pack(req.http.X-aid); binlog.commit(); - return ($ret_vcl_recv); + return (hash); } } -start |