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.

209 lines
5.5 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM miscrel.cmd - SuemiaoR
  4. @REM Move the build components such as symbolcd, ddk to the
  5. @REM conglomeration servers.
  6. @REM
  7. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. @REM
  9. @REM -----------------------------------------------------------------
  10. @perl -x "%~f0" %*
  11. @set RETURNVALUE=%errorlevel%
  12. @goto :endperl
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use Logmsg;
  18. use ParseArgs;
  19. use File::Basename;
  20. use BuildName;
  21. use GetIniSetting;
  22. use comlib;
  23. $ENV{script_name} = basename( $0 );
  24. sub Usage {
  25. print<<USAGE;
  26. Propogate miscellaneous build components such as symbols and DDKS to release server.
  27. Usage:
  28. $ENV{script_name}: -l:<language> -n:<BuildNo>[-a:<Architecture>]
  29. [-t:<Debug Type>][-d:<Release Server>][-s:<Source Server>][-misc] [-p]
  30. -l Language.
  31. Default is "usa".
  32. -n Build Number.
  33. -a Build Architecture. x86 or ia64.
  34. Default is $ENV{_buildArch}.
  35. -t Debug Type.fre or chk.
  36. Default is $ENV{_buildArch}.
  37. -d Release Target conglomeration Server.
  38. Default is defined in the xpsp1.ini.
  39. -s Release Source Server.
  40. Default is %computername%.
  41. -misc Propagate Neutral package file only, such as mui.
  42. -p Powerless.
  43. Display key variables only.
  44. -? Display Usage.
  45. Example:
  46. $ENV{script_name} -n:1026 -s:ntrel
  47. USAGE
  48. exit(1)
  49. }
  50. my ( $buildNo, $miscOnly, $powerLess );
  51. my ( $buildArch, $buildType, @aggServers, $srcServer);
  52. my ( $releaseResDir, @group, $releaseDrive );
  53. my ( @hashTable );
  54. if( !&GetParams() ) { exit{1}; }
  55. timemsg( "Start [$ENV{script_name}]" );
  56. if( !&InitVars() ) { exit(1); }
  57. if( !&CopyMiscBuild ){ exit(1); }
  58. timemsg( "Complete [$ENV{script_name}]" );
  59. exit(0);
  60. #-----------------------------------------------------------------------------
  61. sub GetParams
  62. {
  63. parseargs('?' => \&Usage, 'l:' => \$ENV{lang}, 'n:' => \$buildNo,
  64. 'd:' => \@aggServers, 's:' => \$srcServer,
  65. 'a:' =>\$buildArch, 't:' =>\$buildType,
  66. 'misc' => \$miscOnly, 'p' =>\$powerLess );
  67. $ENV{lang}="usa" if( !$ENV{lang} );
  68. $srcServer = $ENV{computername} if( !$srcServer );
  69. if( !$buildNo )
  70. {
  71. errmsg( "Please enter Build Number." );
  72. return 0;
  73. }
  74. if( !$buildArch ) { $buildArch = $ENV{_BuildArch}; }
  75. elsif( lc $buildArch ne "x86" && lc $buildArch ne "ia64" )
  76. {
  77. errmsg( "Invalid Build Architecture." );
  78. return 0;
  79. }
  80. if( !$buildType ) { $buildType = $ENV{_BuildType}; }
  81. elsif( lc $buildType ne "fre" && lc $buildType ne "chk" )
  82. {
  83. errmsg( "Invalid Build Debug Type." );
  84. return 0;
  85. }
  86. &comlib::ResetLogErrFile( "miscrel.$buildNo.$buildArch$buildType.@aggServers" );
  87. return 1;
  88. }
  89. #-----------------------------------------------------------------------------
  90. sub InitVars
  91. {
  92. my( @iniRequest );
  93. my $dash = '-' x 60;
  94. logmsg ( $dash );
  95. $releaseResDir = "\\release\\$buildNo\\$ENV{lang}\\$buildArch$buildType\\bin";
  96. if( !( -e "\\\\$srcServer\\$releaseResDir" ) )
  97. {
  98. errmsg( "[\\\\$srcServer\\$releaseResDir] not exists, exit." );
  99. return 0;
  100. }
  101. # Define Conglomeration Servers
  102. if( !@aggServers )
  103. {
  104. my $iniAggServers = &GetIniSetting::GetSetting( "ConglomerationServers::$ENV{lang}" );
  105. @aggServers = split( /\s+/, $iniAggServers );
  106. }
  107. #####Array as group in miscrel.txt
  108. if( $miscOnly ) { @group = ( "build" );} else { @group = ( "lang", "build" ); }
  109. logmsg( "Lauguage .................[$ENV{lang}]" );
  110. logmsg( "Build Number .............[$buildNo]" );
  111. logmsg( "Local release path .......[$releaseResDir]" );
  112. logmsg( "Release Target Servers ...[@aggServers]");
  113. logmsg( "Release Source Server ....[$srcServer]" );
  114. logmsg( "Copying group ............[@group]" );
  115. logmsg( "Temp Log file ............[$ENV{LOGFILE}]" );
  116. logmsg( "Temp Error file ..........[$ENV{ERRFILE}]" );
  117. logmsg ( $dash );
  118. return 1;
  119. }
  120. #-----------------------------------------------------------------------------
  121. sub CopyMiscBuild
  122. {
  123. my ( $fromServer, $toServer, $destRootDir, $cmdLine, $copyFlag );
  124. my $dash = '-' x 60;
  125. for my $theAggServer ( @aggServers )
  126. {
  127. $destRootDir = "\\\\$theAggServer\\release\\$buildNo\\$ENV{lang}";
  128. for my $theGroup ( @group )
  129. {
  130. #####Parse miscrel.txt table for copying
  131. @hashTable = &comlib::ParseTable( $theGroup, $ENV{lang}, $buildArch, $buildType );
  132. for my $line( @hashTable )
  133. {
  134. my $from = "\\\\$srcServer$releaseResDir\\$line->{SourceDir}";
  135. my $to = "$destRootDir\\$line->{DestDir}";
  136. my $tmpfile = &comlib::CreateExcludeFile( $line->{ExcludeDir} );
  137. if( uc($line->{DestDir}) eq "IFS" || uc($line->{DestDir}) eq "HAL" || uc($line->{DestDir}) eq "PDK")
  138. {
  139. $copyFlag = "/yei";
  140. }
  141. else
  142. {
  143. $copyFlag = "/ydei";
  144. }
  145. $cmdLine = "xcopy $copyFlag /EXCLUDE:$tmpfile $from $to";
  146. &comlib::ExecuteSystemX( $cmdLine, $powerLess );
  147. }
  148. }
  149. logmsg ( $dash );
  150. }
  151. #####Check error logs
  152. if( -e $ENV{errfile} && !(-z $ENV{errfile}) )
  153. {
  154. logmsg("Please check error at $ENV{errfile}");
  155. return 0;
  156. }
  157. return 1;
  158. }
  159. #-----------------------------------------------------------------------------
  160. 1;
  161. __END__
  162. :endperl
  163. @echo off
  164. if not defined seterror (
  165. set seterror=
  166. for %%a in ( seterror.exe ) do set seterror=%%~$PATH:a
  167. )
  168. @%seterror% %RETURNVALUE%