releasing/cbrtools/perl/Symbian/CBR/Component/Manifest.pm
author jascui
Wed, 17 Nov 2010 13:27:16 +0800
changeset 686 3e502c8c584c
parent 602 3145852acc89
permissions -rw-r--r--
Update release information and product version.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
package Symbian::CBR::Component::Manifest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use base qw(Exporter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use EnvDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use MrpData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use XML::Simple;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use POSIX qw(strftime);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use Carp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use File::Spec;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
use File::Basename;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
use CatData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
eval { push @INC, Utils::PrependEpocRoot('\epoc32\tools') };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
#Constants
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
use constant CONTENTTYPE_SOURCE => 'source';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
use constant CONTENTTYPE_BINARY => 'binary';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
use constant CONTENTTYPE_EXPORT => 'export';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
use constant CONTENT_TYPE       => 'content-type';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
use constant IPR_CATEGORY       => 'ipr-category';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
use constant BINARY_PLATFORM    => 'platform';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
use constant EVALID_MD5         => 'evalid-checksum';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
use constant MODIFIED_TIME      => 'modified-timestamp';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
use constant MANIFEST_FILE      => 'manifest.xml';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
use constant STATUS_CLEAN       => 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
use constant STATUS_DIRTY       => 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
use constant STATUS_DIRTY_SOURCE=> 4;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
our @EXPORT = qw(MANIFEST_FILE CONTENT_TYPE IPR_CATEGORY);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
#Public Interfaces
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
sub new {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
    my $class = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
    my $file  = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
    my $verbose = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
    croak "Error: $file does not exist\n" if !-e $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    my $self = bless {}, $class;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    $self->{verbose} = $verbose;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    if ( $file =~ /.mrp$/i ) { #check if file is a mrp file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
        $self->PopulateDataFromMRP($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
    elsif ( basename($file) =~ /.xml$/i ) { #check if file is a manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
        $self->LoadManifestFile($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
    else { #cannot proceed if file is neither MRP nor manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
        croak "Error: File is neither an MRP file nor a manifest file.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
    return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
sub Save {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    my $self             = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
    my $manifestLocation = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
    my $myManifestFileBasename = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
    my $manifestFile = undef;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
    if (defined $myManifestFileBasename) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
        print "-----> Use user defined manifest file basename: $myManifestFileBasename \n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
        $manifestFile = File::Spec->catfile( $manifestLocation, $myManifestFileBasename);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
        print "---- > Use default manifest file basename\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
        $manifestFile = File::Spec->catfile($manifestLocation, MANIFEST_FILE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    #Die, if the directory path doesn't exist
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
    croak "Error: Directory path does not exist : $manifestLocation\n" if !-d $manifestLocation;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
    #Create an EnvDb object to retrieve component versions
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
    my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
    my $envDb = EnvDb->Open($iniData, 0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
    #Hash structure to be provided as input for XML::Simple->XMLout()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
    my $component = {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
        name       => $self->{componentName},
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
        meta    => {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
            'cbr-version'    => { 'content' => $self->{cbrVersion} },
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
            'created-time'   => { 'content' => strftime( '%Y-%m-%dT%H:%M:%S', localtime()) },
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
            'mrp-path'       => { 'content' => $self->{mrpFilePath} },
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
        },
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
        manifest => { files => [] }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
    };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
    if (defined $envDb->Version($self->{componentName})) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
        $component->{version} = $envDb->Version($self->{componentName});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    if (defined $envDb->InternalVersion($self->{componentName})) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
        $component->{'internal-version'} = $envDb->InternalVersion($self->{componentName});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
    if (defined $self->{evalidVersion}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
        $component->{meta}{'evalid-version'}{content} = $self->{evalidVersion};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
    #Construct the file group structure hierarchy
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    my $groups = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    foreach my $path (keys %{$self->{files}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
        # make file representation
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
        my $file = { path => $path };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
        for $_ (qw(evalid-checksum modified-timestamp)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
            next if !defined $self->{files}{$path}{$_}; # skip undef
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
            $file->{$_} = $self->{files}{$path}{$_};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
        # pick file group
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
        my $groupid = join(',', grep defined, (
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
            $self->{files}{$path}{'content-type'},
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
            $self->{files}{$path}{'ipr-category'},
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
            $self->{files}{$path}{'platform'}));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
        # make new group if it doesn't exist
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
        if (!defined $groups->{$groupid}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
            $groups->{$groupid} = { file => [] }; # make ref
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
            for $_ (qw(content-type ipr-category platform)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
                next if !defined $self->{files}{$path}{$_}; # skip undef
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
                $groups->{$groupid}{$_} = $self->{files}{$path}{$_};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
            push @{$component->{manifest}{files}}, $groups->{$groupid};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
        # add file to correct group
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
        push @{$groups->{$groupid}{file}}, $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
    #Use the hash structure for calling the XMLout() to write the manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
    eval {XMLout(
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
        $component,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
        xmldecl     => '<?xml version="1.0" encoding="ISO-8859-1"?>',
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
        rootname    => 'component',
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
        outputfile  => $manifestFile )};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
    croak "Error: Can't write manifest file: $@\n" if $@;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
    return $manifestFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
sub Compare {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
    my $self           = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
    my $manifestObj    = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
    my $validatesource = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
    my $keepGoing      = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
    my $callback       = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
    my $status = STATUS_CLEAN;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
    #Check for similarity of component names
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
    croak "Error: Component names does not match between manifest versions\n" if lc($self->{componentName}) ne lc($manifestObj->{componentName});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
    #Check for presence of evalid md5 in both versions of the component
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
    croak "Error: MD5 info incomplete\n" if !defined $self->{evalidVersion} or !defined $manifestObj->{evalidVersion};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
    #Check for similarity of evalid versions used in both versions of components
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
    croak "Error: Incompatible evalid versions\n" if $self->{evalidVersion} ne $manifestObj->{evalidVersion};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
    #Get list of files in MRP and manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
    #do not include source if validate source not specified
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
    my $filesFromThisComponent   = $self->GetFiles(!$validatesource);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
    my $filesFromBaselineComponent = $manifestObj->GetFiles(!$validatesource);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
    if ( @$filesFromThisComponent != @$filesFromBaselineComponent ) { #Check if counts of files in both versions are same
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
        print "File counts differ\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
        $status = STATUS_DIRTY;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
    %{$self->{compareFiles}} = (); # Hash to store all zip files, files for zipfile and their status.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
    my @noChecksumFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
    foreach my $file ( @{$filesFromThisComponent} ) { #Iterate through each files listed in mrp
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
        my $zipname = $self->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
        my $fileContentType = $self->GetFileInfo($file, CONTENT_TYPE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
        next if !$validatesource and $fileContentType eq 'source'; #Skip comparison source files if $validatesource is not set
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
        if ( !$manifestObj->FileExists($file) ) { #Check if a corresponding entry for the file exist in manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
            print "File added in the new environment : $file\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
            $self->{compareFiles}{$zipname}{files}{$file} = "added";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
            if ( $fileContentType eq 'source' && $status != STATUS_DIRTY) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
                $status = STATUS_DIRTY_SOURCE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
            else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
                $status = STATUS_DIRTY;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
                return $status unless $keepGoing; #If $keepGoing is set, continue the iteration. Else, stop the comparison and return back to the caller
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
            next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
        #Check evalid md5 checksums of all files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
        if (not defined $manifestObj->GetFileInfo( $file, EVALID_MD5 ) or not defined $self->GetFileInfo($file, EVALID_MD5)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
            push @noChecksumFiles,$file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
        elsif ( $manifestObj->GetFileInfo( $file, EVALID_MD5 ) ne $self->GetFileInfo($file, EVALID_MD5) ) { #comparison of Evalid checksum of both verisons
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
            print "The evalid checksum does not match for the file : $file\n";  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
            $self->{compareFiles}{$zipname}{files}{$file} = "modified";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
            if ( $fileContentType eq 'source' && $status != STATUS_DIRTY) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
                $status = STATUS_DIRTY_SOURCE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
            else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
                $status = STATUS_DIRTY;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
                return $status unless $keepGoing; #If $keepGoing is set, continue the iteration. Else, stop the comparison and return back to the caller
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
        #Check for mismatches in ipr-categories for source and export files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
        if ($validatesource && ($fileContentType eq 'source' or $fileContentType eq 'export')) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
            if ($self->GetFileInfo($file, IPR_CATEGORY) ne $manifestObj->GetFileInfo($file, IPR_CATEGORY)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
                print "Content-type mismatch between version : $file\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
                
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
                $self->{compareFiles}{$zipname}{files}{$file} = "added";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
                
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
                my $zipnameOriginal = $manifestObj->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
                $self->{compareFiles}{$zipnameOriginal}{files}{$file} = "deleted";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
                
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
                if ( $fileContentType eq 'source' && $status != STATUS_DIRTY) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
                    $status = STATUS_DIRTY_SOURCE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
                else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
                    $status = STATUS_DIRTY;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
                    return $status unless $keepGoing; #If $keepGoing is set, continue the iteration. Else, stop the comparison and return back to the caller            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
        #Check for moving some files from one zip file to another
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
        my $ref_zipname = $manifestObj->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
        if ($zipname ne $ref_zipname) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
        	   #The file is moved from $ref_zipname to $zipname
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
            $self->{compareFiles}{$zipname}{files}{$file} = "added";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
            if ($manifestObj->FileExists($file))  {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
                $self->{compareFiles}{$ref_zipname}{files}{$file} = "deleted";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
    if (scalar @noChecksumFiles > 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
        if (defined $callback) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
            unless (&$callback(\@noChecksumFiles,$self,$keepGoing)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
                $status = STATUS_DIRTY if ($status  == STATUS_CLEAN);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
        foreach my $file (@noChecksumFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
            my $zipname = $self->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
            $self->{compareFiles}{$zipname}{files}{$file} = "modified"; #set to modified as don't have a method to compare no-checksum files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
    foreach my $file ( @{$filesFromBaselineComponent } ) { 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
        my $zipname = $manifestObj->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
        if ( !$self->FileExists($file) ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
            $self->{compareFiles}{$zipname}{files}{$file} = "deleted";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
        else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
            #Check for moving some files from one zip file to another
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
            my $ref_zipname = $self->GetZipName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
            if ($zipname ne $ref_zipname) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
                #The file is moved from $zipname to $ref_zipname
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
                $self->{compareFiles}{$zipname}{files}{$file} = "deleted";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
                $self->{compareFiles}{$ref_zipname}{files}{$file} = "added";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
           }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
    return $status;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
sub GetDiffZipFiles {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
  return $self->{compareFiles};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
sub GetDiffFilesForZip {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
  my $zipfile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
  return $self->{compareFiles}{$zipfile}{files};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
sub GetFileStatus {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
  my $zipfile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
  my $file = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
  return $self->{compareFiles}{$zipfile}{files}{$file};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
#Private Methods
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
sub PopulateDataFromMRP {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
    my $self    = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
    my $mrpFile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
    #Check if EvalidCompare is installed
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
    if (eval { require EvalidCompare }) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
        $self->{evalidInstalled} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
        print "Remark: Evalid is not available ($@)\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
    #Create a mrpData object to retrieve files list that define the component
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
    my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
    #need to remove SRCROOT from MRP file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
    $mrpFile = Utils::RemoveSourceRoot($mrpFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
    my $mrpData = MrpData->New( $mrpFile, undef, undef, $iniData, 0, 0 );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
    #Set the evalid version only if EValidCompare is installed
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
    if ( $self->{evalidInstalled} ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
        $self->{evalidVersion}      = $EvalidCompare::VERSION;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
    #Set rest of meta data information
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
    $self->{cbrVersion}         = Utils::ToolsVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
    $self->{componentName}      = $mrpData->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
    $self->{mrpFilePath}        = $mrpData->MrpName();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
    if ( Utils::WithinSourceRoot( $self->{mrpFilePath} ) ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
        $self->{mrpFilePath} = Utils::RemoveSourceRoot( $self->{mrpFilePath} );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
    #Iterate through list of files list returned by mrpData and calculate the manifest informations
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
    #Make calls to SetFileInfo and save the manifest informations of the file to a common file hash
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
    foreach my $sourcecategory ( @{ $mrpData->SourceCategories() } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
        foreach my $file ( @{ $mrpData->Source( $sourcecategory ) }) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
            my $absFilePath = Utils::RelativeToAbsolutePath( $file, $mrpData->{iniData}, SOURCE_RELATIVE );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
            # Reverse any source mappings as we don't want them in the manifest...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
            $file = $iniData->PerformReverseMapOnFileName($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
            # We also want to remove the SRCROOT from the file name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
            if (Utils::WithinSourceRoot($file)){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
                $file = Utils::RemoveSourceRoot($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
            if (-f $absFilePath) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
                $self->SetFileInfo( $file, CONTENT_TYPE, CONTENTTYPE_SOURCE );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
                $self->SetFileInfo( $file, IPR_CATEGORY, $sourcecategory );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
                $self->SetFileInfo( $file, MODIFIED_TIME, Utils::FileModifiedTime( $absFilePath ) );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
                if ($self->{evalidInstalled}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
                    $self->GenerateEvalidSignature($file, $absFilePath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
    }    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
    #List of binary files, their manifest calculations and saving to the file hash
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
    foreach my $binarycategory ( @{ $mrpData->BinaryCategories() } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
        foreach my $file ( @{ $mrpData->Binaries($binarycategory) } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
            my $absFilePath = Utils::RelativeToAbsolutePath( $file, $mrpData->{iniData}, EPOC_RELATIVE );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
            if (-f $absFilePath) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
                $self->SetFileInfo( $file, CONTENT_TYPE, CONTENTTYPE_BINARY );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
                if ( $binarycategory ne 'unclassified') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
                    $self->SetFileInfo( $file, BINARY_PLATFORM, $binarycategory );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
                $self->SetFileInfo( $file, MODIFIED_TIME, Utils::FileModifiedTime( $absFilePath ) );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
                if ($self->{evalidInstalled}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
                    $self->GenerateEvalidSignature($file, $absFilePath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
    #List of export files, their manifest calculations and saving to the file hash
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
    foreach my $exportcategory ( @{ $mrpData->ExportCategories() } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
        foreach my $file ( @{ $mrpData->Exports($exportcategory) } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
            my $absFilePath = Utils::RelativeToAbsolutePath( $file, $mrpData->{iniData}, EPOC_RELATIVE );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
            if (-f $absFilePath) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
                $self->SetFileInfo( $file, CONTENT_TYPE, CONTENTTYPE_EXPORT );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
                $self->SetFileInfo( $file, IPR_CATEGORY, $exportcategory );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
                $self->SetFileInfo( $file, MODIFIED_TIME, Utils::FileModifiedTime( $absFilePath ) );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
                if ($self->{evalidInstalled}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
                    $self->GenerateEvalidSignature($file, $absFilePath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
                }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
sub LoadManifestFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
    my $self         = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
    my $manifestFile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
    my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
    #Generate the hash structure from manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
    my $component   = eval{XMLin(
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
                    $manifestFile,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
                    forcearray => [ qw(files file) ])};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
    croak "Error: Can't read manifest file '$manifestFile': $@\n" if $@;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
    #Extract meta data informations from the generated structure
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
    $self->{componentName}      = $component->{name};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
    $self->{evalidVersion}      = $component->{meta}{'evalid-version'}{content};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
    $self->{cbrVersion}         = $component->{meta}{'cbr-version'}{content};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
    $self->{mrpFilePath}        = $component->{meta}{'mrp-path'}{content};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
    $self->{createdTimeString}  = $component->{meta}{'created-time'}{content};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
    #Extract the manifest information of files from the generated structure
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
    foreach my $category ( @{ $component->{manifest}{files} } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
        foreach my $file ( @{ $category->{file} } ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
            # DEF107988	Source mapping breaks manifest
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
            # Manifest files created with CBR Tools < 2.82.1003 may contain source
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
            # mapping information, which needs to be removed if present
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
            my $fileName = $iniData->PerformReverseMapOnFileName($file->{path});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
            # We also want to remove the SRCROOT from the file name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
            if (Utils::WithinSourceRoot($fileName)){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
                $fileName = Utils::RemoveSourceRoot($fileName);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
            }elsif (Utils::SourceRoot() ne "\\"){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
                $fileName =~ s!^[\\\/]!!;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
            $self->{files}{$fileName}{'content-type'} = $category->{'content-type'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
            $self->{files}{$fileName}{'modified-timestamp'} = $file->{'modified-timestamp'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
            $self->{files}{$fileName}{'ipr-category'} = $category->{'ipr-category'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
            $self->{files}{$fileName}{'platform'} = $category->{'platform'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
            $self->{files}{$fileName}{'evalid-checksum'} = $file->{'evalid-checksum'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
sub RefreshMetaData {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
    my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
    my $ver  = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
    if (eval { require EvalidCompare }) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
        $self->{evalidInstalled} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
        print "Remark: Evalid is not available ($@)\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
    my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
    my %catdata;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
    my %categories;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
    foreach my $file (keys %{$self->{files}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
        if ($self->{files}->{$file}->{'content-type'} =~ m/export/i && !$categories{$self->{files}->{$file}->{'ipr-category'}}) {        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
        my $tempcatdata = CatData->Open($iniData, $comp, $ver, $self->{files}->{$file}->{'ipr-category'});        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
        %catdata = (%catdata, %{$tempcatdata->{data}->{exportinfo}});        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
        $categories{$self->{files}->{$file}->{'ipr-category'}} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
    $self->{createdTimeString} = strftime( '%Y-%m-%dT%H:%M:%S', localtime());
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
    $self->{cbrVersion} = Utils::ToolsVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
    foreach my $file (keys  %{$self->{files}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
        my $type = $self->{files}->{$file}->{'content-type'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
        my $absFilePath;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
        if ($type eq CONTENTTYPE_EXPORT or $type eq CONTENTTYPE_BINARY) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
            $absFilePath = Utils::RelativeToAbsolutePath($file, $iniData, EPOC_RELATIVE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
        } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
            $absFilePath = Utils::RelativeToAbsolutePath($file, $iniData, SOURCE_RELATIVE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   486
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   487
        if (!-e $absFilePath) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   488
            delete $self->{files}->{$file};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   489
            next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   490
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   491
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   492
        $self->SetFileInfo($file, MODIFIED_TIME, Utils::FileModifiedTime($absFilePath));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   493
        $self->GenerateEvalidSignature($file, $absFilePath) if ($self->{evalidInstalled});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   494
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   495
        my $policy;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   496
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   497
        if ($self->{files}->{$file}->{'content-type'} =~ /source/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   498
            my ($category) = Utils::ClassifyPath($iniData, $absFilePath, 0, 0, $comp);        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   499
            $self->SetFileInfo($file, IPR_CATEGORY, $category);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   500
        } elsif ($self->{files}->{$file}->{'content-type'} =~ /export/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   501
            my $sourcefile = Utils::RelativeToAbsolutePath($catdata{$file}, $iniData, SOURCE_RELATIVE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   502
            my ($category) = Utils::ClassifyPath($iniData, $sourcefile, 0, 0, $comp);     
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   503
            $self->SetFileInfo($file, IPR_CATEGORY, $category);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   504
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   505
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   506
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   507
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   508
sub SetFileInfo {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   509
    my $self       = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   510
    my $file       = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   511
    my $infoType   = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   512
    my $valueToSet = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   513
    $self->{files}{$file}{$infoType} = $valueToSet;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   514
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   515
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   516
sub UnsetFileInfo {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   517
    my $self       = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   518
    my $file       = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   519
    my $infoType   = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   520
    delete $self->{files}{$file}{$infoType} if exists $self->{files}{$file}{$infoType};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   521
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   522
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   523
sub GetFiles {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   524
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   525
    my $excludesource = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   526
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   527
    if (!$excludesource) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   528
        my @fileList = keys %{$self->{files}};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   529
        return \@fileList;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   530
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   531
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   532
    my @fileList = grep (($self->GetFileInfo($_, CONTENT_TYPE) ne 'source'), keys %{$self->{files}});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   533
    return \@fileList;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   534
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   535
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   536
sub GetFileInfo {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   537
    my $self     = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   538
    my $file     = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   539
    my $infoType = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   540
    my $fileInfo = $self->{files}{$file}{$infoType};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   541
    unless (defined $fileInfo) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   542
    	  $file = lc $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   543
    	  $fileInfo = $self->{files}{$file}{$infoType};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   544
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   545
    return $fileInfo;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   546
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   547
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   548
sub FileExists {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   549
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   550
  my $file = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   551
  my $isExists = exists $self->{files}{$file};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   552
  if (!$isExists) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   553
    foreach my $ff (keys %{$self->{files}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   554
      return 1 if(lc($ff) eq lc($file));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   555
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   556
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   557
  return $isExists;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   558
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   559
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   560
sub GenerateEvalidSignature {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   561
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   562
    my $file = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   563
    my $absFilePath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   564
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   565
    my $error=0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   566
    # Reroute STDOUT via our error handler
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   567
    tie *STDOUT, 'Symbian::CBR::Component::Manifest::EvalidErrorHandler', \$error;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   568
    my ($md5Checksum, $type) = EvalidCompare::GenerateSignature($absFilePath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   569
    untie *STDOUT;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   570
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   571
    if ($error == 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   572
        $self->SetFileInfo($file, EVALID_MD5, $md5Checksum);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   573
        return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   574
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   575
        print "Warning: Unable to generate checksum for file $file\n" if $error == 2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   576
        $self->UnsetFileInfo($file, EVALID_MD5);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   577
        return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   578
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   579
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   580
sub GetZipName {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   581
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   582
  my $file = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   583
  my $fileContentType = $self->GetFileInfo($file, CONTENT_TYPE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   584
  my $zipname;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   585
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   586
  $fileContentType =~ s/export/exports/i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   587
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   588
  if ($fileContentType eq 'binary') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   589
    my $platform = $self->GetFileInfo($file, 'platform');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   590
    if (defined $platform) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   591
      $zipname = "binaries_".$platform.".zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   592
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   593
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   594
      $zipname = "binaries".".zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   595
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   596
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   597
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   598
    my $cat = $self->GetFileInfo($file, 'ipr-category');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   599
    $zipname = $fileContentType.$cat.".zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   600
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   601
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   602
  return $zipname;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   603
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   604
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   605
package Symbian::CBR::Component::Manifest::EvalidErrorHandler;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   606
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   607
sub TIEHANDLE {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   608
    my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   609
    bless $self, shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   610
    my $errorflag = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   611
    $self->{errorflag} = $errorflag;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   612
    return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   613
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   614
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   615
sub PRINT {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   616
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   617
    my $message = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   618
    my $errorflag = $self->{errorflag};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   619
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   620
    # Untie STDOUT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   621
    my $handle = tied *STDOUT;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   622
    untie *STDOUT;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   623
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   624
    # Check for evalidcompare dependency failures
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   625
    if (
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   626
      $message =~ /^Error: (.*) failed \(\d+\) on file .* - not retrying as raw binary/ or
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   627
      $message =~ /^Error: (.*) failed again \(\d+\) on .* - reporting failure/
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   628
    ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   629
        # Failure: checksum will be corrupt
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   630
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   631
        if ($1 =~ /dumpbin/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   632
            # Suppress known error
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   633
            $$errorflag = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   634
        } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   635
            $message =~ s/^Error:\s*//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   636
            print "Warning: Tool dependency 'evalidcompare' failed with message: ".$message;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   637
            $$errorflag = 2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   638
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   639
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   640
        # Output wasn't an error message
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   641
        print $message;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   642
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   643
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   644
    # Re-tie the handle
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   645
    tie *STDOUT, ref($handle), $errorflag;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   646
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   647
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   648
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   649
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   650
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   651
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   652
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   653
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   654
Manifest.pm - A module that helps the construction of manifest objects for inclusion during component release process and for validation of component release
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   655
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   656
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   657
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   658
The module is used for constructing manifest objects for individual components from either a mrp file or a manifest file. The objects obtained from either processes include informations on the environment and the files that define the component.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   659
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   660
The file properties include useful informations that can be used for validating components during the release processes like the ipr-category of sources and export files, content-type, platform in which binary files are built, evalid md5 checksum and modified timestamp.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   661
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   662
=head1 INTERFACE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   663
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   664
=head2 Object Management
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   665
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   666
=head3 new
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   667
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   668
Expects a full file path of a mrp file or a manifest file path. A valid manifest xml file should be available in the path. Responsible for constructing the manifest object with a list of files that define the component along with useful manifest informations and metadata information regarding the environment
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   669
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   670
=head2 Data Management
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   671
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   672
=head3 Compare
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   673
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   674
Expects a manifest object reference as parameter. Performs a comparison of the manifest informations available in the two manifest objects returns a status of the comparison.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   675
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   676
The comparison is mainly done between the evalid md5 checksums of the both components along with basic environment check on similarity of evalid version being used for generating the checksum on the files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   677
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   678
The comparison results in a status being returned as CLEAN (integer equivalent of 0), if the manifest object informations are the same between versions and returns DIRTY (integer equivalent of 1), if the versions differ.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   679
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   680
=head3 Save
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   681
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   682
Expects a directory path as parameter. The path should be a valid existing directory path and is used by the object to save the manifest informations of the component in the form of a manifest.xml file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   683
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   684
The manifest file will not be saved if the path mentioned for the function does not exist.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   685
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   686
The manifest file contains manifest information of all the files that define the component and are segregated based on filegroups. The filegroups are listed based on basic attributes of the files like the ipr-category, content-type and binary-platform.