author | srilekhas |
Fri, 08 Oct 2010 21:02:28 +0100 | |
changeset 644 | 01667c882e63 |
parent 0 | 044383f39525 |
permissions | -rw-r--r-- |
0
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2 |
# Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
3 |
# All rights reserved. |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
8 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
10 |
# Nokia Corporation - initial contribution. |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
11 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
12 |
# Contributors: |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
13 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
14 |
# Description: |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
15 |
# This module implements the MD5 version of the Evalid's compare |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
16 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
17 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
18 |
package EvalidMD5; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
19 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
20 |
use strict; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
21 |
use Carp; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
22 |
use File::Find; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
23 |
use IO::File; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
24 |
use Sys::Hostname; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
25 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
26 |
use FindBin; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
27 |
use lib "$FindBin::Bin"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
28 |
require Exporter; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
29 |
use File::Basename; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
30 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
31 |
use vars qw($VERSION ); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
32 |
$VERSION = 0.02; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
33 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
34 |
use EvalidCompare; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
35 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
36 |
# Public |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
37 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
38 |
# MD5Generate |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
39 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
40 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
41 |
# $iLeftDir - Left side directory or File containing listing of left side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
42 |
# $iResultsFile - Name of file to write the list of files and MD5 checksum to |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
43 |
# $iExclude - Reference to array of regular expression patterns to exclude |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
44 |
# $iInclude - Reference to array of regular expression patterns to include |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
45 |
# $iListFile - Filename to read for list of files from [Optional] |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
46 |
# $iDumpDir - Directory to generate dump of comparison data [Optional] |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
47 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
48 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
49 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
50 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
51 |
# This function generates the MD5 checksum file |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
52 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
53 |
sub MD5Generate |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
54 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
55 |
my ($iLeftDir, $iResultsFile, $iExclude, $iInclude, $iListFile, $iDumpDir) = @_; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
56 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
57 |
my (@iLeftFiles); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
58 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
59 |
# This should have been check before getting here but to be on the safe side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
60 |
# check again, as it should never overwrite or append to the file |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
61 |
croak "$iResultsFile already exists" if (-e $iResultsFile); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
62 |
croak "$iListFile does exist" if ((defined($iListFile) && (!-e $iListFile))); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
63 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
64 |
if (-d $iLeftDir){ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
65 |
# Make sure all the \ are / for the RegEx |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
66 |
$iLeftDir =~ s/\\/\//g; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
67 |
# Make sure it does not have a / on the end |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
68 |
$iLeftDir =~ s/\/$//; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
69 |
# If $iFileList is defined then use the filelist to generate @iLeftFiles |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
70 |
if (defined($iListFile)) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
71 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
72 |
# Generate list of files |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
73 |
@iLeftFiles = &FilterDir($iLeftDir,$iExclude,$iInclude, $iListFile); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
74 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
75 |
# Generate the the directory listing |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
76 |
@iLeftFiles = &FilterDir($iLeftDir,$iExclude,$iInclude); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
77 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
78 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
79 |
croak "$iLeftDir is not a directory"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
80 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
81 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
82 |
# Open the results file for writing |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
83 |
my ($fResultsFile) = new IO::File; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
84 |
croak "Cannot for $iResultsFile for writing" unless ($fResultsFile->open("> $iResultsFile")); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
85 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
86 |
# Write headers to the file |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
87 |
print $fResultsFile "Host:".&hostname()."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
88 |
print $fResultsFile "Username:".$ENV{'USERNAME'}."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
89 |
print $fResultsFile "Date-Time:".scalar(localtime)."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
90 |
print $fResultsFile "Version:".$VERSION."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
91 |
print $fResultsFile "Directory:".$iLeftDir."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
92 |
print $fResultsFile "FileList:".$iListFile."\n" if (defined($iListFile)); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
93 |
print $fResultsFile "Exclusion(s):"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
94 |
foreach my $iExc (sort @$iExclude) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
95 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
96 |
print $fResultsFile "$iExc "; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
97 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
98 |
print $fResultsFile "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
99 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
100 |
print $fResultsFile "Inclusion(s):"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
101 |
foreach my $iInc (@$iInclude) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
102 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
103 |
print $fResultsFile "$iInc "; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
104 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
105 |
print $fResultsFile "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
106 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
107 |
print $fResultsFile "----------------\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
108 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
109 |
# Write out sorted list of files with MD5 Checksums |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
110 |
foreach my $iFile (sort @iLeftFiles) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
111 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
112 |
my ($MD5, $type) = &EvalidCompare::GenerateSignature($iLeftDir."/".$iFile, $iDumpDir); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
113 |
print $fResultsFile $iFile." TYPE=".$type." MD5=".$MD5."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
114 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
115 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
116 |
$fResultsFile->close; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
117 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
118 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
119 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
120 |
# MD5Compare |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
121 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
122 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
123 |
# $iLeftFile - Left side File containing listing and MD5 of left side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
124 |
# $iRightFile - Right side File containing listing and MD5 of right side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
125 |
# $iVerbose - Verbose Flag |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
126 |
# $iLog - Logfile name |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
127 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
128 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
129 |
# %iCommon - hash relative filenames with values of file type that are in both directories and Compare results/types |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
130 |
# %iDiff - hash relative filenames with values of file type and directory side infomation |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
131 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
132 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
133 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
134 |
sub MD5Compare |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
135 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
136 |
my ($iLeftFile) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
137 |
my ($iRightFile) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
138 |
my ($iVerbose) = defined($_[0]) ? shift : 0; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
139 |
my ($iLog) = defined($_[0]) ? shift : *STDOUT; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
140 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
141 |
my (%iCommon, %iDiff); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
142 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
143 |
my (%iLeftFiles, %iRightFiles); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
144 |
my (%iLeftHeaders, %iRightHeaders); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
145 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
146 |
# Backup check the files are available to read. |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
147 |
croak "$iLeftFile is not a file" unless (-f $iLeftFile); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
148 |
croak "$iRightFile is not a file" unless(-f $iRightFile); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
149 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
150 |
#Read the files |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
151 |
&ReadMD5File($iLeftFile, \%iLeftFiles, \%iLeftHeaders); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
152 |
&ReadMD5File($iRightFile, \%iRightFiles, \%iRightHeaders); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
153 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
154 |
# Check Critical headers |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
155 |
foreach my $iHeader (sort keys %iLeftHeaders) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
156 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
157 |
# Warning is certain headers are not identical |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
158 |
if ($iHeader =~ /^Version|Exclusion\(s\)|Inclusion\(s\)/) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
159 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
160 |
print $iLog "WARNING:$iHeader is different\n" if ($iLeftHeaders{$iHeader} ne $iRightHeaders{$iHeader}); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
161 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
162 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
163 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
164 |
# A Hash is used to combine the two directory listing using the filename as the key |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
165 |
my %iCombinedFiles; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
166 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
167 |
# Enter the files from the left side listing and check the right side critical header are the same |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
168 |
# Note all filenames are turned to lower case as this is designed to only wotk on Windows |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
169 |
foreach my $iFile (sort keys %iLeftFiles) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
170 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
171 |
$iCombinedFiles{$iFile} = "Left"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
172 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
173 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
174 |
# Enter the files from the right side listing |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
175 |
# Note all filenames are turned to lower case as this is designed to only wotk on Windows |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
176 |
foreach my $iFile (sort keys %iRightFiles) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
177 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
178 |
# Check to see if any entry for this file exists on the left side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
179 |
if ((defined ($iCombinedFiles{$iFile})) && ( $iCombinedFiles{$iFile} eq "Left")) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
180 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
181 |
# Yes, so add to the Common set |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
182 |
# Check if the MD5 checksum matches |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
183 |
# The [0] element is the file type |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
184 |
if ($iLeftFiles{$iFile}[0] ne $iRightFiles{$iFile}[0]) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
185 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
186 |
$iCommon{$iFile} = [$iLeftFiles{$iFile}[0]." to ".$iRightFiles{$iFile}[0], "Type Changed"]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
187 |
} elsif ($iLeftFiles{$iFile}[1] eq $iRightFiles{$iFile}[1]) { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
188 |
$iCommon{$iFile} = [$iLeftFiles{$iFile}[0],"OK"]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
189 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
190 |
$iCommon{$iFile} = [$iLeftFiles{$iFile}[0],"Different"]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
191 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
192 |
# The filename key is not needed any more as both sides have been processed, so delete the hash entry |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
193 |
delete $iCombinedFiles{$iFile}; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
194 |
} elsif (!defined($iCombinedFiles{$iFile})) { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
195 |
# No, the key is not defined, so this filename is only in the right side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
196 |
$iDiff{$iFile} = [$iRightFiles{$iFile}[0],"Right"]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
197 |
# The filename key is not needed any more as both sides have been processed, so delete the hash entry |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
198 |
delete $iCombinedFiles{$iFile}; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
199 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
200 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
201 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
202 |
# Add the files left in the hash to the Left side only list |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
203 |
foreach my $iFile (sort keys %iCombinedFiles) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
204 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
205 |
$iDiff{$iFile} = [$iLeftFiles{$iFile}[0],"Left"]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
206 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
207 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
208 |
# Return References to the Arrays |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
209 |
return (\%iCommon, \%iLeftHeaders, \%iRightHeaders, \%iDiff); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
210 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
211 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
212 |
# FilterDir |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
213 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
214 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
215 |
# $iDir - Directory to process |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
216 |
# $iExclude - Reference to array of regular expression patterns to exclude |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
217 |
# $iInclude - Reference to array of regular expression patterns to include |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
218 |
# $iListFile - Filename to read for list of files from [Optional] |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
219 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
220 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
221 |
# @iFinalFileList - Filtered list relative filenames |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
222 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
223 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
224 |
# This function produces a filtered list of filenames in the specified directory or from file |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
225 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
226 |
sub FilterDir |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
227 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
228 |
my ($iDir,$iExclude,$iInclude, $iListFile) = @_; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
229 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
230 |
my (@iFileList, @iFinalFileList, $iFileName); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
231 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
232 |
if(defined($iListFile)) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
233 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
234 |
open LIST, "$iListFile" or croak "Cannot open $iListFile\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
235 |
while(<LIST>) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
236 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
237 |
next if /^\s+$/; # skip blank lines |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
238 |
my $iFileName = $iDir."/".$_; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
239 |
chomp $iFileName; # Remove new line |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
240 |
if(-e $iFileName) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
241 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
242 |
# The listed file exists add to the @iFileList |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
243 |
push @iFileList, $iFileName; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
244 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
245 |
print "Warning: Cannot find $iFileName\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
246 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
247 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
248 |
close LIST; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
249 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
250 |
# Produce full filelist listing without directory names |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
251 |
find sub { push @iFileList, $File::Find::name if (!-d) ;}, $iDir; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
252 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
253 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
254 |
foreach my $iFile ( @iFileList) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
255 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
256 |
my $iExcludeFile = 0; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
257 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
258 |
# Remove the specified directory path from the front of the filename |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
259 |
$iFile =~ s#^$iDir/##; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
260 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
261 |
# Process all Exclude RegEx to see if this file matches |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
262 |
foreach my $iExcludeRegEx (@$iExclude) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
263 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
264 |
if ($iFile =~ /$iExcludeRegEx/i) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
265 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
266 |
# Mark this file to be excluded from the final list |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
267 |
$iExcludeFile = 1; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
268 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
269 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
270 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
271 |
# Process all Include RegEx to see if this file matches |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
272 |
foreach my $iIncludeRegEx (@$iInclude) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
273 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
274 |
if ($iFile =~ /$iIncludeRegEx/i) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
275 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
276 |
# Mark this file to be Included in the final list |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
277 |
$iExcludeFile = 0; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
278 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
279 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
280 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
281 |
# Added the file to the final list based on the flag |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
282 |
push @iFinalFileList, lc($iFile) unless $iExcludeFile; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
283 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
284 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
285 |
return @iFinalFileList; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
286 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
287 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
288 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
289 |
# MD5ComparePrint |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
290 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
291 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
292 |
# $iCommon - Reference to Hash of common file names and the result the comparision |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
293 |
# $iLeftHeaders - Reference to Hash contain the left side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
294 |
# $iRightHeaders - Reference to Hash contain the right side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
295 |
# $iDiff - Reference to Hash of relative filenames with values of file type and left/right directory side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
296 |
# $iLog - Logfile name |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
297 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
298 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
299 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
300 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
301 |
# This function prints the output of a Compare |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
302 |
sub MD5ComparePrint |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
303 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
304 |
my ($iCommon) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
305 |
my ($iLeftHeaders) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
306 |
my ($iRightHeaders) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
307 |
my ($iDiff) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
308 |
my ($iLog) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
309 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
310 |
my ($iFailed) = 0; # Count of the failed comparisions |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
311 |
my ($iPassed) = 0; # Count of the Passed comparisions |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
312 |
my ($iLeft) = 0; # Count of the Passed comparisions |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
313 |
my ($iRight) = 0; # Count of the Passed comparisions |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
314 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
315 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
316 |
my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
317 |
printf $iLog "\n----------------\n%02d:%02d %02d/%02d/%04d\n", $hour, $min, $mday, $mon+1, $year+1900; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
318 |
print $iLog "evalid\nLeft Side=$ARGV[0]\nRight Side=$ARGV[1]\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
319 |
print $iLog "\nLeft side information\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
320 |
foreach my $iHeader (sort keys %$iLeftHeaders) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
321 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
322 |
print $iLog $iHeader.":".$$iLeftHeaders{$iHeader}."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
323 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
324 |
print $iLog "\nRight side information\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
325 |
foreach my $iHeader (sort keys %$iRightHeaders) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
326 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
327 |
print $iLog $iHeader.":".$$iRightHeaders{$iHeader}."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
328 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
329 |
print $iLog "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
330 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
331 |
foreach my $iFile (sort keys %$iCommon) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
332 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
333 |
if ($$iCommon{$iFile}[1] eq "OK") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
334 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
335 |
print $iLog "Passed:$iFile (".$$iCommon{$iFile}[0].")\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
336 |
$iPassed++; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
337 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
338 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
339 |
print $iLog "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
340 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
341 |
foreach my $iFile (sort keys %$iCommon) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
342 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
343 |
if ($$iCommon{$iFile}[1] eq "Type Changed") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
344 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
345 |
print $iLog "Type Changed:$iFile (".$$iCommon{$iFile}[0].")\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
346 |
$iFailed++; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
347 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
348 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
349 |
print $iLog "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
350 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
351 |
foreach my $iFile (sort keys %$iCommon) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
352 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
353 |
if ($$iCommon{$iFile}[1] eq "Different") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
354 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
355 |
print $iLog "Failed:$iFile (".$$iCommon{$iFile}[0].")\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
356 |
$iFailed++; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
357 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
358 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
359 |
print $iLog "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
360 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
361 |
foreach my $iFile (sort keys %$iDiff) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
362 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
363 |
if ($$iDiff{$iFile}[1] eq "Left") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
364 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
365 |
print $iLog "Missing Left:$iFile (".$$iDiff{$iFile}[0].")\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
366 |
$iLeft++; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
367 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
368 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
369 |
print $iLog "\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
370 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
371 |
foreach my $iFile (sort keys %$iDiff) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
372 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
373 |
if ($$iDiff{$iFile}[1] eq "Right") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
374 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
375 |
print $iLog "Missing Right:$iFile (".$$iDiff{$iFile}[0].")\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
376 |
$iRight++; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
377 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
378 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
379 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
380 |
print $iLog "\n\nSummary\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
381 |
print $iLog "Total files processed=".($iPassed+$iFailed+$iRight+$iLeft)."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
382 |
print $iLog "Files Passed=$iPassed\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
383 |
print $iLog "Files Failed=$iFailed\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
384 |
print $iLog "Missing Files in Left=".$iRight."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
385 |
print $iLog "Missing Files in Right=".$iLeft."\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
386 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
387 |
return ($iFailed); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
388 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
389 |
# NameOnly |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
390 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
391 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
392 |
# $filename - may contain path and file extension |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
393 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
394 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
395 |
# $nameOnly - filename without extension and path |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
396 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
397 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
398 |
# This routine is used to extract the name of the file |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
399 |
# only from a filename that may include a path and file extension |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
400 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
401 |
sub NameOnly |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
402 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
403 |
my ($filename) = @_; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
404 |
my $nameOnly = basename($filename); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
405 |
$nameOnly =~ s/(\w+.*)\.\w+$/$1/; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
406 |
return $nameOnly; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
407 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
408 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
409 |
# MD5CompareZipDel |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
410 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
411 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
412 |
# $iCommon - Reference to Hash of common file names and the result the comparision |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
413 |
# $iDiff - Reference to Hash of relative filenames with values of file type and left/right directory side |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
414 |
# $iLeft - filename of Left side directory |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
415 |
# $iRight - filename of Right side directory |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
416 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
417 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
418 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
419 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
420 |
# This function prints the output of a Compare results in a format ready for creating the a |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
421 |
# Zip and batch file to upgrade the left side to the equivalent of the right side. |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
422 |
sub MD5CompareZipDel |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
423 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
424 |
my ($iCommon) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
425 |
my ($iDiff) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
426 |
my ($iLeft) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
427 |
my ($iRight) = shift; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
428 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
429 |
# Build a suitable name for outputfiles based on input filenames |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
430 |
$iLeft = NameOnly($iLeft); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
431 |
$iRight = NameOnly($iRight); |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
432 |
my ($iBasename) = $iLeft."_to_".$iRight; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
433 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
434 |
open DELLIST, ">del_$iBasename.bat"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
435 |
open ZIPLIST, ">zip_$iBasename.log"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
436 |
open ZIPBAT, ">zip_$iBasename.bat"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
437 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
438 |
foreach my $iFile (sort keys %$iCommon) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
439 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
440 |
if (($$iCommon{$iFile}[1] eq "Different") || ($$iCommon{$iFile}[1] eq "Type Changed")) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
441 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
442 |
print ZIPLIST "$iFile\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
443 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
444 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
445 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
446 |
foreach my $iFile (sort keys %$iDiff) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
447 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
448 |
if ($$iDiff{$iFile}[1] eq "Right") |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
449 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
450 |
print ZIPLIST "$iFile\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
451 |
} else { |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
452 |
# DEL needs the / to be \ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
453 |
$iFile =~ s/\//\\/g; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
454 |
print DELLIST "del /F $iFile\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
455 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
456 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
457 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
458 |
print ZIPBAT "zip $iBasename.zip -@<zip_$iBasename.log\n"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
459 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
460 |
close DELLIST; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
461 |
close ZIPLIST; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
462 |
close ZIPBAT; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
463 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
464 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
465 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
466 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
467 |
# Private |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
468 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
469 |
# ReadMD5File |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
470 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
471 |
# Inputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
472 |
# $iResultsFile - Results filename to process |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
473 |
# $iResults - Reference to Results Hash |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
474 |
# $iHeaders - Reference to Headers Hash |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
475 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
476 |
# Outputs |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
477 |
# |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
478 |
# Description |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
479 |
# This function reads the conntent of the MD5 File in to a Hash |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
480 |
sub ReadMD5File |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
481 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
482 |
my ($iResultsFile, $iResults, $iHeaders) = @_; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
483 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
484 |
# Open the results file for reading |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
485 |
open (INPUT, "$iResultsFile") or croak "Cannot for $iResultsFile for reading"; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
486 |
while (<INPUT>) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
487 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
488 |
if (/^(\S+?):(.*)/) |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
489 |
{ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
490 |
$$iHeaders{$1} = $2; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
491 |
} elsif (/^(\S+?)\sTYPE=(.*?)\sMD5=(.*)/){ |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
492 |
$$iResults{$1} = [$2,$3]; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
493 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
494 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
495 |
close INPUT; |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
496 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
497 |
} |
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
498 |
|
044383f39525
Convert Build package from SFL to EPL
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
499 |
1; |