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.

86 lines
2.4 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM spupdate.cmd - JeremyD
  4. @REM create a basic SP upd directory
  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 lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts\\svcpack";
  16. use PbuildEnv;
  17. use ParseArgs;
  18. use Utils;
  19. use SP;
  20. use IO::File;
  21. use File::Basename;
  22. use File::Path;
  23. sub Usage { print<<USAGE; exit(1) }
  24. spupdate [-l <language>]
  25. Create a basic SP upd directory based on SP data generated earlier.
  26. USAGE
  27. parseargs('?' => \&Usage);
  28. exit unless SP::sp_skus();
  29. my @links;
  30. for my $file (get_file_list("$ENV{_NTPOSTBLD}\\SP\\data\\added.txt")) {
  31. (my $dst = $file) =~ s/^i386\\//i;
  32. push @links, ["pro\\$file" => "i386\\new\\$dst"];
  33. }
  34. for my $file (get_file_list("$ENV{_NTPOSTBLD}\\SP\\data\\changed.txt")) {
  35. (my $dst = $file) =~ s/^i386\\//i;
  36. push @links, ["pro\\$file" => "i386\\$dst"];
  37. }
  38. for my $sku (SP::sp_skus()) {
  39. my $letters = Utils::tag_letter($ENV{_BUILDARCH}) . Utils::tag_letter($sku);
  40. for my $file (get_file_list("$ENV{_NTPOSTBLD}\\SP\\data\\$sku\\added.txt")) {
  41. (my $dst = $file) =~ s/^i386\\//i;
  42. push @links, ["$sku\\$file" => "i386\\new\\$letters\\$dst"];
  43. }
  44. for my $file (get_file_list("$ENV{_NTPOSTBLD}\\SP\\data\\$sku\\changed.txt")) {
  45. (my $dst = $file) =~ s/^i386\\//i;
  46. push @links, ["$sku\\$file" => "i386\\$letters\\$dst"];
  47. }
  48. }
  49. push @links, ["sp\\common\\sp1.cab" => "i386\\new\\sp1.cab"];
  50. my $out = IO::File->new("$ENV{_NTPOSTBLD}\\SP\\data\\update_mappings.txt", 'w');
  51. for my $l (@links) {
  52. mkpath dirname("$ENV{_NTPOSTBLD}\\upd\\$l->[1]");
  53. link "$ENV{_NTPOSTBLD}\\$l->[0]", "$ENV{_NTPOSTBLD}\\upd\\$l->[1]"
  54. or warn "failed to link from $l->[0] to $l->[1]";
  55. print $out "$l->[0]\t$l->[1]\n";
  56. }
  57. undef $out;
  58. sub get_file_list {
  59. my $filename = shift;
  60. my @files;
  61. my $fh = IO::File->new($filename, 'r');
  62. while (my $line = $fh->getline) {
  63. chomp $line;
  64. my ($file) = split /\t/, $line;
  65. next unless $file =~ /^i386\\/i;
  66. push @files, $file;
  67. }
  68. return @files;
  69. }