srctree-check.tcl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/tclsh
  2. #
  3. # Run this script from the top of the source tree in order to confirm that
  4. # various aspects of the source tree are up-to-date. Items checked include:
  5. #
  6. # * Makefile.msc and autoconf/Makefile.msc agree
  7. # * src/ctime.tcl is consistent with tool/mkctimec.tcl
  8. # * VERSION agrees with autoconf/tea/configure.ac
  9. # * src/pragma.h agrees with tool/mkpragmatab.tcl
  10. #
  11. # Other tests might be added later.
  12. #
  13. # Error messages are printed and the process exists non-zero if problems
  14. # are found. If everything is ok, no output is generated and the process
  15. # exits with 0.
  16. #
  17. # Read an entire file.
  18. #
  19. proc readfile {filename} {
  20. set fd [open $filename rb]
  21. set txt [read $fd]
  22. close $fd
  23. return $txt
  24. }
  25. # Find the root of the tree.
  26. #
  27. set ROOT [file dir [file dir [file normalize $argv0]]]
  28. # Name of the TCL interpreter
  29. #
  30. set TCLSH [info nameofexe]
  31. # Number of errors seen.
  32. #
  33. set NERR 0
  34. ######################### autoconf/tea/configure.ac ###########################
  35. set confac [readfile $ROOT/autoconf/tea/configure.ac]
  36. set vers [readfile $ROOT/VERSION]
  37. set pattern {AC_INIT([sqlite],[}
  38. append pattern [string trim $vers]
  39. append pattern {])}
  40. if {[string first $pattern $confac]<=0} {
  41. puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION"
  42. puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the"
  43. puts "...... correct version number in AC_INIT()"
  44. incr NERR
  45. }
  46. unset confac
  47. ######################### autoconf/Makefile.msc ###############################
  48. set f1 [readfile $ROOT/autoconf/Makefile.msc]
  49. exec $TCLSH $ROOT/tool/mkmsvcmin.tcl $ROOT/Makefile.msc tmp1.txt
  50. set f2 [readfile tmp1.txt]
  51. file delete tmp1.txt
  52. if {$f1 != $f2} {
  53. puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc"
  54. puts "...... Fix: tclsh tool/mkmsvcmin.tcl"
  55. incr NERR
  56. }
  57. ######################### src/pragma.h ########################################
  58. set f1 [readfile $ROOT/src/pragma.h]
  59. exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt
  60. set f2 [readfile tmp2.txt]
  61. file delete tmp2.txt
  62. if {$f1 != $f2} {
  63. puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl"
  64. puts "...... Fix: tclsh tool/mkpragmatab.tcl"
  65. incr NERR
  66. }
  67. ######################### src/ctime.c ########################################
  68. set f1 [readfile $ROOT/src/ctime.c]
  69. exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt
  70. set f2 [readfile tmp3.txt]
  71. file delete tmp3.txt
  72. if {$f1 != $f2} {
  73. puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl"
  74. puts "..... Fix: tclsh tool/mkctimec.tcl"
  75. incr NERR
  76. }
  77. # If any errors are seen, exit 1 so that the build will fail.
  78. #
  79. if {$NERR>0} {exit 1}