uh_parser/RaptorWarning.pm
changeset 228 ba90e30c0f3c
parent 186 b76adfbc6648
child 229 6669177dab54
equal deleted inserted replaced
227:2101b329ee80 228:ba90e30c0f3c
    34 $buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning';
    34 $buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning';
    35 $buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning';
    35 $buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning';
    36 $buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning';
    36 $buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning';
    37 
    37 
    38 my $filename = '';
    38 my $filename = '';
       
    39 
       
    40 my $raptor_warning_info = {};
    39 
    41 
    40 my $characters = '';
    42 my $characters = '';
    41 
    43 
    42 my $CATEGORY_RAPTORWARNING = 'raptor_warning';
    44 my $CATEGORY_RAPTORWARNING = 'raptor_warning';
    43 my $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode';
    45 my $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode';
    74 }
    76 }
    75 
    77 
    76 sub on_start_buildlog
    78 sub on_start_buildlog
    77 {
    79 {
    78 	RaptorCommon::init();
    80 	RaptorCommon::init();
    79 	
       
    80 	$filename = "$::raptorbitsdir/raptor_warning.txt";
       
    81 	if (!-f$filename)
       
    82 	{
       
    83 		print "Writing warnings file $filename\n";
       
    84 		open(FILE, ">$filename");
       
    85 		close(FILE);
       
    86 	}
       
    87 }
    81 }
       
    82 
    88 sub on_start_buildlog_warning
    83 sub on_start_buildlog_warning
    89 {
    84 {
    90 	open(FILE, ">>$filename");
    85 	my ($el) = @_;
       
    86 	
       
    87 	$raptor_warning_info = {};
       
    88 	
       
    89 	my $attributes = $el->{Attributes};
       
    90 	for (keys %{$attributes})
       
    91 	{
       
    92 		$raptor_warning_info->{$attributes->{$_}->{'LocalName'}} = $attributes->{$_}->{'Value'};
       
    93 		#print "$_ -> $attributes->{$_}->{'Value'}\n";
       
    94 	}
    91 }
    95 }
    92 
    96 
    93 sub on_chars_buildlog_warning
    97 sub on_chars_buildlog_warning
    94 {
    98 {
    95 	my ($ch) = @_;
    99 	my ($ch) = @_;
   103 
   107 
   104 sub on_end_buildlog_warning
   108 sub on_end_buildlog_warning
   105 {
   109 {
   106 	#print "on_end_buildlog_warning\n";
   110 	#print "on_end_buildlog_warning\n";
   107 	
   111 	
       
   112 	my $package = '';
       
   113 	if ($raptor_warning_info->{bldinf})
       
   114 	{
       
   115 		$::allbldinfs->{$raptor_warning_info->{bldinf}} = 1;
       
   116 		
       
   117 		# normalize bldinf path
       
   118 		$raptor_warning_info->{bldinf} = lc($raptor_warning_info->{bldinf});
       
   119 		$raptor_warning_info->{bldinf} =~ s,^[A-Za-z]:,,;
       
   120 		$raptor_warning_info->{bldinf} =~ s,[\\],/,g;
       
   121 		
       
   122 		if ($raptor_warning_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
       
   123 		{
       
   124 			$package = $1;
       
   125 			$package =~ s,/,_,;
       
   126 		}
       
   127 		else
       
   128 		{
       
   129 			print "WARNING: can't understand bldinf attribute of raptor warning: $raptor_warning_info->{bldinf}. Won't associate to package.\n";
       
   130 		}
       
   131 	}
       
   132 	
   108 	$characters =~ s,^[\r\n]*,,;
   133 	$characters =~ s,^[\r\n]*,,;
   109 	$characters =~ s,[\r\n]*$,,;
   134 	$characters =~ s,[\r\n]*$,,;
   110 	
   135 	
   111 	if ($characters =~ m,[^\s^\r^\n],)
   136 	if ($characters =~ m,[^\s^\r^\n],)
   112 	{
   137 	{
   113 		my $dumped = process($characters, $::current_log_file, '', '', '', '', "raptor_warning.txt");
   138 		my $bldinf_field = '';
       
   139 		if ($package)
       
   140 		{
       
   141 			$filename = "$::raptorbitsdir/$package.txt";
       
   142 			$bldinf_field = $raptor_warning_info->{bldinf};
       
   143 		}
       
   144 		else
       
   145 		{
       
   146 			$filename = "$::raptorbitsdir/raptor_warning.txt";
       
   147 		}
       
   148 		
       
   149 		if (!-f$filename)
       
   150 		{
       
   151 			print "Writing file $filename\n";
       
   152 			open(FILE, ">$filename");
       
   153 			close(FILE);
       
   154 		}
       
   155 		
       
   156 		my $dumped = process($characters, $::current_log_file, $bldinf_field, '', '', '', "$package.txt");
   114 		
   157 		
   115 		if ($dumped)
   158 		if ($dumped)
   116 		{
   159 		{
   117 			open(FILE, ">>$filename");
   160 			open(FILE, ">>$filename");
   118 			print FILE "---failure_item_$::failure_item_number\---\n";
   161 			print FILE "---failure_item_$::failure_item_number\---\n";