Hi all,
here's the second release of the build-info patch.
Changes:
- address Amos' comments about configure test
- implement Alex's "+changes" suggestion
- fix the "extra empty line if no version" issue
While testing it, I've discovered that test-builds.sh doesn't really
handle arguments with embedded spaces well.
I've reworked it to handle them better.
I've build-and run- tested it.
Please review.
--
/kinkie
=== modified file 'acinclude/squid-util.m4'
--- acinclude/squid-util.m4 2010-07-09 11:45:58 +0000
+++ acinclude/squid-util.m4 2010-09-07 14:32:00 +0000
@@ -179,3 +179,42 @@
AC_MSG_ERROR([$2])
fi
])
+
+AC_DEFUN([SQUID_EMBED_BUILD_INFO],[
+ AC_ARG_ENABLE([build-info],
+ AS_HELP_STRING([--enable-build-info="build info string"],
+ [Add an additional string in the output of "string -v".
+ Default is not to add anything. If the string is not specified,
+ tries to determine nick and revision number of the current
+ bazaar branch]),[
+ case "$enableval" in
+ no) ${TRUE}
+ ;;
+ yes)
+ if test -d "${srcdir}/.bzr"; then
+ AC_PATH_PROG(BZR,bzr,$FALSE)
+ squid_bzr_branch_nick=`${BZR} nick 2>/dev/null`
+ if test $? -eq 0 -a "x$squid_bzr_branch_nick" != "x"; then
+ squid_bzr_branch_revno=`${BZR} revno 2>/dev/null | sed 's/\"//g'`
+ fi
+ if test $? -eq 0 -a "x$squid_bzr_branch_revno" != "x"; then
+ ${BZR} diff 2>&1 >/dev/null
+ if test $? -eq 1; then
+ squid_bzr_branch_revno="$squid_bzr_branch_revno+changes"
+ fi
+ fi
+ if test "x$squid_bzr_branch_revno" != "x"; then
+ squid_build_info="Built branch: ${squid_bzr_branch_nick}-r${squid_bzr_branch_revno}"
+ fi
+ fi
+ ;;
+ *)
+ squid_build_info=$enableval
+ ;;
+ esac
+ ])
+ if test "x${squid_build_info:=no}" != "xno"; then
+ AC_DEFINE_UNQUOTED([SQUID_BUILD_INFO],["$squid_build_info"],
+ [Squid extended build info field for "squid -v" output])
+ fi
+])
=== modified file 'configure.in'
--- configure.in 2010-08-24 10:35:03 +0000
+++ configure.in 2010-09-03 17:10:48 +0000
@@ -295,6 +295,9 @@
SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
+# possibly include some build info tag into squid -v
+SQUID_EMBED_BUILD_INFO
+
AC_ARG_ENABLE(optimizations,
AS_HELP_STRING([--disable-optimizations],
[Do not compile Squid with compiler optimizations enabled.
=== modified file 'src/main.cc'
--- src/main.cc 2010-08-23 23:15:26 +0000
+++ src/main.cc 2010-09-07 08:03:21 +0000
@@ -113,6 +113,10 @@
#endif
+#ifndef SQUID_BUILD_INFO
+#define SQUID_BUILD_INFO ""
+#endif
+
/** for error reporting from xmalloc and friends */
SQUIDCEXTERN void (*failure_notify) (const char *);
@@ -531,7 +535,10 @@
case 'v':
/** \par v
* Display squid version and build information. Then exit. */
- printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
+ printf("Squid Cache: Version %s\n" ,version_string);
+ if (strlen(SQUID_BUILD_INFO))
+ printf("%s\n",SQUID_BUILD_INFO);
+ printf( "configure options: %s\n", SQUID_CONFIGURE_OPTIONS);
#if USE_WIN32_SERVICE
=== modified file 'test-suite/buildtest.sh'
--- test-suite/buildtest.sh 2010-07-23 13:10:05 +0000
+++ test-suite/buildtest.sh 2010-09-07 12:26:52 +0000
@@ -51,7 +51,10 @@
# above command currently encounters dependancy problems on cleanup.
#
# do not build any of the install's ...
- $base/../configure ${OPTS} ${configcache} 2>&1 &&
+#
+# eval is need to correctly handle quoted arguments
+ eval "$base/../configure ${DISTCHECK_CONFIGURE_FLAGS} ${configcache}" \
+ 2>&1 && \
make ${pjobs} ${MAKETEST} 2>&1
# Remember and then explicitly return the result of the last command
=== modified file 'test-suite/buildtests/layer-00-default.opts'
--- test-suite/buildtests/layer-00-default.opts 2009-10-04 03:33:15 +0000
+++ test-suite/buildtests/layer-00-default.opts 2010-09-07 12:23:31 +0000
@@ -6,7 +6,7 @@
# Default configuration options.
# - Nothing special configured. Just whatever is found by "./configure"
#
-OPTS=""
+DISTCHECK_CONFIGURE_FLAGS=""
# Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export DISTCHECK_CONFIGURE_FLAGS
=== modified file 'test-suite/buildtests/layer-01-minimal.opts'
--- test-suite/buildtests/layer-01-minimal.opts 2010-04-20 15:37:43 +0000
+++ test-suite/buildtests/layer-01-minimal.opts 2010-09-07 14:32:09 +0000
@@ -26,7 +26,8 @@
# --without-build-environment \
#
#
-OPTS=" \
+DISTCHECK_CONFIGURE_FLAGS=" \
+ --disable-build-info \
--disable-loadable-modules \
--disable-gnuregex \
--disable-optimizations \
@@ -99,4 +100,4 @@
"
# Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export DISTCHECK_CONFIGURE_FLAGS
=== modified file 'test-suite/buildtests/layer-02-maximus.opts'
--- test-suite/buildtests/layer-02-maximus.opts 2010-07-21 02:40:18 +0000
+++ test-suite/buildtests/layer-02-maximus.opts 2010-09-07 14:32:06 +0000
@@ -40,7 +40,7 @@
# --with-valgrind-debug \
#
#
-OPTS=" \
+DISTCHECK_CONFIGURE_FLAGS=" \
--enable-loadable-modules \
--enable-gnuregex \
--enable-optimizations \
@@ -94,7 +94,6 @@
--enable-translation \
--enable-zph-qos \
--enable-esi \
- \
--with-aio \
--with-build-environment=default \
--with-dl \
@@ -104,7 +103,8 @@
--with-large-files \
--with-pic \
--with-pthreads \
+ --enable-build-info=squid\ test\ build \
"
# Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export DISTCHECK_CONFIGURE_FLAGS
=== modified file 'test-suite/buildtests/layer-05-nodeps-esi.opts'
--- test-suite/buildtests/layer-05-nodeps-esi.opts 2009-11-04 05:07:56 +0000
+++ test-suite/buildtests/layer-05-nodeps-esi.opts 2010-09-07 14:32:12 +0000
@@ -10,7 +10,11 @@
# NP: there must be no overlap in code for plugging the libraries in/out.
# this means we can test the absence of all in one run and save time.
#
-OPTS="--enable-esi --without-expat --without-libxml2"
+DISTCHECK_CONFIGURE_FLAGS="\
+ --enable-esi \
+ --without-expat \
+ --without-libxml2 \
+ --enable-build-info"
# Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export DISTCHECK_CONFIGURE_FLAGS
=== modified file 'test-suite/buildtests/os-debian.opts'
--- test-suite/buildtests/os-debian.opts 2010-04-23 14:34:23 +0000
+++ test-suite/buildtests/os-debian.opts 2010-09-07 12:25:01 +0000
@@ -7,7 +7,7 @@
#
# This is to test any release build against what the package maintainers are seing
#
-OPTS=" \
+DISTCHECK_CONFIGURE_FLAGS=" \
--build=i486-linux-gnu \
--prefix=/usr \
--includedir="\${prefix}/include" \
=== modified file 'test-suite/buildtests/os-mingw.opts'
--- test-suite/buildtests/os-mingw.opts 2010-04-23 14:34:23 +0000
+++ test-suite/buildtests/os-mingw.opts 2010-09-07 12:25:33 +0000
@@ -5,7 +5,7 @@
#
# Configure options currently supported by MinGW environment
#
-OPTS=" \
+DISTCHECK_CONFIGURE_FLAGS=" \
--prefix=c:/squid \
--enable-storeio="ufs,aufs" \
--enable-removal-policies="lru,heap" \
=== modified file 'test-suite/buildtests/os-ubuntu.opts'
--- test-suite/buildtests/os-ubuntu.opts 2010-04-23 14:34:23 +0000
+++ test-suite/buildtests/os-ubuntu.opts 2010-09-07 12:25:40 +0000
@@ -6,7 +6,7 @@
#
# This is to test any release build against what the package maintainers are seeing
#
-OPTS=" \
+DISTCHECK_CONFIGURE_FLAGS=" \
--build=i486-linux-gnu \
--prefix=/usr \
--includedir="\${prefix}/include" \