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.

141 lines
3.3 KiB

  1. #-----------------------------------------------------------------//
  2. # Script: cktarg.pm
  3. #
  4. # (c) 2000 Microsoft Corporation. All rights reserved.
  5. #
  6. # Purpose: This script validate various build targets depending on
  7. # the given language/target and check the listed architecture
  8. # in %RazzleToolPath%\intlbod.txt against $ENV{_BuildArch}.
  9. #
  10. # Version: <1.00> 06/20/2000 : Suemiao Rossognol
  11. #-----------------------------------------------------------------//
  12. ###-----Set current script Name/Version.-------------//
  13. package cktarg;
  14. $VERSION = '1.00';
  15. ###-----Require section and extern modual.------------//
  16. require 5.003;
  17. use strict;
  18. no strict 'vars';
  19. no strict 'subs';
  20. use lib $ENV{ "RazzleToolPath" };
  21. use lib $ENV{ "RazzleToolPath" }. "\\PostBuildScripts";
  22. use HashText;
  23. use cklang;
  24. use GetParams;
  25. ###-----Main Function.--------------------------------//
  26. sub CkTarg
  27. {
  28. my ( $pTarg, $pLang ) = @_;
  29. $pTarg = uc( $pTarg );
  30. $pLang = uc( $pLang );
  31. ###(1)Get Hash from intlbld.txt file.-----------//
  32. my %hashCodes=();
  33. &HashText::Read_Text_Hash( 0, "$ENV{RazzleToolPath}\\intlbld.txt", \%hashCodes );
  34. ###(2)Validate the target.-----------------------//
  35. if ( !exists( $hashCodes{ $pTarg } ) )
  36. {
  37. return(0);
  38. }
  39. ###(3)Validate the Class by target---------------//
  40. ###---Call cklang.pm to verify the class by lang
  41. if( !&cklang::CkLang( $pLang, $hashCodes{$pTarg}->{ 'Languages'} ) )
  42. {
  43. return (0);
  44. }
  45. ###(4)Validate the Architecture.---------------//
  46. @theArch = split( /\;/, $hashCodes{$pTarg}->{"Architectures"} );
  47. for( @theArch )
  48. {
  49. if( $ENV{"_BuildArch"} eq $_ ){ return(1); }
  50. }
  51. return(0);
  52. }
  53. #-------------------------------------------------------------//
  54. #Function Usage
  55. #-------------------------------------------------------------//
  56. sub Usage
  57. {
  58. print <<USAGE;
  59. Validate target by checking against the given
  60. language and the razzle's architecture.
  61. The valid target/language/architecture combinations
  62. are listed in tools\\intlbld.txt and tools\\codes.txt.
  63. Usage: $0 -t target -l lang
  64. Example: $0 -t STARTUP -l jpn
  65. $0 -t TXTSETUP -l ger
  66. USAGE
  67. exit(1);
  68. }
  69. ###--Cmd entry point for script.----------------------------//
  70. if (eval("\$0 =~ /" . __PACKAGE__ . "\\.pm\$/i"))
  71. {
  72. # <run perl.exe GetParams.pm /? to get the complete usage for GetParams.pm>
  73. &GetParams ('-n', 't:l:','-p', 'target lang', @ARGV);
  74. $rtno = &cktarg::CkTarg( uc($target),uc($lang) );
  75. exit( !$rtno );
  76. }
  77. sub GetParams
  78. {
  79. #Call pm getparams with specified arguments
  80. &GetParams::getparams(@_);
  81. #Call the usage if specified by /?
  82. if ($HELP) {
  83. &Usage();
  84. }
  85. }
  86. #-------------------------------------------------------------//
  87. =head1 NAME
  88. B<cktarg> - Check Target
  89. =head1 SYNOPSIS
  90. perl cktarg.pm -t bootfix -l jpn
  91. =head1 DESCRIPTION
  92. Check target bootfix, language jpn with class defined in intlbld.txt,
  93. and architecture in $ENV{ _BuildAcrh }
  94. =head1 INSTANCES
  95. =head2 <myinstances>
  96. <Description of myinstances>
  97. =head1 METHODS
  98. =head2 <mymathods>
  99. <Description of mymathods>
  100. =head1 SEE ALSO
  101. =head1 AUTHOR
  102. <Suemiao Rossignol <[email protected]>>
  103. =cut
  104. 1;