Add heuristic determination of package for Raptor errors and warnings
authorDario Sestito <darios@symbian.org>
Fri, 09 Apr 2010 17:38:33 +0100
changeset 232 0244765a8d6f
parent 231 914d8060176c
child 233 cf1d34408de3
Add heuristic determination of package for Raptor errors and warnings
uh_parser/RaptorError.pm
uh_parser/RaptorUnreciped.pm
uh_parser/RaptorWarning.pm
--- a/uh_parser/RaptorError.pm	Fri Apr 09 14:05:04 2010 +0100
+++ b/uh_parser/RaptorError.pm	Fri Apr 09 17:38:33 2010 +0100
@@ -177,12 +177,22 @@
 {
 	#print "on_end_buildlog_error\n";
 	
+	$characters =~ s,^[\r\n]*,,;
+	$characters =~ s,[\r\n]*$,,;
+	
 	my $package = '';
+	# if bldinf attribute is not available then heuristically attempt to determine the package
+	if (!$raptor_error_info->{bldinf} &&
+		$characters =~ m,.*?(([/\\]sf)?[/\\](os|mw|app|tools|ostools|adaptation)[/\\][^/^\\]*[/\\]),s)
+	{
+		$raptor_error_info->{bldinf} = "$1... (guessed)";
+	}
+	
 	if ($raptor_error_info->{bldinf})
 	{
-    $::allbldinfs->{$raptor_error_info->{bldinf}} = 1;
+		$::allbldinfs->{$raptor_error_info->{bldinf}} = 1;
     
-    # normalize bldinf path
+		# normalize bldinf path
 		$raptor_error_info->{bldinf} = lc($raptor_error_info->{bldinf});
 		$raptor_error_info->{bldinf} =~ s,^[A-Za-z]:,,;
 		$raptor_error_info->{bldinf} =~ s,[\\],/,g;
@@ -196,23 +206,12 @@
 		{
 			print "WARNING: can't understand bldinf attribute of raptor error: $raptor_error_info->{bldinf}. Won't associate to package.\n";
 		}
-  }
-	
-	$characters =~ s,^[\r\n]*,,;
-	$characters =~ s,[\r\n]*$,,;
+	}
 	
 	if ($characters =~ m,[^\s^\r^\n],)
 	{
-    my $bldinf_field = '';
-    if ($package)
-		{
-			$filename = "$::raptorbitsdir/$package.txt";
-			$bldinf_field = $raptor_error_info->{bldinf};
-		}
-		else
-		{
-		  $filename = "$::raptorbitsdir/raptor_error.txt";
-		}
+		$filename = "$::raptorbitsdir/raptor_error.txt";
+		$filename = "$::raptorbitsdir/$package.txt" if ($package);
 		
 		if (!-f$filename)
 		{
@@ -221,7 +220,7 @@
 			close(FILE);
 		}
 		
-		my $dumped = process($characters, $::current_log_file, $bldinf_field, '', '', '', "$package.txt");
+		my $dumped = process($characters, $::current_log_file, $raptor_error_info->{bldinf}, '', '', '', "$package.txt");
 		
 		if ($dumped)
 		{
--- a/uh_parser/RaptorUnreciped.pm	Fri Apr 09 14:05:04 2010 +0100
+++ b/uh_parser/RaptorUnreciped.pm	Fri Apr 09 17:38:33 2010 +0100
@@ -43,11 +43,9 @@
 
 my $CATEGORY_RAPTORUNRECIPED = 'raptor_unreciped';
 my $CATEGORY_RAPTORUNRECIPED_NORULETOMAKETARGET = 'no_rule_to_make_target';
-my $CATEGORY_RAPTORUNRECIPED_TARGETNOTREMADEFORERRORS = 'target_not_remade_for_errors';
 my $CATEGORY_RAPTORUNRECIPED_IGNORINGOLDCOMMANDSFORTARGET = 'ignoring_old_commands_for_target';
 my $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET = 'overriding_commands_for_target';
 my $CATEGORY_RAPTORUNRECIPED_MAKE_TARGETNOTREMADEBECAUSEOFERRORS = 'make_target_not_remade_because_of_errors';
-my $CATEGORY_RAPTORUNRECIPED_MAKE_ERROR1 = 'make_error_1';
 my $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGETNEEDEDBY = 'make_no_rule_to_make_target_needed_by';
 my $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGET = 'make_no_rule_to_make_target';
 
@@ -67,12 +65,6 @@
 		my $subcategory = $CATEGORY_RAPTORUNRECIPED_NORULETOMAKETARGET;
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
 	}
-	elsif ($text =~ m,make\.exe: Target .* not remade because of errors,)
-	{
-		$severity = $RaptorCommon::SEVERITY_MINOR;
-		my $subcategory = $CATEGORY_RAPTORUNRECIPED_TARGETNOTREMADEFORERRORS;
-		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
-	}
 	elsif ($text =~ m,: warning: ignoring old commands for target,)
 	{
 		# don't dump
@@ -84,18 +76,6 @@
 		my $subcategory = $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET;
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
 	}
-	elsif ($text =~ m,^make(\.exe)?: Target .* not remade because of errors\.,)
-	{
-		$severity = $RaptorCommon::SEVERITY_MINOR;
-		my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_TARGETNOTREMADEBECAUSEOFERRORS;
-		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
-	}
-	elsif ($text =~ m,^make(\.exe)?: \*\*\* .* Error 1,)
-	{
-		$severity = $RaptorCommon::SEVERITY_MINOR;
-		my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_ERROR1;
-		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
-	}
 	elsif ($text =~ m,^make(\.exe)?: \*\*\* No rule to make target .*\ needed by .*,)
 	{
 		$severity = $RaptorCommon::SEVERITY_MINOR;
@@ -108,6 +88,16 @@
 		my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGET;
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
 	}
+	elsif ($text =~ m,^make(\.exe)?: \*\*\* .* Error \d,)
+	{
+		# don't dump
+		$dumped = 0;
+	}
+	elsif ($text =~ m,^make(\.exe)?: Target .* not remade because of errors,)
+	{
+		# don't dump
+		$dumped = 0;
+	}
 	elsif ($text =~ m,^make(\.exe)?: Nothing to be done for .*,)
 	{
 		# don't dump
@@ -133,6 +123,11 @@
 		# don't dump
 		$dumped = 0;
 	}
+	elsif ($text =~ m,^make(\.exe)?: \*\*\* Waiting for unfinished jobs\.\.\.\.,)
+	{
+		# don't dump
+		$dumped = 0;
+	}
 	else # log everything by default
 	{
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
--- a/uh_parser/RaptorWarning.pm	Fri Apr 09 14:05:04 2010 +0100
+++ b/uh_parser/RaptorWarning.pm	Fri Apr 09 17:38:33 2010 +0100
@@ -116,7 +116,17 @@
 {
 	#print "on_end_buildlog_warning\n";
 	
+	$characters =~ s,^[\r\n]*,,;
+	$characters =~ s,[\r\n]*$,,;
+	
 	my $package = '';
+	# if bldinf attribute is not available then heuristically attempt to determine the package
+	if (!$raptor_warning_info->{bldinf} &&
+		$characters =~ m,.*?(([/\\]sf)?[/\\](os|mw|app|tools|ostools|adaptation)[/\\][^/^\\]*[/\\]),s)
+	{
+		$raptor_warning_info->{bldinf} = "$1... (guessed)";
+	}
+	
 	if ($raptor_warning_info->{bldinf})
 	{
 		$::allbldinfs->{$raptor_warning_info->{bldinf}} = 1;
@@ -137,21 +147,10 @@
 		}
 	}
 	
-	$characters =~ s,^[\r\n]*,,;
-	$characters =~ s,[\r\n]*$,,;
-	
 	if ($characters =~ m,[^\s^\r^\n],)
 	{
-		my $bldinf_field = '';
-		if ($package)
-		{
-			$filename = "$::raptorbitsdir/$package.txt";
-			$bldinf_field = $raptor_warning_info->{bldinf};
-		}
-		else
-		{
-			$filename = "$::raptorbitsdir/raptor_warning.txt";
-		}
+		$filename = "$::raptorbitsdir/raptor_warning.txt";
+		$filename = "$::raptorbitsdir/$package.txt" if ($package);
 		
 		if (!-f$filename)
 		{
@@ -160,7 +159,7 @@
 			close(FILE);
 		}
 		
-		my $dumped = process($characters, $::current_log_file, $bldinf_field, '', '', '', "$package.txt");
+		my $dumped = process($characters, $::current_log_file, $raptor_warning_info->{bldinf}, '', '', '', "$package.txt");
 		
 		if ($dumped)
 		{