sbsv1/abld/platform/fcloggerutl.pm
author jjkang
Wed, 30 Jun 2010 11:35:58 +0800
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Merge missed changeset 11 (raptor v2.14 and helium 10.0)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# FC_LOGGER.PM
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
package FCLoggerUTL;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
	PMCheckFCLoggerVersion
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
#Function Call Logger
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
sub PMCheckFCLoggerVersion() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	my $exe=$ENV{EPOCROOT}."epoc32\\tools\\fc_logger\\edgcpfe.exe";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	#Check if file exists
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	if (not -e $exe) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
		print "WARNING: File doesn't exist $exe \n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
		return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
	open FCLPIPE, "$exe -v 2>&1 |";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
	# Read all output from file into array
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
	my @lines=<FCLPIPE>;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
	chomp @lines;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	# combine into single string with each line starting with a :
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
	my $line=join(":", "", @lines);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
	close FCLPIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	if ($line =~ m/version\s([0-9\.]+)/) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
		my $Version      = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
		$Version		 =~ m/(\d+)\.(\d+)\.?([\d+])?/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
		my $MajorVersion = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
		my $MinorVersion = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
		my $PatchLevel   = $3;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
		if ($MajorVersion<3 or $MinorVersion<7) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
			print "WARNING: $exe version is less than 3.7.1. The -logfc option will be ignored.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
			return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
	return 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
}