uh_parser/RaptorRecipe.pm
changeset 186 b76adfbc6648
parent 184 38468523076d
child 191 890789575604
equal deleted inserted replaced
185:978ef35b4e5f 186:b76adfbc6648
    41 $buildlog_recipe_status_status->{next_status} = {};
    41 $buildlog_recipe_status_status->{next_status} = {};
    42 $buildlog_recipe_status_status->{on_start} = 'RaptorRecipe::on_start_buildlog_recipe_status';
    42 $buildlog_recipe_status_status->{on_start} = 'RaptorRecipe::on_start_buildlog_recipe_status';
    43 
    43 
    44 
    44 
    45 my $filename = '';
    45 my $filename = '';
    46 my $failure_item = 0;
       
    47 
    46 
    48 my $recipe_info = {};
    47 my $recipe_info = {};
    49 
    48 
    50 my $characters = '';
    49 my $characters = '';
    51 
    50 
    68 my $mmp_with_issues = {};
    67 my $mmp_with_issues = {};
    69 
    68 
    70 
    69 
    71 sub process
    70 sub process
    72 {
    71 {
    73 	my ($text, $config, $component, $mmp, $phase, $recipe, $file, $line) = @_;
    72 	my ($text, $config, $component, $mmp, $phase, $recipe, $file) = @_;
       
    73 	
       
    74 	my $dumped = 1;
    74 	
    75 	
    75 	my $category = $CATEGORY_RECIPEFAILURE;
    76 	my $category = $CATEGORY_RECIPEFAILURE;
    76 	my $severity = '';
    77 	my $severity = '';
    77 	my $subcategory = '';
    78 	my $subcategory = '';
    78 	
    79 	
    95 	
    96 	
    96 	
    97 	
    97 	if ($text =~ m,Error:  #5: cannot open source input file .*: No such file or directory,)
    98 	if ($text =~ m,Error:  #5: cannot open source input file .*: No such file or directory,)
    98 	{
    99 	{
    99 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CANNOTOPENSOURCEINPUTFILE;
   100 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CANNOTOPENSOURCEINPUTFILE;
   100 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   101 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   101 	}
   102 	}
   102 	elsif ($text =~ m,Fatal error: L6002U: Could not open file .*: No such file or directory,)
   103 	elsif ($text =~ m,Fatal error: L6002U: Could not open file .*: No such file or directory,)
   103 	{
   104 	{
   104 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMLINK_COULDNOTOPENFILE;
   105 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMLINK_COULDNOTOPENFILE;
   105 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   106 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   106 	}
   107 	}
   107 	elsif ($text =~ m,elf2e32 : Error: E1001: Could not open file : .*.,)
   108 	elsif ($text =~ m,elf2e32 : Error: E1001: Could not open file : .*.,)
   108 	{
   109 	{
   109 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_COULDNOTOPENFILE;
   110 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_COULDNOTOPENFILE;
   110 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   111 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   111 	}
   112 	}
   112 	elsif ($text =~ m,elf2e32 : Error: E1036: Symbol .* Missing from ELF File,)
   113 	elsif ($text =~ m,elf2e32 : Error: E1036: Symbol .* Missing from ELF File,)
   113 	{
   114 	{
   114 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE;
   115 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE;
   115 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   116 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   116 	}
   117 	}
   117 	elsif ($text =~ m,Error: L6833E: File '.*' does not exist,)
   118 	elsif ($text =~ m,Error: L6833E: File '.*' does not exist,)
   118 	{
   119 	{
   119 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMAR_FILEDOESNOTEXIST;
   120 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMAR_FILEDOESNOTEXIST;
   120 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   121 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   121 	}
   122 	}
   122 	elsif ($text =~ m,: Warning:  #236-D: controlling expression is constant,)
   123 	elsif ($text =~ m,: Warning:  #236-D: controlling expression is constant,)
   123 	{
   124 	{
   124 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT;
   125 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT;
   125 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   126 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   126 	}
   127 	}
   127 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Internal fault: ,)
   128 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Internal fault: ,)
   128 	{
   129 	{
   129 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT;
   130 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT;
   130 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   131 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   131 	}
   132 	}
   132 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Error:  #655-D: the modifier ".*" is not allowed on this declaration,)
   133 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Error:  #655-D: the modifier ".*" is not allowed on this declaration,)
   133 	{
   134 	{
   134 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_MODIFIERNOTALLOWED;
   135 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_MODIFIERNOTALLOWED;
   135 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   136 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   136 	}
   137 	}
   137 	elsif ($text =~ m,^\+.*/make.exe .*\n/bin/sh: .*: command not found,m)
   138 	elsif ($text =~ m,^\+.*/make.exe .*\n/bin/sh: .*: command not found,m)
   138 	{
   139 	{
   139 		$severity = $RaptorCommon::SEVERITY_CRITICAL;
   140 		$severity = $RaptorCommon::SEVERITY_CRITICAL;
   140 		my $subcategory = $CATEGORY_RECIPEFAILURE_BINSH_COMMANDNOTFOUND;
   141 		my $subcategory = $CATEGORY_RECIPEFAILURE_BINSH_COMMANDNOTFOUND;
   141 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   142 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   142 	}
   143 	}
   143 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-as\.exe .*^Error: .*,ms)
   144 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-as\.exe .*^Error: .*,ms)
   144 	{
   145 	{
   145 		my $subcategory = $CATEGORY_RECIPEFAILURE_AS_ERROR;
   146 		my $subcategory = $CATEGORY_RECIPEFAILURE_AS_ERROR;
   146 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   147 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   147 	}
   148 	}
   148 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-g\+\+\.exe .*:\d+: [Ee]rror: .*,ms)
   149 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-g\+\+\.exe .*:\d+: [Ee]rror: .*,ms)
   149 	{
   150 	{
   150 		my $subcategory = $CATEGORY_RECIPEFAILURE_GPP_ERROR;
   151 		my $subcategory = $CATEGORY_RECIPEFAILURE_GPP_ERROR;
   151 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   152 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   152 	}
   153 	}
   153 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-g\+\+\.exe .*:\d+: [Ww]arning: .*,ms)
   154 	elsif ($text =~ m,^\+.*/arm-none-symbianelf-g\+\+\.exe .*:\d+: [Ww]arning: .*,ms)
   154 	{
   155 	{
   155 		my $subcategory = $CATEGORY_RECIPEFAILURE_GPP_WARNING;
   156 		my $subcategory = $CATEGORY_RECIPEFAILURE_GPP_WARNING;
   156 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   157 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   157 	}
   158 	}
   158 	# the following captures generic armcc error/warnings, not captured by regexps above
   159 	# the following captures generic armcc error/warnings, not captured by regexps above
   159 	elsif ($text =~ m,/armcc.exe , and $text =~ m,: \d+ warnings\, \d+ errors$,)
   160 	elsif ($text =~ m,/armcc.exe , and $text =~ m,: \d+ warnings\, \d+ errors$,)
   160 	{
   161 	{
   161 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS;
   162 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS;
   162 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   163 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   163 	}
   164 	}
   164 	elsif ($text =~ m,mwccsym2.exe , and $text =~ m,: the file '.*' cannot be opened,)
   165 	elsif ($text =~ m,mwccsym2.exe , and $text =~ m,: the file '.*' cannot be opened,)
   165 	{
   166 	{
   166 		my $subcategory = $CATEGORY_RECIPEFAILURE_MWCCSYM2_FILECANNOTBEOPENED;
   167 		my $subcategory = $CATEGORY_RECIPEFAILURE_MWCCSYM2_FILECANNOTBEOPENED;
   167 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   168 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   168 	}
   169 	}
   169 	else # log everything by default
   170 	else # log everything by default
   170 	{
   171 	{
   171 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   172 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file);
   172 	}
   173 	}
       
   174 	
       
   175 	return $dumped;
   173 }
   176 }
   174 
   177 
   175 sub on_start_buildlog
   178 sub on_start_buildlog
   176 {
   179 {
   177 	#print FILE "line,layer,component,name,armlicence,platform,phase,code,bldinf,mmp,target,source,\n";
   180 	#print FILE "line,layer,component,name,armlicence,platform,phase,code,bldinf,mmp,target,source,\n";
   269 				print "Writing recipe file $filename\n";
   272 				print "Writing recipe file $filename\n";
   270 				open(FILE, ">$filename");
   273 				open(FILE, ">$filename");
   271 				close(FILE);
   274 				close(FILE);
   272 			}
   275 			}
   273 			
   276 			
   274 			if ($failure_item == 0 and -f "$filename")
   277 			my $dumped = process($characters, $recipe_info->{config}, $recipe_info->{bldinf}, $recipe_info->{mmp}, $recipe_info->{phase}, $recipe_info->{name}, "$package.txt");
       
   278 			
       
   279 			if ($dumped)
   275 			{
   280 			{
   276 				open(FILE, "$filename");
   281 				open(FILE, ">>$filename");
   277 				{
   282 				print FILE "---failure_item_$::failure_item_number\---\n";
   278 					local $/ = undef;
   283 				print FILE "$characters\n\n";
   279 					my $filecontent = <FILE>;
       
   280 					$failure_item = $1 if ($filecontent =~ m/.*---failure_item_(\d+)/s);
       
   281 				}
       
   282 				close(FILE);
   284 				close(FILE);
   283 			}
   285 			}
   284 			
   286 		}
   285 			$failure_item++;
       
   286 			
       
   287 			open(FILE, ">>$filename");
       
   288 			print FILE "---failure_item_$failure_item\---\n";
       
   289 			print FILE "$characters\n\n";
       
   290 			close(FILE);
       
   291 		}
       
   292 		
       
   293 		process($characters, $recipe_info->{config}, $recipe_info->{bldinf}, $recipe_info->{mmp}, $recipe_info->{phase}, $recipe_info->{name}, "$package.txt", $failure_item);
       
   294 	}
   287 	}
   295 
   288 
   296 	$characters = '';
   289 	$characters = '';
   297 }
   290 }
   298 
   291