Merge
authorDario Sestito <darios@symbian.org>
Mon, 13 Jul 2009 18:03:32 +0100
changeset 245 2719a5d09e27
parent 244 9544c55a7fd0 (diff)
parent 243 71d24b4fa162 (current diff)
child 246 4f2482f1dd48
child 251 f3105028766d
Merge
--- a/common/tools/raptor/RaptorCommon.pm	Mon Jul 13 17:43:50 2009 +0100
+++ b/common/tools/raptor/RaptorCommon.pm	Mon Jul 13 18:03:32 2009 +0100
@@ -15,9 +15,21 @@
 package RaptorCommon;
 
 our $CATEGORY_GENERAL = 'general';
+
 our $CATEGORY_RAPTORERROR = 'raptor_error';
+our $CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION = 'cannot_process_schema_version';
+our $CATEGORY_RAPTORERROR_NOBLDINFFOUND = 'no_bld_inf_found';
 
 our $SEVERITY_UNKNOWN = 'unknown';
 our $SEVERITY_CRITICAL = 'critical';
 
+sub dump_fault
+{
+	my ($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line) = @_;
+	
+	open(SUMMARY, ">>$::basedir/summary.csv");
+	print SUMMARY "$category,$subcategory,$severity,$component,$phase,$recipe,$file,$line\n";
+	close(SUMMARY);
+}
+
 1;
--- a/common/tools/raptor/RaptorError.pm	Mon Jul 13 17:43:50 2009 +0100
+++ b/common/tools/raptor/RaptorError.pm	Mon Jul 13 18:03:32 2009 +0100
@@ -34,28 +34,41 @@
 $buildlog_error_status->{on_end} = 'RaptorError::on_end_buildlog_error';
 $buildlog_error_status->{on_chars} = 'RaptorError::on_chars_buildlog_error';
 
+my $filename = '';
+
 my $characters = '';
 
 my $category = $RaptorCommon::CATEGORY_RAPTORERROR;
 
 sub process
 {
-	my ($text) = @_;
+	my ($text, $component, $phase, $recipe, $file, $line) = @_;
 	
 	my $severity = $RaptorCommon::SEVERITY_UNKNOWN;
 	
 	if ($text =~ m,Cannot process schema version .* of file,)
 	{
 		$severity = $RaptorCommon::SEVERITY_CRITICAL;
-		
-		#dump_error($category, $severity, $text);
-		print "$category, $severity, $text\n";
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	elsif ($text =~ m,No bld\.inf found at,)
+	{
+		$severity = $RaptorCommon::SEVERITY_CRITICAL;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_NOBLDINFFOUND;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	else # log everything by default
+	{
+		$severity = $RaptorCommon::SEVERITY_UNKNOWN;
+		my $subcategory = '';
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
 	}
 }
 
 sub on_start_buildlog_error
 {
-	my $filename = "$::basedir/errors.txt";
+	$filename = "$::basedir/errors.txt";
 	print "Writing error file $filename\n" if (!-f$filename);
 	open(FILE, ">>$filename");
 }
@@ -75,14 +88,19 @@
 {
 	#print "on_end_buildlog_error\n";
 	
-	process($characters);
-	
 	print FILE $characters if ($characters =~ m,[^\s^\r^\n],);
 	print FILE "\n" if ($characters !~ m,[\r\n]$, );
+	close(FILE);
+	
+	# get the line number - not really optimized
+	my $linecount = 0;
+	open(FILE, "$filename");
+	for ($linecount = 0; <FILE>; $linecount++) { }
+	close(FILE);
+	
+	process($characters, '', '', '', "errors.txt", $linecount);
 	
 	$characters = '';
-	
-	close(FILE);
 }