1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/chromium/src/third_party/libevent/test/rpcgen_wrapper.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +#!/bin/sh 1.5 +# libevent rpcgen_wrapper.sh 1.6 +# Transforms event_rpcgen.py failure into success for make, only if 1.7 +# regress.gen.c and regress.gen.h already exist in $srcdir. This 1.8 +# is needed for "make distcheck" to pass the read-only $srcdir build, 1.9 +# as with read-only sources fresh from tarball, regress.gen.[ch] will 1.10 +# be correct in $srcdir but unwritable. This previously triggered 1.11 +# Makefile.am to create stub regress.gen.c and regress.gen.h in the 1.12 +# distcheck _build directory, which were then detected as leftover 1.13 +# files in the build tree after distclean, breaking distcheck. 1.14 +# Note that regress.gen.[ch] are not in fresh git clones, making 1.15 +# working Python a requirement for make distcheck of a git tree. 1.16 + 1.17 +exit_updated() { 1.18 + echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" 1.19 + exit 0 1.20 +} 1.21 + 1.22 +exit_reuse() { 1.23 + echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 1.24 + exit 0 1.25 +} 1.26 + 1.27 +exit_failed() { 1.28 + echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 1.29 + exit 1 1.30 +} 1.31 + 1.32 +if [ -x /usr/bin/python2 ] ; then 1.33 + PYTHON2=/usr/bin/python2 1.34 +elif [ "x`which python2`" != x ] ; then 1.35 + PYTHON2=python2 1.36 +else 1.37 + PYTHON2=python 1.38 +fi 1.39 + 1.40 +srcdir=$1 1.41 +srcdir=${srcdir:-.} 1.42 +${PYTHON2} ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc 1.43 +case "$?" in 1.44 + 0) 1.45 + exit_updated 1.46 + ;; 1.47 + *) 1.48 + test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ 1.49 + exit_reuse 1.50 + exit_failed 1.51 + ;; 1.52 +esac