From: Dave Hart Date: Mon, 15 Aug 2011 18:40:32 +0000 (-0400) Subject: Try to fix 'make distcheck' errors when building out-of-tree X-Git-Tag: release-2.0.14-stable~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04656ea85a1b6ec0fbe1fa126f8c81e9b17abab5;p=libevent Try to fix 'make distcheck' errors when building out-of-tree --- diff --git a/.gitignore b/.gitignore index cab5a599..2dca840e 100644 --- a/.gitignore +++ b/.gitignore @@ -85,6 +85,7 @@ libevent_openssl.pc /test/regress /test/regress.gen.c /test/regress.gen.h +/test/rpcgen-attempted /test/test-eof /test/test-init /test/test-ratelim diff --git a/test/Makefile.am b/test/Makefile.am index 66e01ea3..bcda535c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include -DTINYTEST_LOCAL -EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c test.sh +EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c rpcgen_wrapper.sh test.sh noinst_PROGRAMS = test-init test-eof test-weof test-time \ bench bench_cascade bench_http bench_httpclient test-ratelim \ @@ -71,15 +71,20 @@ bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la bench_httpclient_SOURCES = bench_httpclient.c bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent_core.la -regress.gen.c regress.gen.h: regress.rpc $(top_srcdir)/event_rpcgen.py - if $(top_srcdir)/event_rpcgen.py $(srcdir)/regress.rpc ; then \ - echo "HI"; \ +regress.gen.c regress.gen.h: rpcgen-attempted + +rpcgen-attempted: $(srcdir)/regress.rpc $(srcdir)/../event_rpcgen.py $(srcdir)/rpcgen_wrapper.sh + date -u > $@ + if $(srcdir)/rpcgen_wrapper.sh $(srcdir); then \ + echo "rpcgen okay"; \ else \ - echo "No Python installed; can't test RPC."; \ + echo "No Python installed; stubbing out RPC test." >&2; \ echo " "> regress.gen.c; \ echo "#define NO_PYTHON_EXISTS" > regress.gen.h; \ fi +CLEANFILES = rpcgen-attempted + DISTCLEANFILES = *~ verify: check diff --git a/test/rpcgen_wrapper.sh b/test/rpcgen_wrapper.sh new file mode 100755 index 00000000..a60331c9 --- /dev/null +++ b/test/rpcgen_wrapper.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# libevent rpcgen_wrapper.sh +# Transforms event_rpcgen.py failure into success for make, only if +# regress.gen.c and regress.gen.h already exist in $srcdir. This +# is needed for "make distcheck" to pass the read-only $srcdir build, +# as with read-only sources fresh from tarball, regress.gen.[ch] will +# be correct in $srcdir but unwritable. This previously triggered +# Makefile.am to create stub regress.gen.c and regress.gen.h in the +# distcheck _build directory, which were then detected as leftover +# files in the build tree after distclean, breaking distcheck. +# Note that regress.gen.[ch] are not in fresh git clones, making +# working Python a requirement for make distcheck of a git tree. + +exit_updated() { + echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" + exit 0 +} + +exit_reuse() { + echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 + exit 0 +} + +exit_failed() { + echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 + exit 1 +} + +srcdir=$1 +srcdir=${srcdir:-.} +${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc +case "$?" in + 0) + exit_updated + ;; + *) + test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ + exit_reuse + exit_failed + ;; +esac