sbsv1/abld/e32util/fixsource.bat
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
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
@rem All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
@rem This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
@rem under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
@rem which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
@rem Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
@rem Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
@rem Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
@rem Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
@rem = '--*-Perl-*--
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
@echo off
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
if "%OS%" == "Windows_NT" goto WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
:WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
perl -x -S "%0" %*
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
@rem ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
#!perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
#line 14
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
use Getopt::Long;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
use File::Spec;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
use File::Copy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
use File::Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
use File::Basename;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
my $toolVersion = "2.1";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
# Example warnings:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
# Incorrect slash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
#	\src\common\generic\comms-infras\commsfw\group\bld.inf:10: Incorrect slash in PRJ_EXPORTS - '..\inc\commschan.h'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
#	\src\cedar\generic\base\f32\group\ecomp.mmp:14: Incorrect slash in SYSTEMINCLUDE - '..\inc'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
#	\src\common\generic\syncml\framework\TransportProvision\HttpWsp\SmlHttpBase.cpp:13: Incorrect slash in #include - 'http\rhttpheaders.h'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
# Incorrect case for epoc32 tree
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
#	\src\common\generic\syslibs\pwrcli\group\bld.inf:23: Incorrect case for epoc32 tree in PRJ_EXPORTS - '\epoc32\rom\include\PwrCli.IBY'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
#	\src\common\generic\security\crypto\group\hash.mmp:8: Incorrect case for epoc32 tree in TARGET - 'hash.DLL'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
#	\src\common\generic\syslibs\ecom\ongoing\Framework\frame\Discoverer.cpp:20: Incorrect case for epoc32 tree in #include - 'BaSPI.h'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
# Incorrect case versus filesystem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
#	\src\common\generic\comms-infras\commdb\commdbshim\group\BLD.INF:20: Incorrect case versus filesystem in PRJ_EXPORTS - '..\inc\cdblen.h' vs. \src\common\generic\comms-infras\commdb\commdbshim\INC\CDBLEN.H.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
#	\src\common\generic\syslibs\ecom\ongoing\Framework\MMPFiles\EComServer.mmp:45: Incorrect case versus filesystem in USERINCLUDE - '..\..\framework\inc' vs. \src\common\generic\syslibs\ecom\ongoing\Framework\inc.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
#	\src\common\generic\comms-infras\commdb\commdbshim\INC\CDBOVER.H:16: Incorrect case versus filesystem in #include - 'cdbpreftable.h' vs. \src\common\generic\comms-infras\commdb\commdbshim\INC\CDBPREFTABLE.H.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
# Incorrect case for epoc32 tree from default export (i.e. source export case will replicated under \epoc32)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
#	\src\common\generic\application-protocols\http\group\bld.inf:22: Incorrect case for epoc32 tree from default export in PRJ_EXPORTS - '..\inc\HTTPSocketConstants.h'.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
#	\src\common\generic\messaging\email\smtpservermtm\group\bld.inf:11: Incorrect case for epoc32 tree from default export in PRJ_EXPORTS - '..\inc\smts.h' vs. \src\common\generic\messaging\email\smtpservermtm\inc\SMTS.H.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
# Incorrect case versus exclusion list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
#	\src\common\generic\Multimedia\openmax\group\bld.inf:14: Incorrect case versus exclusion list in PRJ_EXPORTS - '\epoc32\include\openmax\il\OMX_Types.h' vs. OMX_TYPES.H.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
#	\src\common\generic\Multimedia\openmax\inc\openmax\il\OMX_Audio.h:41: Incorrect case versus exclusion list in #include - 'OMX_Types.h' vs. OMX_TYPES.H.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
# Can't find physical file match for
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
#	\src\common\generic\app-framework\conarc\group\BLD.INF:48: Can't find physical file match for PRJ_TESTMMPFILES MMP - '..\tsrc\tcon3_V2.mpp' on filesystem.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
# 1. Check arguments, output help etc.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
my $analyse = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
my $list = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
my $update = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
my $warnings = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
my $verbose = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
my $debug = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
my $debugUpdate = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
GetOptions ('analyse|a' => \$analyse, 'list|l' => \$list, 'update|u' => \$update, 'warnings|w=s' => \$warnings,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
			'verbose|v' => \$verbose, 'debug|d' => \$debug, 'debugupdate|du' => \$debugUpdate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
if (@ARGV == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
	print (STDERR "\nFIXSOURCE.BAT - Version $toolVersion\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	print STDERR << 'END_OF_HELP';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
Usage: fixsource.bat -analyse|-list|-update|-warnings buildlog_1.log [buildlog_n.log] 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
Parses the output from the specified build logs to locate warnings produced via
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
"abld -checksource".  Provides the option to update source automatically to comply
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
with Symbian's Filename Policy.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
-analyse | -a	             List and describe all warnings that cannot be addressed
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
                             by this tool.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
-list    | -l	             List all source files that can be updated by this tool
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
                             using "-update".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
-update  | -u	             Update source files, as output by "-list", to comply with
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
                             Symbian's Filename Policy.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
-warnings| -w [all|fixable]  Output all unique "-checksource" warnings present in the
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
                             specified logs:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
                                all     - every warning, regardless of whether this
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
                                          tool can fix them.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
                                fixable - only warnings that this tool can fix.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
-verbose | -v                Additional verbose output for the "-update" option.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
NOTES:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
* The tool assumes that the original build source and layout is present on the drive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
  where it is being executed.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
* With the exception of the "-warnings all" output, any warnings for files under the
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
  known release and build locations of %EPOCROOT%epoc32\include and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
  %EPOCROOT%epoc32\build are discarded by default.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
END_OF_HELP
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
# 2. Parse the logs storing all GNU format warnings and errors
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
my %ActionableFilenamePolicyWarnings;	# Hash Key (filename)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
										#	Hash Key (line number)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
										#		Hash Key (problematic text)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
										#			Hash Key ORIGINAL_WARNINGS
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
										#				Hash Key (original warning)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
										#					1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
										#			Hash Key ITEM
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
										#				item type that has generated the warning
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
										#			Hash Key SEARCH_TEXT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
										#				quotemeta version of problematic text
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
										#			Hash Key UNIX_SLASH
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
										#				1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
										#			Hash Key LOWERCASE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
										#				1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
										#			Hash Key PHYSICAL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
										#				1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
										#			Hash Key EXCLUSION
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
										#				1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
										#			Hash Key PHYSICAL_REALITY
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
										#				Hash Key (physical reality)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
										#					1
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
										#				fully pathed filesystem reality used in physical checking
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
										#			Hash Key EXCLUSION_LISTING
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
										#				required format of reference as dictated from an exclusion list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
										#			Hash Key ACTUAL_TEST
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
										#				test used for check when this differed from that in actual source
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
										#			Hash Key DEFAULT_EXPORT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
										#				special case - a PRJ_EXPORTS line without a destination will break
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
										#				the filename policy if the source line is not lowercase
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
my %NonActionableFilenamePolicyWarnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
my %AllFilenamePolicyWarnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
my %OtherWarningsAndErrors;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
foreach my $BUILD_LOG (@ARGV)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
	open BUILD_LOG, "< $BUILD_LOG" or die "\nCannot read \"$BUILD_LOG\"!\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
	while (<BUILD_LOG>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
		chomp;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
		if (/^\\\S+:.*: .+$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
			if (!/:\d+: (Incorrect case|Incorrect slash|Can\'t find) /)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
				$OtherWarningsAndErrors{$_} = 1 if (!/(unresolved api-item|unknown base class|unresolved xref|no image file|xm-replace_text)/);	# Ignore the noise of doc stuff...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
				next;					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
			$AllFilenamePolicyWarnings{$_} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
			if (/: Can\'t find /)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
				$NonActionableFilenamePolicyWarnings{$_} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
				next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
			my $originalWarning = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
			/(^.*):(\d+): Incorrect (case for epoc32 tree|case versus filesystem|case versus exclusion list|slash|case for epoc32 tree from default export) in (.+) - \'(.+?)\'/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
			my $filename = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
			my $lineNumber = $2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
			my $type = $3;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
			my $item = $4;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
			my $problematicText = $5;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
			$type =~ s/case for epoc32 tree from default export/defaultexport/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
			$type =~ s/case for epoc32 tree/lowercase/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
			$type =~ s/case versus filesystem/physical/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
			$type =~ s/case versus exclusion list/exclusion/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
			my $actualTest = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
			my $physicalReality = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
			my $exclusionListing = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
			$actualTest = $1 if (/\(actual test \'(.*)\'\)/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
			if (/ vs\. (.*)\./)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
				$physicalReality = $1 if ($type eq "physical");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
				$exclusionListing = $1 if ($type eq "exclusion");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
			if ($debug)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
				print ("ORIGINAL WARNING   : $originalWarning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
				print ("FILENAME           : $filename\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
				print ("LINENUMBER         : $lineNumber\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
				print ("TYPE               : $type\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
				print ("ITEM               : $item\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
				print ("PROBLEMATIC TEXT   : $problematicText\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
				print ("ACTUAL TEST        : $actualTest\n") if ($actualTest);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
				print ("PHYSICAL REALITY   : $physicalReality\n") if ($physicalReality);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
				print ("EXCLUSION LISTING  : $exclusionListing\n") if ($exclusionListing); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
				print ("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
			next if ($warnings =~ /all/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	# Line Number
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
			my $lineNumberHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
			if ($ActionableFilenamePolicyWarnings{$filename})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
				$lineNumberHashRef = $ActionableFilenamePolicyWarnings{$filename};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
				my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
				$lineNumberHashRef = \%newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
				$ActionableFilenamePolicyWarnings{$filename} = $lineNumberHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
	# Problematic Text
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
			my $problematicTextHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
			if ($lineNumberHashRef->{$lineNumber})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
				$problematicTextHashRef = $lineNumberHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
				my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
				$problematicTextHashRef = \%newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
				$lineNumberHashRef->{$lineNumber} = $problematicTextHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	# Attributes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
			my $attributesHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
			if ($problematicTextHashRef->{$problematicText})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
				$attributesHashRef = $problematicTextHashRef->{$problematicText};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
				my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
				$attributesHashRef = \%newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
				$problematicTextHashRef->{$problematicText} = $attributesHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
	# Attributes : Original Warnings
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
			my $originalWarningsHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
			if ($attributesHashRef->{ORIGINAL_WARNINGS})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
				$originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
				my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
				$originalWarningsHashRef = \%newHash;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
				$attributesHashRef->{ORIGINAL_WARNINGS} = $originalWarningsHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
			$originalWarningsHashRef->{$originalWarning} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
	# Attributes : Item
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
			$attributesHashRef->{ITEM} = $item;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
	# Attributes : Search Text
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
			$attributesHashRef->{SEARCH_TEXT} = quotemeta ($problematicText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
	# Attributes : Unix Slash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
			$attributesHashRef->{UNIX_SLASH} = 1 if ($type eq "slash");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
	# Attributes : Lowercase
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
			$attributesHashRef->{LOWERCASE} = 1 if ($type eq "lowercase");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
	# Attributes : Physical
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
			$attributesHashRef->{PHYSICAL} = 1 if ($type eq "physical");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	# Attributes : Exclusion
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
			$attributesHashRef->{EXCLUSION} = 1 if ($type eq "exclusion");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
	# Attributes : Physical Reality
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
			my $physicalRealityHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
			if ($physicalReality)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
				if ($attributesHashRef->{PHYSICAL_REALITY})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
					$physicalRealityHashRef = $attributesHashRef->{PHYSICAL_REALITY};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
				else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
					my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
					$physicalRealityHashRef = \%newHash;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
					$attributesHashRef->{PHYSICAL_REALITY} = $physicalRealityHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
				$physicalRealityHashRef->{$physicalReality} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
	# Attributes : Actual Test
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
			$attributesHashRef->{ACTUAL_TEST} = $actualTest if ($actualTest);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
	# Attributes : Exclusion Listing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
			$attributesHashRef->{EXCLUSION_LISTING} = $exclusionListing if ($exclusionListing);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
	# Attributes : Default Export
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
			$attributesHashRef->{DEFAULT_EXPORT} = 1 if ($type eq "defaultexport");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	close BUILD_LOG;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
# 3. Examine source and warnings and compile lists of files and warnings that we can/can't do anything about
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
my %WarningsNotMatchingSource;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
my %WarningsWithMissingFiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
my %WarningsForBothLowercaseAndPhysicalOnSameReference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
my %WarningsForMultiplePhysicalUpdates;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
if ($analyse || $list || $update || $debugUpdate || $warnings =~ /^fixable$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
	foreach my $SOURCE_FILE (sort keys %ActionableFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
	# Discard anything in known release locations
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
		if ($SOURCE_FILE =~ /\\epoc32\\(include|build)\\/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
			delete ($ActionableFilenamePolicyWarnings{$SOURCE_FILE});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
		my $lineNumbersHashRef = $ActionableFilenamePolicyWarnings{$SOURCE_FILE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
	# Discard warnings where source files cannot be found
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
		if (!(open SOURCE_FILE, "< $SOURCE_FILE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
			foreach my $lineNumber (sort keys (%$lineNumbersHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
				my $problematicTextHashRef = $lineNumbersHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
				foreach my $problematicText (sort keys (%$problematicTextHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
					my $attributesHashRef = $problematicTextHashRef->{$problematicText};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
					my $originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
					foreach my $originalWarning (keys (%$originalWarningsHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
						$WarningsWithMissingFiles{$originalWarning} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
						}					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
			delete ($ActionableFilenamePolicyWarnings{$SOURCE_FILE});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
	# Identify and discard warnings where, for the same reference:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
	# (a) both lowercase and physical warnings are flagged and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
	# (b) multiple, different, filesystem matches have been found
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
	# These will need to be resolved manually
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
		foreach my $lineNumber (sort keys (%$lineNumbersHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
			my $problematicTextHashRef = $lineNumbersHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
			foreach my $problematicText (sort keys (%$problematicTextHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
				my $attributesHashRef = $problematicTextHashRef->{$problematicText};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
				my $originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
				my $skipPhysicalUpdate = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
				my $skipLowercaseUpdate = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
				if ($attributesHashRef->{LOWERCASE} && $attributesHashRef->{PHYSICAL})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
					$skipPhysicalUpdate = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
					$skipLowercaseUpdate = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
					foreach my $originalWarning (keys %{$originalWarningsHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
						next if ($originalWarning !~ /Incorrect case/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
						$originalWarning =~ /\:(.*$)/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
						my $lowercaseAndPhysicalWarningsHashRef;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
						if ($WarningsForBothLowercaseAndPhysicalOnSameReference{$SOURCE_FILE})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
							$lowercaseAndPhysicalWarningsHashRef = $WarningsForBothLowercaseAndPhysicalOnSameReference{$SOURCE_FILE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
							my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
							$lowercaseAndPhysicalWarningsHashRef = \%newHash;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
							$WarningsForBothLowercaseAndPhysicalOnSameReference{$SOURCE_FILE} = $lowercaseAndPhysicalWarningsHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
						$lowercaseAndPhysicalWarningsHashRef->{$1} = 1;						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
				my $physicalRealityHashRef = $attributesHashRef->{PHYSICAL_REALITY};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
				if ($physicalRealityHashRef && ((keys %{$physicalRealityHashRef}) > 1))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
					{						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
					my $physicalMatchCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
					if ($attributesHashRef->{ACTUAL_TEST})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
						$physicalMatchCheck = $attributesHashRef->{ACTUAL_TEST};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
					else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
						$physicalMatchCheck = $problematicText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
						$physicalMatchCheck =~ s/\.\.[\\|\/]//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
						$physicalMatchCheck =~ s/\.[\\|\/]//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
					$physicalMatchCheck =~ s/\\\\/\\/g;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
					$physicalMatchCheck =~ s/\/\//\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
					$physicalMatchCheck =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
					$physicalMatchCheck = quotemeta($physicalMatchCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
					$physicalMatchCheck =~ s/\\\*/\\w\+/g;			# * -> \w+
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
					$physicalMatchCheck =~ s/\\\?/\\w\{1\}/g;		# ? -> \w{1}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
					my %normalisedPhysicalReferences;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
					foreach my $physicalReality (keys %{$physicalRealityHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
						$physicalReality =~ /($physicalMatchCheck)$/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
						$normalisedPhysicalReferences{$1} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
					if ((keys (%normalisedPhysicalReferences)) > 1)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
						foreach my $originalWarning (keys %{$originalWarningsHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   462
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   463
							next if ($originalWarning !~ /Incorrect case versus/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   464
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
							$originalWarning =~ /\:(.*$)/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
							my $multiplePhysicalWarningsHashRef;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
							if ($WarningsForMultiplePhysicalUpdates{$SOURCE_FILE})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
								$multiplePhysicalWarningsHashRef = $WarningsForMultiplePhysicalUpdates{$SOURCE_FILE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   472
							else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   473
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   474
								my %newHash;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   475
								$multiplePhysicalWarningsHashRef = \%newHash;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   476
								$WarningsForMultiplePhysicalUpdates{$SOURCE_FILE} = $multiplePhysicalWarningsHashRef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   477
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   478
							$multiplePhysicalWarningsHashRef->{$1} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   479
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   480
						$skipPhysicalUpdate = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   481
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   482
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   483
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   484
				$attributesHashRef->{LOWERCASE} = 0 if ($skipLowercaseUpdate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   485
				$attributesHashRef->{PHYSICAL} = 0 if ($skipPhysicalUpdate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   486
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   487
				if (!$attributesHashRef->{LOWERCASE} && !$attributesHashRef->{PHYSICAL} &&
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   488
					!$attributesHashRef->{UNIX_SLASH} && !$attributesHashRef->{DEFAULT_EXPORT} &&
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   489
					!$attributesHashRef->{EXCLUSION})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   490
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   491
					delete ($problematicTextHashRef->{$problematicText});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   492
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   493
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   494
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   495
			delete ($lineNumbersHashRef->{$lineNumber}) if (!scalar (keys %{$problematicTextHashRef}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   496
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   497
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   498
		my $lineNumber = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   499
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   500
		while (my $line = <SOURCE_FILE>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   501
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   502
			$lineNumber++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   503
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   504
			next if (!($lineNumbersHashRef->{$lineNumber}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   505
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   506
			my $problematicTextHashRef = $lineNumbersHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   507
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   508
			foreach my $text (keys %{$problematicTextHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   509
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   510
				my $attributesHashRef = $problematicTextHashRef->{$text};				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   511
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   512
				chomp ($line);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   513
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   514
				if ($line !~ /(\"|\<|^|\s){1}$attributesHashRef->{SEARCH_TEXT}/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   515
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   516
					# Put warning(s) onto the failed list, as we can't find the required text
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   517
					# in the source present on the machine
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   518
						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   519
					my $originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   520
					foreach my $originalWarning (keys %{$originalWarningsHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   521
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   522
						$WarningsNotMatchingSource{$originalWarning} = $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   523
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   524
						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   525
					delete ($problematicTextHashRef->{$text});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   526
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   527
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   528
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   529
			delete ($lineNumbersHashRef->{$lineNumber}) if (!scalar (keys %{$problematicTextHashRef}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   530
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   531
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   532
		delete ($ActionableFilenamePolicyWarnings{$SOURCE_FILE}) if (!scalar (keys %{$lineNumbersHashRef}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   533
		close SOURCE_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   534
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   535
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   536
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   537
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   538
# 4. Provide -warnings [all|fixable] output
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   539
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   540
if ($warnings =~ /^all$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   541
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   542
	foreach my $warning (sort keys %AllFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   543
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   544
		print ("$warning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   545
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   546
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   547
elsif ($warnings =~ /^fixable$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   548
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   549
	my %fixableWarnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   550
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   551
	foreach my $sourceFile (keys %ActionableFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   552
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   553
		my $lineNumbersHashRef = $ActionableFilenamePolicyWarnings{$sourceFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   554
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   555
		foreach my $lineNumber (keys (%$lineNumbersHashRef))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   556
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   557
			my $problematicTextHashRef = $lineNumbersHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   558
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   559
			foreach my $text (keys %{$problematicTextHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   560
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   561
				my $attributesHashRef = $problematicTextHashRef->{$text};				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   562
				my $originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   563
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   564
				foreach my $originalWarning (keys %{$originalWarningsHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   565
					{						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   566
					$fixableWarnings{$originalWarning} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   567
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   568
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   569
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   570
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   571
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   572
	foreach my $fixableWarning (sort keys %fixableWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   573
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   574
		print ("$fixableWarning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   575
		}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   576
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   577
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   578
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   579
# 5. Provide -list output
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   580
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   581
if ($list)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   582
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   583
	foreach my $sourceFile (sort keys %ActionableFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   584
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   585
		print ("$sourceFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   586
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   587
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   588
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   589
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   590
# 6. Provide -analyse output
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   591
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   592
if ($analyse)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   593
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   594
	print ("\nFilename policy warnings with missing files\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   595
		     "-------------------------------------------\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   596
	foreach my $warningWithMissingFile (sort keys %WarningsWithMissingFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   597
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   598
		print ("$warningWithMissingFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   599
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   600
	print ("NONE\n") if (!scalar (keys %WarningsWithMissingFiles));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   601
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   602
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   603
	print ("\n\nFilename policy warnings that don't match source\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   604
		       "------------------------------------------------\n\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   605
	foreach my $warningNotMatchingSource (sort keys %WarningsNotMatchingSource)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   606
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   607
		print ("$warningNotMatchingSource\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   608
		print ("\tACTUAL LINE : \'$WarningsNotMatchingSource{$warningNotMatchingSource}\'\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   609
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   610
	print ("NONE\n") if (!scalar (keys %WarningsNotMatchingSource));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   611
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   612
	print ("\n\nFilename policy warnings with both lowercase and physical warnings for the same reference\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   613
		       "-----------------------------------------------------------------------------------------\n\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   614
	foreach my $sourceFile (sort keys %WarningsForBothLowercaseAndPhysicalOnSameReference)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   615
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   616
		print ("$sourceFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   617
		foreach my $warning (sort keys %{$WarningsForBothLowercaseAndPhysicalOnSameReference{$sourceFile}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   618
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   619
			print ("\t$warning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   620
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   621
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   622
	print ("NONE\n") if (!scalar (keys %WarningsForBothLowercaseAndPhysicalOnSameReference));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   623
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   624
	print ("\n\nMultiple differing physical filename policy warnings for the same reference\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   625
		       "---------------------------------------------------------------------------\n\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   626
	foreach my $sourceFile (sort keys %WarningsForMultiplePhysicalUpdates)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   627
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   628
		print ("$sourceFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   629
		foreach my $warning (sort keys %{$WarningsForMultiplePhysicalUpdates{$sourceFile}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   630
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   631
			print ("\t$warning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   632
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   633
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   634
	print ("NONE\n") if (!scalar (keys %WarningsForMultiplePhysicalUpdates));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   635
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   636
	print ("\n\nNon-actionable filename policy warnings\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   637
		     "---------------------------------------\n\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   638
	foreach my $nonActionableWarning (sort keys %NonActionableFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   639
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   640
		print ("$nonActionableWarning\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   641
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   642
	print ("NONE\n") if (!scalar (keys %NonActionableFilenamePolicyWarnings));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   643
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   644
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   645
	print ("\n\nOther detected warnings unrelated to filename policy\n".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   646
		     "----------------------------------------------------\n\n");		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   647
	foreach my $otherWarningOrError (sort keys %OtherWarningsAndErrors)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   648
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   649
		print ("$otherWarningOrError\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   650
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   651
	print ("NONE\n") if (!scalar (keys %OtherWarningsAndErrors));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   652
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   653
	print ("\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   654
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   655
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   656
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   657
# 7. Perform -update function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   658
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   659
if ($update || $debugUpdate)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   660
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   661
	foreach my $SOURCE_FILE (sort keys %ActionableFilenamePolicyWarnings)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   662
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   663
		if (!(open SOURCE_FILE, "< $SOURCE_FILE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   664
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   665
			print ("ERROR: Could not open $SOURCE_FILE to read.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   666
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   667
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   668
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   669
		print ("Updating \'$SOURCE_FILE\'...\n") unless ($debugUpdate);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   670
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   671
		my $lineNumbersHashRef = $ActionableFilenamePolicyWarnings{$SOURCE_FILE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   672
		my $lineNumber = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   673
		my @newSourceFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   674
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   675
		while (my $line = <SOURCE_FILE>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   676
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   677
			$lineNumber++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   678
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   679
			if ($lineNumbersHashRef->{$lineNumber})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   680
				{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   681
				print ("\tOriginal : $line") if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   682
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   683
				my $problematicTextHashRef = $lineNumbersHashRef->{$lineNumber};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   684
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   685
				# We need to order the updates on a per-line basis so that, for example,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   686
				# a search and update for 'nkern\arm\' occurs after one for 'include\nkern\arm\nk_plat.h'
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   687
				# We can do this by length, making sure the longest updates are performed first
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   688
				my @problematicTextOrderedHashKeys = sort {length $b <=> length $a} (keys %{$problematicTextHashRef});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   689
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   690
				foreach my $problematicText (@problematicTextOrderedHashKeys)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   691
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   692
					my $attributesHashRef = $problematicTextHashRef->{$problematicText};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   693
					my $revisedText = $problematicText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   694
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   695
		# Physical
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   696
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   697
					if ($attributesHashRef->{PHYSICAL})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   698
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   699
						my $physicalRealityHashRef = $attributesHashRef->{PHYSICAL_REALITY};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   700
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   701
						my $physicalReality = (keys %{$physicalRealityHashRef})[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   702
						my $physicalRealityUnixSlash = $physicalReality;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   703
						$physicalRealityUnixSlash =~ s/\\/\//g;						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   704
							
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   705
						if ($physicalReality =~ /($attributesHashRef->{SEARCH_TEXT})$/i ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   706
							$physicalRealityUnixSlash =~ /($attributesHashRef->{SEARCH_TEXT})$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   707
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   708
							# Simple case - direct match with just case and slash differences
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   709
							my $replacement = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   710
							$replacement =~ s/\\/\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   711
							$revisedText =~ s/$attributesHashRef->{SEARCH_TEXT}/$replacement/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   712
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   713
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   714
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   715
							# What we're looking at in the source file doesn't map directly
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   716
							# to what's physically on the file system.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   717
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   718
							my $modifiedSearchText = $problematicText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   719
							$modifiedSearchText =~ s/\.\.[\\|\/]//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   720
							$modifiedSearchText =~ s/\.[\\|\/]//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   721
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   722
							my $physicalMatchCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   723
							if ($attributesHashRef->{ACTUAL_TEST})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   724
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   725
								$physicalMatchCheck = $attributesHashRef->{ACTUAL_TEST};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   726
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   727
							else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   728
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   729
								$physicalMatchCheck = $modifiedSearchText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   730
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   731
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   732
							# The physical match check needs to remove double-slashing...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   733
							$physicalMatchCheck =~ s/\\\\/\\/g;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   734
							$physicalMatchCheck =~ s/\/\//\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   735
							
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   736
							$modifiedSearchText = quotemeta($modifiedSearchText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   737
							$physicalMatchCheck = quotemeta($physicalMatchCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   738
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   739
							$physicalMatchCheck =~ s/\\\*/\\w\+/g;			# * -> \w+
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   740
							$physicalMatchCheck =~ s/\\\?/\\w\{1\}/g;		# ? -> \w{1}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   741
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   742
							if ($physicalReality =~ /($physicalMatchCheck)$/i ||
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   743
								$physicalRealityUnixSlash =~ /($physicalMatchCheck)$/i )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   744
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   745
								my $replacement = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   746
								$replacement =~ s/\\/\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   747
								
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   748
								if ($attributesHashRef->{ACTUAL_TEST} &&
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   749
									($attributesHashRef->{ITEM} =~ /MMP$/ || $attributesHashRef->{ITEM} =~ /DEFFILE/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   750
									{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   751
									# Both DEFFILE and PRJ_[TEST]MMPFILE entries may be specifed without extension
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   752
									$replacement =~ s/\.\w+$// if ($problematicText !~ /\.\w+$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   753
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   754
									# DEFFILE entries may have eabi\bwins in the physical match and had a "u" inserted or appended 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   755
									if ($attributesHashRef->{ITEM} =~ /DEFFILE/ && $replacement !~ /$modifiedSearchText$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   756
										{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   757
										$replacement =~ s/(eabi|bwins)\//~\//i if ($problematicText =~ /~[\\|\/]/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   758
										$replacement =~ s/u(\.\w+)?$/$1/i if ($attributesHashRef->{ITEM} !~ /NOSTRICTDEF/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   759
										}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   760
									}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   761
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   762
								$revisedText =~ s/$modifiedSearchText/$replacement/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   763
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   764
							else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   765
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   766
								print ("ERROR: Can\'t perform physical consistency updates for:");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   767
								
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   768
								my $originalWarningsHashRef = $attributesHashRef->{ORIGINAL_WARNINGS};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   769
								foreach my $originalWarning (keys %{$originalWarningsHashRef})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   770
									{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   771
									print ("\t$originalWarning") if ($originalWarning =~ /case versus/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   772
									}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   773
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   774
								print ("\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   775
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   776
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   777
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   778
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   779
		# Exclusion
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   780
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   781
					if ($attributesHashRef->{EXCLUSION})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   782
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   783
						my $exclusionListingSearch = quotemeta($attributesHashRef->{EXCLUSION_LISTING});						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   784
						$revisedText =~ s/$exclusionListingSearch/$attributesHashRef->{EXCLUSION_LISTING}/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   785
						}						
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   786
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   787
		# Slash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   788
					if ($attributesHashRef->{UNIX_SLASH})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   789
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   790
						$revisedText =~ s/\\/\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   791
						$revisedText =~ s/\/\//\//g;		# Don't allow replacements that lead to "//" in paths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   792
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   793
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   794
		# Lowercase
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   795
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   796
					if ($attributesHashRef->{LOWERCASE})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   797
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   798
						$revisedText = lc ($revisedText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   799
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   800
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   801
		# Default Export
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   802
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   803
					if ($attributesHashRef->{DEFAULT_EXPORT})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   804
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   805
						my $exportedFilename = lc (basename ($problematicText));							
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   806
						$revisedText .= " \/epoc32\/include\/".$exportedFilename;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   807
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   808
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   809
					$line =~ s/(\"|\<|^|\s){1}$attributesHashRef->{SEARCH_TEXT}/$1$revisedText/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   810
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   811
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   812
				print ("\tUpdated  : $line") if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   813
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   814
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   815
			push @newSourceFile, $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   816
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   817
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   818
		close SOURCE_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   819
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   820
		if ($debugUpdate)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   821
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   822
			# Don't touch the original source, but create two trees for easy comparison
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   823
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   824
			my $baseDir = dirname ($SOURCE_FILE);				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   825
			mkpath ("\\compare\\orig".$baseDir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   826
			mkpath ("\\compare\\updated".$baseDir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   827
			print ("Copying  \'\\compare\\orig".$SOURCE_FILE."\'...\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   828
			copy ($SOURCE_FILE, "\\compare\\orig".$SOURCE_FILE);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   829
			$SOURCE_FILE = "\\compare\\updated".$SOURCE_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   830
			print ("Updating \'$SOURCE_FILE\'...\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   831
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   832
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   833
		if (!(open SOURCE_FILE, "> $SOURCE_FILE"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   834
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   835
			print ("ERROR: Could not open $SOURCE_FILE to write.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   836
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   837
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   838
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   839
		foreach my $line (@newSourceFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   840
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   841
			print (SOURCE_FILE $line);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   842
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   843
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   844
		close SOURCE_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   845
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   846
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   847
	print ("\n") if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   848
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   849
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   850
__END__
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   851
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   852
:endofperl