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.

232 lines
7.0 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM BuildSlp.cmd
  5. REM Create SLP build in the release server.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM Version: < 1.0 > 06/17/2002 Suemiao Rossignol
  9. REM ------------------------------------------------------------------
  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 Logmsg;
  17. use ParseArgs;
  18. use File::Basename;
  19. use comlib;
  20. use GetIniSetting;
  21. my $scriptname = basename( $0 );
  22. sub Usage {
  23. print<<USAGE;
  24. Create SLP build in the release server.
  25. Usage:
  26. $scriptname -n:<Build Number> [-p] [-mail]
  27. [-a:<Build Architecture>] [-t:<Build Debug Type>]
  28. -n: Build Number.
  29. -a: Build Architecture. x86 or ia64.
  30. Default is $ENV{_BuildArch}.
  31. -t: Build Debug Type. fre or chk.
  32. Default is $ENV{_BuildType}.
  33. -mail Send notification mail.
  34. -p: Powerless.
  35. -? Display Usage.
  36. USAGE
  37. exit(1)
  38. }
  39. my ( $buildNo, $relPath, $buildArch, $buildType, $sendMail, $isPowerLess );
  40. if( !&GetParams() ) { &ExitWithError(); }
  41. timemsg( "Start $scriptname" );
  42. if( !&InitVars() ) { &ExitWithError(); }
  43. if( !&CreateSLP() ){ &ExitWithError(); }
  44. if( !&PostCopy() ){ &ExitWithError(); }
  45. timemsg( "Complete $scriptname - NO ERRORS ENCOUNTERED" );
  46. exit(0);
  47. #-----------------------------------------------------------------------------
  48. sub ExitWithError
  49. {
  50. timemsg( "Complete $scriptname - ERRORS ENCOUNTERED" );
  51. exit(1);
  52. }
  53. #-----------------------------------------------------------------------------
  54. sub GetParams
  55. {
  56. my $relServer;
  57. parseargs('?' => \&Usage, 'l:' =>\$ENV{lang}, 'n:' => \$buildNo,'mail' =>\$sendMail,
  58. 'a:' =>\$buildArch, 't:' =>\$buildType, 'p'=>\$isPowerLess );
  59. $ENV{lang}="usa" if( !$ENV{lang} );
  60. if( !$buildNo )
  61. {
  62. errmsg( "Please enter build number." );
  63. return 0;
  64. }
  65. if( !$buildArch ) { $buildArch = $ENV{_BuildArch}; }
  66. elsif( lc $buildArch ne "x86" && lc $buildArch ne "ia64" )
  67. {
  68. errmsg( "Invalid Build Architecture." );
  69. return 0;
  70. }
  71. if( !$buildType ) { $buildType = $ENV{_BuildType}; }
  72. elsif( lc $buildType ne "fre" && lc $buildType ne "chk" )
  73. {
  74. errmsg( "Invalid Build Debug Type." );
  75. return 0;
  76. }
  77. &comlib::ResetLogErrFile( "BuildSlp.$buildNo.$buildArch$buildType" );
  78. return 1;
  79. }
  80. #-----------------------------------------------------------------------------
  81. sub InitVars
  82. {
  83. # Check source path is existing
  84. $relPath = "\\release\\$buildNo\\$ENV{lang}\\$buildArch$buildType";
  85. if( !(-e "$relPath\\bin\\upd" ) )
  86. {
  87. errmsg( "[$relPath\\bin\\upd] does not exist" );
  88. return 0;
  89. }
  90. logmsg( "Lauguage ............[$ENV{lang}]" );
  91. logmsg( "Build No ............[$buildNo]" );
  92. logmsg( "Build Platform ......[$buildArch$buildType]" );
  93. logmsg( "Build Path ..........[$relPath]" );
  94. logmsg( "Temp Log file .......[$ENV{LOGFILE}]" );
  95. logmsg( "Temp Error file .....[$ENV{ERRFILE}]" );
  96. return 1;
  97. }
  98. #-----------------------------------------------------------------------------
  99. sub PostCopy
  100. {
  101. my $dash = '-' x 60;
  102. my $cmdLine;
  103. if( lc $buildArch eq "x86" )
  104. {
  105. # Create Procd1
  106. my $from = "$relPath\\slp\\pro";
  107. my $to = "$relPath\\slp\\procd1";
  108. return 0 if( !&comlib::ExecuteSystemX( "compdir /eknst $from $to", $isPowerLess) );
  109. #Create Procd2
  110. $from = "$relPath\\slp\\procd1\\cmpnents";
  111. $to = "$relPath\\slp\\procd2\\";
  112. &comlib::ExecuteSystemX( "rd /s /q $to\\cmpnents", $isPowerLess) if( -e ("$to\\cmpnents") );
  113. &comlib::ExecuteSystemX( "md $to", $isPowerLess ) if( !(-e $to) );
  114. return 0 if( !&comlib::ExecuteSystemX( "move $from $to", $isPowerLess ));
  115. return 0 if( !(-e $to) && !$isPowerLess);
  116. # Create readme.txt
  117. $from = "$relPath\\bin\\setuptxt\\cd2\\readmecd2.txt";
  118. $to = "$relPath\\slp\\procd2\\readme.txt";
  119. return 0 if( !&comlib::ExecuteSystemX( "copy $from $to", $isPowerLess ));
  120. }
  121. # miscrel.cmd - Make a conglomerator dirs
  122. logmsg ( $dash );
  123. $cmdLine = "$ENV{RazzleToolPath}\\sp\\miscrel.cmd -l:$ENV{lang} -n:$buildNo -d:$ENV{computername}
  124. -s:$ENV{computername} -a:$buildArch -t:$buildType";
  125. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  126. # raiseall.cmd - Make bvt dfs links
  127. logmsg ( $dash );
  128. $cmdLine = "$ENV{RazzleToolPath}\\sp\\raiseall.cmd -l:$ENV{lang} -n:$buildNo -q:bvt -a:$buildArch -t:$buildType";
  129. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ) );
  130. if( $sendMail )
  131. {
  132. # mailbvt.cmd - Send mail notification to BVT lab
  133. logmsg ( $dash );
  134. logmsg ( "Sleep 10 minutes for all the dfs links are replcated in the dfs servers" );
  135. sleep( 600 );
  136. $cmdLine = "$ENV{RazzleToolPath}\\sp\\mailbvt.cmd -l:$ENV{lang} -n:$buildNo -a:$buildArch -t:$buildType";
  137. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  138. }
  139. # copysym.cmd - Copy common symbols files from usa build
  140. logmsg ( $dash );
  141. $cmdLine = "$ENV{RazzleToolPath}\\sp\\copysym.cmd -l:$ENV{lang} -n:$buildNo
  142. -a:$buildArch -t:$buildType";
  143. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  144. # delbuild.cmd - Lower and delete builds
  145. logmsg ( $dash );
  146. $cmdLine = "$ENV{RazzleToolPath}\\sp\\delbuild.cmd -l:$ENV{lang}";
  147. &comlib::ExecuteSystemX( $cmdLine, $isPowerLess );
  148. return 1;
  149. }
  150. #-----------------------------------------------------------------------------
  151. sub CreateSLP
  152. {
  153. my $dash = '-' x 60;
  154. local $ENV{build} = $buildNo;
  155. local $ENV{_ntpostbld}="$relPath\\bin";
  156. local $ENV{_ntpostbld_bak}=$ENV{_ntpostbld};
  157. local $ENV{_BuildArch}=$buildArch;
  158. local $ENV{_BuildType}=$buildType;
  159. local $ENV{dont_modify_ntpostbld} =1;
  160. my @runFiles = ( "slipstream.cmd",
  161. "standalone.cmd",
  162. "makewinpeimg.cmd",
  163. "cd2.cmd" );
  164. for my $file ( @runFiles )
  165. {
  166. if( lc $buildArch ne "x86" )
  167. {
  168. next if ( $file =~ /spmakebfloppy.cmd/i );
  169. next if ( $file =~ /cd2.cmd/i );
  170. }
  171. logmsg ( $dash );
  172. my $cmdLine = "$ENV{RazzleToolPath}\\sp\\$file -l:$ENV{lang}";
  173. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  174. }
  175. logmsg ( $dash );
  176. &comlib::ExecuteSystemX( "rd /s /q $relPath\\upd", $isPowerLess) if( -e "$relPath\\upd" );
  177. my $cmdLine = "move $relPath\\bin\\upd $relPath";
  178. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  179. &comlib::ExecuteSystemX( "rd /s /q $relPath\\slp", $isPowerLess) if( -e "$relPath\\slp" );
  180. my $cmdLine = "move $relPath\\bin\\slp $relPath";
  181. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  182. &comlib::ExecuteSystemX( "rd /s /q $relPath\\spcd", $isPowerLess) if( -e "$relPath\\spcd" );
  183. my $cmdLine = "move $relPath\\bin\\spcd $relPath";
  184. return 0 if( !&comlib::ExecuteSystemX( $cmdLine, $isPowerLess ));
  185. return 1;
  186. }
  187. #-----------------------------------------------------------------------------
  188. 1;