Generate error and summary file even if build reports no error
authorDario Sestito <darios@symbian.org>
Wed, 22 Jul 2009 10:58:34 +0100
changeset 324 f1baeb3f075f
parent 323 5c33f37d47a4
child 325 779cc88ed845
Generate error and summary file even if build reports no error
common/tools/raptor/RaptorCommon.pm
common/tools/raptor/RaptorError.pm
--- a/common/tools/raptor/RaptorCommon.pm	Tue Jul 21 13:32:34 2009 +0100
+++ b/common/tools/raptor/RaptorCommon.pm	Wed Jul 22 10:58:34 2009 +0100
@@ -23,6 +23,17 @@
 our $SEVERITY_UNKNOWN = 'unknown';
 our $SEVERITY_CRITICAL = 'critical';
 
+sub init
+{
+	my $filename = "$::basedir/summary.csv";
+	if (!-f$filename)
+	{
+		print "Writing summary file $filename\n";
+		open(SUMMARY, ">$filename");
+		close(SUMMARY);
+	}
+}
+
 sub dump_fault
 {
 	my ($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line) = @_;
--- a/common/tools/raptor/RaptorError.pm	Tue Jul 21 13:32:34 2009 +0100
+++ b/common/tools/raptor/RaptorError.pm	Wed Jul 22 10:58:34 2009 +0100
@@ -27,6 +27,7 @@
 
 $buildlog_status->{name} = 'buildlog_status';
 $buildlog_status->{next_status} = {error=>$buildlog_error_status};
+$buildlog_status->{on_start} = 'RaptorError::on_start_buildlog';
 
 $buildlog_error_status->{name} = 'buildlog_error_status';
 $buildlog_error_status->{next_status} = {};
@@ -66,10 +67,21 @@
 	}
 }
 
+sub on_start_buildlog
+{
+	RaptorCommon::init();
+	
+	$filename = "$::basedir/errors.txt";
+	if (!-f$filename)
+	{
+		print "Writing error file $filename\n";
+		open(FILE, ">$filename");
+		close(FILE);
+	}
+}
+
 sub on_start_buildlog_error
 {
-	$filename = "$::basedir/errors.txt";
-	print "Writing error file $filename\n" if (!-f$filename);
 	open(FILE, ">>$filename");
 }