rcc update

原创 2016年05月31日 14:13:18
#!/opt/cool/bin/expect
proc FileLog { result } {
global doupdate
global MYLOGIN
global ROOT RCC SRCC ROOTRCC
global updatelog

set i 0
# puts "line 9 MYLOGIN=$MYLOGIN \n"
# puts "line 10 expect_out(buffer)=$result \n"
exec rm -f  /bld/$MYLOGIN/tempfile
exec touch /bld/$MYLOGIN/tempfile 
set tempfile /bld/$MYLOGIN/tempfile
exec echo "$result" >$tempfile
sleep 5
set f [open $tempfile r]
set content [read $f]
puts "line 17 content=$content"
close $f
foreach  line [split $content "\n"] {
#ignore 3 lines
if { $i==0 || $i==1 ||$i==2 || $i==3 } {
# puts "line23 $line\n"
incr i
continue
}
set field [split $line "/"]
set temp  [lindex $field 4] 
# puts "line30 temp=$temp RCC=$RCC\n"
# puts "line31 line=$line\n"
puts "line31 temp=$temp;RCC=$RCC"
if { [ string equal $temp $RCC ] == 1} {
# puts "line33 line=$line \n"
set row [split $line ")"]
# puts "line35 row=$row \n"
set number [lindex $row 0]
# puts "line36 number=$number \n"
# puts "$number\r"
send "$number\r"
sleep 5
set timeout  600 
expect {
"*Do you want to continue?*" {
send "y\r"
sleep 30 
expect {
timeout {
puts "send y time out\n!"
exit 2
}
"*UPDATES COMPLETE*" {
set    doupdate 1
#why expect_out had 'u'   begin , should not include 'y' ,just return value
set    updatelog $expect_out(buffer)
break   }


}
}
timeout {
puts "send y fail\n"
exit 2
}
}
}
}
}
#
proc FileUpdate {result } {
global MYLOGIN
global ROOT
global RCC SRCC ROOTRCC


exec rm -f  /bld/$MYLOGIN/tempupdate
exec touch /bld/$MYLOGIN/tempupdate
set tempupdate /bld/$MYLOGIN/tempupdate
exec echo "$result" >$tempupdate
sleep 5
set f [open $tempupdate r]
set content [read $f]
close $f
puts "line86 RCC=$RCC;SRCC=$SRCC;ROOTRCC=$ROOTRCC;ROOT=$ROOT\n"


#if just have version;tips just have version; modify equivalent.rcc
#how to check  line content       
#10.       The SRCC files that need to be updated manually are listed when the tool updateSRCC done, such as:
#11.              The following files have been updated:
#12.              cool/NGNsrcc_lib/rcc/port/net_funcs.c
#13.              cool/NGNsrcc_lib/rcc/com/net_funcs.c
#14.              cool/NGNsrcc_lib/version
set i 0
set modifyname(0) ""
set modifypath(0) ""
foreach  line [split $content "\n"] {
#puts "line 78 $line\n"
if { [ regexp {^\s*cool} $line ] ==1 ||  [regexp {^\s*head} $line ] ==1  } {
#why use global modifypath(i) $line ,use global   is wrong ,set is right?
set modifypath($i) [ file dirname $line ]
puts "line98 modifypath($i)=$modifypath($i) \n"
set modifyname($i) [ file  tail $line ]
puts "line100 modifyname($i)=$modifyname($i) \n" 
incr i
}
}
if { [ string equal $modifyname(0) version ] ==1 } {
Equivalent $RCC $SRCC
} else {
puts "line103 ROOTRCC=$ROOTRCC\n"
#modify file need under 1apx10
ModifyFile modifyname modifypath
}

}
#
proc SolarisUpdate {} {
global doupdate 
global updatelog
global os


set os "Solaris"
#The RCCHOME for OFC8L39.0 is /bld/aptps/fms/kai3.0.0.07_20120326/flxsde/tps/fmssparc/rcc


#The following RCC versions are currently available:
#1) /bld/aptps/fms/kai3.0.0.07_20120326/flxsde/tps/fmssparc/rcc
#2) /bld/aptps/fms/kai1.0.0.26_20120327/flxsde/tps/fmssparc/rcc
#3) /bld/aptps/fms/kai3.0.0.08_20120403/flxsde/tps/fmssparc/rcc
#4) /bld/aptps/fms/kai1.0.0.27_20120409/flxsde/tps/fmssparc/rcc
#5) /bld/aptps/fms/kai3.0.0.09_20120409/flxsde/tps/fmssparc/rcc
#6) /bld/aptps/fms/kai3.0.0.10_20120416/flxsde/tps/fmssparc/rcc
#Select RCC version for COOL surrogate upgrade: 
set timeout 240 
send  "/opt/cool/tools/lib/updateSRCC \r"
#why must add sleep ? remove wrong ,i cannot understand 
sleep 30
expect {
timeout {
                 puts "line138 expect_out(buffer)=$expect_out(buffer)\n";
puts stdout "Failed to run /opt/cool/tools/lib/updateSRCC!\n";
exit 21
}
"*ERROR:  Failed to determine CCMS view that corresponds to this RCC delivery*"      {


}
"*The following RCC versions are currently available*" {
        # puts "expect_out(buffer)=$expect_out(buffer)\n";
# puts "MYLOGIN=$MYLOGIN\n";
FileLog $expect_out(buffer)  
if { $doupdate == 1 } {
puts "line343 updatelog=$updatelog \n"
set doupdate 0
FileUpdate $updatelog 
} else {
puts "cannot match rcc version \n"
exit 1
}
}
   }
}
#linux update command
proc LinuxUpdate {}  {
global doupdate
global updatelog
global os


set os "Linux"
set timeout 400 
send  "/opt/cool/tools/lib/updateSRCC -p LINUX \r"
#why must add sleep ? remove wrong ,i cannot understand 
sleep 30
expect {
timeout {
                 puts "line208 expect_out(buffer)=$expect_out(buffer)\n";
puts stdout "Failed to run /opt/cool/tools/lib/updateSRCC -p LINUX!\n";
exit 1
}
"*The following RCC versions are currently available*" {
puts "line 177 $expect_out(buffer)"
# puts "MYLOGIN=$MYLOGIN\n";
#hard code 
sleep 5
  set doupdate 1
FileLog $expect_out(buffer)  
#hard code 
if { $doupdate == 1 } {
puts "line183 updatelog=$updatelog \n"
set doupdate 0
FileUpdate $updatelog 
} else {
puts "cannot match rcc version \n"
exit 1
}
}
   }
}
#
proc Equivalent {RCC SRCC} {
#modify equivalent.rcc
global locate os
set timeout  30
send "su cool\r"
expect {
timeout {puts  "cool account timeout\n"; exit 3}
"*Password*" {send "Ilovec00l123\r"}
}
#sucess connect last send
expect {
timeout {puts "cool pwd timeout \n";exit 1}
"*su: Sorry*" {puts "cool pwd is wrong \n";exit 1}
"" {
#/opt/cool/loads/equivalent.rcc (append)
if { [ string equal $os Solaris ] ==1 } {
exec echo  "/bld/aptps/fms/$RCC/flxsde/tps/fmssparc/rcc=/bld/aptps/fms/$SRCC/flxsde/tps/fmssparc/rcc" >>/opt/cool/loads/equivalent.rcc.bak
puts "\nsucess update rcc version\n"
  } else {
exec echo  "/bld/aptps/fms/$RCC/linux_mv_cge50_x86_em64t_32/tps/fmssparc/rcc=/bld/aptps/fms/$SRCC/flxsde/tps/linux_mv_cge50_x86_em64t_32/rcc" >>/opt/cool/loads/equivalent.rcc.bak
}
#else if { [string equal $os Linux ] ==1 } {
# exec echo  "/bld/aptps/fms/$RCC/linux_mv_cge50_x86_em64t_32/tps/fmssparc/rcc=/bld/aptps/fms/$SRCC/flxsde/tps/linux_mv_cge50_x86_em64t_32/rcc" >>/opt/cool/loads/equivalent.rcc.bak
#     }
  }
}
sleep 5
send "exit \r"
sleep 5
expect {
timeout {puts "send exit timeout \n";exit 1}
"" {puts "sucess exit cool acount .finished in $locate for $os ! \n ";}
}
}
#
proc CheckUpdate {} {
set check [eval exec grep $RCC "/opt/cool/loads/equivalent.rcc" ]
puts "check=$check \n"
if { [string length $check] == 0 } {
puts "RCC had update! \n"
exit 1
}

}


#modify file donnot need modify equivalent
proc ModifyFile { modifyname modifypath } {
global ROOT ROOTRCC
global buGen LOAD
#add proc createmymr for user--the branch need mr ,the other equivalent donnot need 
#CreateMymr
set MR "MR213627"


upvar $modifyname a
upvar $modifypath b
set i 0


#felixzh
#cms flow
# Set the environment
set timeout 15
send ". setenv -S ecpc -g $buGen -l $LOAD -F -E\r"
expect {
        timeout {puts stdout "Failed to setenv on $SERVER\n"; exit 3}
        "setenv: Error:*" {puts stdout "Failed to setenv on $SERVER\n"; exit 3}
        #########try ;it is sucessful
        "*DBLOC*" {sleep 1;puts "sucess log\n"}
        }


foreach el [ lsort [array names a ] ] {
puts "line 252 $el = $a($el) \n"
#check if path exist ,if no return, or go on(no means OOT folder is wrong)
if { [ file isdirector $ROOT/$b($i)] !=1 } {
        puts stdout "\nERROR:line255 $ROOT/$b($i) path must exist!\n"
        exit 1
}


#exec cd $ROOT/$b($i);why it can't exec 
send "cd $ROOT/$b($i)  \r"
expect {
timeout {puts "cd $ROOT/$b($i)";exit 1}
"*>" {send "pwd \r"}
"*not found*" {puts "there is no path found";exit 1}
}
#2 is Fault-tolerant
#2 unedget /3 edget /4 replace file /5 edput
#had edget or had edget and remove file
sleep 5
set timeout 15
puts "line285 MR=$MR;a($i)=$a($i) \n"
send "unedget mr=$MR $a($i) \r"
#expect {
# timeout {puts "unedget mr=$MR $a($i) timeout \n"; exit 1}
# "*MR*does not exist*" {puts "MR does not exist \n"; exit 1}
        #if already in load, tgetversion etc have the file, remove it ,then cms  operate
# "*ERROR*is free*" {puts "file is already in load\n";rm  $a($i)}
# "" {puts "line292 $expect_out(buffer); sucess unedget file--it means has edget file\n"}
 #       "*not out for MR*" {puts "it is edit(edget) by other ME \n";exit 1}
# }
#already edput ,no unedget,you can do edget normal
sleep 5
send "pwd \r"
sleep 5 
#send "rm $a($i) "
#sleep 5
send "edget mr=$MR $a($i) rm=y \r" 
sleep 10
#expect {
# timeout {puts "edget file $b($i)/$a($i) fail" ; exit 1}
#first ,make MR associate with file
# "*Are you sure you want to associate*" {
#                puts "line271 $expect_out(buffer)\n"
                send "y \r"
#                expect {
 #                       timeout ""
                        #sucess edget;maybe one or many mr
 #                       "*The unapproved MRs on sourcefile*" {puts "line305 $expect_out(buffer)"
                       #felixzh1 
                       #if >1 MR exit; =1 sucess
                                #already edget ,do edget twice ,error
#                "ERROR*is out for edit on MR*" {puts "line311 $expect_out(buffer) \n";   exit 1}
                        #return --try again with "rm=y".then send edget with rm=y
 #                        "*try again with*" {send "edget mr=$MR $a($i) rm=y \r"}
#                         }
 #                       }
 #        }
         #not the first time   
         #sucess edget;maybe one or many mr
  #       "*The unapproved MRs on sourcefile*" {puts "line318 $expect_out(buffer)"
          #felixzh1 
         #if >1 MR exit; =1 sucess
         #already edget ,do edget twice ,error
# "ERROR*is out for edit on MR*" {puts "line323 $expect_out(buffer) \n";   exit 1}
          #return --try again with "rm=y".then send edget with rm=y
 #         "*try again with*" {send "edget mr=$MR $a($i) rm=y \r"}
#  }


 #       }


#exec rm $a($i)--why it cannot exec
puts "accosiating to with MR \n "
sleep 600
send "rm $a($i) \r"
expect {
timeout {puts "rm $a($i) timeout";exit 1}
"*No such file or directory*" {puts "rm fail ";exit 1}
"*override protection 444*" {send "y \r"}
#sucess
}
sleep 5
#exec cp $ROOTRCC/$b($i) $ROOT/$b($i)
send "cp $ROOTRCC/$b($i)/$a($i) $ROOT/$b($i)/$a($i) \n"
expect {
timeout {puts  "cp timeout ";exit 1}
"*cp: cannot access*" {puts "cp fail";exit 1}
#sucess
""
}
sleep 5
send "edput mr=$MR $a($i)  \r"
puts "sucess cms done !"
exit 1
#expect {
# timeout {puts "edput file $ROOT/$b($i)/$a($i) fail";exit 1}
# "*no change*" {puts "cms fail :already edput  $b($i)/$a($i) ";exit 1}
# ""
# }
#end for 
}
}
#main flow
set Usage "
-r <RCC version>
-s <SRCC>\n"
#give a example in web: rccupdate -r  -s  -l L9OFC39.0 
#-m MR1234 -R /bld/felixzh/1apx10  -S bldr/njcpga/bjbldd
# Get the command-line options.
set  MYLOGIN 0
set  doupdate 0 
set tmpWHOAMI [exec who am i]
set locate 0
set os  ""
regexp (^\[a-z\]*) $tmpWHOAMI match MYLOGIN
puts "tmpWHOAMI=$tmpWHOAMI"


while { [llength $argv] > 0 } {
set flag [lindex $argv 0]
puts "line15 flag=$flag"
switch -- $flag \
"-r" {
#RCC value
set RCC [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "RCC=$RCC"
} "-s" {
# SRCC value
set SRCC [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "SRCC=$SRCC"
} "-l" {
# LOAD value
set LOAD [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "LOAD=$LOAD"
} "-m" {
# MR number
set MR [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "MR=$MR"
} "-R" {
# root
set ROOT [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "ROOT=$ROOT"
} "-S" {
# sever name 
set SERVER [lindex $argv 1]
set argv [lrange $argv 2 end]
puts "SERVER=$SERVER"
} "-h" {
    # Help


    puts stdout "$Usage"
    exit 0
} default {
# unexpected
puts stdout "ERROR: Unexpected parameter [lindex $argv 1]!\n\n$Usage"
exit 1
}
}
#info exists LOAD and [string length $FAFPERM]!=0 what is the different???
if { ![info exists RCC] } {
        puts stdout "\nERROR: RCC must be specified!\n"
        exit 1
}
if { ![info exists SRCC] } {
        puts stdout "\nERROR: SRCC must be specified!\n"
        exit 1
}
if { ![info exists LOAD] } {
        puts stdout "\nERROR: LOAD must be specified!\n"
        exit 1
}


#ROOT do with
#get user ROOT,if donnot use -R , if tcl can get from user env
#user donnot use -R default envROOT
if { ![info exists SERVER] } {
set SERVER "bldr"
}
if { ![info exists ROOT] } {
if {![info exists env(ROOT)]} { 
        puts stdout "\nERROR: ROOT must exist!\n"
        exit 1
} else {
        set ROOT $env(ROOT)
}
}
if { ![info exists buGen] } {
        # Construct buGen
        regexp "^(\[a-zA-Z]*)(\[0-9]*\[.]*\[0-9]*)L(\[0-9]*).0" $LOAD match ld_type ld_num gen_num
        set buGen "1000L$gen_num.0"
puts "felixzh1 line393 COOLstartAP buGen=$buGen \n"
}


#hard code
#set ROOT /bld/felixzh/1apx10-back
#clean ROOT;it need many minutes
#exec zapnode -f $ROOT
#clean error last time
exec rm -rf /bld/$MYLOGIN/rcc/$RCC
exec mkdir -p /bld/$MYLOGIN/rcc/$RCC




exec echo "Loging into $SERVER as $MYLOGIN ...\n"
set timeout 15 
spawn rlogin $SERVER -l $MYLOGIN 
set locate "IH"
    expect {
       timeout {exec echo "Failed to log into $SERVER\n"}
           }
# Set the environment
set ROOTRCC /bld/$MYLOGIN/rcc/$RCC
# Set the environment  
set timeout 15 
send ". setenv -S ap -g $buGen -l $LOAD -F -E\r"
expect {
        timeout {puts stdout "Failed to setenv on $SERVER\n"; exit 3}
        "setenv: Error:*" {puts stdout "Failed to setenv on $SERVER\n"; exit 3}
#########try ;it is sucessful
        "*DBLOC*" {sleep 1;puts "sucess log\n"}
}


set timeout 30 
send "cd $ROOTRCC\r"
sleep 1
expect {
timeout {
puts stdout "Failed to run cd $ROOTRCC\n";
exit 21
}
"$ROOTRCC" {
sleep 1;
puts "sucess cd $ROOTRCC\n";
sleep 1
}
}
#at least 55 sec
set timeout 240
send "setnode cool\r"
sleep 5
expect {
timeout {
puts stdout "Run setnode cool timeout\n";
exit 21
}
"*setnode complete*" {
sleep 1;
puts "sucess  setnode complete\n";
sleep 1
}
"*Failed to run setnode cool*" {
put "setnode cool fail\n"
exit 21
}
}
#SolarisUpdate
LinuxUpdate
版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

RCC电路[转]

Acer 5750G-2432G

STM32F4_RCC系统时钟配置及描述

Ⅰ、概述 对于系统时钟应该都知道它的作用,就是驱动整个芯片工作的心脏,如果没有了它,就等于人没有了心跳。 对于使用开发板学习的朋友来说,RCC系统时钟这一块知识估计没怎么去配置过,原因在于开发板提...

精选:深入理解 Docker 内部原理及网络配置

网络绝对是任何系统的核心,对于容器而言也是如此。Docker 作为目前最火的轻量级容器技术,有很多令人称道的功能,如 Docker 的镜像管理。然而,Docker的网络一直以来都比较薄弱,所以我们有必要深入了解Docker的网络知识,以满足更高的网络需求。

STM32->RCC

使用STM32一段时间了,总结一下其时钟系统。 STM32 共有 5 个可选时钟源:    ①HSI内部高速时钟,集成的 RC 振荡器为8MHz;    ②HSE高速外部时钟,选接对应谐振器或时钟源...
  • Qi_ta
  • Qi_ta
  • 2017-06-16 09:24
  • 86

STM8->RCC

尝试通过RTC中断唤醒halt()低功耗模式,需要一个功耗低的时钟源作为RTC运行时钟,选择LSI的16分频作为时钟源: void RCC_LSI(void) {     CLK_LSICmd (EN...
  • Qi_ta
  • Qi_ta
  • 2017-06-26 13:33
  • 176

STM32F4 RCC及SystemInit配置分析

转自http://bbs.21ic.com/blog-976962-120828.html
  • blatu
  • blatu
  • 2014-09-05 13:33
  • 914

STM32时钟控制RCC探究

在STM32中,有五个时钟源,为HSI、HSE、LSI、LSE、PLL。 其实是四个时钟源,如下图所示(灰蓝色),PLL是由锁相环电路倍频得到PLL时钟。   ①、HSI是高速内部时钟,RC振荡器,...
  • mdy09
  • mdy09
  • 2014-10-09 21:03
  • 148

stm32 rcc 设置

/******************************************************************************* * Function Name  :...

STM32-RCC时钟

STM32中在使用任何一个外设都必须打开相应的时钟,所以我从STM32的时钟学起。 RCC时钟 在STM32中有5个时钟源: ①、HSI是高速内部时钟,RC震荡器,频率为 8MHz。 ②、...

关于RCC的配置

一、

STM---STM32F103 RCC

STM32F103 RCC
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)