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.

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