From: drh <> Date: Thu, 8 Jun 2023 15:27:35 +0000 (+0000) Subject: Include source provenance in the header comment of the amalgamation. X-Git-Tag: version-3.43.0~214 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd5d18045a5d81c168197ac8c3496400ac6dc6ef;p=thirdparty%2Fsqlite.git Include source provenance in the header comment of the amalgamation. FossilOrigin-Name: e3eb5af9050aae1db6887d17a560a24e4ca58f232ad7ac7c283c861ea4944f0b --- diff --git a/Makefile.in b/Makefile.in index 66bfd7ba53..5e3ff4b320 100644 --- a/Makefile.in +++ b/Makefile.in @@ -781,7 +781,7 @@ mptest: mptester$(TEXE) cp fts5.c fts5.h tsrc touch .target_source -sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl +sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . diff --git a/Makefile.msc b/Makefile.msc index 3f906708c1..3827bf3a05 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1876,7 +1876,7 @@ mptest: mptester.exe move vdbe.new tsrc\vdbe.c echo > .target_source -sqlite3.c: .target_source sqlite3ext.h sqlite3session.h $(MKSQLITE3C_TOOL) +sqlite3.c: .target_source sqlite3ext.h sqlite3session.h $(MKSQLITE3C_TOOL) src-verify.exe $(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS) sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl diff --git a/main.mk b/main.mk index f1936497ad..b247a65761 100644 --- a/main.mk +++ b/main.mk @@ -644,7 +644,7 @@ target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c cp fts5.c fts5.h tsrc touch target_source -sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl +sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl src-verify tclsh $(TOP)/tool/mksqlite3c.tcl cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . @@ -656,7 +656,7 @@ sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl sqlite3ext.h: target_source cp tsrc/sqlite3ext.h . -sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl +sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl src-verify tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros=1 echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c cat sqlite3.c >>tclsqlite3.c diff --git a/manifest b/manifest index fdb2d9e731..a71a213823 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Enhance\sLemon\sso\sthat\sit\sremembers\swhich\s-D\scommand-line\soptions\sare\sactually\nused\sin\sthe\sgrammar\sand\sincludes\sa\slist\sof\sall\ssuch\soptions\sin\sthe\sheader\nof\sthe\sgenerated\soutput\sfile. -D 2023-06-08T12:52:28.968 +C Include\ssource\sprovenance\sin\sthe\sheader\scomment\sof\sthe\samalgamation. +D 2023-06-08T15:27:35.001 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in bb4554cd186313a89f2e774698faa718350b3fc914386845c5ddb39710181cff +F Makefile.in 4b75bbccdbdd1d4953f67f93ec7fd6dbc31d0f5eeab432ad0dc56d70b8aff0d5 F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241 -F Makefile.msc 9c032cabd86fc0468167459b714478be7fe77e47ce43fdf1bfaf2e48e829a112 +F Makefile.msc 82b56254cedf800b3388ce54b4b271ae1a47f5a9332866b25e21689049eb3c09 F README.md 6f942c2e542d53202dc75b114b0617e9e02f8a6a777508fc23c3d8297951c478 F VERSION c6366dc72582d3144ce87b013cc35fe48d62f6d07d5be0c9716ea33c862144aa F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -556,7 +556,7 @@ F ext/wasm/wasmfs.make cf9a68162d92ca2bcb0b9528b244cb36d5cc2d84ccc9c2d398461927d F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 14bdf404d42ffee34b637369afd305c8dbc283cab233ca5d27bb104024d7f5b7 +F main.mk 2504d5451f9202094b840cdbf3d4e4019e1d6cc32d91acd57f3bc27f4cf67104 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -1974,7 +1974,7 @@ F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f -F tool/mksqlite3c.tcl eb47021591b1ad4a6862e2cb5625f1ac67ec1e0c6db5ba3953c069c635284cf5 +F tool/mksqlite3c.tcl dc14cedec7b83425afbfe1954e7fbfb3b56ed7cec92feaa5151042539273286e F tool/mksqlite3h.tcl d391cff7cad0a372ee1406faee9ccc7dad9cb80a0c95cae0f73d10dd26e06762 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5 @@ -2007,7 +2007,7 @@ F tool/sqldiff.c 2a693b4e7c1818c23f871f82f0c3fe67d80b67e3f087893089d33da29c1e387 F tool/sqlite3_analyzer.c.in f88615bf33098945e0a42f17733f472083d150b58bdaaa5555a7129d0a51621c F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 -F tool/src-verify.c cf3aa5a7dcfae4680b011d9fbc3eafa558367f7e1ad19532684b887aa553a324 +F tool/src-verify.c b7b26f1ae4acbf20d1fd8d013dc621d52cda310b1432a39c3b5f34fca42806a7 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 @@ -2040,8 +2040,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5332abf0ad8ef42c44e9dd7045d017bb8fc9a0262a89ababa3e2c41788a6cdb8 -R 8901e2725cbc66d820e7686f035bb3c9 +P c47a4dbd24b8277c57b7a83a8c0aeac2bc8f6ab75d1b65ba5e1fa83d1868d95f +R 674e703d30474530d75ea6adb4bbb3a6 U drh -Z e939ccde6d44f5ae271532ac04101d42 +Z f0add852f7350241c63aa7cf96943aee # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 275994dbe8..8d0c3f51dc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c47a4dbd24b8277c57b7a83a8c0aeac2bc8f6ab75d1b65ba5e1fa83d1868d95f \ No newline at end of file +e3eb5af9050aae1db6887d17a560a24e4ca58f232ad7ac7c283c861ea4944f0b \ No newline at end of file diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index bc1aadd194..c7667095e8 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -87,7 +87,7 @@ set out [open $fname w] # Force the output to use unix line endings, even on Windows. fconfigure $out -translation lf set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1] -puts $out [subst \ +puts $out \ {/****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version $VERSION. By combining all the individual C code files into this @@ -106,7 +106,30 @@ puts $out [subst \ ** if you want a wrapper to interface SQLite with your choice of programming ** language. The code for the "sqlite3" command-line shell is also in a ** separate file. This file contains only code for the core SQLite library. -*/ +**} +set srcroot [file dirname [file dirname [info script]]] +if {$tcl_platform(platform)=="windows"} { + set vsrcprog src-verify.exe +} else { + set vsrcprog ./src-verify +} +if {[file executable $vsrcprog] && [file readable $srcroot/manifest]} { + set res [string trim [split [exec $vsrcprog -x $srcroot]] \n] + puts $out "** The content in this amalgamation comes from Fossil check-in" + puts -nonewline $out "** [string range [lindex $res 0] 1 35]" + if {[llength $res]==1} { + puts "." + } else { + puts $out " with changes in files:\n**" + foreach f [lrange $res 1 end] { + puts $out "** $f" + } + } +} else { + puts $out "** The origin of the sources used to build this amalgamation" + puts $out "** is unknown." +} +puts $out [subst {*/ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1}] if {$addstatic} { diff --git a/tool/src-verify.c b/tool/src-verify.c index a9120d3aa0..d067c25967 100644 --- a/tool/src-verify.c +++ b/tool/src-verify.c @@ -13,11 +13,16 @@ ** ** USAGE: ** -** src-verify $(ROOT) +** src-verify [-x] [-v] $(ROOT) ** ** Where ROOT is the root of the source tree - the directory that contains ** the "manifest" and "manifest.uuid" files. Add the "-v" option for -** some debugging output. Additional debugging options: +** some debugging output. With the -x option, the output is in a format +** that is intended to be read by a script rather by a human. The -x output +** format always has the SHA3 hash of the source check-in on the first line +** and lists files that have changed on subsequent lines. +** +** Additional debugging options: ** ** src-verify --sha1 FILE ... ** src-verify --sha3 FILE ... @@ -782,46 +787,68 @@ static void errorMsg(int *pnErr, const char *zVers, const char *zFile){ printf(" %s\n", zFile); (*pnErr)++; } +static void errorMsgNH(int *pnErr, const char *zVers, const char *zFile){ + if( *pnErr==0 ){ + printf("%s\n", zVers); + } + printf("%s\n", zFile); + (*pnErr)++; +} int main(int argc, char **argv){ int i, j; int nDir; FILE *in; int bDebug = 0; + int bNonHuman = 0; int nErr = 0; SHA3Context ctx3; - const char *zDir; + const char *zDir = 0; + void (*xErr)(int*,const char*,const char*); char zHash[100]; char zCk[100]; char zVers[100]; char zLine[40000]; char zFile[40000]; - if( argc>=3 && strcmp(argv[1],"--sha1")==0 ){ - /* For testing purposes, if the first argument is --sha1, then simply - ** compute and print the SHA1 checksum of all subsequent arguments. */ - for(i=2; i=3 && strcmp(argv[1], "--sha3")==0 ){ - /* For testing purposes, if the first argument is --sha3, then simply - ** compute and print the SHA3-256 checksum of all subsequent arguments. */ - for(i=2; i1000 ){ - fprintf(stderr, "First argument too big: [%s]\n", zDir); + fprintf(stderr, "Directory argument too big: [%s]\n", zDir); return 1; } nDir = (int)strlen(zDir); if( nDir<0 ){ - fprintf(stderr, "First argument too short.\n"); + fprintf(stderr, "Directory argument too short.\n"); return 1; } memcpy(zFile, zDir, nDir); @@ -868,7 +895,7 @@ int main(int argc, char **argv){ zFile[sizeof(zFile)-1] = 0; defossilize(&zFile[nDir]); if( zLine[i]!=' ' ){ - errorMsg(&nErr, zVers, "manifest"); + xErr(&nErr, zVers, "manifest"); return 1; } for(i++, j=0; zLine[i]>='0' && zLine[i]<='f'; i++, j++){ @@ -880,21 +907,21 @@ int main(int argc, char **argv){ printf("%s %s\n", zFile, zHash); } if( access(zFile, R_OK)!=0 ){ - errorMsg(&nErr, zVers, &zFile[nDir]); + xErr(&nErr, zVers, &zFile[nDir]); continue; } if( strlen(zHash)==40 ){ sha1sum_file(zFile, zCk); if( strcmp(zHash, zCk)!=0 ){ - errorMsg(&nErr, zVers, &zFile[nDir]); + xErr(&nErr, zVers, &zFile[nDir]); } }else if( strlen(zHash)==64 ){ sha3sum_file(zFile, zCk); if( strcmp(zHash, zCk)!=0 ){ - errorMsg(&nErr, zVers, &zFile[nDir]); + xErr(&nErr, zVers, &zFile[nDir]); } }else{ - errorMsg(&nErr, zVers, "manifest"); + xErr(&nErr, zVers, "manifest"); return 1; } } @@ -908,11 +935,16 @@ int main(int argc, char **argv){ || zLine[64]!='\n' || memcmp(zLine, zVers, 64)!=0 ){ - errorMsg(&nErr, zVers, &zFile[nDir]); + xErr(&nErr, zVers, &zFile[nDir]); } if( in ) fclose(in); - if( nErr ) return nErr; - printf("OK %.25s\n", zVers); + if( bNonHuman ){ + if( nErr ) return 0; + printf("%s\n", zVers); + }else{ + if( nErr ) return nErr; + printf("OK %.25s\n", zVers); + } return 0; }