sbsv2/raptor/python/plugins/filter_checkcomp.py
author timothy.murphy@nokia.com
Thu, 11 Feb 2010 10:08:31 +0200
branchfix
changeset 202 5ec640568a23
child 203 faed4203d5c6
permissions -rw-r--r--
FilterCheckComp - checking file existence by component
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):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    27
		super(filter_what.FilterWhat, self).__init__()
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))
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    50
		self.outfile.write("-- abld -w \nChdir %s \n++ Started at\n" % dir)
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    51
		
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    52
	def end_bldinf(self):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    53
		self.outfile.write("++ Finished at\n")
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    54
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    55
	def open(self, build_parameters):
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    56
		t = filter_what.FilterWhat.open(self, build_parameters)
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    57
		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
    58
		self.path_prefix_to_add_on = build_parameters.incoming_epocroot
5ec640568a23 FilterCheckComp - checking file existence by component
timothy.murphy@nokia.com
parents:
diff changeset
    59
		return t