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.

613 lines
20 KiB

  1. @echo off
  2. if defined _echo echo on
  3. if defined verbose echo on
  4. set __MTSCRIPT_ENV_ID=
  5. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  6. REM -------------------------------------------------------------------------------------------
  7. REM Template for the postbuild scripts:
  8. REM SD Location: %sdxroot%\tools\postbuildscripts
  9. REM
  10. REM (1) Code section description:
  11. REM PreMain - Developer adaptable code. Use this model and add your script params
  12. REM Main - Developer code section. This is where your work gets done.
  13. REM PostMain - Logging support code. No changes should be made here.
  14. REM
  15. REM (2) GetParams.pm - Usage
  16. REM run perl.exe GetParams.pm /? for complete usage
  17. REM
  18. REM (3) Reserved Variables -
  19. REM lang - The specified language. Defaults to USA.
  20. REM logfile - The path and filename of the logs file.
  21. REM logfile_bak - The path and filename of the logfile.
  22. REM errfile - The path and filename of the error file.
  23. REM tmpfile - The path and filename of the temp file.
  24. REM errors - The scripts errorlevel.
  25. REM script_name - The script name.
  26. REM script_args - The arguments passed to the script.
  27. REM CMD_LINE - The script name plus arguments passed to the script.
  28. REM _NTPostBld - Abstracts the language from the files path that
  29. REM postbuild operates on.
  30. REM
  31. REM (4) Reserved Subs -
  32. REM Usage - Use this sub to discribe the scripts usage.
  33. REM ValidateParams - Use this sub to verify the parameters passed to the script.
  34. REM
  35. REM
  36. REM (8) Do not turn echo off, copy the 3 lines from the beginning of the template
  37. REM instead.
  38. REM
  39. REM (9) Use setlocal/endlocal as in this template.
  40. REM
  41. REM (10)Have your changes reviewed by a member of the US build team (ntbusa) and
  42. REM by a member of the international build team (ntbintl).
  43. REM
  44. REM -------------------------------------------------------------------------------------------
  45. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  46. REM Begin PreProcessing Section - Adapt this section but do not remove support
  47. REM scripts or reorder section.
  48. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  49. :PreMain
  50. REM
  51. REM Define SCRIPT_NAME. Used by the logging scripts.
  52. REM Define CMD_LINE. Used by the logging scripts.
  53. REM Define SCRIPT_ARGS. Used by the logging scripts.
  54. REM
  55. set SCRIPT_NAME=%~nx0
  56. set CMD_LINE=%script_name% %*
  57. set SCRIPT_ARGS=%*
  58. REM
  59. REM Parse the command line arguments - Add your scripts command line arguments
  60. REM as indicated by brackets.
  61. REM For complete usage run: perl.exe GetParams.pm /?
  62. REM
  63. REM special case command line parser here
  64. set Lang=usa
  65. set Full=
  66. set Safe=
  67. set Reuse=
  68. set PrivateDatFile=
  69. :SwitchLoop
  70. for %%a in (./ .- .) do if ".%1." == "%%a?." goto :Usage
  71. if "%1" == "" goto :EndSwitchLoop
  72. for /f "tokens=1* delims=:" %%a in ('echo %1') do (
  73. set Switch=%%a
  74. set Arg=%%b
  75. for %%c in (./ .-) do (
  76. if ".!Switch!." == "%%cl." (set Lang=!Arg!&&goto :ShiftArg)
  77. if ".!Switch!." == "%%cfull." (set Full=TRUE&&goto :ShiftArg)
  78. if ".!Switch!." == "%%csafe." (set Safe=TRUE&&goto :ShiftArg)
  79. if ".!Switch!." == "%%cr." (set Reuse=TRUE&&goto :ShiftArg)
  80. if ".!Switch!." == "%%cd." (set PrivateDatFile=!Arg!&&goto :ShiftArg)
  81. )
  82. REM if we're here, we didn't encounter any switches and thus we have
  83. REM an unrecognized argument
  84. goto :Usage
  85. )
  86. :ShiftArg
  87. shift
  88. goto :SwitchLoop
  89. :EndSwitchLoop
  90. REM not using the template so we can still use postbuild -full
  91. REM for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  92. REM REM call :GetParams -n <add required prams> -o l:<add optional params> -p "lang <add variable names>" %SCRIPT_ARGS%
  93. REM call :GetParams -o fsl: -p "full safe lang" %SCRIPT_ARGS%
  94. REM if errorlevel 1 goto :End
  95. REM
  96. REM Special postbuild cleanup step
  97. REM
  98. REM NOTE: %TEMP% and %TMP% might be pointing at different physical locations
  99. REM if the user has configured things that way either by design or accident
  100. REM more likely the latter). At worst we'll flush twice, at best we prevent
  101. REM weird random breaks.
  102. if defined lang (
  103. rd /s/q %tmp%\%lang% 2>Nul
  104. md %tmp%\%lang%
  105. rd /s/q %temp%\%lang% 2>Nul
  106. md %temp%\%lang%
  107. ) else (
  108. rd /s/q %tmp%\usa 2>Nul
  109. md %tmp%\usa
  110. rd /s/q %temp%\usa 2>Nul
  111. md %temp%\usa
  112. )
  113. REM
  114. REM Set up the local enviroment extensions.
  115. REM
  116. call :LocalEnvEx -i
  117. if errorlevel 1 goto :End
  118. REM
  119. REM Validate the command line parameters.
  120. REM
  121. call :ValidateParams
  122. if errorlevel 1 goto :End
  123. REM
  124. REM Execute Main
  125. REM
  126. call :Main
  127. :End_PreMain
  128. goto PostMain
  129. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  130. REM Begin Main code section
  131. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  132. REM (5) Call other executables or command scripts by using:
  133. REM call ExecuteCmd.cmd "<command>"
  134. REM Check for errors by using:
  135. REM if errorlevel 1 ...
  136. REM Note that the executable/script you're calling with ExecuteCmd must return a
  137. REM non-zero value on errors to make the error checking mechanism work.
  138. REM
  139. REM Example
  140. REM call ExecuteCmd.cmd "xcopy /f foo1 foo2"
  141. REM if errorlevel 1 (
  142. REM set errors=%errorlevel%
  143. REM goto end
  144. REM )
  145. REM
  146. REM (6) Log non-error information by using:
  147. REM call logmsg.cmd "<log message>"
  148. REM and log error information by using:
  149. REM call errmsg.cmd "<error message>"
  150. REM
  151. REM (7) Exit from the option routines with
  152. REM set errors=%errorlevel%
  153. REM goto end
  154. REM if errors found during execution and with
  155. REM goto end
  156. REM otherwise.
  157. :Main
  158. REM Main code section
  159. REM <Start your script's code here>
  160. REM before anything else, yell to octopus
  161. if /i "%COMPUTERNAME%" == "X86FRE00" (
  162. echo start ^^%%RazzleToolPath^^%%\PostBuildScripts\octowrap.cmd | remote /c mlekas-x octopus /L 1
  163. )
  164. REM delete the FoundLatest file so copywow64 and copyremoteboot work correctly
  165. set FoundLatestFile=%_NTPOSTBLD%\build_logs\FoundLatest.txt
  166. if exist %FoundLatestFile% del /f /q %FoundLatestFile%
  167. REM globally defined the interleave log as a special case for postbuild
  168. for %%a in (%LOGFILE%) do set INTBASELOGNAME=%%~na
  169. set INTLOGNAME=!INTBASELOGNAME!.int.log
  170. set INTERRNAME=!INTBASELOGNAME!.int.err
  171. set INTERLEAVE_LOG=%TEMP%\!INTLOGNAME!
  172. set INTERLEAVE_ERRLOG=%TEMP%\!INTERRNAME!
  173. REM data driven postbuild, uses pbuild.dat
  174. REM set test vars here
  175. set Waiter=perl %RazzleToolPath%\PostBuildScripts\cmdevt.pl
  176. set PbsPath=%RazzleToolPath%\PostBuildScripts
  177. set /a ExitCode=0
  178. set FullPass=
  179. set SafePass=
  180. REM Set local command line parameters
  181. if defined full (set FullPass=TRUE)
  182. if defined safe (set SafePass=TRUE)
  183. REM first things first, put in a flag marker saying that postbuild is
  184. REM currently running ...
  185. set MarkerFile=%SDXROOT%\postbuild.run.%_BuildArch%%_BuildType%
  186. if exist %MarkerFile% (
  187. REM we may want to add this code at some point ...
  188. REM call logmsg.cmd "There was a marker file already at %MarkerFile%"
  189. REM call logmsg.cmd "Please ensure no other postbuild instances are running"
  190. REM call logmsg.cmd "then re-run postbuild."
  191. REM goto :End
  192. del /f %MarkerFile%
  193. )
  194. echotime /t> %MarkerFile%
  195. if /i "%lang%" NEQ "usa" (
  196. if /i "%lang%" NEQ "psu" (
  197. if /i "%lang%" NEQ "mir" (
  198. if /i "!FullPass!" == "TRUE" (
  199. if /i "%REUSE%" NEQ "TRUE" (
  200. if exist %_NTPOSTBLD% (
  201. call ExecuteCmd "ren %_NTPOSTBLD% %lang%_TEMP"
  202. if not errorlevel 1 (
  203. call logmsg.cmd "Raise another window to remove the old _NTPOSTBLD %_NTPOSTBLD%_TEMP tree"
  204. start "CLEAN - %_NTPOSTBLD%" cmd /c "rd %_NTPOSTBLD%_TEMP /s /q"
  205. )
  206. )
  207. )
  208. )
  209. )
  210. )
  211. )
  212. set REUSE=
  213. REM handle the full switch, meaning they want to do everything over in
  214. REM postbuild
  215. REM delete the full pass flag if necessary
  216. set FullPassFlag=%_NTPOSTBLD%\build_logs\FullPass.txt
  217. if exist %FullPassFlag% del %FullPassFlag%
  218. if /i "!FullPass!" == "TRUE" (
  219. set DelFileList=%_NTPOSTBLD%\build_logs\bindiff.txt
  220. set DelFileList=!DelFileList! %_NTPOSTBLD%\build_logs\BinSnapShot.txt
  221. set DelFileList=!DelFileList! %_NTPOSTBLD%\build_logs\postbuild.*
  222. set DelFileList=!DelFileList! %_NTPostBLD%\build_logs\buildname.txt
  223. set DelFileList=!DelFileList! %_NTPostBld%\iis51.cab
  224. set DelFileList=!DelFileList! %_NTPostBld%\iis6.cab
  225. set DelFileList=!DelFileList! %_NTPostBld%\nt5.ca*
  226. set DelFileList=!DelFileList! %_NTPostBld%\nt5inf.ca*
  227. set DelFileList=!DelFileList! %_NTPostBld%\perinf\nt5inf.ca*
  228. set DelFileList=!DelFileList! %_NTPostBld%\blainf\nt5inf.ca*
  229. set DelFileList=!DelFileList! %_NTPostBld%\sbsinf\nt5inf.ca*
  230. set DelFileList=!DelFileList! %_NTPostBld%\srvinf\nt5inf.ca*
  231. set DelFileList=!DelFileList! %_NTPostBld%\entinf\nt5inf.ca*
  232. set DelFileList=!DelFileList! %_NTPostBld%\dtcinf\nt5inf.ca*
  233. set DelFileList=!DelFileList! %_NTPostBld%\ntprint.ca*
  234. set DelFileList=!DelFileList! %_NTPostBld%\congeal_scripts\setupw95.txt
  235. set DelFileList=!DelFileList! %_NTPostBld%\congeal_scripts\sfcgen*.txt
  236. for %%a in (!DelFileList!) do if exist %%a del /f %%a
  237. set DelDirList=%_NTPostBld%\uniproc
  238. set DelDirList=!DelDirList! %_NTPostBld%\comp
  239. set DelDirList=!DelDirList! %_NTPostBld%\per
  240. set DelDirList=!DelDirList! %_NTPostBld%\pro
  241. set DelDirList=!DelDirList! %_NTPostBld%\bla
  242. set DelDirList=!DelDirList! %_NTPostBld%\sbs
  243. set DelDirList=!DelDirList! %_NTPostBld%\srv
  244. set DelDirList=!DelDirList! %_NTPostBld%\ads
  245. set DelDirList=!DelDirList! %_NTPostBld%\dtc
  246. set DelDirList=!DelDirList! %_NTPostBld%\build_logs\bindiff_backups
  247. set DelDirList=!DelDirList! %_NTPostBld%\cabs\driver
  248. set DelDirList=!DelDirList! %_NTPostBld%\congeal_scripts\drvgen
  249. for %%a in (!DelDirList!) do if exist %%a rd /s /q %%a
  250. REM put a flag saying we're a full pass
  251. if not exist %_NTPOSTBLD%\build_logs md %_NTPOSTBLD%\build_logs
  252. echo Running full postbuild>%FullPassFlag%
  253. )
  254. REM backup and clear log files at the beginning of every run
  255. for %%a in (postbuild.err postbuild.log postbuild.ord.log) do (
  256. if exist %_NTPostBld%\build_logs\%%a.old (
  257. del /f %_NTPostBld%\build_logs\%%a.old
  258. )
  259. if exist %_NTPostBld%\build_logs\%%a (
  260. move %_NTPostBld%\build_logs\%%a %_NTPostBld%\build_logs\%%a.old
  261. )
  262. )
  263. REM clear CPLocation.txt so copy* scripts don't try to copy early
  264. if exist %_NTPostBld%\build_logs\cplocation.txt (
  265. del /f %_NTPostBld%\build_logs\cplocation.txt
  266. )
  267. REM Remove this once setupw95 works
  268. set notfirst=
  269. if exist %_NTPostBld%\build_logs\binsnapshot.txt set notfirst=1
  270. if exist %_NTPostBld%\build_logs\bindiff.txt set notfirst=1
  271. if not defined notfirst (
  272. if not exist %_NTPostBld%\congeal_scripts md %_NTPostBld%\congeal_scripts
  273. echo first pass>%_NTPostBld%\congeal_scripts\firstpass.txt
  274. ) else (
  275. if exist %_NTPostBld%\congeal_scripts\firstpass.txt del /f %_NTPostBld%\congeal_scripts\firstpass.txt
  276. )
  277. REM the following code is to ensure we don't lose changed-file history if
  278. REM somebody Ctrl-C's postbuild
  279. set BinBak=%_NTPostBld%\build_logs\bindiff_backups
  280. if exist %BinBak% (
  281. REM if this dir exists already, that means someone hit Ctrl-C in the
  282. REM last postbuild run, so let's copy over the old bindiff files
  283. for %%a in (%BinBak%\bindiff.txt %BinBak%\BinSnapShot.txt) do (
  284. if exist %%a copy %%a %_NTPostBld%\build_logs
  285. )
  286. ) else (
  287. REM if the %BinBak% dir doesn't exist, it means we're either doing a fresh
  288. REM postbuild run or a run after a complete postbuild run.
  289. if not exist %BinBak% md %BinBak%
  290. for %%a in (%_NTPostBld%\build_logs\bindiff.txt %_NTPostBld%\build_logs\BinSnapShot.txt) do (
  291. if exist %%a copy %%a %BinBak%
  292. )
  293. )
  294. REM note that there is a corresponding code section at the end of postbuild
  295. REM which deletes this directory
  296. echo. > %_NTPostBld%\disk1
  297. rem hack to make ddkcabs.bat work
  298. pushd %PbsPath%
  299. REM Decide if we want to do compression
  300. set Comp=No
  301. if /i "!PB_COMP!" == "TRUE" (
  302. set Comp=Yes
  303. ) else (
  304. if "!PB_COMP!" == "FALSE" (
  305. set Comp=No
  306. ) else (
  307. if defined OFFICIAL_BUILD_MACHINE set Comp=Yes
  308. if !NUMBER_OF_PROCESSORS! GEQ 4 set Comp=Yes
  309. )
  310. )
  311. REM do the actual dirty work in pbuild.cmd
  312. set PbuildOptions=
  313. if defined PrivateDatFile set PbuildOptions=-d:%PrivateDatFile%
  314. call %RazzleToolpath%\PostBuildScripts\pbuild.cmd -l %lang% %PbuildOptions%
  315. REM delete the backup bindiff directory as we have fully completed our
  316. REM current postbuild run.
  317. if exist %BinBak% rd /s /q %BinBak%
  318. REM Get directory for logs
  319. set DRIVE=%_NTPostBld:~0,2%
  320. set MyCopyDir=%_NTPostBld%\build_logs
  321. REM determine the name of the release directory for this branch
  322. set MyReleaseDirName=
  323. set IniCmd=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  324. set IniCmd=!IniCmd! -l:%lang%
  325. set IniCmd=!IniCmd! -b:%_BuildBranch%
  326. set IniCmd=!IniCmd! -f:AlternateReleaseDir
  327. for /f %%a in ('!IniCmd!') do (
  328. set MyReleaseDirName=%%a
  329. )
  330. if not defined MyReleaseDirName set MyReleaseDirName=release
  331. if NOT exist %_NTPostBld% (
  332. for /f %%a in ('!RazzleToolPath!\PostBuildScripts\GetLatestRelease.cmd -l:%lang%') do (
  333. if /i "%%a" == "none" (
  334. set MyCopyDir=%DRIVE%\.
  335. call errmsg.cmd "No latest release found, copying logs to !MyCopyDir!"
  336. ) else (
  337. set LatestBuild=%%a
  338. if /i "%lang%" NEQ "usa" (
  339. set MyCopyDir=%DRIVE%\%MyReleaseDirName%\%lang%\!LatestBuild!\build_logs
  340. ) else (
  341. set MyCopyDir=%DRIVE%\%MyReleaseDirName%\!LatestBuild!\build_logs
  342. )
  343. )
  344. )
  345. )
  346. REM cough out the time-date stamp.
  347. REM this could probably be done during SubmitPublic, but i'll do it here
  348. REM
  349. REM let's also put this time into a nice SD format
  350. REM
  351. REM echotime /t>!MyCopyDir!\BuildFinishTime.txt 2>nul
  352. for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do (
  353. set ThisMonth=%%a
  354. set ThisDate=%%b
  355. set ThisYear=%%c
  356. )
  357. for /f "tokens=4" %%a in ('echotime /t') do set ThisTimeStamp=%%a
  358. set SDTimeStamp=%ThisYear%/%ThisMonth%/%ThisDate%:%ThisTimeStamp%
  359. REM
  360. REM note we have to use the funny syntax for the redirect here because
  361. REM the date time stamp ends in a number -- if that number is one or two,
  362. REM we'd accidentally redirect the wrong way and lose a digit from our string.
  363. REM
  364. echo %SDTimeStamp% 1>%MyCopyDir%\BuildFinishTime.txt 2>nul
  365. REM Save off compile time and postbuild logs exept for postbuild's own logs
  366. echo Copying build logs to: %MyCopyDir%
  367. if NOT exist %MyCopyDir% mkdir %MyCopyDir%
  368. REM timebuild also copies build.changes, but not in build labs, so do it again here
  369. if exist %_NTBINDIR%\build.changes copy /Y %_NTBINDIR%\build.changes %MyCopyDir%
  370. if exist %_NTBINDIR%\build.changedfiles copy /Y %_NTBINDIR%\build.changedfiles %MyCopyDir%
  371. if exist %_NTBINDIR%\build.scorch copy %_NTBINDIR%\build.scorch %MyCopyDir%
  372. if exist %_NTBINDIR%\build.log copy %_NTBINDIR%\build.log %MyCopyDir%
  373. if exist %_NTBINDIR%\build.wrn copy %_NTBINDIR%\build.wrn %MyCopyDir%
  374. REM We need to delete the bindiff backups dir after release finishes.
  375. if exist %MyCopyDir%\bindiff_backups rd /s/q %MyCopyDir%\bindiff_backups
  376. if exist %MyCopyDir%\build.err (
  377. copy %MyCopyDir%\build.err %MyCopyDir%\build.err.old
  378. del %MyCopyDir%\build.err
  379. )
  380. if exist %_NTBINDIR%\build.err (
  381. copy %_NTBINDIR%\build.err %MyCopyDir%
  382. copy %_NTBINDIR%\build.err %_NTBINDIR%\build.err.old
  383. del %_NTBINDIR%\build.err
  384. )
  385. if exist %_NTBINDIR%\build.fixed-err (
  386. copy %_NTBINDIR%\build.fixed-err %MyCopyDir%
  387. copy %_NTBINDIR%\build.fixed-err %_NTBINDIR%\build.fixed-err.old
  388. del %_NTBINDIR%\build.fixed-err
  389. )
  390. if exist %TMP%\CdData.txt copy %TMP%\CdData.txt %MyCopyDir%
  391. if exist %TMP%\CdData.txt.full copy %TMP%\CdData.txt.full %MyCopyDir%
  392. popd
  393. REM remove the marker file
  394. if exist %MarkerFile% del /f %MarkerFile%
  395. goto end
  396. :ValidateParams
  397. REM
  398. REM Validate the option given as parameter.
  399. REM
  400. goto end
  401. :Usage
  402. REM Usage of the script
  403. REM If errors, goto end
  404. echo Usage: %script_name% [-f -s -r -l lang][-?]
  405. echo -l:lang run for given language (see ^%RazzleToolPath^%\codes.txt)
  406. echo -full run in forced non-incremental mode, i.e. run everything
  407. echo from scratch
  408. echo -safe run in incremental mode with extra sanity checks, e.g.
  409. echo force rebase and bind to run
  410. echo -r run incremental aggregation.
  411. echo Applicable to international builds only.
  412. echo -? Displays usage
  413. echo.
  414. echo %script_name% is the general process to take a binaries tree and generate a
  415. echo bootable image from it. it is incremental in the sense that it will
  416. echo not run more than is needed on a second pass, and it is configurably
  417. echo multithreaded. the user has two non-command line options for setting
  418. echo preferences for compression and multithreading:
  419. echo.
  420. echo HORSE_POWER if this env var is set, the maximum number of threads
  421. echo spawned by %0 will be HORSE_POWER multiplied
  422. echo by NUMBER_OF_PROCESSORS. default is HORSE_POWER=2
  423. echo PB_COMP if this env var is set to TRUE, compressed bootable
  424. echo images will be generated regardless of the machine
  425. echo %0 is running on. if this env var is set to FALSE,
  426. echo uncompressed images will be generated. the default is
  427. echo to generate compressed images on quad-proc machines
  428. echo or higher.
  429. echo.
  430. echo note that %0 must be run from an NT razzle window with ^%_NTPostBld^%
  431. echo defined and existing.
  432. set ERRORS=1
  433. goto end
  434. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  435. REM End Main code section
  436. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  437. :End_Main
  438. goto PostMain
  439. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  440. REM Support Subs - Do not touch this section!
  441. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  442. :GetParams
  443. REM
  444. REM Parse the command line arguments
  445. REM
  446. set ERRORS=0
  447. for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  448. pushd %RazzleToolPath%\PostBuildScripts
  449. set ERRORS=0
  450. for /f "tokens=1 delims=;" %%c in ('perl.exe GetParams.pm %*') do (
  451. set commandline=%%c
  452. set commandtest=!commandline:~0,3!
  453. if /i "!commandtest!" neq "set" (
  454. if /i "!commandtest!" neq "ech" (
  455. echo %%c
  456. ) else (
  457. %%c
  458. )
  459. ) else (
  460. %%c
  461. )
  462. )
  463. if "%errorlevel%" neq "0" (
  464. set ERRORS=%errorlevel%
  465. goto end
  466. )
  467. popd
  468. goto end
  469. :LocalEnvEx
  470. REM
  471. REM Manage local script environment extensions
  472. REM
  473. pushd %RazzleToolPath%\PostBuildScripts
  474. for /f "tokens=1 delims=;" %%c in ('perl.exe LocalEnvEx.pm %1') do (
  475. set commandline=%%c
  476. set commandtest=!commandline:~0,3!
  477. if /i "!commandtest!" neq "set" (
  478. if /i "!commandtest!" neq "ech" (
  479. echo %%c
  480. ) else (
  481. %%c
  482. )
  483. ) else (
  484. %%c
  485. )
  486. )
  487. if "%errorlevel%" neq "0" (
  488. set errors=%errorlevel%
  489. goto end
  490. )
  491. popd
  492. goto end
  493. :end
  494. seterror.exe "%errors%"& goto :EOF
  495. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  496. REM Begin PostProcessing - Do not touch this section!
  497. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  498. :PostMain
  499. REM
  500. REM End the local environment extensions.
  501. REM
  502. call :LocalEnvEx -e
  503. REM
  504. REM Create the interleave errfile
  505. REM
  506. findstr /ilc:"error:" %INTERLEAVE_LOG% | findstr /v /il filelist.dat >>%INTERLEAVE_ERRLOG%
  507. for %%a in (%INTERLEAVE_ERRLOG%) do (
  508. if "%%~za" == "0" del %%a
  509. )
  510. REM
  511. REM Check for errors and copy logs in place
  512. REM
  513. if defined MyCopyDir if exist !MyCopyDir! (
  514. if exist %INTERLEAVE_ERRLOG% copy %INTERLEAVE_ERRLOG% %MyCopyDir%\postbuild.err >nul
  515. if exist %INTERLEAVE_LOG% copy %INTERLEAVE_LOG% %MyCopyDir%\postbuild.log >nul
  516. if exist %LOGFILE% copy %LOGFILE% %MyCopyDir%\postbuild.ord.log >nul
  517. if exist %MyCopyDir%\postbuild.err (
  518. echo.
  519. echo Postbuild failed, errors logged in: %MyCopyDir%\postbuild.err
  520. echo.
  521. set /a errors=%errors%+1
  522. ) else (
  523. echo.
  524. echo Postbuild completed successfully
  525. echo.
  526. if exist %SDXROOT%\developer\%_NTUSER%\custom_build_actions.cmd (
  527. echo ...calling %SDXROOT%\developer\%_NTUSER%\custom_build_actions.cmd
  528. echo.
  529. call %SDXROOT%\developer\%_NTUSER%\custom_build_actions.cmd
  530. )
  531. )
  532. )
  533. endlocal& seterror.exe "%errors%"