subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1201421 - in /subversion/trunk: configure.ac notes/knobs subversion/include/private/svn_dep_compat.h subversion/libsvn_subr/sqlite.c
Date Sun, 13 Nov 2011 11:36:37 GMT
Author: danielsh
Date: Sun Nov 13 11:36:36 2011
New Revision: 1201421

URL: http://svn.apache.org/viewvc?rev=1201421&view=rev
Log:
Introduce a --enable-sqlite-compatibility-version=X.Y.Z option for
./configure to allow people building Subversion to specify how old the
system being deployed on might be.  Setting the compatibility version
to an older version turns on code in subversion that works around
infelicities in older versions and relaxes the version check ("SQLite
compiled for 3.7.4, but running with 3.7.3") at initialization time.

If the compat version is set to a version before the minimum supported
version (3.6.18), the build will fail early (at 'make') so the person
building can adjust her expectations.

The default for the compat version is the currently installed version,
so there should be no change in behavior for users not passing this
option to the configure script.


* subversion/include/private/svn_dep_compat.h
  (SVN_SQLITE_MIN_VERSION_NUMBER, SVN_SQLITE_MIN_VERSION): Set to
    SQLITE_VERSION_NUMBER, SQLITE_VERSION (respectively) if undefined.
  (SQLITE_VERSION_AT_LEAST): Check SVN_SQLITE_MIN_VERSION_NUMBER instead
    of SQLITE_VERSION_NUMBER.

* subversion/libsvn_subr/sqlite.c
  (init_sqlite):
    Check sqlite version against SVN_SQLITE_MIN_VERSION_NUMBER instead
    of SQLITE_VERSION_NUMBER.

* configure.ac:
    (--enable-sqlite-compatibility-version): New switch; sets
    SVN_SQLITE_MIN_VERSION_NUMBER and SVN_SQLITE_MIN_VERSION.

* notes/knobs
  (SVN_SQLITE_MIN_VERSION_NUMBER, SVN_SQLITE_MIN_VERSION): Document.


Patch by: Jonathan Nieder <jrnieder@gmail.com>
(I wrote the notes/knobs part (having forgotten to advise Jonathan about
that) and made minor tweaks to the remainder)


Modified:
    subversion/trunk/configure.ac
    subversion/trunk/notes/knobs
    subversion/trunk/subversion/include/private/svn_dep_compat.h
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1201421&r1=1201420&r2=1201421&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Sun Nov 13 11:36:36 2011
@@ -172,6 +172,18 @@ SQLITE_URL="http://www.sqlite.org/sqlite
 SVN_LIB_SQLITE(${SQLITE_MINIMUM_VER}, ${SQLITE_RECOMMENDED_VER},
                ${SQLITE_URL})
 
+AC_ARG_ENABLE(sqlite-compatibility-version,
+  AS_HELP_STRING([--enable-sqlite-compatibility-version=X.Y.Z],
+                 [Allow binary to run against SQLite as old as ARG]),
+  [sqlite_compat_ver=$enableval],[sqlite_compat_ver=no])
+
+if test -n "$sqlite_compat_ver" && test "$sqlite_compat_ver" != no; then
+  SVN_SQLITE_VERNUM_PARSE([$sqlite_compat_ver],
+                          [sqlite_compat_ver_num])
+  CFLAGS="-DSVN_SQLITE_MIN_VERSION='\"$sqlite_compat_ver\"' $CFLAGS"
+  CFLAGS="-DSVN_SQLITE_MIN_VERSION_NUMBER=$sqlite_compat_ver_num $CFLAGS"
+fi
+
 dnl Set up a number of directories ---------------------
 
 dnl Create SVN_BINDIR for proper substitution

Modified: subversion/trunk/notes/knobs
URL: http://svn.apache.org/viewvc/subversion/trunk/notes/knobs?rev=1201421&r1=1201420&r2=1201421&view=diff
==============================================================================
--- subversion/trunk/notes/knobs (original)
+++ subversion/trunk/notes/knobs Sun Nov 13 11:36:36 2011
@@ -44,6 +44,8 @@ SVN_MERGE__ALLOW_ALL_FORWARD_MERGES_FROM
 SVN_USE_WIN32_CRASHHANDLER
 SVN_DAV_SEND_VTXN_NAME
 SVN_DISABLE_PREFIX_SUFFIX_SCANNING
+SVN_SQLITE_MIN_VERSION_NUMBER
+SVN_SQLITE_MIN_VERSION
 
 2.3 Debugging Support
 
@@ -205,6 +207,24 @@ SVN_I_LIKE_LATENCY_SO_IGNORE_HTTPV2
   Default:   not defined
   Suggested: not defined
 
+4.8 SVN_SQLITE_MIN_VERSION_NUMBER
+
+  Scope:     libsvn_subr
+  Purpose:   The minimum SQLite version to have run-time support for.
+  Range:     SQLite version numbers, as packed integers
+  Default:   SQLITE_VERSION_NUMBER (i.e., the compile-time-sqlite version)
+  Suggested: not defined (to use default)
+
+4.9 SVN_SQLITE_MIN_VERSION
+
+  Scope:     libsvn_subr
+  Purpose:   See SVN_SQLITE_MIN_VERSION_NUMBER.  The two must be overridden
+	     (or not overridden) together; defining one but leaving the other
+             at its default will cause undefined behaviour.
+  Range:     SQLite versions, as string literals
+  Default:   SQLITE_VERSION
+  Suggested: not defined (to use default)
+
 
 5 Defines controling debug support
 ==================================

Modified: subversion/trunk/subversion/include/private/svn_dep_compat.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_dep_compat.h?rev=1201421&r1=1201420&r2=1201421&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_dep_compat.h (original)
+++ subversion/trunk/subversion/include/private/svn_dep_compat.h Sun Nov 13 11:36:36 2011
@@ -107,6 +107,32 @@ typedef apr_uint32_t apr_uintptr_t;
 #endif /* SERF_VERSION_AT_LEAST */
 
 /**
+ * By default, if libsvn is built against one version of SQLite
+ * and then run using an older version, svn will error out:
+ *
+ *     svn: Couldn't perform atomic initialization
+ *     svn: SQLite compiled for 3.7.4, but running with 3.7.3
+ *
+ * That can be annoying when building on a modern system in order
+ * to deploy on a less modern one.  So these constants allow one
+ * to specify how old the system being deployed on might be.
+ * For example,
+ *
+ *     EXTRA_CFLAGS += -DSVN_SQLITE_MIN_VERSION_NUMBER=3007003
+ *     EXTRA_CFLAGS += '-DSVN_SQLITE_MIN_VERSION="3.7.3"'
+ *
+ * turns on code that works around infelicities in older versions
+ * as far back as 3.7.3 and relaxes the check at initialization time
+ * to permit them.
+ *
+ * @since New in 1.8.
+ */
+#ifndef SVN_SQLITE_MIN_VERSION_NUMBER
+#define SVN_SQLITE_MIN_VERSION_NUMBER SQLITE_VERSION_NUMBER
+#define SVN_SQLITE_MIN_VERSION SQLITE_VERSION
+#endif /* SVN_SQLITE_MIN_VERSION_NUMBER */
+
+/**
  * Check at compile time if the SQLite version is at least a certain
  * level.
  * @param major The major version component of the version checked
@@ -120,7 +146,7 @@ typedef apr_uint32_t apr_uintptr_t;
  */
 #ifndef SQLITE_VERSION_AT_LEAST
 #define SQLITE_VERSION_AT_LEAST(major,minor,patch)                     \
-((major*1000000 + minor*1000 + patch) <= SQLITE_VERSION_NUMBER)
+((major*1000000 + minor*1000 + patch) <= SVN_SQLITE_MIN_VERSION_NUMBER)
 #endif /* SQLITE_VERSION_AT_LEAST */
 
 #ifdef __cplusplus

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1201421&r1=1201420&r2=1201421&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Sun Nov 13 11:36:36 2011
@@ -606,12 +606,12 @@ static volatile svn_atomic_t sqlite_init
 static svn_error_t *
 init_sqlite(void *baton, apr_pool_t *pool)
 {
-  if (sqlite3_libversion_number() < SQLITE_VERSION_NUMBER)
+  if (sqlite3_libversion_number() < SVN_SQLITE_MIN_VERSION_NUMBER)
     {
       return svn_error_createf(
                     SVN_ERR_SQLITE_ERROR, NULL,
                     _("SQLite compiled for %s, but running with %s"),
-                    SQLITE_VERSION, sqlite3_libversion());
+                    SVN_SQLITE_MIN_VERSION, sqlite3_libversion());
     }
 
 #if APR_HAS_THREADS



Mime
View raw message