]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Attempt to fix libevent "make distcheck" failure related to read-only
authorDave Hart <hart@ntp.org>
Fri, 12 Aug 2011 06:21:59 +0000 (06:21 +0000)
committerDave Hart <hart@ntp.org>
Fri, 12 Aug 2011 06:21:59 +0000 (06:21 +0000)
srcdir and event_rpcgen.py by avoiding creating stub regress.gen.h and
regress.gen.c in the build directory when $srcdir has both already.

bk: 4e44c687DmxOFpgHZOYWTGtt27YsOQ

ChangeLog
sntp/libevent/test/Makefile.am
sntp/libevent/test/rpcgen_wrapper.sh [new file with mode: 0755]

index 4712901b2393e3f8c13e4d37ae6bfa7ca39f3282..d31a6180da128dfaabf2783d2ae720c4012c2dea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* Fix make distcheck with --enable-libevent-regress problem with
+  unwritable $srcdir.
 (4.2.7p202) 2011/08/09 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1983] --without-sntp build breaks in sntp subdir.
 * [Bug 1984] from 4.2.6p4-RC3: ntp/libisc fails to compile on OS X 10.7.
index 66e01ea35e1103ac9833b6eaa8ba94a9e8bed056..b368cbfa59340b1a4fed43db7fa06d4ba0230422 100644 (file)
@@ -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 \
+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 "HI"; \
        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/sntp/libevent/test/rpcgen_wrapper.sh b/sntp/libevent/test/rpcgen_wrapper.sh
new file mode 100755 (executable)
index 0000000..6ae53d0
--- /dev/null
@@ -0,0 +1,42 @@
+#!/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
\ No newline at end of file