Posted to tcl by hypnotoad at Thu Dec 03 16:17:33 GMT 2015view raw

  1. proc fossil_dbfile {module} {
  2. if {![info exists ::fossil_dbfile($module)]} {
  3. set ::fossil_dbfile($module) [file join $::fossilRepoPath $module.fossil]
  4. }
  5. return $::fossil_dbfile($module)
  6. }
  7.  
  8. set scriptfile [file join [pwd] [info script]]
  9. set tclsrcroot [file dirname [file dirname $scriptfile]]
  10. set fossilRepoPath [file join $tclsrcroot .. fossil]
  11. set tclConfigPath [file join $tclsrcroot .. tclconfig]
  12.  
  13.  
  14. foreach line [split [exec fossil all list] \n] {
  15. set file [string trim $line]
  16. set module [file rootname [file tail $file]]
  17. set fossil_dbfile($module) $line
  18. }
  19.  
  20. if {![file exists $tclConfigPath]} {
  21. set dbfile [fossil_dbfile tclconfig]
  22. if {![file exists $dbfile]} {
  23. fossil clone http://core.tcl.tk/tclconfig $dbfile
  24. }
  25. file mkdir $tclConfigPath
  26. cd $tclConfigPath
  27. fossil open $dbfile trunk
  28. }
  29.  
  30. foreach {module url tag} {
  31. thread http://core.tcl.tk/thread trunk
  32. sqlite http://cyqlite.sourceforge.net/cgi-bin/sqlite trunk
  33. tdbc http://core.tcl.tk/tdbc trunk
  34. tdbcsqlite http://core.tcl.tk/tdbcsqlite trunk
  35. } {
  36. set fossdb [fossil_dbfile $module]
  37. if {![file exists $fossdb]} {
  38. fossil clone $url $fossdb
  39. }
  40. set srcpath [file join $tclsourceroot pkgs $module]]
  41. if {![file exists $srcpath]} {
  42. file mkdir $srcpath
  43. cd $srcpath
  44. exec fossil open $fossdb $tag --nested
  45. if {[file exists [file join $tclsourceroot tools/pkgs/$module.tcl]]} {
  46. source [file join $tclsourceroot tools/pkgs/$module.tcl]
  47. }
  48. } else {
  49. cd $srcpath
  50. exec fossil update $tag
  51. }
  52. }