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.

189 lines
4.8 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM copysym.cmd
  5. REM Copy symbols from US build to the other language builds.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM Version: < 1.0 > 05/28/2002 Suemiao Rossignol
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. @set RETURNVALUE=%errorlevel%
  12. @goto :endperl
  13. #!perl
  14. use strict;
  15. use lib "$ENV{RAZZLETOOLPATH}\\sp";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use Logmsg;
  18. use ParseArgs;
  19. use File::Basename;
  20. use comlib;
  21. use GetIniSetting;
  22. $ENV{script_name} = basename( $0 );
  23. sub Usage {
  24. print<<USAGE;
  25. Copy symbols from US build to the other language builds.
  26. Usage:
  27. $ENV{script_name} -l:Language -n:<Build Number> [-s:<Source Server>][-d:<Target Server>]
  28. [-a:<Build Architecture>] [-t:<Build Debug Type>][-d] [-p]
  29. -n: Build Number.
  30. -s: Source Server.
  31. Default is skifre00.
  32. -d: Target Server.
  33. Default is %computername%.
  34. -a: Build Architecture. x86 or ia64.
  35. Default is $ENV{_BuildArch}.
  36. -t: Build Debug Type. fre or chk.
  37. Default is $ENV{_BuildType}.
  38. -p: Powerless.
  39. -? Display Usage.
  40. USAGE
  41. exit(1)
  42. }
  43. my ( $buildNo, $srcServer, $destServer, $isPowerLess);
  44. my ( $buildArch, $buildType );
  45. my ( $srcPath, $destPath );
  46. if( !&GetParams()) { exit(1); }
  47. timemsg( "Start $ENV{script_name}" );
  48. if( lc $ENV{lang} eq "usa" )
  49. {
  50. logmsg( "Skip running for usa builds" );
  51. exit(0);
  52. }
  53. if( !&InitVars() ) { exit(1); }
  54. if( !&CopySymbols ){ exit(1); }
  55. timemsg( "Complete $ENV{script_name}" );
  56. exit(0);
  57. #-----------------------------------------------------------------------------
  58. sub GetParams
  59. {
  60. my $relServer;
  61. parseargs('?' => \&Usage, 'l:' =>\$ENV{lang}, 'n:' => \$buildNo,
  62. 's:' =>\$srcServer, 'd:' =>\$destServer,
  63. 'a:' =>\$buildArch, 't:' =>\$buildType,
  64. 'p'=>\$isPowerLess );
  65. $ENV{lang} = "usa" if( !$ENV{lang} );
  66. if( !$buildNo )
  67. {
  68. errmsg( "Please enter build number." );
  69. return 0;
  70. }
  71. $destServer = $ENV{computername} if( !$destServer );
  72. if( !$buildArch ) { $buildArch = $ENV{_BuildArch}; }
  73. elsif( lc $buildArch ne "x86" && lc $buildArch ne "ia64" )
  74. {
  75. errmsg( "Invalid Build Architecture." );
  76. return 0;
  77. }
  78. if( !$buildType ) { $buildType = $ENV{_BuildType}; }
  79. elsif( lc $buildType ne "fre" && lc $buildType ne "chk" )
  80. {
  81. errmsg( "Invalid Build Debug Type." );
  82. return 0;
  83. }
  84. &comlib::ResetLogErrFile( "copysym.$buildNo.$buildArch$buildType.$destServer" );
  85. return 1;
  86. }
  87. #-----------------------------------------------------------------------------
  88. sub InitVars
  89. {
  90. my ( @iniRequest );
  91. # Check source server is available
  92. if( !$srcServer )
  93. {
  94. @iniRequest = ( "BuildMachine\:\:$buildArch\:\:$buildType\:\:usa" );
  95. if( !($srcServer = &GetIniSetting::GetSetting( @iniRequest )))
  96. {
  97. errmsg( "Failed to find usa symbol server." );
  98. return 0;
  99. }
  100. }
  101. if( !&comlib::ExecuteSystem( "net view $srcServer >nul 2>nul") )
  102. {
  103. errmsg( "Failed to see [$srcServer] via net view, exit. ");
  104. return 0;
  105. }
  106. # Get release Drive
  107. @iniRequest = ( "releaseDrive::$destServer" );
  108. my( $relDrive ) = &GetIniSetting::GetSetting( @iniRequest );
  109. # Check source path is existing
  110. $srcPath = "\\\\$srcServer\\release\\$buildNo\\usa\\$buildArch$buildType\\spcd\\support\\symbols";
  111. $destPath = "\\\\$destServer\\$relDrive\$\\release\\$buildNo\\$ENV{lang}\\$buildArch$buildType\\spcd\\support\\symbols";
  112. logmsg( "Lauguage ............[$ENV{lang}]" );
  113. logmsg( "Build No ............[$buildNo]" );
  114. logmsg( "Source Serevrs ......[$srcServer]" );
  115. logmsg( "Target Serevrs ......[$destServer]" );
  116. logmsg( "Build Platform ......[$buildArch$buildType]" );
  117. logmsg( "Release Path ........[$srcPath]" );
  118. logmsg( "Release Path ........[$destPath]" );
  119. logmsg( "Temp Log file .......[$ENV{LOGFILE}]" );
  120. logmsg( "Temp Error file .....[$ENV{ERRFILE}]" );
  121. return 1;
  122. }
  123. #-----------------------------------------------------------------------------
  124. sub CopySymbols
  125. {
  126. return 1 if( $isPowerLess );
  127. my $cnt;
  128. while( !(-e "$srcPath" ) && $cnt <= 60 )
  129. {
  130. timemsg( "[$srcPath] is not available, sleep and try again later" );
  131. sleep(600);
  132. $cnt++;
  133. }
  134. if( $cnt > 60 )
  135. {
  136. errmsg( "Give up copying [$srcPath] after 10 hours checking." );
  137. return 0;
  138. }
  139. &comlib::ExecuteSystem( "md $destPath" ) if( !(-e $destPath ) );
  140. return 0 if( !&comlib::ExecuteSystem( "compdir /deknst /x eula.txt $srcPath $destPath" ) );
  141. return 1;
  142. }
  143. #-----------------------------------------------------------------------------
  144. 1;
  145. __END__
  146. :endperl
  147. @echo off
  148. if not defined seterror (
  149. set seterror=
  150. for %%a in ( seterror.exe ) do set seterror=%%~$PATH:a
  151. )
  152. @%seterror% %RETURNVALUE%