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.

765 lines
22 KiB

  1. if (!$__IITENVPM ) { use iit::env; }
  2. if (!$__IITBUILDCOMPONENTPM ) { use iit::buildcomponent; }
  3. if (!$__IITSSREPLPM ) { use iit::ssrepl; }
  4. sub BuildServer
  5. {
  6. local($sServerName, @lBuildServerComponents) = @_;
  7. my($rc) = BC_NOTHINGDONE;
  8. PrintL("\nStarting ".$sServerName." ... \n\n", PL_HEADER);
  9. my($sBuildResultsFile) = $PROJROOT."\\logs\\".$sServerName."msg.html";
  10. unlink($sBuildResultsFile);
  11. PrintToFile($sBuildResultsFile,
  12. "<html><title>".$sServerName." Results</title><body bgproperties=\"FIXED\"".
  13. "background=\"http://iit/images/IITback2.gif\">");
  14. foreach $component (@lBuildServerComponents)
  15. {
  16. my($sComponentName, $sParams) = split(/\s*=>\s*/, $component, 2);
  17. PrintL("\nStarting ".$sComponentName." build ... \n\n", PL_SUBHEADER);
  18. $strBuildMsg = ""; #TODO: remove
  19. my($bcComponent) = SetLocalGlobalsAndBegin($sComponentName, split(/\s+/, $sParams));
  20. Append($sBuildResultsFile, $PROJROOT."\\logs\\".$sComponentName."msg.html");
  21. $rc |= $bcComponent;
  22. if (!($bcComponent & BC_NOTHINGDONE) && ($rc & BC_NOTHINGDONE))
  23. {
  24. $rc -= BC_NOTHINGDONE;
  25. }
  26. }
  27. my($sResults) = "<b><font size=5 face=\"arial\">".$sBuildName." Results: <BR>"
  28. .BuildCodeToHTML($rc)."<BR><\/font><\/b>".GetAllTextFromFile($sBuildResultsFile);
  29. unlink($sBuildResultsFile);
  30. PrintToFile($sBuildResultsFile, $sResults);
  31. PrintToFile($sBuildResultsFile, "<BR><BR>\n".FormatLogAsHTML(GetSLMLog('-t '.GetDayRange(2))));
  32. $sResults = GetAllTextFromFile($sBuildResultsFile);
  33. my($sRecipients) = "";
  34. if ($USERNAME eq "nlgbuild") # fix!
  35. {
  36. $sRecipients = join(" ", @lOfficialMailRecipients);
  37. }
  38. else
  39. {
  40. $sRecipients = join(" ", @lMailRecipients);
  41. }
  42. SendHtmlMail($sRecipients,
  43. $sServerName." Results: ".HTMLToStr(BuildCodeToHTML($rc)),
  44. $sResults);
  45. return($rc);
  46. }
  47. ####################################################################################
  48. # BeginBuild()
  49. # performs many common tasks when beginning a build (opens the logs, handles many of the
  50. # passed argument options, sets up the variables, etc.)
  51. # call after SetLocalGlobalsAndBegin() and before EndBuild()
  52. # a-jbilas, 03/20/99 - created
  53. ####################################################################################
  54. sub BeginBuild
  55. {
  56. my($rc) = 1;
  57. $strBuildMsg .= "<! ".$sShortBuildName." ".$nScriptStartTime." SUMMARY ENTRY POINT >\n";
  58. # our way of doing set local (reset at EndBuild())
  59. $sOldPath = $PATH;
  60. $sOldInclude = $INCLUDE;
  61. $sOldLib = $LIB;
  62. if (!$bGlobalsSet)
  63. {
  64. PrintL("Globals not set\n", PL_BIGWARNING);
  65. }
  66. my($startDir) = @_;
  67. shift(@_);
  68. @lAllowedArgs = Union(*lAllowedArgs, *lAllowedBuilds);
  69. @lAllowedArgs = Union(*lAllowedArgs, *lAllowedModifiers);
  70. @lAllowedArgs = Union(*lAllowedArgs, *lAllowedComponents);
  71. @lAllowedArgs = Union(*lAllowedArgs, *lAllowedLanguages);
  72. BuildAcceleratorLists();
  73. @lArgs = ParseArgs(@_);
  74. ####### change dir to build root
  75. PushD($startDir);
  76. ####### delete old build message and build log
  77. PrintL("Deleting old build logs ...\n\n");
  78. EchoedUnlink($sMailfile, $sVarsLog, $sTyposLog, $sSyncLog, $sUpdateLog, $sBuildLog);
  79. $fhBuildLog = OpenFile($sBuildLog, "write");
  80. if (!$fhBuildLog)
  81. {
  82. PrintL("Could not open ".$sBuildLog.", logging for this session will be disabled\n\n", PL_BIGERROR);
  83. }
  84. else
  85. {
  86. $fhBuildLog->print(GetAllTextFromFile($sDHTMLIncFile)."\n\n<html>\n");
  87. if (!$bDHTMLActive)
  88. {
  89. if ($strBuildMsg !~ /<! DHTML ACTIVATION SCRIPT >/)
  90. {
  91. PrintL("<! DHTML ACTIVATION SCRIPT >".GetAllTextFromFile($sDHTMLIncFile)
  92. ."<! END DHTML ACTIVATION SCRIPT >", PL_MSGONLY);
  93. }
  94. $bDHTMLActive = 1;
  95. }
  96. }
  97. ####### make list of build types needed
  98. @lBuilds = Intersect(*lAllowedBuilds, *lArgs);
  99. if (IsMemberOf("ALL", @lArgs))
  100. {
  101. @lBuilds = @lAllowedBuilds;
  102. }
  103. if (IsMemberOf("SHIP", @lArgs))
  104. {
  105. $bShipBuild = 1;
  106. if (@lBuilds == ())
  107. {
  108. @lBuilds = @lAllowedBuilds;
  109. }
  110. }
  111. ####### set modifier flags
  112. if (IsMemberOf("VERBOSE", @lArgs))
  113. {
  114. $DEBUG = 1; #TODO: change all refs to this flag to $bVerbose
  115. $bVerbose = 1;
  116. }
  117. if (IsMemberOf("BVT", @lArgs))
  118. {
  119. $bBVT = 1;
  120. }
  121. if (IsMemberOf("NOCOPY", @lArgs))
  122. {
  123. $bNoCopy = 1;
  124. }
  125. if (IsMemberOf("MAIL", @lArgs))
  126. {
  127. $bSendMail = 1;
  128. }
  129. if (IsMemberOf("HALT", @lArgs))
  130. {
  131. $bDieOnError = 1;
  132. }
  133. if (@lBuilds == () && @lAllowedBuilds != ())
  134. {
  135. PrintL("No buildtype selected, defaulting to ".$lAllowedBuilds[0]."\n\n", PL_NOLOG);
  136. @lBuilds = ($lAllowedBuilds[0], @lBuilds);
  137. }
  138. @lModifiers = Intersect(*lAllowedModifiers, *lArgs);
  139. if (IsMemberOf("ALLCOMP", @lModifiers))
  140. {
  141. @lComponents = @lAllowedComponents;
  142. }
  143. else
  144. {
  145. @lComponents = Intersect(*lAllowedComponents, *lArgs);
  146. if (@lComponents == () && @lAllowedComponents != ())
  147. {
  148. PrintL("No components chosen, defaulting to ".$lAllowedComponents[0]."\n\n", PL_NOLOG);
  149. push(@lComponents, $lAllowedComponents[0]); #defaults to first component in @lAllowedComponents
  150. }
  151. }
  152. ####### set build number (and official build)
  153. if (((lc($USERNAME) eq $sOfficialBuildAccount) || IsMemberOf("OFFICIAL", @lArgs)) && !IsMemberOf("TEST", @lArgs))
  154. {
  155. if (defined($ENV{"BUILDNUM"}) && $ENV{"BUILDNUM"} > 0)
  156. {
  157. $sBuildNumber = $ENV{"BUILDNUM"};
  158. }
  159. else
  160. {
  161. $sBuildNumber = GetBuildNumber($nBuildStartYear);
  162. $ENV{"BUILDNUM"} = $sBuildNumber;
  163. }
  164. @lMailRecipients = Union(*lOfficialMailRecipients, *lMailRecipients);
  165. $bOfficialBuild = 1;
  166. # 0000 is assumed to be unique build identifier
  167. $sDropDir =~ s/0000/$sBuildNumber/; #set the drop dir location for official build
  168. $sLogDropDir =~ s/0000/$sBuildNumber/; #set the drop dir location for official build
  169. $sRemoteBuildLog =~ s/0000/$sBuildNumber/; #set the log name for official build
  170. if (!$bNoCopy && !IsMemberOf("NONEWLOG", @lArgs))
  171. {
  172. UpdateLogTOC($sRemoteTOC, $sBuildLog);
  173. }
  174. if (!IsMemberOf(@lArgs, "QUIET") && IsMemberOf(@lAllowedArgs, "QUIET"))
  175. {
  176. push(@lArgs, "QUIET");
  177. }
  178. }
  179. else
  180. {
  181. $sBuildNumber = "0000";
  182. $bOfficialBuild = 0;
  183. $sDropDir =~ s/$sRootDropDir/$sTestRootDropDir/;
  184. $sLogDropDir = $sLogDir;
  185. $sRemoteBuildLog = $sBuildLog;
  186. $sRootDropDir = $sTestRootDropDir;
  187. }
  188. $ENV{"BUILDNUM"} = $sBuildNumber; #legacy script (ssrepl depends on this) TODO: remove
  189. OutputHeader($nLoggingMode);
  190. ####### resync
  191. if (IsMemberOf("RESYNC", @lArgs))
  192. {
  193. PrintL("Resyncing SLM Files ...\n\n", PL_LARGE | PL_BOLD);
  194. if ($bOfficialBuild)
  195. {
  196. GrabCookie('r');
  197. }
  198. if (@lSyncDirs != ())
  199. {
  200. foreach $dir (@lSyncDirs)
  201. {
  202. my($bRecurse) = 0;
  203. if ($dir =~ /^RECURSE:/)
  204. {
  205. $dir =~ s/^RECURSE://;
  206. $bRecurse = 1;
  207. }
  208. PushD($dir);
  209. PrintL(" - Syncing ".$dir."\n", PL_BLUE | PL_BOLD);
  210. PrintToFile($sSyncLog, ("*" x 30)."\nSyncing ".$dir."\n\n");
  211. ExecuteAndOutputToFile($cmdSync." -f".($bRecurse ? "r" : ""), $sSyncLog);
  212. PopD();
  213. }
  214. }
  215. else
  216. {
  217. ExecuteAndOutputToFile($cmdSync." -rf", $sSyncLog);
  218. }
  219. PrintL("\n");
  220. if ($bOfficialBuild)
  221. {
  222. FreeCookie();
  223. }
  224. }
  225. ####### rebuild
  226. if (IsMemberOf("REBUILD", @lArgs))
  227. {
  228. if (@lCleanDirs != ())
  229. {
  230. PrintL("Cleaning Up ...\n\n", PL_SUBHEADER);
  231. foreach $dir (@lCleanDirs)
  232. {
  233. DelAll($dir, 'RECURSE');
  234. }
  235. PrintL("\n");
  236. }
  237. else
  238. {
  239. # TODO: default behavior
  240. }
  241. }
  242. if ($bVerbose)
  243. {
  244. DumpVars();
  245. }
  246. # at this point we should be ready for build (or to delete files if rebuild, then build)
  247. # don't forget to EndBuild() or the starting directory will not returned to and ENV vars will not be restored
  248. if (defined &BeginBuildCustom)
  249. {
  250. return(BeginBuildCustom() && $rc);
  251. }
  252. else
  253. {
  254. return($rc);
  255. }
  256. }
  257. ####################################################################################
  258. # EndBuild()
  259. # ends the building block (report status, cleanup activities, restore old system settings, etc.)
  260. # only useful when paired with BeginBuild()
  261. # a-jbilas, 04/10/99 - created
  262. ####################################################################################
  263. sub EndBuild
  264. #call upon build completion
  265. {
  266. if (defined &EndBuildCustom)
  267. {
  268. EndBuildCustom();
  269. }
  270. OutputFooter($nLoggingMode);
  271. CloseFile($fhBuildLog);
  272. if ($nLoggingMode == 2)
  273. {
  274. InsertSummaryIntoLog($sBuildLog);
  275. }
  276. $fhMailFile = OpenFile($sMailfile, "write");
  277. if ($fhMailFile)
  278. {
  279. my($tmpBuildMsg) = $strBuildMsg;
  280. my($replStr) = "<BR><BR><b><font size=5>".$sBuildName." ".BuildCodeToHTML($bcStatus)."<\/b>".
  281. " - <a href=\"".TranslateToHTTP($sRemoteBuildLog)."\">Log<\/a><\/font><BR><BR>";
  282. $strBuildMsg =~ s/<\! $sShortBuildName $nScriptStartTime SUMMARY ENTRY POINT >/$replStr/;
  283. $fhMailFile->print($strBuildMsg);
  284. CloseFile($fhMailFile);
  285. $strBuildMsg = $tmpBuildMsg;
  286. }
  287. if ($bOfficialBuild && !$bNoCopy && ($sRemoteBuildLog ne ""))
  288. {
  289. if (!CopyLogs())
  290. {
  291. PrintL("Warning: ".$sShortBuildName." log failed to copy\n", PL_MSGONLY);
  292. }
  293. }
  294. if ($bSendMail)
  295. {
  296. my($sRecipients) = "";
  297. foreach $member (@lMailRecipients)
  298. {
  299. if ($sRecipients eq "")
  300. {
  301. $sRecipients = $member;
  302. }
  303. else
  304. {
  305. $sRecipients .= " ".$member;
  306. }
  307. }
  308. if ($sRecipients ne "")
  309. {
  310. my($htmlresult) = '<font color="'.($bNothingDone ? 'gray">Nothing Done' :
  311. ($bBuildFailed ? 'red">Failed' : 'green">Successful')).
  312. ($bCopyFailed ? '</font> <font color=orange>(with copy failures)' : '').'</font>';
  313. my($result) = $htmlresult;
  314. $result =~ s/<[^>]*>//g;
  315. PrintL("\nComposing and Sending Build Mail ...\n\n");
  316. # desperate attempt to fix incomplete e-mail bug
  317. my ($sMsgBody) = '<b><font size=5>'.$sBuildName.' '.$htmlresult.'&nbsp&nbsp</font><font size=3>(';
  318. $sMsgBody .= FmtDeltaTime(time() - $nScriptStartTime).')</font><font size=5> - <a href="';
  319. $sMsgBody .= TranslateToHTTP($sLogDropDir."\\".$sRemoteBuildLog).'">Log File</a></font></font><BR><BR></b>';
  320. $sMsgBody .= "\n".$strBuildMsg.'<BR><BR><BR><BR>';
  321. $sMsgBody .= FormatLogAsHTML(GetSLMLog('-t '.GetDayRange(1)));
  322. SendHtmlMail($sRecipients,
  323. $sBuildName." Results: ".$result,
  324. $sMsgBody);
  325. }
  326. }
  327. # if ($bColor)
  328. # {
  329. # system("color"); #restore old color
  330. # }
  331. PrintL("\nExiting ...\n");
  332. PopD();
  333. $ENV{PATH} = $sOldPath; #restore old path
  334. $ENV{INCLUDE} = $sOldInclude; #restore old inc
  335. $ENV{LIB} = $sOldLib;
  336. $bGlobalsSet = 0;
  337. if (!$bOfficialBuild && !IsMemberOf("QUIET", @lArgs) && !IsMemberOf("NONEWLOG", @lArgs))
  338. {
  339. print(STDOUT "\n - Launching build log (use 'QUIET' option next time to skip)\n");
  340. Execute($sBuildLog);
  341. print(STDOUT "\n");
  342. }
  343. }
  344. ####################################################################################
  345. # OutputHeader()
  346. # outputs start build status info to log and screen
  347. # if caller is the rootbuild, status info will appear larger with more information
  348. # a-jbilas, 04/20/99 - created
  349. ####################################################################################
  350. sub OutputHeader
  351. {
  352. # NOTE: dhtml does not get activated in mode 0 or 1
  353. if ($_[0] == 0)
  354. {
  355. }
  356. elsif ($_[0] == 1)
  357. {
  358. PrintL($sShortBuildName." started at ".GetLocalTime()."\n\n", PL_BOLD);
  359. }
  360. else
  361. {
  362. PrintL("<title>".$sBuildName.'</title><body '.
  363. ($bDHTMLActive ? 'onload="init()" ' : '').'bgproperties="FIXED" '.
  364. 'background="http://iit/images/IITback2.gif">'."\n", PL_NOSTD);
  365. PrintL("\n", PL_NOLOG);
  366. PrintL($sBuildName, PL_HEADER | PL_PURPLE);
  367. foreach $arg (@lArgs)
  368. {
  369. if ($arg !~ /__IGNORE/i)
  370. {
  371. my($desc) = GetKeyCaseInsensitive($arg, %hOptionDescription);
  372. $desc =~ s/^ *//;
  373. PrintLTip(" [".$arg."]", $desc, PL_GREEN | PL_BOLD);
  374. }
  375. }
  376. print($fhBuildLog "<\/font>");
  377. PrintL("\n");
  378. if ($bOfficialBuild)
  379. {
  380. PrintL("Build #".$sBuildNumber." *Official Build*", PL_HEADER | PL_GREEN);
  381. }
  382. else
  383. {
  384. PrintL("*Unofficial Build*", PL_HEADER);
  385. }
  386. if (($USERNAME ne "") && ($COMPUTERNAME ne ""))
  387. {
  388. PrintL(" (user ", PL_HEADER | PL_GRAY);
  389. PrintL($USERNAME, PL_HEADER);
  390. PrintL(" on ", PL_HEADER | PL_GRAY);
  391. PrintL("\\\\".$COMPUTERNAME, PL_HEADER);
  392. PrintL(")", PL_HEADER | PL_GRAY);
  393. }
  394. PrintL("\n");
  395. local($x, $sOSVer) = `ver`; #first line is blank
  396. PrintL($PROCESSOR_ARCHITECTURE, PL_HEADER);
  397. PrintL(" running ", PL_HEADER | PL_GRAY);
  398. PrintL($sOSVer, PL_HEADER);
  399. PrintL("Start Time: ", PL_HEADER | PL_GRAY);
  400. PrintL(GetLocalTime()."\n\n", PL_HEADER);
  401. PrintL("\n<! ".$sShortBuildName." ".$nScriptStartTime." SUMMARY ENTRY POINT >\n", PL_NOSTD | PL_FLUSH);
  402. }
  403. }
  404. ####################################################################################
  405. # OutputFooter()
  406. # outputs completed build status info to log and screen
  407. # if caller is the rootbuild, status info will appear larger with more information
  408. # a-jbilas, 04/20/99 - created
  409. # a-jbilas, 06/29/99 - added 'nothing done' case
  410. ####################################################################################
  411. sub OutputFooter
  412. {
  413. if ($_[0] == 0)
  414. {
  415. return();
  416. }
  417. elsif ($_[0] == 1)
  418. {
  419. PrintL($sShortBuildName." ended at ".GetLocalTime()." with status: ".BuildCodeToHTML($bcStatus)."\n\n", PL_BOLD);
  420. }
  421. else
  422. {
  423. PrintL("\n".$sBuildName, PL_HEADER);
  424. foreach $arg (@lArgs)
  425. {
  426. PrintL(" [".$arg."]", PL_GREEN | PL_BOLD);
  427. }
  428. PrintL("\nEnded at ".GetLocalTime()." with status:\n", PL_HEADER);
  429. PrintL(BuildCodeToHTML($bcStatus)."\n", PL_HEADER | PL_FLUSH | PL_NOTAG);
  430. PrintL("<\/body><\/html>", PL_NOSTD);
  431. }
  432. }
  433. ####################################################################################
  434. # GetUsage()
  435. # return a string with usage information based upon values in @lAllowedArgs
  436. # a-jbilas, 04/10/99 - created
  437. # a-jbilas, 06/03/99 - moved descriptions into a hashing table for easier updates
  438. # a-jbilas, 06/09/99 - added accelerator support
  439. # a-jbilas, 08/16/99 - separated args into subsections
  440. ####################################################################################
  441. sub GetUsage()
  442. {
  443. my($sUsage) = "\n";
  444. local(@lKeys) = ();
  445. local(@lDesc) = ();
  446. foreach $elem (keys(%hOptionDescription))
  447. {
  448. push(@lKeys, $elem);
  449. push(@lDesc, $hOptionDescription{$elem});
  450. }
  451. $sUsage .= "usage:\n";
  452. $sUsage .= RemovePath($PROGRAM_NAME)." [args ...]\n\n";
  453. if (@lDefaultArgs != ())
  454. {
  455. $sUsage .= "DEFAULTS: ";
  456. foreach $item (@lDefaultArgs)
  457. {
  458. $sUsage .= $item." ";
  459. }
  460. $sUsage .= "\n";
  461. }
  462. if (@lAllowedBuilds != ())
  463. {
  464. $sUsage .= "\nBuild Arguments:\n";
  465. foreach $arg (@lAllowedBuilds)
  466. {
  467. my($bFound) = 0;
  468. for ($index = 0 ; !$bFound && $index < scalar(@lKeys) ; ++$index)
  469. {
  470. if (uc($lKeys[$index]) eq uc($arg))
  471. {
  472. $sUsage .= " ".$lKeys[$index]." ".$lDesc[$index]."\n";
  473. $bFound = 1;
  474. }
  475. }
  476. }
  477. }
  478. if (@lAllowedLanguages != ())
  479. {
  480. $sUsage .= "\nLanguage Arguments:\n";
  481. foreach $arg (@lAllowedLanguages)
  482. {
  483. my($bFound) = 0;
  484. for ($index = 0 ; !$bFound && $index < scalar(@lKeys) ; ++$index)
  485. {
  486. if (uc($lKeys[$index]) eq uc($arg))
  487. {
  488. $sUsage .= " ".$lKeys[$index]." ".$lDesc[$index]."\n";
  489. $bFound = 1;
  490. }
  491. }
  492. }
  493. }
  494. if (@lAllowedComponents != ())
  495. {
  496. $sUsage .= "\nComponent Arguments:\n";
  497. foreach $arg (@lAllowedComponents)
  498. {
  499. my($bFound) = 0;
  500. for ($index = 0 ; !$bFound && $index < scalar(@lKeys) ; ++$index)
  501. {
  502. if (uc($lKeys[$index]) eq uc($arg))
  503. {
  504. $sUsage .= " ".$lKeys[$index]." ".$lDesc[$index]."\n";
  505. $bFound = 1;
  506. }
  507. }
  508. }
  509. }
  510. if (@lAllowedModifiers != ())
  511. {
  512. $sUsage .= "\nModifier Arguments:\n";
  513. foreach $arg (@lAllowedModifiers)
  514. {
  515. my($bFound) = 0;
  516. for ($index = 0 ; !$bFound && $index < scalar(@lKeys) ; ++$index)
  517. {
  518. if (uc($lKeys[$index]) eq uc($arg))
  519. {
  520. $sUsage .= " ".$lKeys[$index]." ".$lDesc[$index]."\n";
  521. $bFound = 1;
  522. }
  523. }
  524. }
  525. }
  526. return($sUsage."\nTo save time, type only the capital letters of each ".
  527. "param on the left\n\n");
  528. }
  529. ####################################################################################
  530. # MatchShipBuilds()
  531. # utility for build-specific buildtypes:
  532. # pass the buildtypes allowed in the specific build
  533. # function will return the command line specified buildtypes allowed for this build (intersection)
  534. # a-jbilas, 04/20/99 - created
  535. # a-jbilas, 05/11/99 - will intersect args with @lBuilds only if $bShipBuild flagged, otherwise return @lBuilds
  536. ####################################################################################
  537. sub MatchShipBuilds
  538. {
  539. local(@ret) = ();
  540. if ($bShipBuild)
  541. {
  542. foreach $buildtype (@lBuilds)
  543. {
  544. if (IsMemberOf($buildtype, @_))
  545. {
  546. push(@ret, $buildtype);
  547. }
  548. }
  549. return(@ret);
  550. }
  551. else
  552. {
  553. return(@lBuilds);
  554. }
  555. }
  556. ####################################################################################
  557. # CheckTypos()
  558. # runs the typo.pl script on the current directory and outputs it to $sTyposLog
  559. # if non-zero, the log is logged to the main log and output to the screen
  560. # a-jbilas, 04/10/99 - created
  561. # a-jbilas, 09/20/99 - update filter to new typos.pl
  562. ####################################################################################
  563. sub CheckTypos()
  564. {
  565. local($rc) = 1;
  566. if (IsMemberOf("TYPO", @lArgs))
  567. {
  568. unlink($sTyposLog);
  569. PrintL("\nRunning typo check ... \n\n", PL_SUBHEADER);
  570. ExecuteAndOutputToFile("perl ".$sBinBatDir."\\typo.pl -optionfile:".$sBinBatDir."\\typo.cfg c",
  571. $sTyposLog);
  572. my($sErrs) = "";
  573. my($fhTyposLog) = OpenFile($sTyposLog, "read");
  574. while($fhTyposLog && !$fhTyposLog->eof())
  575. {
  576. my($text) = $fhTyposLog->getline();
  577. if ($text !~ /^\/\//)
  578. {
  579. $sErrs .= $text;
  580. }
  581. }
  582. CloseFile($fhTyposLog);
  583. if ($sErrs ne "")
  584. {
  585. PrintL("Warning: Typo Errors", PL_BIGWARNING);
  586. PrintL("\n***********************************\n".$sErrs);
  587. PrintMsgBlock($sErrs);
  588. $rc = 0;
  589. }
  590. else
  591. {
  592. PrintL("No Typo Errors Found\n", PL_GREEN | PL_BOLD);
  593. }
  594. }
  595. return($rc);
  596. }
  597. ####################################################################################
  598. # GetCustomShipHash()
  599. # Builds and returns a hash of the components (keys) and matching buildtypes found
  600. # in filename passed in argument (otherwise defaults to build.ini in cwd())
  601. # returns 0 if file does not exist
  602. # a-jbilas, 06/14/99 - created
  603. ####################################################################################
  604. sub GetCustomShipHash
  605. {
  606. carp("Usage: GetCustomShipHash([configName]) ")
  607. unless((@_ == 0) || (@_ == 1));
  608. my($sConfigFile) = @_;
  609. my(%hShipTypes) = ();
  610. if ($sConfigFile eq "")
  611. {
  612. $sConfigFile = cwd()."\\build.ini";
  613. }
  614. if (!-e $sConfigFile)
  615. {
  616. return(0);
  617. }
  618. $fhConfigFile = OpenFile($sConfigFile, "read");
  619. while (<$fhConfigFile>)
  620. {
  621. if (/^\#/)
  622. {
  623. # (skip comments)
  624. }
  625. elsif (/=/)
  626. {
  627. s/\s//g;
  628. chomp($_);
  629. s/^(.*)=(.*)$/$1 $2/;
  630. PrintL("Special condition found in $1: $2\n", PL_VERBOSE);
  631. $hShipTypes{lc($1)} = uc($2);
  632. }
  633. }
  634. return(%hShipTypes);
  635. }
  636. sub BuildDie
  637. {
  638. PrintL($_[0], PL_BIGERROR);
  639. EndBuild();
  640. exit(1);
  641. }
  642. $__IITBUILDPM = 1;
  643. 1;