mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
bb4ae85d59
works with tcl 8.x, more configuration stuff, etc.
96 lines
3.2 KiB
Tcl
Executable File
96 lines
3.2 KiB
Tcl
Executable File
#!/usr/bonsaitools/bin/mysqltcl
|
|
# -*- Mode: tcl; indent-tabs-mode: nil -*-
|
|
#
|
|
# The contents of this file are subject to the Netscape Public License
|
|
# Version 1.0 (the "License"); you may not use this file except in
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
# http://www.mozilla.org/NPL/
|
|
#
|
|
# Software distributed under the License is distributed on an "AS IS"
|
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing rights and limitations
|
|
# under the License.
|
|
#
|
|
# The Original Code is the Bonsai CVS tool.
|
|
#
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
|
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
|
# Netscape Communications Corporation. All Rights Reserved.
|
|
|
|
# Oy, what a hack.
|
|
#
|
|
# Bonsai has a split heritage, and so some of it is written in Perl, and
|
|
# some of it is written in TCL. The perl half wants to be able to look
|
|
# at the basic configuration, kept in data/configdata. But that file is
|
|
# designed to be quickly read by TCL. And I don't feel like writing perl
|
|
# code to parse it. So, instead, we have this hack which will read the
|
|
# file and push it out in a form friendlier to perl. Gross, gross, gross.
|
|
|
|
|
|
source globals.tcl
|
|
|
|
proc haschar {str char} {
|
|
return [string match "*$char*" $str]
|
|
}
|
|
|
|
proc PerlStringify {str} {
|
|
if {![haschar $str "'"]} {
|
|
return "'$str'"
|
|
}
|
|
foreach i [list "/" ":" "@" "#" "%" "^"] {
|
|
if {![haschar $str $i]} {
|
|
return "q$i$str$i"
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Lock
|
|
LoadTreeConfig
|
|
|
|
set outfilename "data/configdata.pl"
|
|
set fid [open $outfilename "w"]
|
|
puts $fid "\# WARNING! Do not edit this file! Automatically generated!"
|
|
puts $fid "\# You want to instead edit the 'configdata' file. This file"
|
|
puts $fid "\# gets automatically generated from that one."
|
|
puts $fid ""
|
|
regsub -all {(^|[^\])&} $BUGSYSTEMEXPR {\1$\&} BUGSYSTEMEXPR
|
|
puts $fid "\$BUGSYSTEMEXPR = [PerlStringify $BUGSYSTEMEXPR];"
|
|
puts $fid "\$cvscommand = [PerlStringify $cvscommand];"
|
|
puts $fid "\$rlogcommand = [PerlStringify $rlogcommand];"
|
|
puts $fid "\$rcsdiffcommand = [PerlStringify $rcsdiffcommand];"
|
|
puts $fid "\$cocommand = [PerlStringify $cocommand];"
|
|
puts $fid "\$lxr_base = [PerlStringify $lxr_base];"
|
|
puts $fid "\$mozilla_lxr_kludge = [PerlStringify $mozilla_lxr_kludge];"
|
|
puts $fid "\$tinderbox_base = [PerlStringify $tinderbox_base];"
|
|
puts $fid "\$mysqluser = [PerlStringify $mysqluser];"
|
|
puts $fid "\$mysqlpassword = [PerlStringify $mysqlpassword];"
|
|
puts $fid "\$cvsadmin = [PerlStringify $cvsadmin];"
|
|
puts $fid "\$userdomain = [PerlStringify $userdomain];"
|
|
# perl scripts don't use the LDAP config variables
|
|
set list ""
|
|
foreach i $treelist {
|
|
append list [PerlStringify $i]
|
|
append list ", "
|
|
}
|
|
puts $fid "@treelist = ($list);"
|
|
|
|
foreach i [lsort [array names treeinfo]] {
|
|
lassign [split $i ","] a b
|
|
if {![info exists done($a)]} {
|
|
set done($a) 1
|
|
puts $fid "\$treeinfo{[PerlStringify $a]} = {};"
|
|
}
|
|
puts $fid "\$treeinfo{[PerlStringify $a]}->{[PerlStringify $b]} = [PerlStringify $treeinfo($i)];"
|
|
}
|
|
|
|
|
|
close $fid
|
|
catch {chmod 0666 $outfilename}
|
|
|
|
Unlock
|