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.

271 lines
7.7 KiB

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. if DEFINED _echo echo on
  4. if DEFINED verbose echo on
  5. if NOT defined _NTTREE echo No Binaries tree exists (_NTTREE not defined) - Aborting.& goto :EOF
  6. REM Move latest tree to binaries if binaries does not exist
  7. REM so that you can run postbuild more than once after completing a build
  8. set DRIVE=!_NTTREE:~0,2!
  9. if NOT exist %_NTTREE% (
  10. for /f %%a in ('%RazzleToolPath%\PostBuildScripts\GetLatestRelease.cmd') do (
  11. if /i "%%a" == "none" (
  12. echo No Binaries tree or latest release found - Aborting.& goto :EOF
  13. ) else (
  14. set Latest=%%a
  15. echo.
  16. echo WARNING WARNING WARNING WARNING WARNING
  17. echo.
  18. echo There is currently no !_NTTREE! directory ...
  19. echo Moving !DRIVE!\release\!Latest! to !_NTTREE! ...
  20. echo.
  21. echo To stop this HIT CTRL-C NOW
  22. echo.
  23. sleep 10
  24. echo Now moving !DRIVE!\release\!Latest! to !_NTTREE! ...
  25. move !DRIVE!\release\!Latest! !_NTTREE!
  26. if "!ERRORLEVEL!" == "1" echo Move failed - Aborting.& goto :EOF
  27. echo Move completed. Continuing postbuild ...
  28. )
  29. )
  30. )
  31. REM Postbuild.cmd makes a CD image from a complete binaries tree
  32. REM Define SCRIPT_NAME. Used by the logging scripts.
  33. for %%i in (%0) do set script_name=%%~ni.cmd
  34. REM Save the command line.
  35. set cmdline=%script_name% %*
  36. REM Parse the command line
  37. :SwitchLoop
  38. for %%a in (./ .- .) do if ".%1." == "%%a?." goto Usage
  39. if "%1" == "" goto EndSwitchLoop
  40. for /f "tokens=1,2 delims=:" %%a in ('echo %1') do (
  41. set Switch=%%a
  42. set Arg=%%b
  43. for %%c in (./ .-) do (
  44. if ".!Switch!." == "%%cl." (set Lang=!Arg!&&goto ShiftArg)
  45. if ".!Switch!." == "%%cm." (set Mode=!Arg!&&goto ShiftArg)
  46. if not ".!Switch!." == "%%cl." (
  47. if not ".!Switch!." == "%%cm." goto Usage
  48. )
  49. )
  50. )
  51. :ShiftArg
  52. shift
  53. goto SwitchLoop
  54. :EndSwitchLoop
  55. if NOT defined Lang set Lang=USA
  56. REM Define TEMP dir to include lang
  57. set TMP=%TMP%\%Lang%
  58. set TEMP=%TEMP%\%Lang%
  59. if exist %TMP% rd /s/q %TMP%
  60. if not exist %TMP% md %TMP%
  61. if exist %TMP%\cddata.txt del %TMP%\cddata.txt
  62. set LogFile=%TMP%\postbuild.log
  63. set ErrFile=%TMP%\postbuild.err
  64. if exist %LogFile% del %LogFile%
  65. if exist %ErrFile% del %ErrFile%
  66. REM Mark the beginning of script's execution.
  67. call LogMsg.cmd /t "START %cmdline%" %LogFile%
  68. REM Make sure new publics are added to the public change list.
  69. call SubmitNewPublicFiles.cmd Add
  70. pushd %RazzleToolPath%\PostBuildScripts
  71. REM Official build machines will need to check in publics
  72. if defined OFFICIAL_BUILD_MACHINE start /min "Capture File Versions" cmd /c CaptureSourceFileList.cmd
  73. REM Compress if machine is big
  74. if /i %NUMBER_OF_PROCESSORS% GEQ 4 set Comp=Yes
  75. if defined COMPRESS_IN_POSTBUILD set Comp=Yes
  76. REM Start copying wow64 binaries as early as possible
  77. echo Starting copywow64.cmd ...
  78. start "CopyWow64.cmd" /MIN cmd /c CopyWow64.cmd
  79. REM Start copying Remote boot files
  80. echo Starting CopyRemoteBoot.cmd ...
  81. start "CopyRemoteBoot.cmd" /MIN cmd /c CopyRemoteBoot.cmd
  82. REM Null file needed for CDs
  83. echo. > %_NTTREE%\disk1
  84. REM Get data for compress
  85. call cddata.cmd -f -d
  86. REM Start first round of compression
  87. echo Beginning compression ...
  88. if defined Comp call Startcompress.cmd Precomp
  89. REM TSClient must be run before rebasing
  90. echo Running tsclient ...
  91. call tsclient.cmd PREREBASE 2>Nul 1>Nul
  92. REM Rebase and Bind
  93. call LogMsg.cmd /t "START ntrebase.cmd" %LogFile%
  94. call ntrebase.cmd 2>Nul 1>Nul
  95. call LogMsg.cmd /t "END ntrebase.cmd" %LogFile%
  96. call LogMsg.cmd /t "START bindsys.cmd" %LogFile%
  97. call bindsys.cmd 2>Nul 1>Nul
  98. call LogMsg.cmd /t "END ntrebase.cmd" %LogFile%
  99. REM CONGEAL Rules
  100. echo.
  101. echo Waiting for post rebase\bind scripts to complete ...
  102. REM crypto.cmd smashem.cmd layout.cmd timebomb.cmd setupw95.cmd tagmsi.cmd
  103. set CongealTemp=%tmp%\congeal
  104. if NOT exist %CongealTemp% md %CongealTemp%
  105. if exist %CongealTemp%\*.tmp del %CongealTemp%\*.tmp
  106. for %%a in (%RazzleToolPath%\postbuildscripts\bldrules\*.cmd) do call :CongealRules %%a
  107. goto EndCongealRules
  108. :CongealRules
  109. start "%1" /MIN cmd /c %1 CONGEAL
  110. goto :EOF
  111. :EndCongealRules
  112. :CongealTempLoop
  113. sleep 10
  114. if EXIST %CongealTemp%\*.tmp goto CongealTempLoop
  115. REM Start second round of compression
  116. if defined Comp call Startcompress.cmd Postcomp
  117. REM CABGEN Rules
  118. echo Waiting for cab generation scripts to complete ...
  119. REM inetsrv.cmd nntpsmtp.cmd adminpak.cmd
  120. REM Logging ...
  121. set cabtemp=%tmp%\cabgen
  122. if NOT exist %Cabtemp% md %Cabtemp%
  123. if exist %Cabtemp%\*.tmp del %Cabtemp%\*.tmp
  124. for %%a in (%RazzleToolPath%\postbuildscripts\bldrules\*.cmd) do call :CabGenRules %%a
  125. goto EndCabGenRules
  126. :CabGenRules
  127. start "%1" /MIN cmd /c %1 CABGEN
  128. goto :EOF
  129. :EndCabGenRules
  130. :CabTempLoop
  131. sleep 10
  132. if EXIST %cabtemp%\*.tmp goto CabTempLoop
  133. REM Wait for remote boot to finish. Needs to happen
  134. REM before catalog signing
  135. if EXIST %tmp%\copyremoteboot.tmp echo Waiting on CopyRemoteBoot.cmd to finish ...
  136. :CopyRemoteBootLoop
  137. sleep 10
  138. if EXIST %tmp%\copyremoteboot.tmp goto CopyRemoteBootLoop
  139. REM Catalog sign
  140. call catsign.cmd
  141. REM Make driver.cab
  142. call LogMsg.cmd /t "START drivercab.cmd" %LogFile%
  143. call drivercab.cmd
  144. call LogMsg.cmd /t "END ntrebase.cmd" %LogFile%
  145. REM Refresh data - pushd for aesthetic reasons
  146. pushd %RazzleToolPath%\PostBuildScripts
  147. call CdData.cmd -f -cdl -cdn
  148. REM Make sure copywow64.cmd is done
  149. if EXIST %tmp%\copywow64.tmp echo Waiting on CopyWow64.cmd to finish ...
  150. :CopyWow64Loop
  151. sleep 10
  152. if EXIST %tmp%\copywow64.tmp goto CopyWow64Loop
  153. REM Make Cd images
  154. call CdImage.cmd
  155. REM Check for missing files
  156. perl filechk.pl
  157. REM Check in publics
  158. call submit_public.cmd
  159. REM Run release scripts
  160. if defined OFFICIAL_BUILD_MACHINE perl release.pl
  161. REM Run boot tests
  162. call LogMsg.cmd /t "Beginning boot tests ..." %LogFile%
  163. if defined OFFICIAL_BUILD_MACHINE call %RazzleToolPath%\PostbuildScripts\AutoBootTest.cmd
  164. popd
  165. echo.
  166. REM Mark end of scripts execution
  167. call LogMsg.cmd /t "Postbuild done." %LogFile%
  168. set DRIVE=%_NTTREE:~0,2%
  169. set MyCopyDir=%_NTTREE%\build_logs
  170. if NOT exist %_NTTREE% (
  171. for /f %%a in ('!RazzleToolPath!\PostBuildScripts\GetLatestRelease.cmd') do (
  172. if /i "%%a" == "none" (
  173. set MyCopyDir=%DRIVE%\.
  174. call errmsg.cmd "No latest release found, copying logs to !MyCopyDir!"
  175. ) else (
  176. set LatestBuild=%%a
  177. set MyCopyDir=%DRIVE%\release\!LatestBuild!\build_logs
  178. )
  179. )
  180. )
  181. REM Make error log
  182. for /f "tokens=*" %%a in (%tmp%\postbuild.log) do (
  183. @echo %%a | findstr /ilc:"error:">Nul
  184. if NOT "!ERRORLEVEL!" == "1" echo %%a>>%tmp%\postbuild.err
  185. )
  186. REM Save off logs
  187. echo Copying build logs to: %MyCopyDir%
  188. if NOT exist %MyCopyDir% mkdir %MyCopyDir%
  189. if exist %_NTBINDIR%\build.log copy %_NTBINDIR%\build.log %MyCopyDir%
  190. if exist %_NTBINDIR%\build.wrn copy %_NTBINDIR%\build.wrn %MyCopyDir%
  191. if exist %MyCopyDir%\build.err (
  192. copy %MyCopyDir%\build.err %MyCopyDir%\build.err.old
  193. del %MyCopyDir%\build.err
  194. )
  195. if exist %_NTBINDIR%\build.err copy %_NTBINDIR%\build.err %MyCopyDir%
  196. if exist %TMP%\postbuild.log copy %TMP%\postbuild.log %MyCopyDir%
  197. if exist %TMP%\CdData.txt copy %TMP%\CdData.txt %MyCopyDir%
  198. if exist %MyCopyDir%\postbuild.err (
  199. copy %MyCopyDir%\postbuild.err %MyCopyDir%\postbuild.err.old
  200. del %MyCopyDir%\postbuild.err
  201. )
  202. if exist %TMP%\postbuild.err (
  203. copy %TMP%\postbuild.err %MyCopyDir%
  204. echo Check %MyCopyDir%\postbuild.err for errors
  205. goto ErrEnd
  206. ) else (
  207. call LogMsg.cmd /t "No errors encountered." %LogFile%
  208. REM now call octopus.cmd on PRIMECDIXF for now
  209. echo pushd echo pushd ^^%%RazzleToolPath^^%%\PostBuildScripts ^&^& echo octopus.cmd ^& echo popd | remote /c PRIMECDIXF remote1 /L 1
  210. )
  211. goto End
  212. :Usage
  213. echo.
  214. echo Postbuild makes Cd images from a complete binaries tree.
  215. echo.
  216. echo -l:<lang>
  217. echo -m:<mode> default is normal. Expect to add bbt
  218. echo
  219. echo.
  220. goto :End
  221. :End
  222. endlocal
  223. goto :EOF
  224. :ErrEnd
  225. call :End
  226. seterror.exe 1