Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

364 lines
11 KiB

  1. @REM normal cmd header stuff ...
  2. @echo off
  3. if defined _echo echo on
  4. if defined verbose echo on
  5. setlocal EnableDelayedExpansion EnableExtensions
  6. set SCRIPT_NAME=%~nx0
  7. set Language=%1
  8. set BuildName=%2
  9. for /f "tokens=1 delims=." %%a in ('echo %BuildName%') do set /a BuildNumber=%%a
  10. if not exist %TMP% md %TMP%
  11. set LOGFILE=%TMP%\%SCRIPT_NAME%.log
  12. if exist %LOGFILE% del %LOGFILE%
  13. REM if binaries directory still exists then release did not run properly
  14. if exist %_NTPOSTBLD% (
  15. call errmsg.cmd "Binaries tree %_NTPOSTBLD% still exists, not copying symbols!"
  16. goto :ErrEnd
  17. )
  18. REM if running on idx branch then paths below will change
  19. set OfficialIDXBranch1=idx01
  20. set OfficialIDXBranch2=idx02
  21. call logmsg.cmd "Beginning ..."
  22. time /t
  23. REM figure out symbol farm we are copying symbols to
  24. REM Read it out of this lab's ini file
  25. set SymbolsMachineShare=
  26. set CmdIni=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  27. set ThisCommandLine=%CmdIni% -l:%Language% -f:SymFarm
  28. %ThisCommandLine% >nul 2>nul
  29. if %ERRORLEVEL% NEQ 0 (
  30. call errmsg.cmd "SymFarm is not defined in the ini file, not copying symbols"
  31. goto :ErrEnd
  32. ) else (
  33. for /f %%a in ('%ThisCommandLine%') do (
  34. set SymbolsMachineShare=%%a
  35. )
  36. call logmsg "Symbol farm location is !SymbolsMachineShare!"
  37. )
  38. if not defined SymbolsMachineShare (
  39. call errmsg.cmd "SymFarm is not defined in the ini file, not copying symbols"
  40. goto :ErrEnd
  41. )
  42. set SymbolsMachineShareWritable=%SymbolsMachineShare%$
  43. REM set paths to where symbols, etc are copied (pushed)
  44. set PushPriShare=%SymbolsMachineShareWritable%\%Language%\%BuildName%\symbols.pri
  45. set PushPubShare=%SymbolsMachineShareWritable%\%Language%\%BuildName%\symbols
  46. set PushBinShare=%SymbolsMachineShareWritable%\%Language%\%BuildName%
  47. set PushSymsrvShare=%SymbolsMachineShareWritable%\%Language%\%BuildName%\symsrv\%Language%\add_finished
  48. set PushTraceFormatShare=%SymbolsMachineShareWritable%\%Language%\%BuildName%\symbols.pri\TraceFormat
  49. if not exist %PushPriShare% md %PushPriShare%
  50. if not exist %PushPubShare% md %PushPubShare%
  51. if not exist %PushBinShare% md %PushBinShare%
  52. if not exist %PushSymsrvShare% md %PushSymsrvShare%
  53. if not exist %PushTraceFormatShare% md %PushTraceFormatShare%
  54. REM set paths from which symbols, etc. are copied from (pulled)
  55. REM IDX branch release directory is named differently
  56. set ReleaseDir=release
  57. set ThisRelDir=
  58. set IniCmd=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  59. set IniCmd=!IniCmd! -l:%Language%
  60. set IniCmd=!IniCmd! -b:%_BuildBranch%
  61. set IniCmd=!IniCmd! -f:AlternateReleaseDir
  62. for /f %%a in ('!IniCmd!') do (
  63. set ThisRelDir=%%a
  64. )
  65. if defined ThisRelDir set ReleaseDir=%ThisRelDir%
  66. REM get the local path so we can do file ops on them
  67. set ReleaseLocalPath=
  68. for /f "tokens=1,2" %%a in ('net share %ReleaseDir%') do (
  69. if /i "%%a" == "path" set ReleaseLocalPath=%%b
  70. )
  71. if not defined ReleaseLocalPath (
  72. call errmsg.cmd "Can't find local path for %ReleaseDir%"
  73. goto :ErrEnd
  74. )
  75. set PullRelPath=%ReleaseLocalPath%
  76. if /i "%Language%" neq "usa" set PullRelPath=!PullRelPath!\%Language%
  77. set PullRelPath=%PullRelPath%\%BuildName%
  78. set PullPriShare=%PullRelPath%\symbols.pri
  79. set PullPubShare=%PullRelPath%\symbols
  80. set PullBinShare=%PullRelPath%
  81. set PullSymsrvShare=%PullRelPath%\symsrv\%Language%\add_finished
  82. set PullTraceFormatShare=%PullRelPath%\symbols.pri\TraceFormat
  83. REM We need only copy the files required by the symfarm, as defined in the
  84. REM .pri .pub and .bin files:
  85. REM we need to find the latest
  86. REM :FindLatestSymFile sets the env var %NewestFile% to the greatest numbered file
  87. set SymFiles=%PullSymsrvShare%\%BuildName%.*.pri
  88. call :FindLatestSymFile %SymFiles%
  89. set SymPriFile=%NewestFile%
  90. set SymPriFilePath=%PullSymsrvShare%\%NewestFile%
  91. set SymFiles=%PullSymsrvShare%\%BuildName%.*.pub
  92. call :FindLatestSymFile %SymFiles%
  93. set SymPubFile=%NewestFile%
  94. set SymPubFilePath=%PullSymsrvShare%\%NewestFile%
  95. set SymFiles=%PullSymsrvShare%\%BuildName%.*.bin
  96. call :FindLatestSymFile %SymFiles%
  97. set SymBinFile=%NewestFile%
  98. set SymBinFilePath=%PullSymsrvShare%\%NewestFile%
  99. time /t
  100. call logmsg.cmd /t "Beginning %SymPriFile% split"
  101. REM delete old split files
  102. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  103. if exist %SymPriFilePath%.%%a del %SymPriFilePath%.%%a
  104. )
  105. if not defined SymPriFile (
  106. call logmsg "No pri symbol file -- OK"
  107. goto EndSymPriFile
  108. )
  109. REM split up list of private symbols to copy
  110. perl %RazzleToolPath%\PostBuildScripts\SplitList.pl -n %NUMBER_OF_PROCESSORS% -f %SymPriFilePath% -l %Language%
  111. set EventNames=
  112. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  113. if exist %SymPriFilePath%.%%a (
  114. start "copy symbols.pri #%%a" /min /high cmd /c %RazzleToolPath%\PostBuildScripts\symcopythread.cmd %PullPriShare% %PushPriShare% %SymPriFilePath%.%%a %SymPriFile%.%%a
  115. set EventNames=!EventNames! %SymPriFile%.%%a
  116. ) else (
  117. call errmsg.cmd "SplitList.pl did not create %SymPriFilePath%.%%a as expected!"
  118. )
  119. )
  120. call logmsg.cmd /t "WAITING ON COPYING PRIVATE SYMBOLS"
  121. perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -wv !EventNames!
  122. call logmsg.cmd /t "FINISHED COPYING PRIVATE SYMBOLS"
  123. :EndSymPriFile
  124. call logmsg.cmd /t "Beginning %SymPubFile% split"
  125. REM delete old split files
  126. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  127. if exist %SymPubFilePath%.%%a del %SymPubFilePath%.%%a
  128. )
  129. if not defined SymPubFile (
  130. call logmsg "No pub symbol file -- OK"
  131. goto EndSymPubFile
  132. )
  133. REM split up list of public symbols to copy
  134. perl %RazzleToolPath%\PostBuildScripts\SplitList.pl -n %NUMBER_OF_PROCESSORS% -f %SymPubFilePath% -l %Language%
  135. set EventNames=
  136. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  137. if exist %SymPubFilePath%.%%a (
  138. start "copy symbols.pub #%%a" /min /high cmd /c %RazzleToolPath%\PostBuildScripts\symcopythread.cmd %PullPubShare% %PushPubShare% %SymPubFilePath%.%%a %SymPubFile%.%%a
  139. set EventNames=!EventNames! %SymPubFile%.%%a
  140. ) else (
  141. call errmsg.cmd "SplitList.pl did not create %SymPubFilePath%.%%a as expected!"
  142. )
  143. )
  144. call logmsg.cmd /t "WAITING ON COPYING PUBLIC SYMBOLS"
  145. perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -wv !EventNames!
  146. call logmsg.cmd /t "FINISHED COPYING PUBLIC SYMBOLS"
  147. :EndSymPubFile
  148. call logmsg.cmd /t "Beginning %SymBinFile% split"
  149. REM delete old split files
  150. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  151. if exist %SymBinFilePath%.%%a del %SymBinFilePath%.%%a
  152. )
  153. if not defined SymBinFile (
  154. call logmsg "No bin symbol file -- OK"
  155. goto EndSymBinFile
  156. )
  157. REM split up list of binaries to copy
  158. perl %RazzleToolPath%\PostBuildScripts\SplitList.pl -n %NUMBER_OF_PROCESSORS% -f %SymBinFilePath% -l %Language%
  159. set EventNames=
  160. for /l %%a in (1,1,%NUMBER_OF_PROCESSORS%) do (
  161. if exist %SymBinFilePath%.%%a (
  162. start "copy symbols.bin #%%a" /min /high cmd /c %RazzleToolPath%\PostBuildScripts\symcopythread.cmd %PullBinShare% %PushBinShare% %SymBinFilePath%.%%a %SymBinFile%.%%a
  163. set EventNames=!EventNames! %SymBinFile%.%%a
  164. ) else (
  165. call errmsg.cmd "SplitList.pl did not create %SymBinFilePath%.%%a as expected!"
  166. )
  167. )
  168. call logmsg.cmd /t "WAITING ON COPYING BINARIES"
  169. perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl -wv !EventNames!
  170. call logmsg.cmd /t "FINISHED COPYING BINARIES"
  171. :EndSymBinFile
  172. if defined SymPriFile (
  173. call logmsg.cmd "copying %SymPriFilePath% ..."
  174. xcopy /dhkr %SymPriFilePath% %PushPriShare%
  175. if "!ErrorLevel!" neq "0" (
  176. call errmsg.cmd "copy failed: xcopy /dhkr %SymPriFilePath% %PushPriShare%"
  177. )
  178. )
  179. if defined SymPubFile (
  180. call logmsg.cmd "copying %SymPubFilePath% ..."
  181. xcopy /dhkr %SymPubFilePath% %PushPubShare%
  182. if "!ErrorLevel!" neq "0" (
  183. call errmsg.cmd "copy failed: xcopy /dhkr %SymPubFilePath% %PushPubShare%"
  184. )
  185. )
  186. if defined SymBinFile (
  187. call logmsg.cmd "copying %SymBinFilePath% ..."
  188. xcopy /dhkr %SymBinFilePath% %PushBinShare%
  189. if "!ErrorLevel!" neq "0" (
  190. call errmsg.cmd "copy failed: xcopy /dhkr %SymBinFilePath% %PushBinShare%"
  191. )
  192. )
  193. call logmsg.cmd "copying %PullSymsrvShare% ..."
  194. xcopy /dehikr %PullSymsrvShare% %PushSymsrvShare% >nul 2>nul
  195. if "!ErrorLevel!" neq "0" (
  196. call errmsg.cmd "copy failed: xcopy /dehikr %PullSymsrvShare% %PushSymsrvShare%"
  197. )
  198. REM International might not have TraceFormat folder
  199. if exist "%PullTraceFormatShare%" (
  200. call logmsg.cmd "copying %PullTraceFormatShare% ..."
  201. xcopy /dehikr %PullTraceFormatShare% %PushTraceFormatShare% >nul 2>nul
  202. if "!ErrorLevel!" neq "0" (
  203. call errmsg.cmd "copy failed: xcopy /dehikr %PullTraceFormatShare% %PushTraceFormatShare%"
  204. )
  205. )
  206. REM Copy sfcfiles out there
  207. if exist %PullPriShare%\retail\dll\sfcfiles*.pdb (
  208. call logmsg.cmd "copying %PullPriShare%\retail\dll\sfcfiles*.pdb ... "
  209. if not exist %PushPriShare%\retail\dll mkdir %PushPriShare%\retail\dll
  210. xcopy /dehikr %PullPriShare%\retail\dll\sfcfiles*.pdb %PushPriShare%\retail\dll
  211. if "!ErrorLevel!" neq "0" (
  212. call errmsg.cmd "copy failed:xcopy /dehikr %PullPriShare%\retail\dll\sfcfiles*.pdb %PushPriShare%\retail\dll\sfcfiles*.pdb"
  213. )
  214. )
  215. findstr /il error: %LOGFILE%
  216. if "!ErrorLevel!" equ "0" (
  217. findstr /il error: %LOGFILE% > %LOGFILE%.err
  218. call logmsg.cmd /t "Errors in Symbol Copy, see %LOGFILE%.err"
  219. goto :ErrEnd
  220. )
  221. goto :End
  222. REM :FindLatestSymFile sets the env var %NewestFile% to the greatest numbered file
  223. :FindLatestSymFile
  224. set FileSpec=%1
  225. set NewestFile=
  226. set SysCommand=dir /a-d /b %FileSpec%
  227. %SysCommand% >nul 2>nul
  228. if "!ErrorLevel!" neq "0" (
  229. REM no files with this spec found, return nothing
  230. set NewestFile=
  231. goto :EOF
  232. )
  233. set LargestNumber=0
  234. set ThisFileName=
  235. for /f "tokens=1,2,3,4,5,6,7 delims=." %%a in ('%SysCommand%') do (
  236. if "%%e" gtr "!LargestNumber!" (
  237. set LargestNumber=%%e
  238. set ThisFileName=%%a.%%b.%%c.%%d.%%e.%%f.%%g
  239. )
  240. )
  241. set NewestFile=!ThisFileName!
  242. goto :EOF
  243. :End
  244. call logmsg.cmd "FINISHED with all Symbol copies, no errors!!!"
  245. endlocal
  246. goto :EOF
  247. :ErrEnd
  248. REM Send mail about symcopy error
  249. set Sender=%COMPUTERNAME%
  250. set Title=Symbol copy error on %COMPUTERNAME% build %BUILDNAME%
  251. set Message=A symbol copy error was detected on machine %COMPUTERNAME%. See %LOGFILE%.err
  252. REM Read the Symbol Copy Error Message Receiver from the .ini file
  253. set Receiver=
  254. set CmdIni=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  255. set ThisCommandLine=%CmdIni% -l:%Language% -f:SymCopyErrReceiver
  256. %ThisCommandLine% >nul 2>nul
  257. if %ERRORLEVEL% NEQ 0 (
  258. call errmsg.cmd "SymCopyErrReceiver is not defined in the .ini file, can't send error message email"
  259. goto :SkipSendMsg
  260. ) else (
  261. for /f %%a in ('%ThisCommandLine%') do (
  262. set Receiver=%%a
  263. )
  264. call logmsg "Symbol Copy Error Message Receiver is !Receiver!"
  265. )
  266. if not defined Receiver (
  267. call errmsg.cmd "SymCopyErrReceiver is not defined in the .ini file, can't send error message email"
  268. goto :SkipSendMsg
  269. )
  270. perl -e "require '%RazzleToolPath%\sendmsg.pl';sendmsg('-v','%Sender%','%Title%','%Message%','%Receiver%');"
  271. :SkipSendMsg
  272. REM type logfile so it is seen in the window
  273. type %LOGFILE%.err
  274. endlocal
  275. seterror.exe 1