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.

147 lines
3.4 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM mailbvt.cmd
  5. REM Send mail notification to bvt lab when the build is ready.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM Version: < 1.0 > 05/30/2002 Suemiao Rossignol
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. @set RETURNVALUE=%errorlevel%
  12. @goto :endperl
  13. #!perl
  14. use strict;
  15. use lib "$ENV{RAZZLETOOLPATH}\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use Logmsg;
  18. use ParseArgs;
  19. use File::Basename;
  20. use comlib;
  21. use GetIniSetting;
  22. use WaitProc;
  23. my $scriptname = basename( $0 );
  24. require $ENV{'sdxroot'} . '\TOOLS\sendmsg.pl';
  25. sub Usage {
  26. print<<USAGE;
  27. Send a notification mail to BVT lab when a build is ready for BVT.
  28. Usage:
  29. $scriptname -n:<Build Number>
  30. [-a:<Build Architecture>] [-t:<Build Debug Type>]
  31. [-to:<mail receivers>][-cc:<mail correspondents>]
  32. -n: Build Number.
  33. -a: Build Architecture. x86 or ia64.
  34. Default is $ENV{_BuildArch}.
  35. -t: Build Debug Type. fre or chk.
  36. Default is $ENV{_BuildType}.
  37. -to: Mail receivers.
  38. Use ';' to delimit multiple receivers.
  39. -cc: Mail correspondents.
  40. Use ';' to delimit multiple correspondents.
  41. -? Display Usage.
  42. USAGE
  43. exit(1)
  44. }
  45. my ( $buildNo, $buildArch, $buildType );
  46. my ( @mailTO );
  47. if( !&GetParams()) { exit(1); }
  48. timemsg( "Start $scriptname" );
  49. if( !&SendMail()){ exit(1); }
  50. timemsg( "Complete $scriptname" );
  51. exit(0);
  52. #-----------------------------------------------------------------------------
  53. sub GetParams
  54. {
  55. my $CC;
  56. parseargs('?' => \&Usage, 'l:' =>\$ENV{lang}, 'n:' => \$buildNo,
  57. 'a:' =>\$buildArch, 't:' =>\$buildType ,
  58. '-to:' => \@mailTO, '-cc:' =>\$CC );
  59. $ENV{lang} = "usa" if( !$ENV{lang} );
  60. $ENV{lang} = uc $ENV{lang};
  61. if( !$buildNo )
  62. {
  63. errmsg( "Please enter build number." );
  64. return 0;
  65. }
  66. if( !$buildArch ) { $buildArch = $ENV{_BuildArch}; }
  67. elsif( lc $buildArch ne "x86" && lc $buildArch ne "ia64" )
  68. {
  69. errmsg( "Invalid Build Architecture." );
  70. return 0;
  71. }
  72. if( !$buildType ) { $buildType = $ENV{_BuildType}; }
  73. elsif( lc $buildType ne "fre" && lc $buildType ne "chk" )
  74. {
  75. errmsg( "Invalid Build Debug Type." );
  76. return 0;
  77. }
  78. @mailTO = ("2kbvt" ) if( !@mailTO );
  79. my $tmp;
  80. if( !$CC)
  81. {
  82. $tmp = "cc:xpsp1bld";
  83. }
  84. else
  85. {
  86. $tmp = "cc:";
  87. $tmp .= $CC ;
  88. }
  89. push( @mailTO, $tmp );
  90. return 1;
  91. }
  92. #-----------------------------------------------------------------------------
  93. sub SendMail
  94. {
  95. my $mailSubject = "$ENV{lang} $buildNo $buildArch$buildType Build is ready for BVT";
  96. my $mailFrom = "ntbldi";
  97. if( $ENV{lang} =~ /usa/i || $ENV{lang} =~ /ger/i || $ENV{lang} =~ /jpn/i
  98. || $ENV{lang} =~ /fr/i )
  99. {
  100. $mailFrom = "y-ntbld";
  101. }
  102. my $mailMsg = "Thanks!\n\n";
  103. $mailMsg .= "Windows US Build Team : http://ntbld/\n";
  104. $mailMsg .= "NT Build Lab 26N/2219 - x66817\n";
  105. if( sendmsg ('-v', $mailFrom, $mailSubject, $mailMsg, @mailTO))
  106. {
  107. print "WARNING: sendmsg failed!\n";
  108. return 0;
  109. }
  110. return 1;
  111. }
  112. #-----------------------------------------------------------------------------
  113. 1;
  114. __END__
  115. :endperl
  116. @echo off
  117. if not defined seterror (
  118. set seterror=
  119. for %%a in ( seterror.exe ) do set seterror=%%~$PATH:a
  120. )
  121. @%seterror% %RETURNVALUE%