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.

137 lines
3.5 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM incCatSign.cmd - surajp
  4. @REM
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @perl -x "%~f0" %*
  10. @goto :EOF
  11. #!perl
  12. use strict;
  13. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  14. use lib $ENV{RAZZLETOOLPATH};
  15. use PbuildEnv;
  16. use ParseArgs;
  17. use Updcat;
  18. use Logmsg;
  19. sub Usage { print<<USAGE; exit(1) }
  20. incCatSign -list:picklist.txt -mapfile:spmap.txt
  21. USAGE
  22. parseargs('?' => \&Usage);
  23. my $path = "$ENV{RazzleToolPath}\\sp\\data\\catalog\\$ENV{lang}\\$ENV{_BuildArch}$ENV{_BUildType}";
  24. sys("copy $path\\wow64.cat $ENV{_NTPOSTBLD}\\wowbins_uncomp");
  25. sys("copy $path\\wowlang.cat $ENV{_NTPOSTBLD}\\wowbins_uncomp\\lang");
  26. # Read in current hashes.
  27. my $hash="$path\\wow64.hash";
  28. my $hash_lang="$path\\wowlang.hash";
  29. my(%hash,%hash_lang,@line);
  30. open hash, $hash or die "unable to open $hash: $!";
  31. foreach (<hash>){
  32. chomp;
  33. @line=split(/\s+/);
  34. $hash{$line[0]}=$line[1];
  35. }
  36. open hash_lang, $hash_lang or die "unable to open $hash_lang: $!";
  37. foreach (<hash_lang>){
  38. chomp;
  39. @line=split(/\s+/);
  40. $hash_lang{$line[0]}=$line[1];
  41. }
  42. close hash;
  43. close hash_lang;
  44. # Get list of files to change.
  45. sys("dir /b /a-d $ENV{_NTPOSTBLD}\\wowbins_uncomp >$ENV{TMP}\\wowlistfile.txt");
  46. sys("dir /b /a-d $ENV{_NTPOSTBLD}\\wowbins_uncomp\\lang >$ENV{TMP}\\wowlistfile_lang.txt");
  47. # Process hashes in wow directory.
  48. my (@wadd_filesigs, @wremove_hashes);
  49. my (@wladd_filesigs, @wlremove_hashes);
  50. open F,"$ENV{TMP}\\wowlistfile.txt";
  51. foreach (<F>){
  52. chomp;
  53. next if /\.cat/;
  54. s/\s*//g;
  55. if (defined $hash{$_}){
  56. push @wremove_hashes, $hash{$_};
  57. push @wadd_filesigs, "$ENV{_NTPostBld}\\wowbins_uncomp\\$_";
  58. }
  59. else {
  60. logmsg "NEW FILE ADDED to wow64.cat:::$_";
  61. push @wadd_filesigs, "$ENV{_NTPostBld}\\wowbins_uncomp\\$_";
  62. }
  63. }
  64. close F;
  65. # Process hashes in wow\lang directory.
  66. open F,"$ENV{TMP}\\wowlistfile_lang.txt";
  67. foreach (<F>){
  68. chomp;
  69. next if /\.cat/;
  70. s/\s*//g;
  71. if (defined $hash_lang{$_}){
  72. push @wlremove_hashes, $hash_lang{$_};
  73. push @wladd_filesigs, "$ENV{_NTPostBld}\\wowbins_uncomp\\lang\\$_";
  74. }
  75. else {
  76. logmsg "NEW FILE ADDED to wowlang.cat:::$_";
  77. push @wladd_filesigs, "$ENV{_NTPostBld}\\wowbins_uncomp\\lang\\$_";
  78. }
  79. }
  80. close F;
  81. # See if any files will be deleted.
  82. if (!open F,"$ENV{_NTPOSTBLD}\\..\\build_logs\\files.txt") {
  83. errmsg "Can't open files.txt: $!";
  84. die;
  85. }
  86. foreach (<F>){
  87. chomp;
  88. if ( /^([^\;\s]*\s+)?([^\;\s]+)/ ) {
  89. my $tag = $1;
  90. $_ = lc"w$2";
  91. next if $_ eq "w";
  92. next if $tag !~ /d/i or $tag =~ /m/i;
  93. if (defined $hash{$_}) {
  94. logmsg "FILE DELETED from wow64.cat:::$_";
  95. push @wremove_hashes, $hash{$_};
  96. }
  97. if (defined $hash_lang{$_}) {
  98. logmsg "FILE DELETED from wowlang.cat:::$_";
  99. push @wlremove_hashes, $hash{$_};
  100. }
  101. }
  102. }
  103. # Make the changes.
  104. if ( (@wadd_filesigs || @wremove_hashes) &&
  105. !Updcat::Update("$ENV{_NTPostBld}\\wowbins_uncomp\\wow64.cat", \@wremove_hashes, \@wadd_filesigs) )
  106. {
  107. die "Error updating catalog: ". Updcat::GetLastError();
  108. }
  109. if ( (@wladd_filesigs || @wlremove_hashes) &&
  110. !Updcat::Update("$ENV{_NTPostBld}\\wowbins_uncomp\\lang\\wowlang.cat", \@wlremove_hashes, \@wladd_filesigs) )
  111. {
  112. die "Error updating catalog: ". Updcat::GetLastError();
  113. }
  114. sub sys {
  115. my $cmd = shift;
  116. print "$cmd\n";
  117. system($cmd);
  118. if ($?) {
  119. errmsg "$cmd ($?)";
  120. die;
  121. }
  122. }