Changeset 1190 for trunk/gsascmds.tcl


Ignore:
Timestamp:
May 3, 2012 3:03:02 PM (9 years ago)
Author:
toby
Message:

add proxy server code -- TB tested

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsascmds.tcl

    r1188 r1190  
    37903790
    37913791proc CheckAndDoUpdate { } {
     3792    if [file exists [file join $::expgui(gsasdir) proxyinfo.txt]] {
     3793        set fp [open [file join $::expgui(gsasdir) proxyinfo.txt]]
     3794        gets $fp proxyaddr
     3795        gets $fp proxport
     3796        set proxy "--config-option servers:global:http-proxy-host=$proxaddr"
     3797        set proxp "--config-option servers:global:http-proxy-port=$proxport"
     3798    } else {
     3799        set proxy {}
     3800        set proxp {}
     3801    }
    37923802    pleasewait "... Checking with software repository..."
    37933803    if {! [CheckSVNinstalled]} {
     
    38083818    # check for updates
    38093819    set SVN [auto_execok svn]
    3810     if [catch {set res [eval exec $SVN status [list $::expgui(gsasdir)] -u]} err] {
     3820    if [catch {set res \
     3821                   [eval exec $SVN status [list $::expgui(gsasdir)] -u $proxy $proxp] \
     3822               } err] {
    38113823        donewait
    38123824        set ans [MyMessageBox -parent . -title "Error checking status" \
     
    38153827        if {$ans != "no"} {
    38163828            forknewterm "manually update in subversion" \
    3817                 "$SVN update [file normalize $::expgui(gsasdir)]"
     3829                "$SVN update [file normalize $::expgui(gsasdir)] $proxy $proxp"
    38183830            forknewterm "manually update in subversion" \
    3819                 "$SVN update [file normalize $::expgui(scriptdir)]"
     3831                "$SVN update [file normalize $::expgui(scriptdir)] $proxy $proxp"
    38203832        }
    38213833        return
    38223834     } else {
    38233835        if {[string first "*" $res] == -1} {
    3824             catch {set res [eval exec $SVN status [list $::expgui(scriptdir)] -u]} err
     3836            catch {set res \
     3837                       [eval exec $SVN status [list $::expgui(scriptdir)] -u $proxy $proxp]\
     3838                   } err
    38253839        }
    38263840        if {[string first "*" $res] == -1} {
     
    38323846        }
    38333847    }
    3834 
     3848    set msg {
     3849Updates to GSAS/EXPGUI found on server.
     3850                 
     3851Press the "Update & Restart" button to begin the update process. After the update completes, EXPGUI will be restarted.}
     3852    if {$proxy != "" || $proxp != ""} {
     3853        append msg "\nUsing proxy settings \"$proxy\" and \"$proxp\""
     3854    }
    38353855    donewait
    38363856    if {[MyMessageBox -parent . -title "Ready to Update" \
    3837              -message {
    3838 Updates to GSAS/EXPGUI found on server.
    3839                  
    3840 Press the "Update & Restart" button to begin the update process. After the update completes, EXPGUI will be restarted.} \
     3857             -message $msg \
    38413858             -type {Cancel "Update & Restart"} -default cancel -icon warning
    38423859        ] == "cancel"} {return}
     
    38553872@pause
    38563873.\svn\bin\svn cleanup .
    3857 .\svn\bin\svn update .
    3858 }
     3874}
     3875        puts $fp ".\svn\bin\svn update . $proxy $proxp"
    38593876        puts $fp ".\\svn\\bin\\svn cleanup $::expgui(scriptdir)"
    3860         puts $fp ".\\svn\\bin\\svn update $::expgui(scriptdir)"
     3877        puts $fp ".\\svn\\bin\\svn update $::expgui(scriptdir) $proxy $proxp"
    38613878        puts $fp {@if (%1)==() goto Install2
    38623879@echo ****************************************************
     
    38963913            -icon error
    38973914    }
    3898     if [catch {set res [exec $SVN up $::expgui(gsasdir)]} err] {
     3915    if [catch {set res [exec $SVN up $::expgui(gsasdir) $proxy $proxp]} err] {
    38993916        MyMessageBox -parent . -title "Error updating" \
    39003917            -message "Error performing update:\n$err" \
    39013918            -icon error
    39023919        return
    3903     } elseif [catch {set res [exec $SVN up $::expgui(scriptdir)]} err] {
     3920    } elseif [catch {set res [exec $SVN up $::expgui(scriptdir) $proxy $proxp]} err] {
    39043921        MyMessageBox -parent . -title "Error updating" \
    39053922            -message "Error performing scriptdir update:\n$err" \
Note: See TracChangeset for help on using the changeset viewer.