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.

270 lines
7.7 KiB

  1. # ---------------------------------------------------------------------------
  2. # Script: startsymcopy.pl
  3. #
  4. # (c) 2000 Microsoft Corporation. All rights reserved.
  5. #
  6. # Purpose: Called from postbuild. To be run after _NTTREE has been moved to
  7. # the release share on the build machine
  8. #
  9. #
  10. # Version: 1.00 (06/12/2000) : (dmiura) updated original with internatioanl complient template
  11. #---------------------------------------------------------------------
  12. # Set Package
  13. package startsymcopy;
  14. # Set the script name
  15. $ENV{script_name} = 'startsymcopy.pl';
  16. # Set version
  17. $VERSION = '1.00';
  18. # Set required perl version
  19. require 5.003;
  20. # Use section
  21. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  22. use lib $ENV{RAZZLETOOLPATH};
  23. use GetParams;
  24. use LocalEnvEx;
  25. use Logmsg;
  26. use strict;
  27. no strict 'vars';
  28. use symindex;
  29. use GetIniSetting;
  30. # Require section
  31. require Exporter;
  32. # Global variable section
  33. my ( $BuildName, $BuildNamePath, $LogFileName, $TempDir, $RazPath );
  34. sub Main {
  35. # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  36. # Begin Main code section
  37. # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  38. # Return when you want to exit on error
  39. # <Implement your code here>
  40. $RazPath = $ENV{ "RazzleToolPath" };
  41. if (! ( defined( $RazPath ) ) ) {
  42. wrnmsg( "RazzleToolPath not set");
  43. return(1);
  44. }
  45. # don't copy symbols for pseudo, Pseudo_FE or mirror builds
  46. if ($lang =~ /(psu)/i) {
  47. logmsg( "Don't copy symbols for pseudo build - exiting");
  48. return(0);
  49. }
  50. if ($lang =~ /(mir)/i) {
  51. logmsg( "Don't copy symbols for mirror build - exiting");
  52. return(0);
  53. }
  54. if ($lang =~ /(FE)/i) {
  55. logmsg( "Don't copy symbols for FE build - exiting");
  56. return(0);
  57. }
  58. # don't copy symbols for MUI builds ref Raid #440898
  59. if ((lc$ENV{_BuildArch} eq "ia64") && ($lang !~ /(usa)|(ger)|(jpn)|(fr)/i)) {
  60. logmsg( "Don't copy symbols for non-fully localize build - exiting");
  61. return(0);
  62. }
  63. # get BuildName:
  64. # we need to use get latest release here to accomodate the forks
  65. my( $CommandName ) = $ENV{ "RazzleToolPath" } .
  66. "\\PostBuildScripts\\GetLatestRelease.cmd -l:$lang";
  67. logmsg ("$CommandName");
  68. my( $CommandReturn ) = `$CommandName`;
  69. chomp( $CommandReturn );
  70. if ( $CommandReturn =~ /none/i ) {
  71. # error case, return
  72. errmsg( "Failed to get build name from $CommandName ..." );
  73. return( 1 );
  74. }
  75. # get the release share name from the ini file
  76. my( $BuildReleasePath ) = "release";
  77. my( @IniRequest ) = ( "AlternateReleaseDir" );
  78. my( $IniReturn ) = &GetIniSetting::GetSettingEx( $ENV{ "_BuildBranch" },
  79. $lang,
  80. @IniRequest );
  81. if ( $IniReturn ) {
  82. $BuildReleasePath = $IniReturn;
  83. }
  84. if ($lang !~ /(usa)/i) {
  85. $BuildReleasePath .= "\\$lang";
  86. }
  87. # tack on the build name from getlatestrelease
  88. $BuildReleasePath .= "\\$CommandReturn";
  89. $BuildNamePath = "\\\\$ENV{ 'COMPUTERNAME' }\\$BuildReleasePath\\" .
  90. "build_logs\\buildname.txt";
  91. logmsg( "buildnamepath is $BuildNamePath");
  92. if ( !( -e $BuildNamePath ) ) {
  93. wrnmsg( "$BuildNamePath does not exist, abort symbols copy" );
  94. return( 1 );
  95. }
  96. $BuildName = `type $BuildNamePath`;
  97. # take of the return char
  98. chomp( $BuildName );
  99. #then take off the space that echo appends when called from MakeBuildName
  100. if ( $BuildName =~ /\s$/ ) { $BuildName =~ s/\s$//; }
  101. logmsg( "Symbols will be copied for $BuildName.");
  102. system( "start /min cmd /c $RazPath\\PostBuildScripts\\symcopy.cmd $lang $BuildName" );
  103. # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  104. # End Main code section
  105. # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  106. }
  107. # <Implement your subs here>
  108. sub ValidateParams {
  109. #<Add your code for validating the parameters here>
  110. }
  111. # <Add your usage here>
  112. sub Usage {
  113. print <<USAGE;
  114. Purpose of program
  115. Usage: $0 [-l lang]
  116. -l Language
  117. -? Displays usage
  118. Example:
  119. $0 -l jpn
  120. USAGE
  121. }
  122. sub GetParams {
  123. # Step 1: Call pm getparams with specified arguments
  124. &GetParams::getparams(@_);
  125. # Step 2: Set the language into the enviroment
  126. $ENV{lang}=$lang;
  127. # Step 3: Call the usage if specified by /?
  128. if ($HELP) {
  129. &Usage();
  130. exit 1;
  131. }
  132. }
  133. # Cmd entry point for script.
  134. if (eval("\$0 =~ /" . __PACKAGE__ . "\\.pl\$/i")) {
  135. # Step 1: Parse the command line
  136. # <run perl.exe GetParams.pm /? to get the complete usage for GetParams.pm>
  137. &GetParams ('-o', 'l:', '-p', 'lang', @ARGV);
  138. # Include local environment extensions
  139. &LocalEnvEx::localenvex('initialize');
  140. # Set lang from the environment
  141. $lang=$ENV{lang};
  142. # Validate the option given as parameter.
  143. &ValidateParams;
  144. # Step 4: Call the main function
  145. &startsymcopy::Main();
  146. # End local environment extensions.
  147. &LocalEnvEx::localenvex('end');
  148. }
  149. # -------------------------------------------------------------------------------------------
  150. # Script: template_script.pl
  151. # Purpose: Template perl perl script for the NT postbuild environment
  152. # SD Location: %sdxroot%\tools\postbuildscripts
  153. #
  154. # (1) Code section description:
  155. # CmdMain - Developer code section. This is where your work gets done.
  156. # <Implement your subs here> - Developer subs code section. This is where you write subs.
  157. #
  158. # (2) Reserved Variables -
  159. # $ENV{HELP} - Flag that specifies usage.
  160. # $ENV{lang} - The specified language. Defaults to USA.
  161. # $ENV{logfile} - The path and filename of the logs file.
  162. # $ENV{logfile_bak} - The path and filename of the logfile.
  163. # $ENV{errfile} - The path and filename of the error file.
  164. # $ENV{tmpfile} - The path and filename of the temp file.
  165. # $ENV{errors} - The scripts errorlevel.
  166. # $ENV{script_name} - The script name.
  167. # $ENV{_NTPostBld} - Abstracts the language from the files path that
  168. # postbuild operates on.
  169. # $ENV{_NTPostBld_Bak} - Reserved support var.
  170. # $ENV{_temp_bak} - Reserved support var.
  171. # $ENV{_logs_bak} - Reserved support var.
  172. #
  173. # (3) Reserved Subs -
  174. # Usage - Use this sub to discribe the scripts usage.
  175. # ValidateParams - Use this sub to verify the parameters passed to the script.
  176. #
  177. # (4) Call other executables or command scripts by using:
  178. # system "foo.exe";
  179. # Note that the executable/script you're calling with system must return a
  180. # non-zero value on errors to make the error checking mechanism work.
  181. #
  182. # Example
  183. # if (system("perl.exe foo.pl -l $lang")){
  184. # errmsg("perl.exe foo.pl -l $lang failed.");
  185. # # If you need to terminate function's execution on this error
  186. # goto End;
  187. # }
  188. #
  189. # (5) Log non-error information by using:
  190. # logmsg "<log message>";
  191. # and log error information by using:
  192. # errmsg "<error message>";
  193. #
  194. # (6) Have your changes reviewed by a member of the US build team (ntbusa) and
  195. # by a member of the international build team (ntbintl).
  196. #
  197. # -------------------------------------------------------------------------------------------
  198. =head1 NAME
  199. B<mypackage> - What this package for
  200. =head1 SYNOPSIS
  201. <An code example how to use>
  202. =head1 DESCRIPTION
  203. <Use above example to describe this package>
  204. =head1 INSTANCES
  205. =head2 <myinstances>
  206. <Description of myinstances>
  207. =head1 METHODS
  208. =head2 <mymathods>
  209. <Description of mymathods>
  210. =head1 SEE ALSO
  211. <Some related package or None>
  212. =head1 AUTHOR
  213. <Your Name <your e-mail address>>
  214. =cut
  215. 1;