sbsv2/raptor/python/plugins/filter_checkcomp.py
author timothy.murphy@nokia.com
Mon, 15 Feb 2010 11:58:10 +0000
branchfix
changeset 208 432f3175b677
parent 206 9bc64f367d8a
permissions -rw-r--r--
fix: use super() properly to ensure that these classes are initialised as expected.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
202
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     1
#
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     2
# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     3
# All rights reserved.
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     4
# This component and the accompanying materials are made available
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     6
# which accompanies this distribution, and is available
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     8
#
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
     9
# Initial Contributors:
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    11
#
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    12
# Contributors:
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    13
#
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    14
# Description: 
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    15
# Filter class for doing a Check operation but also prints component information.
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    16
#
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    17
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    18
import os
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    19
import sys
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    20
import re
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    21
import filter_interface
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    22
import filter_what
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    23
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    24
class FilterCheckComp(filter_what.FilterWhat):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    25
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    26
	def __init__(self):
208
432f3175b677 fix: use super() properly to ensure that these classes are initialised as expected.
timothy.murphy@nokia.com
parents: 206
diff changeset
    27
		super(FilterCheckComp, self).__init__()
202
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    28
		self.check = True
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    29
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    30
	def write(self, text):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    31
		"process some log text"
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    32
		ok = True
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    33
		
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    34
		for line in text.splitlines():
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    35
			ok = filter_what.FilterWhat.write(self, line)
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    36
			if not ok:
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    37
				break
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    38
		self.ok = ok
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    39
		return self.ok
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    40
	
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    41
	def start_bldinf(self, bldinf):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    42
		dir = None
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    43
		if "win" in self.buildparameters.platform:
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    44
			dir = os.path.dirname(bldinf.replace("/","\\"))
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    45
			dir = os.path.splitdrive(dir)[1]
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    46
		else:
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    47
			dir = os.path.dirname(bldinf)
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    48
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    49
		self.outfile.write("=== %s == %s\n" % (dir, dir))
203
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    50
		self.outfile.write("=== check == %s\n" % (dir))
206
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    51
		self.outfile.write("-- sbs_filter --filters=FilterCheckComp\n++ Started at Thu Feb 11 10:05:19 2010\nChdir %s\n" % dir)
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    52
202
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    53
	def end_bldinf(self):
206
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    54
		self.outfile.write("++ Finished at Thu Feb 11 10:05:20 2010\n")
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    55
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    56
	def close(self):
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    57
		self.outfile.write("++ Finished at Thu Feb 11 10:05:20 2010\n")
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    58
		self.outfile.write("=== check finished Thu Feb 11 10:05:20 2010\n")
202
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    59
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    60
	def open(self, build_parameters):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    61
		t = filter_what.FilterWhat.open(self, build_parameters)
203
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    62
		if t:
206
9bc64f367d8a fix: checkcomp filter formatting updates from Samu Sillanpaa. This is a custom filter for helium scanlog's missing files-per-component reporting.
timothy.murphy@nokia.com
parents: 203
diff changeset
    63
			self.outfile.write("\n===-------------------------------------------------\n")
203
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    64
			self.outfile.write("=== check\n")
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    65
			self.outfile.write("===-------------------------------------------------\n")
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    66
			self.outfile.write("=== check started Thu Feb 11 10:02:21 2010\n")
faed4203d5c6 Fix up file testing with checkwhatcomp and make epocroot driveletter stripping case insensitive.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents: 202
diff changeset
    67
202
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    68
		self.path_prefix_to_strip = os.path.abspath(build_parameters.epocroot)
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    69
		self.path_prefix_to_add_on = build_parameters.incoming_epocroot
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    70
		return t