Leaked source code of windows server 2003
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.

217 lines
6.0 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM ctokens.cmd - jorgeba
  4. @REM a batch files that performs tokenization -called by pbuild.dat
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if defined _CPCMAGIC goto CPCBegin
  10. @perl -x "%~f0" %*
  11. @goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use ParseArgs;
  18. use ParseTable;
  19. use comlib;
  20. use Logmsg;
  21. my %hashCodes=();
  22. sub Usage { print<<USAGE; exit(1) }
  23. ctokens.cmd -l:lang
  24. -l: Lang
  25. lang of build
  26. Example:
  27. ctokens.cmd -l:psu
  28. USAGE
  29. parseargs('?' => \&Usage);
  30. if(parse_table_file($ENV{"RazzleToolPath"}."\\Codes.txt", \%hashCodes ))
  31. {
  32. errmsg "Could not open codes.txt";
  33. }
  34. my $releaseShareRootDir = &comlib::ParseNetShare( "release", "Path" );
  35. if( lc($ENV{Lang}) eq "usa" )
  36. {
  37. $ENV{"ReleaseDir"} = "$releaseShareRootDir";
  38. }
  39. else
  40. {
  41. $ENV{"ReleaseDir"} = "$releaseShareRootDir\\$ENV{Lang}";
  42. }
  43. $ENV{"CodePage"} = $hashCodes{uc($ENV{"LANG"})}{ACP};
  44. # *** TEMPLATE CODE ***
  45. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  46. __END__
  47. @:CPCBegin
  48. @set _CPCMAGIC=
  49. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  50. @if not defined DEBUG echo off
  51. @REM *** CMD SCRIPT BELOW ***
  52. IF NOT DEFINED LANG goto Use
  53. if /i "%LANG%" == "usa" goto Done
  54. if /i "%LANG%" == "cov" goto Done
  55. if /i "%LANG%" == "mir" goto Done
  56. REM ********************************************************************************
  57. REM Get and set parameters from %_BuildBranch%.%LANG%.ini file
  58. REM ********************************************************************************
  59. set PlocPath=%SDXROOT%\tools\ploc
  60. set CmdIni=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  61. if "%CodePage%" EQU "" (
  62. call errmsg.cmd "CodePage is not defined in codes.txt, exiting"
  63. goto :Done
  64. )
  65. REM *********************************************************************************
  66. REM Get the release point
  67. REM *********************************************************************************
  68. set ThisCommandLine=call GetLatestRelease -l:%LANG%
  69. %ThisCommandLine% > nul 2> nul
  70. if %ERRORLEVEL% NEQ 0 (
  71. call errmsg.cmd "Could not get a build to tokenize"
  72. goto :Done
  73. ) else (
  74. for /f %%a in ('%ThisCommandLine%') do (
  75. set TokenPath=%ReleaseDir%\%%a
  76. set BuildShare=%ReleaseDir%\%%a
  77. )
  78. )
  79. REM +------------------------------------------------------------------------------+
  80. set path=%PlocPath%;%path%
  81. REM Do Tokenization
  82. set TmpBinPath=%TokenPath%
  83. set TmpResPath=%TokenPath%\resources
  84. set TokLogFile=%TokenPath%\resources\TokLogFile.log
  85. set LocMapPath=%BuildShare%\dump
  86. if NOT EXIST !TmpBinPath! md !TmpBinPath!
  87. if NOT EXIST !TmpResPath! md !TmpResPath!
  88. if exist %TokLogFile% goto :DONE
  89. set Ustoken=yes
  90. if /i "%_BuildBranch%"=="srv03_rtm" (
  91. if exist \\localizability\snap\dnsrv\lockit\latest (
  92. set Ustoken=no
  93. set USLocalizabilityToken=\\localizability\snap\dnsrv\lockit\latest
  94. )
  95. ) else if /i "%_BuildBranch%"=="main" (
  96. if exist \\localizability\snap\LongHorn\lockit\latest (
  97. set Ustoken=no
  98. set USLocalizabilityToken=\\localizability\snap\LongHorn\lockit\latest
  99. )
  100. ) else (
  101. for /f "tokens=1 delims=_" %%i in ("%_BuildBranch%") do set LabName=%%i
  102. if exist \\localizability\snap\%LabName%\lockit\latest (
  103. set Ustoken=no
  104. set USLocalizabilityToken=\\localizability\snap\%LabName%\lockit\latest
  105. )
  106. )
  107. if /i "%_BuildBranch%"=="jazber" (
  108. if exist \\localizability\snap\lab07\lockit\latest (
  109. set Ustoken=no
  110. set USLocalizabilityToken=\\localizability\snap\lab07\lockit\latest
  111. )
  112. )
  113. echo TokenPath is %TokenPath%
  114. echo TmpBinPath is %TmpBinPath%
  115. echo USLocalizabilityToken is %USLocalizabilityToken%
  116. echo Ustoken is %Ustoken%
  117. if not exist %TmpBinPath%\resources\us md %TmpBinPath%\resources\us
  118. if "%Ustoken%"=="no" (
  119. xcopy /s /q %USLocalizabilityToken% %TmpBinPath%\resources\us
  120. )
  121. REM call tokenization scripts, wait for both to complete
  122. REM create semaphores
  123. set toksem1=%PlocPath%\run\toksem1
  124. set toksem2=%PlocPath%\run\toksem2
  125. REM create the poor man's semaphore
  126. echo running > %toksem1%
  127. echo running > %toksem2%
  128. Start "Whistler1 tokenization" cmd /c !PlocPath!\run\scriptwrap1.bat %toksem1% !PlocPath!\tokwrap.bat !TokLogFile! !_NTTREE! !PlocPath! !SDXROOT!\tools\ploc\whistler1.bat !LANG! !TmpBinPath! !BuildShare!
  129. Start "Whistler1 tokenization" cmd /c !PlocPath!\run\scriptwrap1.bat %toksem2% !PlocPath!\tokwrap.bat !TokLogFile! !_NTTREE! !PlocPath! !SDXROOT!\tools\ploc\whistler2.bat !LANG! !TmpBinPath! !BuildShare!
  130. popd
  131. REM wait for first pseudoloc process to complete
  132. call logmsg /t "PSEUDOLOC TokSEM 1................[Running]"
  133. :psuloop1
  134. sleep 10
  135. if exist %toksem1% goto psuloop1
  136. call logmsg /t "PSEUDOLOC TokSEM 1................[Finished]"
  137. REM wait for second pseudoloc process to complete
  138. call logmsg /t "PSEUDOLOC TokSEM 2................[Running]"
  139. :psuloop2
  140. sleep 10
  141. if exist %toksem2% goto psuloop2
  142. call logmsg /t "PSEUDOLOC TokSEM 2................[Finished]"
  143. if /I "!LANG!" == "psu" (
  144. copy /y /v !PlocPath!\!CodePage!map.inf !TmpResPath!\map.inf
  145. ) else if /I "!LANG!" == "fe" (
  146. copy /y /v !PlocPath!\!CodePage!map.inf !TmpResPath!\map.inf
  147. ) else (
  148. copy /y /v !LocMapPath!\map.inf !TmpResPath!\map.inf
  149. )
  150. rem if exist %TokenPath% (
  151. rem if exist %BuildShare%\resources (
  152. rem ren %_ntpostbld%\resources resources.bak
  153. rem if "!errorlevel!" neq "0" (
  154. rem call logmsg "ren %BuildShare%\resources resources.bak failed"
  155. rem rd /q /s %BuildShare%\resources
  156. rem )
  157. rem )
  158. rem move %TokenPath%\resources %BuildShare%
  159. rem rd /q /s %TokenPath%
  160. rem )
  161. goto :Done
  162. :USE
  163. call logmsg "ctokens.cmd -l:lang"
  164. :Done
  165. set CodePage=
  166. set TokenPath=
  167. set BuildShare=