Incorporate fossil-scm version information into the build. Add the
SQLITE_SOURCE_ID macro to the header. Add the sqlite3_sourceid() interface.
Add the sqlite_source_id() SQL function.
FossilOrigin-Name: 302dabe98f50b472bccd65c58504bc8a330049c4
diff --git a/Makefile.in b/Makefile.in
index 4d84c0c..cf16aaa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -682,8 +682,8 @@
status.lo: $(TOP)/src/status.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c
-sqlite3.h: $(TOP)/src/sqlite.h.in
- cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h
+sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
+ tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
table.lo: $(TOP)/src/table.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c
diff --git a/main.mk b/main.mk
index db65855..3e16eda 100644
--- a/main.mk
+++ b/main.mk
@@ -388,8 +388,8 @@
mv parse.h parse.h.temp
awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
-sqlite3.h: $(TOP)/src/sqlite.h.in
- cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h
+sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
+ tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
keywordhash.h: $(TOP)/tool/mkkeywordhash.c
$(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
diff --git a/manifest b/manifest
index bd8f871..6c368ae 100644
--- a/manifest
+++ b/manifest
@@ -1,10 +1,10 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Fix\stypos\sin\scomments\sused\sto\sgenerate\sdocumentation.\nCVSTrac\stickets\s#4028\sand\s#4029.
-D 2009-08-13T20:15:29
+C Incorporate\sfossil-scm\sversion\sinformation\sinto\sthe\sbuild.\s\sAdd\sthe\nSQLITE_SOURCE_ID\smacro\sto\sthe\sheader.\s\sAdd\sthe\ssqlite3_sourceid()\sinterface.\nAdd\sthe\ssqlite_source_id()\sSQL\sfunction.
+D 2009-08-14T16:01:24
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
-F Makefile.in c606c9b502dfde3b9c3b2d23ed49f3737829693b
+F Makefile.in 0f7761c5d1c62ae7a841e3393ffaff1fa0f5c00a
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F Makefile.vxworks 10010ddbf52e2503c7c49c7c0b7c7a096f8638a6
F README b974cdc3f9f12b87e851b04e75996d720ebf81ac
@@ -89,14 +89,14 @@
F ext/rtree/viewrtree.tcl 09526398dae87a5a87c5aac2b3854dbaf8376869
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
-F main.mk dd83a99a4341e342ac26563246c3070673ed5e3f
+F main.mk 6272ba6c273b6390602b276dd2b1e4fe71d1049a
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
F mkopcodec.awk 3fb9bf077053c968451f4dd03d11661ac373f9d1
F mkopcodeh.awk 513946ce4429bf2723aef0d640eb4d2493deb68e
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
-F publish.sh 5d092a0d7b0d9de009cb7aeff8bcd1608b49dd01
+F publish.sh 6626434f492f8e98757b4666b4eeca07236f50bb
F publish_osx.sh 2ad2ee7d50632dff99949edc9c162dbb052f7534
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
@@ -119,7 +119,7 @@
F src/delete.c dcf07632d8ca3d4086df8b65ea907a47278e6382
F src/expr.c d069ba1e060f296ea4f18fb85198fafefd00b22f
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
-F src/func.c 9856373f5315f6b8690d7f07f7191aa9f279ca87
+F src/func.c e536218d193b8d326aab91120bc4c6f28aa2b606
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
F src/hash.c ebcaa921ffd9d86f7ea5ae16a0a29d1c871130a7
F src/hash.h 35b216c13343d0b4f87d9f21969ac55ad72174e1
@@ -129,7 +129,7 @@
F src/legacy.c 303b4ffcf1ae652fcf5ef635846c563c254564f6
F src/lempar.c 0c4d1ab0a5ef2b0381eb81a732c54f68f27a574d
F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a
-F src/main.c a936f18fbb9cdf9ed9df93f58bb813876bd98590
+F src/main.c a474b32f050fc663fb2205577043f36e99a65ffb
F src/malloc.c 561710bf4b84084e2d047584ab3e7c7094e22a56
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
@@ -164,7 +164,7 @@
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
F src/select.c 67b0778c9585905c8aa75aaa469e76ef3c1d315a
F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb
-F src/sqlite.h.in 96feff9a06728854d010a9d5d297f61b9e1178d9
+F src/sqlite.h.in a6850e9034df1336e8139c4d6964d7d2f0f52337
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 6a90791138ba3447572d184d0798c24f3cbbec98
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
@@ -731,7 +731,7 @@
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c.tcl b790a58c9971e3ace07e92cab5604fec8849fa23
-F tool/mksqlite3h.tcl d27b76db9639f17c24dcd24e803c9e5e8f9eac23
+F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
@@ -746,14 +746,14 @@
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 06098505fca5c67b627a9e1102451f93e490e192
-R d4d0948e39fa9439b335fc4d02e99bd0
+P 1fc73b9146ee8844c73fc6a545cd0c98ac4d472b
+R dbfdfaedac46eb1b39f3c6eec19f1ba6
U drh
-Z 5aa73c2062675a6d05a5e133659c9885
+Z c2d13e484bdd96fc606ad98711ac77b0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFKhHRkoxKgR168RlERAs56AJsEjxte6e2cU7ofRb/0kOzyY2ojEACdFXXe
-ayEtSSJyG8UpeTrDqlbpvlc=
-=0vKf
+iD8DBQFKhYpXoxKgR168RlERAp4YAJ9oD/++ykjvNZXi8ZeYZ9DkS649/wCfZ0eI
+RPoHRxcwuo0Ii9TsHX1eAZ0=
+=W6Vw
-----END PGP SIGNATURE-----
diff --git a/manifest.uuid b/manifest.uuid
index 4c7a894..9bd7f5a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-1fc73b9146ee8844c73fc6a545cd0c98ac4d472b
\ No newline at end of file
+302dabe98f50b472bccd65c58504bc8a330049c4
\ No newline at end of file
diff --git a/publish.sh b/publish.sh
index 727a99e..3b8a75d 100644
--- a/publish.sh
+++ b/publish.sh
@@ -94,8 +94,7 @@
cd $srcdir
cd ..
mv sqlite sqlite-$VERS
-EXCLUDE=`find sqlite-$VERS -print | egrep '(CVS|www/|art/|doc/|contrib/|_FOSSIL_|manifest)' | sed 's,^, --exclude ,'`
-echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
+echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz --exclude _FOSSIL_ sqlite-$VERS"
tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
mv sqlite-$VERS sqlite
cd $ORIGIN
diff --git a/src/func.c b/src/func.c
index 6243536..2766fa3 100644
--- a/src/func.c
+++ b/src/func.c
@@ -15,8 +15,6 @@
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
-**
-** $Id: func.c,v 1.239 2009/06/19 16:44:41 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -702,7 +700,7 @@
}
/*
-** Implementation of the VERSION(*) function. The result is the version
+** Implementation of the sqlite_version() function. The result is the version
** of the SQLite library that is running.
*/
static void versionFunc(
@@ -714,6 +712,20 @@
sqlite3_result_text(context, sqlite3_version, -1, SQLITE_STATIC);
}
+/*
+** Implementation of the sqlite_source_id() function. The result is a string
+** that identifies the particular version of the source code used to build
+** SQLite.
+*/
+static void sourceidFunc(
+ sqlite3_context *context,
+ int NotUsed,
+ sqlite3_value **NotUsed2
+){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ sqlite3_result_text(context, SQLITE_SOURCE_ID, -1, SQLITE_STATIC);
+}
+
/* Array for converting from half-bytes (nybbles) into ASCII hex
** digits. */
static const char hexdigits[] = {
@@ -1433,6 +1445,7 @@
FUNCTION(randomblob, 1, 0, 0, randomBlob ),
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
FUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
+ FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
FUNCTION(quote, 1, 0, 0, quoteFunc ),
FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
FUNCTION(changes, 0, 0, 0, changes ),
diff --git a/src/main.c b/src/main.c
index 994cc07..b739d0d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,8 +13,6 @@
** implement the programmer interface to the library. Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
-**
-** $Id: main.c,v 1.562 2009/07/20 11:32:03 drh Exp $
*/
#include "sqliteInt.h"
@@ -35,6 +33,7 @@
const char sqlite3_version[] = SQLITE_VERSION;
#endif
const char *sqlite3_libversion(void){ return sqlite3_version; }
+const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 87996db..24c8d88 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -29,8 +29,6 @@
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
-**
-** @(#) $Id: sqlite.h.in,v 1.462 2009/08/06 17:40:46 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@@ -95,33 +93,44 @@
** The Z value is the release number and is incremented with
** each release but resets back to 0 whenever Y is incremented.
**
+** Since version 3.6.18, SQLite source code has been stored in the
+** "fossil" configuration management system. The SQLITE_SOURCE_ID
+** macro is a string which identifies a particular check-in of SQLite
+** within its configuration management system. The string contains the
+** date and time of the check-in (UTC) and an SHA1 hash of the entire
+** source tree.
+**
** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].
**
** Requirements: [H10011] [H10014]
*/
-#define SQLITE_VERSION "--VERS--"
-#define SQLITE_VERSION_NUMBER --VERSION-NUMBER--
+#define SQLITE_VERSION "--VERS--"
+#define SQLITE_VERSION_NUMBER --VERSION-NUMBER--
+#define SQLITE_SOURCE_ID "--SOURCE-ID--"
/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
-** These features provide the same information as the [SQLITE_VERSION]
-** and [SQLITE_VERSION_NUMBER] #defines in the header, but are associated
-** with the library instead of the header file. Cautious programmers might
-** include a check in their application to verify that
+** These interfaces provide the same information as the [SQLITE_VERSION],
+** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
+** but are associated with the library instead of the header file. Cautious
+** programmers might include a check in their application to verify that
** sqlite3_libversion_number() always returns the value
** [SQLITE_VERSION_NUMBER].
**
** The sqlite3_libversion() function returns the same information as is
** in the sqlite3_version[] string constant. The function is provided
** for use in DLLs since DLL users usually do not have direct access to string
-** constants within the DLL.
+** constants within the DLL. Similarly, the sqlite3_sourceid() function
+** returns the same information as is in the [SQLITE_SOURCE_ID] #define of
+** the header file.
**
** Requirements: [H10021] [H10022] [H10023]
*/
SQLITE_EXTERN const char sqlite3_version[];
const char *sqlite3_libversion(void);
+const char *sqlite3_sourceid(void);
int sqlite3_libversion_number(void);
/*
diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl
index e7dae4b..58fe8a8 100644
--- a/tool/mksqlite3h.tcl
+++ b/tool/mksqlite3h.tcl
@@ -1,5 +1,16 @@
#!/usr/bin/tclsh
#
+# This script constructs the "sqlite3.h" header file from the following
+# sources:
+#
+# 1) The src/sqlite.h.in source file. This is the template for sqlite3.h.
+# 2) The VERSION file containing the current SQLite version number.
+# 3) The manifest file from the fossil SCM. This gives use the date.
+# 4) The manifest.uuid file from the fossil SCM. This gives the SHA1 hash.
+#
+# Run this script by specifying the root directory of the source tree
+# on the command-line.
+#
# This script performs processing on src/sqlite.h.in. It:
#
# 1) Adds SQLITE_EXTERN in front of the declaration of global variables,
@@ -8,28 +19,66 @@
# formatted as a string (e.g. "3.6.17"), and
# 4) Replaces the string --VERSION-NUMBER-- with current library version,
# formatted as an integer (e.g. "3006017").
+# 5) Replaces the string --SOURCE-ID-- with the date and time and sha1
+# hash of the fossil-scm manifest for the source tree.
#
-# This script reads from stdin, and outputs to stdout. The current library
-# version number should be passed as the only argument. Example invocation:
+# This script outputs to stdout.
#
-# cat sqlite.h.in | mksqlite3h.tcl 3.6.17 > sqlite3.h
+# Example usage:
+#
+# tclsh mksqlite3h.tcl ../sqlite >sqlite3.h
#
-set zVersion [lindex $argv 0]
+
+# Get the source tree root directory from the command-line
+#
+set TOP [lindex $argv 0]
+
+# Get the SQLite version number (ex: 3.6.18) from the $TOP/VERSION file.
+#
+set in [open $TOP/VERSION]
+set zVersion [string trim [read $in]]
+close $in
set nVersion [eval format "%d%03d%03d" [split $zVersion .]]
-while {![eof stdin]} {
- set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
- set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(}
+# Get the fossil-scm version number from $TOP/manifest.uuid.
+#
+set in [open $TOP/manifest.uuid]
+set zUuid [string trim [read $in]]
+close $in
- set line [gets stdin]
+# Get the fossil-scm check-in date from the "D" card of $TOP/manifest.
+#
+set in [open $TOP/manifest]
+set zDate {}
+while {![eof $in]} {
+ set line [gets $in]
+ if {[regexp {^D (2.*[0-9])} $line all date]} {
+ set zDate [string map {T { }} $date]
+ break
+ }
+}
+close $in
+
+# Set up patterns for recognizing API declarations.
+#
+set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
+set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(}
+
+# Process the src/sqlite.h.in file.
+#
+set in [open $TOP/src/sqlite.h.in]
+while {![eof $in]} {
+
+ set line [gets $in]
regsub -- --VERS-- $line $zVersion line
regsub -- --VERSION-NUMBER-- $line $nVersion line
+ regsub -- --SOURCE-ID-- $line "$zDate $zUuid" line
if {[regexp {define SQLITE_EXTERN extern} $line]} {
puts $line
- puts [gets stdin]
+ puts [gets $in]
puts ""
puts "#ifndef SQLITE_API"
puts "# define SQLITE_API"
@@ -44,4 +93,4 @@
}
puts $line
}
-
+close $in