common/tools/raptor/uh.pl
changeset 879 e88616591730
parent 791 9054e820b1e6
equal deleted inserted replaced
878:3a6ebfddb7fe 879:e88616591730
    70 $saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status);
    70 $saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status);
    71 $saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status);
    71 $saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status);
    72 $saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status);
    72 $saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status);
    73 $saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status);
    73 $saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status);
    74 
    74 
       
    75 our $allbldinfs = {};
       
    76 
    75 my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
    77 my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
    76 for (@logfiles)
    78 for (@logfiles)
    77 {
    79 {
    78 	print "Reading file: $_\n";
    80 	print "Reading file: $_\n";
    79 	$current_log_file = $_;
    81 	$current_log_file = $_;
    80 	$parser->parse_uri($_);
    82 	$parser->parse_uri($_);
    81 }
    83 }
       
    84 
       
    85 my @allpackages = distinct_packages($allbldinfs);
    82 
    86 
    83 print "Generating HTML...\n";
    87 print "Generating HTML...\n";
    84 
    88 
    85 system("rd /S /Q $outputdir") if (-d $outputdir);
    89 system("rd /S /Q $outputdir") if (-d $outputdir);
    86 mkdir ($outputdir);
    90 mkdir ($outputdir);
   221 	print AGGREGATED "$categoryline\n";
   225 	print AGGREGATED "$categoryline\n";
   222 }
   226 }
   223 print AGGREGATED "</table>\n";
   227 print AGGREGATED "</table>\n";
   224 print AGGREGATED "<br/>\n";
   228 print AGGREGATED "<br/>\n";
   225 
   229 
   226 print AGGREGATED "<br/>PACKGE-SPECIFIC FAILURES<br/>\n";
   230 print AGGREGATED "<br/>PACKAGE-SPECIFIC FAILURES<br/>\n";
   227 print AGGREGATED "<table border='1'>\n";
   231 print AGGREGATED "<table border='1'>\n";
   228 $tableheader = "<tr><th>package</th>";
   232 $tableheader = "<tr><th>package</th>";
   229 for (@severities) { $tableheader .= "<th>$_</th>"; }
   233 for (@severities) { $tableheader .= "<th>$_</th>"; }
   230 $tableheader .= "</tr>";
   234 $tableheader .= "</tr>";
   231 print AGGREGATED "$tableheader\n";
   235 print AGGREGATED "$tableheader\n";
   232 for my $package (keys %{$recipe_failures_num_by_severity})
   236 for my $package (@allpackages)
   233 {
   237 {
   234 	print_package_specific_summary($package, $recipe_failures_by_package_severity->{$package});
   238 	if (defined $recipe_failures_num_by_severity->{$package})
   235 	my $packagesummaryhtml = $package;
   239 	{
   236 	$packagesummaryhtml =~ s,/,_,;
   240 		print_package_specific_summary($package, $recipe_failures_by_package_severity->{$package});
   237 	$packagesummaryhtml .= ".html";
   241 		my $packagesummaryhtml = $package;
   238 	my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
   242 		$packagesummaryhtml =~ s,/,_,;
   239 	for (@severities)
   243 		$packagesummaryhtml .= ".html";
   240 	{
   244 		my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
   241 		my $failuresbyseverity = 0;
   245 		for (@severities)
   242 		$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_});
   246 		{
   243 		$packageline .= "<td>$failuresbyseverity</td>";
   247 			my $failuresbyseverity = 0;
   244 	}
   248 			$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_});
   245 	$packageline .= "</tr>";
   249 			$packageline .= "<td>$failuresbyseverity</td>";
   246 	print AGGREGATED "$packageline\n";
   250 		}
       
   251 		$packageline .= "</tr>";
       
   252 		print AGGREGATED "$packageline\n";
       
   253 	}
       
   254 	else
       
   255 	{
       
   256 		my $packageline = "<tr><td>$package</td>";
       
   257 		for (@severities) { $packageline .= "<td>0</td>"; }
       
   258 		$packageline .= "</tr>";
       
   259 		print AGGREGATED "$packageline\n";
       
   260 	}
   247 }
   261 }
   248 print AGGREGATED "</table>\n";
   262 print AGGREGATED "</table>\n";
   249 close(AGGREGATED);
   263 close(AGGREGATED);
   250 
   264 
   251 translate_detail_files_to_html();
   265 translate_detail_files_to_html();
   356 		open(FILE, ">$outputdir/$filenamebase\_failures.html");
   370 		open(FILE, ">$outputdir/$filenamebase\_failures.html");
   357 		print FILE $filecontent;
   371 		print FILE $filecontent;
   358 		close(FILE);
   372 		close(FILE);
   359 	}
   373 	}
   360 }
   374 }
       
   375 
       
   376 sub distinct_packages
       
   377 {
       
   378 	my ($allbldinfs) = @_;
       
   379 	
       
   380 	my $allpackages = {};
       
   381 	
       
   382 	for my $bldinf (keys %{$allbldinfs})
       
   383 	{
       
   384 		# normalize bldinf path
       
   385 		$bldinf = lc($bldinf);
       
   386 		$bldinf =~ s,^[A-Za-z]:,,;
       
   387 		$bldinf =~ s,[\\],/,g;
       
   388 		
       
   389 		my $package = '';
       
   390 		if ($bldinf =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
       
   391 		{
       
   392 			$package = $1;
       
   393 		}
       
   394 		else
       
   395 		{
       
   396 			print "WARNING: can't understand bldinf attribute of recipe: $bldinf. Won't dump to failed recipes file.\n";
       
   397 		}
       
   398 		
       
   399 		$allpackages->{$package} = 1;
       
   400 	}
       
   401 	
       
   402 	return sort {$a cmp $b} keys %{$allpackages};
       
   403 }