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.

135 lines
4.1 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM copytokens.cmd - aesquiv
  4. @REM Copies tokenization binaries from build machine to release server.
  5. @REM This scripts is called from autoploc.cmd and pushed out to the release
  6. @REM server for execution.
  7. @REM
  8. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  9. @REM
  10. @REM -----------------------------------------------------------------
  11. @if defined _CPCMAGIC goto CPCBegin
  12. @perl -x "%~f0" %*
  13. @goto :EOF
  14. #!perl
  15. use strict;
  16. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  17. use lib $ENV{RAZZLETOOLPATH};
  18. use PbuildEnv;
  19. use ParseArgs;
  20. sub Usage { print<<USAGE; exit(1) }
  21. -This script is called from autoploc.cmd with the following arguments
  22. or it can be called by itself as follows:
  23. copytokens.cmd -b:<buildname> -m:<build machine name> -l:<lang>
  24. -b: BuildName
  25. build name of tokenized binaries to copy
  26. -m: MachineName
  27. name of build machine where tokenized binaries reside
  28. -l: Lang
  29. lang of build
  30. Note: This script is design to run on release servers.
  31. Example:
  32. copytokens.cmd -b:3663.main.x86fre.020805-1420 -m:bld_wpxc1 -l:psu
  33. USAGE
  34. parseargs('?' => \&Usage,
  35. '-b:' => \$ENV{BuildName},
  36. '-m:' => \$ENV{MachineName});
  37. # *** TEMPLATE CODE ***
  38. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  39. __END__
  40. @:CPCBegin
  41. @set _CPCMAGIC=
  42. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  43. @if not defined DEBUG echo off
  44. @REM *** CMD SCRIPT BELOW ***
  45. REM ********************************************************************************
  46. REM Get and set parameters from %_BuildBranch%.%LANG%.ini file
  47. REM ********************************************************************************
  48. set CmdIni=perl %RazzleToolPath%\PostBuildScripts\CmdIniSetting.pl
  49. set ThisCommandLine=%CmdIni% -l:%LANG% -f:ReleaseDir
  50. %ThisCommandLine% >nul 2>nul
  51. if %ERRORLEVEL% NEQ 0 (
  52. call logmsg.cmd "ReleaseDir is not defined in the %_BuildBranch%.%LANG%.ini file, Using release as default"
  53. set ReleaseDir=release
  54. ) else (
  55. for /f %%a in ('%ThisCommandLine%') do (
  56. set ReleaseDir=%%a
  57. )
  58. net share !ReleaseDir! >nul 2>nul
  59. if !ERRORLEVEL! NEQ 0 (
  60. call errmsg.cmd "No release share found on release server, exciting"
  61. goto :Done
  62. )
  63. set ReleaseShare=
  64. for /f "tokens=1,2" %%a in ('net share !ReleaseDir!') do (
  65. if /i "%%a" == "Path" (
  66. REM at this point, %%b is the local path to the default release directory
  67. set ReleaseShare=%%b
  68. )
  69. )
  70. )
  71. set ThisCommandLine=%CmdIni% -l:%LANG% -f:TokenShare
  72. %ThisCommandLine% >nul 2>nul
  73. if %ERRORLEVEL% NEQ 0 (
  74. call errmsg.cmd "TokenShare is not defined in the %_BuildBranch%.%LANG%.ini file, exciting"
  75. goto :Done
  76. ) else (
  77. for /f %%a in ('%ThisCommandLine%') do (
  78. set TokenShare=%%a
  79. )
  80. rmtshare \\!MachineName!\!TokenShare! >nul 2>nul
  81. if !ERRORLEVEL! NEQ 0 (
  82. call errmsg.cmd "No token share found on build machine !MachineName!, exciting"
  83. goto :Done
  84. )
  85. set TokenPath=
  86. for /f "tokens=1,2" %%a in ('rmtshare \\!MachineName!\!TokenShare!') do (
  87. if /i "%%a" == "Path" (
  88. REM at this point, %%b is the local path to the default release directory
  89. set TokenPath=%%b
  90. )
  91. )
  92. )
  93. REM If build machine is also used as a release server then just copy from different shares.
  94. set ThisCommandLine=%CmdIni% -l:%LANG% -f:ReleaseServers::%_BuildArch%%_BuildType%
  95. %ThisCommandLine% >nul 2>nul
  96. if !ERRORLEVEL! NEQ 0 (
  97. call errmsg.cmd "ReleaseServers is not defined in the %_BuildBranch%.%LANG%.ini file, exiting"
  98. goto :Done
  99. ) else (
  100. for /f %%a in ('!ThisCommandLine!') do (
  101. if /i "!MachineName!" == "%%a" (
  102. xcopy /s !TokenPath!\!LANG!\!BuildName! !ReleaseShare!\!LANG!\!BuildName!
  103. ) else (
  104. xcopy /s \\!MachineName!\!TokenShare!\!LANG!\!BuildName! !ReleaseShare!\!LANG!\!BuildName!
  105. )
  106. )
  107. )
  108. :Done