Extend UH parser to cope with tools build
authorDario Sestito <darios@symbian.org>
Mon, 28 Jun 2010 11:59:20 +0100
changeset 293 a02973783e64
parent 292 4629129243a0
child 294 60fee4a35d67
Extend UH parser to cope with tools build
uh_parser/RaptorCommon.pm
uh_parser/RaptorError.pm
uh_parser/RaptorRecipe.pm
uh_parser/RaptorUnreciped.pm
uh_parser/RaptorWarning.pm
uh_parser/uh.pl
--- a/uh_parser/RaptorCommon.pm	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/RaptorCommon.pm	Mon Jun 28 11:59:20 2010 +0100
@@ -41,4 +41,39 @@
 	close(SUMMARY);
 }
 
+sub normalize_bldinf_path
+{
+	my ($bldinfref) = @_;
+	
+	${$bldinfref} = lc(${$bldinfref});
+	${$bldinfref} =~ s,^[A-Za-z]:,,;
+	${$bldinfref} =~ s,[\\],/,g;
+}
+
+sub get_package_subpath
+{
+	my ($bldinf) = @_;
+	
+	my $package = '';
+	
+	if ($bldinf =~ m,(unknown/unknown),)
+	{
+		$package = 'unknown/unknown';
+	}
+	elsif ($bldinf =~ m,^/+?([^/]*?/[^/]*?/[^/]*?)/,)
+	{
+		$package = $1;
+	}
+	#elsif ($bldinf =~ m,^/+?([^/]*?/[^/]*?)/,)
+	#{
+	#	$package = $1;
+	#}
+	#elsif ($bldinf =~ m,^/+?([^/]*?)/,)
+	#{
+	#	$package = $1;
+	#}
+	
+	return $package;
+}
+
 1;
--- a/uh_parser/RaptorError.pm	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/RaptorError.pm	Mon Jun 28 11:59:20 2010 +0100
@@ -202,17 +202,11 @@
 	{
 		$::allbldinfs->{$raptor_error_info->{bldinf}} = 1;
     
-		# 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;
+		RaptorCommon::normalize_bldinf_path(\$raptor_error_info->{bldinf});
 		
-		if ($raptor_error_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[a-zA-Z]+),)
-		{
-			$package = $1;
-			$package =~ s,/,_,;
-		}
-		else
+		$package = RaptorCommon::get_package_subpath($raptor_error_info->{bldinf});
+		$package =~ s,/,_,g;
+		if (!$package)
 		{
 			print "WARNING: can't understand bldinf attribute of raptor error: $raptor_error_info->{bldinf}. Won't associate to package.\n";
 		}
--- a/uh_parser/RaptorRecipe.pm	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/RaptorRecipe.pm	Mon Jun 28 11:59:20 2010 +0100
@@ -268,18 +268,12 @@
 	if ($recipe_info->{exit} =~ /failed/i || $recipe_info->{exit} =~ /retry/i && $recipe_info->{forcesuccess} =~ /FORCESUCCESS/i)
 	{
 		#print "2 normalizing bldinf: $recipe_info->{bldinf} \n";
-		# normalize bldinf path
-		$recipe_info->{bldinf} = lc($recipe_info->{bldinf});
-		$recipe_info->{bldinf} =~ s,^[A-Za-z]:,,;
-		$recipe_info->{bldinf} =~ s,[\\],/,g;
+		RaptorCommon::normalize_bldinf_path(\$recipe_info->{bldinf});
 		
 		my $package = '';
-		if ($recipe_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[a-zA-Z]+),)
-		{
-			$package = $1;
-			$package =~ s,/,_,;
-		}
-		else
+		$package = RaptorCommon::get_package_subpath($recipe_info->{bldinf});
+		$package =~ s,/,_,g;
+		if (!$package)
 		{
 			#print "WARNING: can't understand bldinf attribute of recipe: $recipe_info->{bldinf}. Won't dump to failed recipes file.\n";
 			$package = 'unknown_unknown';
--- a/uh_parser/RaptorUnreciped.pm	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/RaptorUnreciped.pm	Mon Jun 28 11:59:20 2010 +0100
@@ -178,16 +178,10 @@
 		{
 			$::allbldinfs->{$guessed_bldinf} = 1;
 			
-			# normalize bldinf path
-			$guessed_bldinf = lc($guessed_bldinf);
-			$guessed_bldinf =~ s,^[A-Za-z]:,,;
-			$guessed_bldinf =~ s,[\\],/,g;
+			RaptorCommon::normalize_bldinf_path(\$guessed_bldinf);
 			
-			if ($guessed_bldinf =~ m,/((os|mw|app|tools|ostools|adaptation)/[a-zA-Z]+),)
-			{
-				$package = $1;
-				$package =~ s,/,_,;
-			}
+			$package = RaptorCommon::get_package_subpath($guessed_bldinf);
+			$package =~ s,/,_,g;
 		}
 			
 		if ($line =~ m,[^\s^\r^\n],)
--- a/uh_parser/RaptorWarning.pm	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/RaptorWarning.pm	Mon Jun 28 11:59:20 2010 +0100
@@ -132,17 +132,11 @@
 	{
 		$::allbldinfs->{$raptor_warning_info->{bldinf}} = 1;
 		
-		# normalize bldinf path
-		$raptor_warning_info->{bldinf} = lc($raptor_warning_info->{bldinf});
-		$raptor_warning_info->{bldinf} =~ s,^[A-Za-z]:,,;
-		$raptor_warning_info->{bldinf} =~ s,[\\],/,g;
+		RaptorCommon::normalize_bldinf_path(\$raptor_warning_info->{bldinf});
 		
-		if ($raptor_warning_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[a-zA-Z]+),)
-		{
-			$package = $1;
-			$package =~ s,/,_,;
-		}
-		else
+		$package = RaptorCommon::get_package_subpath($raptor_warning_info->{bldinf});
+		$package =~ s,/,_,g;
+		if (!$package)
 		{
 			print "WARNING: can't understand bldinf attribute of raptor warning: $raptor_warning_info->{bldinf}. Won't associate to package.\n";
 		}
--- a/uh_parser/uh.pl	Tue Jun 22 10:59:48 2010 +0100
+++ b/uh_parser/uh.pl	Mon Jun 28 11:59:20 2010 +0100
@@ -185,11 +185,8 @@
 		}
 		if ($failure->{component})
 		{
-			if ($failure->{component} =~ m,/((os|mw|app|tools|ostools|adaptation|unknown)/[a-zA-Z]+),)
-			{
-				$failure_package = $1;
-			}
-			else
+			$failure_package = RaptorCommon::get_package_subpath($failure->{component});
+			if (!$failure_package)
 			{
 				print "WARNING: summary line with wrong component path at $csv_file line $csv_linenum. Skipping\n";
 				next;
@@ -295,7 +292,7 @@
 	if ($mustlink)
 	{
 		my $packagesummaryhtml = $package;
-		$packagesummaryhtml =~ s,/,_,;
+		$packagesummaryhtml =~ s,/,_,g;
 		$packagesummaryhtml .= ".html";
 		my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
 		for (@severities)
@@ -337,8 +334,8 @@
 {
 	my ($category, $failures_by_severity) = @_;
 	
-	my $filenamebase = $category;
-	$filenamebase =~ s,/,_,;
+	my $filenamebase = $category; 
+	$filenamebase =~ s,/,_,g;
 	
 	open(SPECIFIC, ">$outputdir/$filenamebase.html");
 	print SPECIFIC "FAILURES FOR CATEGORY $category<br/>\n";
@@ -376,8 +373,8 @@
 	
 	my $anyfailures = 0;
 	
-	my $filenamebase = $package;
-	$filenamebase =~ s,/,_,;
+	my $filenamebase = $package; 
+	$filenamebase =~ s,/,_,g;
 	
 	if (defined $recipe_failures_by_package_severity->{$package})
 	{
@@ -422,7 +419,7 @@
 		$missing_by_package->{$package} = 0;
 		
 		my $missinglistfile = $package;
-		$missinglistfile =~ s,/,_,;
+		$missinglistfile =~ s,/,_,g;
 		$missinglistfile .= "_missing.txt";
 		if (open(MISSINGLIST, "$::raptorbitsdir/$missinglistfile"))
 		{
@@ -507,17 +504,13 @@
 	
 	for my $bldinf (keys %{$allbldinfs})
 	{
-		# normalize bldinf path
-		$bldinf = lc($bldinf);
-		$bldinf =~ s,^[A-Za-z]:,,;
-		$bldinf =~ s,[\\],/,g;
+		RaptorCommon::normalize_bldinf_path(\$bldinf);
 		
 		my $package = '';
-		if ($bldinf =~ m,/((os|mw|app|tools|ostools|adaptation|unknown)/[a-zA-Z]+),)
-		{
-			$package = $1;
-		}
-		else
+		print "bldinf: $bldinf\n";
+		$package = RaptorCommon::get_package_subpath($bldinf);
+		print "package: $package\n";
+		if (!$package)
 		{
 			print "WARNING: can't understand bldinf attribute of recipe: $bldinf. Won't dump to failed recipes file.\n";
 		}