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.

126 lines
4.3 KiB

  1. Include('types.js');
  2. Include('utils.js');
  3. var g_AlreadyCompleted = false; // prevent sending "completed" email more than once.
  4. // GenerateBuildReport() //
  5. // //
  6. // Produce the build completion email with elapsed time and //
  7. // duplicate file reports. //
  8. // //
  9. // This function checks to ensure it only sends this email //
  10. // one time. //
  11. function GenerateBuildReport()
  12. {
  13. if (!g_AlreadyCompleted && !PrivateData.objConfig.Options.fRestart)
  14. {
  15. var strTitle;
  16. var strMsg;
  17. var strDuplicated = "";
  18. var strElapsed = GetElapsedReport();
  19. if (!PrivateData.fIsStandalone)
  20. strDuplicated = GetDuplicateReport();
  21. strTitle = 'Build complete.';
  22. strMsg = PrivateData.objEnviron.LongName + " " + PrivateData.objEnviron.Description + ' completed.\n\n\n';
  23. strMsg += strElapsed + '\n\n';
  24. strMsg += strDuplicated;
  25. SendErrorMail(strTitle, strMsg);
  26. g_AlreadyCompleted = true;
  27. }
  28. // <Config xmlns="x-schema:config_schema.xml">
  29. // <LongName>Win64 Check</LongName>
  30. // <Description>Sync and win64 check build, with all post-build options and test-signing</Description>
  31. // <Environment xmlns="x-schema:enviro_schema.xml">
  32. // <LongName>AXP64 Checked</LongName>
  33. // <Description>Build on AXP64Chk, NTAXP03, NTAXP04, NTAXP05 AND NTAXP06</Description>
  34. }
  35. function GetDuplicateReport()
  36. {
  37. // Dump the duplicated published file info
  38. var strFileName;
  39. var cDuplicatedFiles = 0;
  40. var strMsg;
  41. var strDuplicateFiles = '';
  42. for(strFileName in PrivateData.hPublishedFiles)
  43. {
  44. if (!PrivateData.hPublishedFiles.__isPublicMember(strFileName))
  45. continue;
  46. if (PrivateData.hPublishedFiles[strFileName].aReferences.length > 1)
  47. {
  48. if (cDuplicatedFiles == 0)
  49. LogMsg("Duplicated file summary");
  50. ++cDuplicatedFiles;
  51. strMsg = "File: '" + strFileName + "' duplicated across " + PrivateData.hPublishedFiles[strFileName].aReferences.length + " depots";
  52. LogMsg(strMsg);
  53. strDuplicateFiles += strMsg + "\n";
  54. for(i = 0; i < PrivateData.hPublishedFiles[strFileName].aReferences.length; ++i)
  55. {
  56. strMsg = " " + PrivateData.hPublishedFiles[strFileName].aReferences[i].strName + ", Depot " + PrivateData.hPublishedFiles[strFileName].aReferences[i].strDir + ", " + PrivateData.hPublishedFiles[strFileName].aReferences[i].strName;
  57. LogMsg(strMsg);
  58. strDuplicateFiles += strMsg + "\n";
  59. }
  60. }
  61. }
  62. if (cDuplicatedFiles == 0)
  63. strMsg = "no duplicate published files";
  64. else
  65. strMsg = "There were " + cDuplicatedFiles + " files published more than once";
  66. LogMsg(strMsg);
  67. return strMsg + '\n' + strDuplicateFiles;
  68. }
  69. function GetElapsedReport()
  70. {
  71. var strMsg = "Elapsed Times:\n";
  72. var objET;
  73. var i;
  74. var strDelta;
  75. objET = PublicData.aBuild[0].objElapsedTimes;
  76. aDateMembers = ['Scorch', 'Sync', 'Build', 'CopyFiles', 'Post'];
  77. for(i = 0; i < aDateMembers.length; ++i)
  78. {
  79. strDelta = GetTimeDelta(objET["date" + aDateMembers[i] + "Start"], objET["date" + aDateMembers[i] + "Finish"]);
  80. strMsg += "\t" + aDateMembers[i] + ": " + strDelta + "\n";
  81. }
  82. strDelta = GetTimeDelta(objET.dateScorchStart, objET.datePostFinish);
  83. strMsg += "\t" + "Total" + ": " + strDelta + "\n";
  84. return strMsg;
  85. }
  86. function GetTimeDelta(dateStart, dateFinish)
  87. {
  88. var dElapsed;
  89. var dFinish;
  90. var hours;
  91. var min;
  92. if (!dateStart || dateStart.length == 0 || dateStart == 'unset')
  93. return '0:00';
  94. if (dateFinish && dateFinish != 'unset')
  95. dFinish = new Date(dateFinish);
  96. else
  97. dFinish = new Date();
  98. dElapsed = new Date(dFinish.getTime() - new Date(dateStart).getTime());
  99. hours = dElapsed.getUTCHours();
  100. min = dElapsed.getUTCMinutes();
  101. if (min < 10)
  102. min = '0' + min;
  103. return hours + ':' + min;
  104. }