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.

165 lines
4.0 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM reqprs.cmd
  5. REM Request PRS signing.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM Version: < 1.0 > 04/09/2001 Suemiao Rossignol
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use Logmsg;
  18. use ParseArgs;
  19. use File::Basename;
  20. use comlib;
  21. my $scriptname = basename( $0 );
  22. sub Usage {
  23. print<<USAGE;
  24. Request PRS Build lab & Fusion sign for the Windows build.
  25. Usage:
  26. $scriptname: [-l:<language>] [-x] [-qfe <QFE_number>]
  27. -l Language. Default is "usa".
  28. -x Sign the final exe instead of the catalogs.
  29. -qfe Sign a QFE catalog instead of service pack catalogs.
  30. Example:
  31. $scriptname -l:ger
  32. USAGE
  33. exit(1)
  34. }
  35. sub Dependencies {
  36. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  37. errmsg("Unable to open dependency list file.");
  38. die;
  39. }
  40. print DEPEND<<DEPENDENCIES;
  41. \[$0\]
  42. IF {...} ADD {}
  43. DEPENDENCIES
  44. close DEPEND;
  45. exit;
  46. }
  47. my $qfe;
  48. my $final;
  49. parseargs('?' => \&Usage,
  50. 'plan' => \&Dependencies,
  51. 'qfe:' => \$qfe,
  52. 'x' => \$final);
  53. my $lang = lc $ENV{LANG};
  54. my $name = $qfe ? "Q$qfe":"sp1";
  55. my $fin = $final ? "-final":"";
  56. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  57. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  58. errmsg("Unable to open skip list file.");
  59. die;
  60. }
  61. while (<SKIP>) {
  62. chomp;
  63. exit if lc$_ eq lc$0;
  64. }
  65. close SKIP;
  66. }
  67. END {
  68. system( "del $ENV{_NTPOSTBLD}\\..\\build_logs\\startprs.txt >nul 2>nul" );
  69. }
  70. # Figure out what languages are being signed right now.
  71. my @langs = ();
  72. if (-e "$ENV{_NTPOSTBLD}\\..\\build_logs\\langlist.txt") {
  73. if (!open LANGS, "$ENV{_NTPOSTBLD}\\..\\build_logs\\langlist.txt") {
  74. errmsg("Unable to open language list file.");
  75. die;
  76. }
  77. while (<LANGS>) {
  78. chomp;
  79. push @langs, lc $_;
  80. }
  81. close LANGS;
  82. }
  83. push @langs, $lang if $#langs < 0;
  84. my $pri = ($lang eq $langs[0]);
  85. # Create the signing directories.
  86. my $idir = "$ENV{_NTPOSTBLD}\\..\\build_logs\\prsin";
  87. my $odir = "$ENV{_NTPOSTBLD}\\..\\build_logs\\prsout";
  88. if ($pri) {
  89. sys( "rd /q /s $idir" ) if -d $idir;
  90. sys( "md $idir\\prs" ) if !$final;
  91. sys( "md $idir\\fusion" ) if !$final;
  92. sys( "md $idir\\pack" ) if $final;
  93. sys( "touch /c $idir\\..\\startprs.txt" );
  94. } else {
  95. while ( !-e "$idir\\..\\startprs.txt" ) {
  96. print "Waiting for primary language...\n";
  97. sleep 10;
  98. }
  99. }
  100. system( "del /q $ENV{temp}\\displayname.$ENV{_BUILDARCH}$ENV{_BUILDTYPE}.txt >nul 2>nul" );
  101. # Move all of the files to the signing directory.
  102. sys( "$ENV{RAZZLETOOLPATH}\\sp\\prs\\movefiles.cmd -l:$lang -d:$idir -n:$name $fin" );
  103. # Wait until everyone has finished.
  104. my @certs;
  105. @certs = ("prs", "fusion") if !$final;
  106. @certs = ("external") if $final;
  107. if ($pri) {
  108. foreach my $cert (@certs) {
  109. foreach my $l (@langs) {
  110. while ( !-e "$idir\\$cert.$ENV{_buildArch}$ENV{_buildType}.$l.txt" ) {
  111. print "Waiting for $l to copy files for $cert.\n";
  112. sleep 10;
  113. }
  114. }
  115. }
  116. }
  117. # Sign the files. Remove empty directories so they won't be signed.
  118. if ($pri) {
  119. system( "rd $idir\\prs >nul 2>nul" );
  120. system( "rd $idir\\fusion >nul 2>nul" );
  121. system( "rd $idir\\pack >nul 2>nul" );
  122. sys( "del $ENV{_NTPOSTBLD}\\..\\build_logs\\startprs.txt" );
  123. sys( "$ENV{RAZZLETOOLPATH}\\sp\\prs\\submitall.cmd -p:$odir -d:$idir -n:$name" );
  124. } else {
  125. foreach my $cert (@certs) {
  126. while ( !-e "$idir\\$cert.txt" ) {
  127. print "Waiting for $cert to finish signing.\n";
  128. sleep 10;
  129. }
  130. }
  131. }
  132. # Replace the files.
  133. sys( "$ENV{RAZZLETOOLPATH}\\sp\\prs\\getprs.cmd -l:$lang -s:$odir -n:$name $fin" );
  134. sub sys {
  135. my $cmd = shift;
  136. logmsg($cmd);
  137. my $err = system($cmd);
  138. $err = $err >> 8;
  139. if ($err) {
  140. errmsg("$cmd ($err)");
  141. die;
  142. }
  143. return $err;
  144. }