r4175 - trunk/varnish-cache/lib/libvarnish
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Thu Aug 6 12:53:18 CEST 2009
Author: tfheen
Date: 2009-08-06 12:53:17 +0200 (Thu, 06 Aug 2009)
New Revision: 4175
Modified:
trunk/varnish-cache/lib/libvarnish/Makefile.am
trunk/varnish-cache/lib/libvarnish/version.c
Log:
Reinstate svn_version code
Reinstate code to embed the svn version (or git commit id) in the
output given by varnishd -V.
Also, make sure we don't overwrite version.c when the tree is
exported, but generate it if it's completely missing. (This should
only happen if somebody does svn export rather than make dist, but
some people might do that.)
Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am
===================================================================
--- trunk/varnish-cache/lib/libvarnish/Makefile.am 2009-08-04 10:54:17 UTC (rev 4174)
+++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2009-08-06 10:53:17 UTC (rev 4175)
@@ -15,6 +15,7 @@
cli_common.c \
flopen.c \
num.c \
+ svn_version.c \
time.c \
tcp.c \
vct.c \
@@ -29,6 +30,24 @@
libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM}
+DISTCLEANFILES = svn_version.c
+svn_version.c: FORCE
+ V="$$(git log -n 1 --pretty=format:%h 2>/dev/null || LANG=C svnversion -n $(top_srcdir))" \
+ H="$$(head -n 1 svn_version.c 2>/dev/null || true)"; \
+ [ "$$V" = "exported" ] && [ -e svn_version.c ] && exit 0 ; \
+ if [ "/* $$V */" != "$$H" ]; then \
+ ( \
+ echo "/* $$V */" ;\
+ echo "#include <libvarnish.h>" ;\
+ echo "const char* svn_version(void)" ;\
+ echo "{" ;\
+ echo " const char* SVN_Version = \"$$V\";" ;\
+ echo " return SVN_Version;" ;\
+ echo "}" ;\
+ ) > svn_version.c ; \
+ fi
+FORCE:
+
if ENABLE_TESTS
TESTS = num_c_test
Modified: trunk/varnish-cache/lib/libvarnish/version.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/version.c 2009-08-04 10:54:17 UTC (rev 4174)
+++ trunk/varnish-cache/lib/libvarnish/version.c 2009-08-06 10:53:17 UTC (rev 4175)
@@ -41,8 +41,8 @@
void
varnish_version(const char *progname)
{
- fprintf(stderr, "%s (%s-%s)\n", progname,
- PACKAGE_TARNAME, PACKAGE_VERSION);
+ fprintf(stderr, "%s (%s-%s SVN %s)\n", progname,
+ PACKAGE_TARNAME, PACKAGE_VERSION, svn_version());
fprintf(stderr,
"Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS\n");
}
More information about the varnish-commit
mailing list