mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Less dramatic changes to the source-id following an edit. Modify the way
that the amalgamation is constructed to give it the opportunity to detect changes and modify the source-id. FossilOrigin-Name: 564c7340a3368501c3da885afde52123ed7f558801f6190cbe6173dfe9704b70
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
** SHA3 hash of the manifest file.
|
||||
**
|
||||
** (2) All individual file hashes in the manifest are verified. If any
|
||||
** source file has changed, the SHA3 hash ends with "-modified".
|
||||
** source file has changed, the SHA3 hash ends with "modified".
|
||||
**
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
@ -844,7 +844,7 @@ int main(int argc, char **argv){
|
||||
fclose(in);
|
||||
sha3sum_file(zManifest, 256, zHash);
|
||||
if( !allValid ){
|
||||
printf("%s %.55s-modified\n", zDate, zHash);
|
||||
printf("%s %.60salt1\n", zDate, zHash);
|
||||
}else{
|
||||
printf("%s %s\n", zDate, zHash);
|
||||
}
|
||||
|
@ -242,7 +242,13 @@ proc copy_file {filename} {
|
||||
}
|
||||
}
|
||||
append line $funcname $rest
|
||||
puts $out $line
|
||||
if {$funcname=="sqlite3_sourceid" && !$linemacros} {
|
||||
# The sqlite3_sourceid() routine is synthesized at the end of
|
||||
# the amalgamation
|
||||
puts $out "/* $line */"
|
||||
} else {
|
||||
puts $out $line
|
||||
}
|
||||
} else {
|
||||
puts $out "SQLITE_PRIVATE $line"
|
||||
}
|
||||
@ -396,4 +402,34 @@ foreach file {
|
||||
copy_file tsrc/$file
|
||||
}
|
||||
|
||||
# Synthesize an alternative sqlite3_sourceid() implementation that
|
||||
# that tries to detects changes in the amalgamation source text
|
||||
# and modify returns a modified source-id if changes are detected.
|
||||
#
|
||||
# The only detection mechanism we have is the __LINE__ macro. So only
|
||||
# edits that changes the number of lines of source code are detected.
|
||||
#
|
||||
if {!$linemacros} {
|
||||
flush $out
|
||||
set in2 [open sqlite3.c]
|
||||
set cnt 0
|
||||
set oldsrcid {}
|
||||
while {![eof $in2]} {
|
||||
incr cnt
|
||||
gets $in2 line
|
||||
if {[regexp {^#define SQLITE_SOURCE_ID } $line]} {set oldsrcid $line}
|
||||
}
|
||||
close $in2
|
||||
regsub {[0-9a-flt]{4}"} $oldsrcid {alt2"} oldsrcid
|
||||
puts $out \
|
||||
"#if __LINE__!=[expr {$cnt+0}]
|
||||
#undef SQLITE_SOURCE_ID
|
||||
$oldsrcid
|
||||
#endif
|
||||
/* Return the source-id for this library */
|
||||
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }"
|
||||
}
|
||||
puts $out \
|
||||
"/************************** End of sqlite3.c ******************************/"
|
||||
|
||||
close $out
|
||||
|
Reference in New Issue
Block a user