Add heuristic determination of package for Raptor unreciped text
authorDario Sestito <darios@symbian.org>
Fri, 09 Apr 2010 18:03:22 +0100
changeset 233 cf1d34408de3
parent 232 0244765a8d6f
child 234 74890d706f0c
Add heuristic determination of package for Raptor unreciped text
uh_parser/RaptorError.pm
uh_parser/RaptorUnreciped.pm
uh_parser/RaptorWarning.pm
--- a/uh_parser/RaptorError.pm	Fri Apr 09 17:38:33 2010 +0100
+++ b/uh_parser/RaptorError.pm	Fri Apr 09 18:03:22 2010 +0100
@@ -212,6 +212,8 @@
 	{
 		$filename = "$::raptorbitsdir/raptor_error.txt";
 		$filename = "$::raptorbitsdir/$package.txt" if ($package);
+		my $filenamewnopath = "raptor_error.txt";
+		$filenamewnopath = "$package.txt" if ($package);
 		
 		if (!-f$filename)
 		{
@@ -220,7 +222,7 @@
 			close(FILE);
 		}
 		
-		my $dumped = process($characters, $::current_log_file, $raptor_error_info->{bldinf}, '', '', '', "$package.txt");
+		my $dumped = process($characters, $::current_log_file, $raptor_error_info->{bldinf}, '', '', '', $filenamewnopath);
 		
 		if ($dumped)
 		{
--- a/uh_parser/RaptorUnreciped.pm	Fri Apr 09 17:38:33 2010 +0100
+++ b/uh_parser/RaptorUnreciped.pm	Fri Apr 09 18:03:22 2010 +0100
@@ -139,14 +139,6 @@
 sub on_start_buildlog
 {
 	RaptorCommon::init();
-	
-	$filename = "$::raptorbitsdir/raptor_unreciped.txt";
-	if (!-f$filename)
-	{
-		print "Writing unreciped file $filename\n";
-		open(FILE, ">$filename");
-		close(FILE);
-	}
 }
 
 sub on_chars_buildlog
@@ -180,9 +172,45 @@
 	my @lines = split(/[\r\n]/, $characters);
 	for my $line (@lines)
 	{
+		my $package = '';
+		my $guessed_bldinf = '';
+		# if bldinf attribute is not available then heuristically attempt to determine the package
+		if ($line =~ m,.*?(([/\\]sf)?[/\\](os|mw|app|tools|ostools|adaptation)[/\\][^/^\\]*[/\\]),s)
+		{
+			$guessed_bldinf = "$1... (guessed)";
+		}
+		
+		if ($guessed_bldinf)
+		{
+			$::allbldinfs->{$guessed_bldinf} = 1;
+			
+			# normalize bldinf path
+			$guessed_bldinf = lc($guessed_bldinf);
+			$guessed_bldinf =~ s,^[A-Za-z]:,,;
+			$guessed_bldinf =~ s,[\\],/,g;
+			
+			if ($guessed_bldinf =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
+			{
+				$package = $1;
+				$package =~ s,/,_,;
+			}
+		}
+			
 		if ($line =~ m,[^\s^\r^\n],)
 		{
-			my $dumped = process($line, $::current_log_file, '', '', '', '', "raptor_unreciped.txt");
+			$filename = "$::raptorbitsdir/raptor_unreciped.txt";
+			$filename = "$::raptorbitsdir/$package.txt" if ($package);
+			my $filenamewnopath = "raptor_unreciped.txt";
+			$filenamewnopath = "$package.txt" if ($package);
+			
+			if (!-f$filename)
+			{
+				print "Writing file $filename\n";
+				open(FILE, ">$filename");
+				close(FILE);
+			}
+		
+			my $dumped = process($line, $::current_log_file, $guessed_bldinf, '', '', '', $filenamewnopath);
 			
 			if ($dumped)
 			{
--- a/uh_parser/RaptorWarning.pm	Fri Apr 09 17:38:33 2010 +0100
+++ b/uh_parser/RaptorWarning.pm	Fri Apr 09 18:03:22 2010 +0100
@@ -151,6 +151,8 @@
 	{
 		$filename = "$::raptorbitsdir/raptor_warning.txt";
 		$filename = "$::raptorbitsdir/$package.txt" if ($package);
+		my $filenamewnopath = "raptor_warning.txt";
+		$filenamewnopath = "$package.txt" if ($package);
 		
 		if (!-f$filename)
 		{
@@ -159,7 +161,7 @@
 			close(FILE);
 		}
 		
-		my $dumped = process($characters, $::current_log_file, $raptor_warning_info->{bldinf}, '', '', '', "$package.txt");
+		my $dumped = process($characters, $::current_log_file, $raptor_warning_info->{bldinf}, '', '', '', $filenamewnopath);
 		
 		if ($dumped)
 		{