releasing/cbrtools/perl/Symbian/CBR/CreateDelta.pm
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 602 3145852acc89
permissions -rw-r--r--
Specify extenal tool with path
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2007-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
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
# Symbian::CBR::CreateDelta.pm
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
package Symbian::CBR::CreateDelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use File::Basename;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use File::Spec;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use File::Path;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use File::Copy;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use XML::Simple;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use Carp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
use Digest::Md5;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
use ExportData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
use EnvDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
use Symbian::CBR::DeltaRelease::Manifest qw(ADDED_ZIPS META_FILES);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
use Symbian::CBR::Component::Manifest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
sub new {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
  my $iniData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
  my $pgpkey = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
  my $releaseManifest = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
  my $verbose = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
  my $noevalid = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
  my $nodelta = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
  my $maxdelta = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
  my $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
  $self->{iniData} = $iniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
  $self->{pgpKey} = $pgpkey;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  $self->{releaseManifest} = $releaseManifest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  $self->{verbose} = $verbose;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  $self->{noevalid} = $noevalid;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  $self->{nodelta} = $nodelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  $self->{maxdelta} = $maxdelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
  bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
sub compareEnvironments {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  my $referenceComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
  my $referenceVer = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
  my $nominatedComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
  my $nominatedVer = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  print "Comparing reldata files\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  my $referenceRelData = RelData->Open($self->{iniData}, $referenceComp, $referenceVer, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  my $nominatedRelData = RelData->Open($self->{iniData}, $nominatedComp, $nominatedVer, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  my $referenceEnv = $referenceRelData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
  my $nominatedEnv = $nominatedRelData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  foreach my $thisComp ( sort keys %{$nominatedEnv}){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    if (defined $referenceEnv->{$thisComp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
      if ($referenceEnv->{$thisComp} ne $nominatedEnv->{$thisComp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
        $self->{diffComps}{modified}{$thisComp}{$referenceEnv->{$thisComp}} = $nominatedEnv->{$thisComp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
      else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
        $self->{diffComps}{identical}{$thisComp} = $nominatedEnv->{$thisComp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
      $self->{diffComps}{added}{$thisComp} = $nominatedEnv->{$thisComp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
  foreach my $thisComp( sort keys %{$referenceEnv}){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
    unless (defined $nominatedEnv->{$thisComp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
      $self->{diffComps}{deleted}{$thisComp} = $referenceEnv->{$thisComp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  }
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
sub compareFiles {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  my $referenceVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  my $nominatedVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  my $diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
  my $referenceComp = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $referenceVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
  my $nominatedComp = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  my $referenceManifest = File::Spec->catdir($referenceComp,MANIFEST_FILE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
  my $nominatedManifest = File::Spec->catdir($nominatedComp,MANIFEST_FILE);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  if (-e $referenceManifest and -e $nominatedManifest) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
    $diffFiles =   $self->compareManifestFiles($referenceManifest,$nominatedManifest);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
    $diffFiles =   $self->compareAllZipFiles($comp, $nominatedComp, $referenceComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
  #List meta files (reldata, manifest and exports.txt files).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  foreach my $thisFile (@{Utils::ReadDir($nominatedComp)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
    unless ($thisFile =~ /\.zip$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
      $diffFiles->{$comp}{files}{$thisFile} = 1;
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
  return $diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
sub compareAllZipFiles {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
  my $nominatedComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
  my $referenceComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
  my $tempRefPath = File::Spec->catdir($self->{tempDir},"ref");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
  my $tempNomPath = File::Spec->catdir($self->{tempDir},"nom");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
  print "Manifest file is not available for $comp\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
  my $nominatedCompFiles = Utils::ReadDir($nominatedComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
  my $referenceCompFiles = Utils::ReadDir($referenceComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
  my $nominatedZipFiles ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
  my $referenceZipFiles ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  my %diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
  foreach  my $thisFile (@{$nominatedCompFiles}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    $nominatedZipFiles->{$thisFile} = 1 if ($thisFile =~ /\.zip$/) ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
  foreach  my $thisFile (@{$referenceCompFiles}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
    $referenceZipFiles->{$thisFile} = 1 if ($thisFile =~ /\.zip$/) ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
  foreach  my $thisZip (keys %{$nominatedZipFiles}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
    next unless ( $self->isExportableCat($comp, $thisZip) );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
    if (defined $referenceZipFiles->{$thisZip}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
      #Modified zip file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
      my $refZipFile = File::Spec->catdir($referenceComp, $thisZip);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
      my $nomZipFile = File::Spec->catdir($nominatedComp, $thisZip);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
      print "Extracting $thisZip.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
      Utils::Unzip($refZipFile ,$tempNomPath,0,1); # 0 = verbose, 1 = overwrite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
      Utils::Unzip($nomZipFile,$tempRefPath,0,1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
      my @referenceFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
      my @nominatedFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
      Utils::ListAllFiles($tempRefPath, \@referenceFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
      Utils::ListAllFiles($tempNomPath, \@nominatedFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
      foreach my $thisnomFile (@nominatedFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
        my $file1 = $thisnomFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
        $thisnomFile = substr($thisnomFile, (length( $tempNomPath)+1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
        my $file2 = File::Spec->catfile($tempRefPath,$thisnomFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
        if (-e $file2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
          unless ($self->compareFile($file1 ,$file2)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
            $diffFiles->{$comp}{zips}{$thisZip}{modified}{$thisnomFile} = 1; #modified file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
            unlink($file1) or print "Warning: Couldn't delete $file1 : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
            unlink($file2) or print "Warning: Couldn't delete $file2 : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
          }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
        else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
          $diffFiles{$comp}{zips}{$thisZip}{added}{$thisnomFile} = 1; #added file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
          unlink($file1) or print "Warning: Couldn't delete $file1 : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
      foreach my $thisFile (@referenceFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
        my $file1 = substr($thisFile, (length( $tempRefPath)+1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
        $file1  = File::Spec->catfile($tempNomPath,$file1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
        unless (-e $file1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
          $diffFiles{$comp}{zips}{$thisZip}{deleted}{$file1} = 1 ; #deleted file for zip file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
          unlink($thisFile) or print "Warning: Couldn't delete $thisFile : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
      #Newly added zip file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
      my $nomZipFile = File::Spec->catdir($nominatedComp, $thisZip);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
      print "Extracting $thisZip.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
      Utils::Unzip($nomZipFile,$tempNomPath,0,1); # 0 = verbose, 1 = overwrite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
      my @nominatedCompFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
      Utils::ListAllFiles($tempNomPath, \@nominatedCompFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
      foreach my $thisFile (@nominatedCompFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
        my $file = substr($thisFile, (length( $tempNomPath)+1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
        $diffFiles{$comp}{zips}{$thisZip}{added}{$thisFile} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
        unlink($thisFile) or print "Warning: Couldn't delete $thisFile : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
  #check for deleted zip files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
  foreach  my $thisZip (keys %{$referenceZipFiles}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
    unless (defined $nominatedZipFiles->{$thisZip}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
      my @referenceCompFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
      my $refZipFile = File::Spec->catdir($referenceComp, $thisZip);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
      print "Extracting $thisZip.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
      Utils::Unzip($refZipFile ,$tempRefPath,0,1); # 0 =  verbose, 1 = overwrite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
      Utils::ListAllFiles($tempRefPath, \@referenceCompFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
      foreach my $thisFile (@referenceCompFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
        my $file = substr($thisFile , (length( $tempRefPath)+1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
        $diffFiles{$comp}{zips}{$thisZip}{deleted}{$file} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
        unlink($thisFile) or print "Warning: Couldn't delete $thisFile : $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
  return \%diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
sub compareFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
  my $file1 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
  my $file2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
  my $Checksum1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  my $Checksum2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
  unless ($self->{noevalid}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
    my $type1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
    my $type2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
    ($Checksum1, $type1) = EvalidCompare::GenerateSignature($file1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    ($Checksum2, $type2) = EvalidCompare::GenerateSignature($file2);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
    open(FILEHANDLE1,"$file1");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
    open(FILEHANDLE2,"$file2");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
    my $ctx1 = Digest::MD5->new;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
    my $ctx2 = Digest::MD5->new;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
    $ctx1->addfile(FILEHANDLE1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
    $ctx2->addfile(FILEHANDLE2);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
    $Checksum1 = $ctx1->hexdigest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
    $Checksum2 = $ctx2->hexdigest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
    close FILEHANDLE1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
    close FILEHANDLE2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  return 1 if ($Checksum1 eq $Checksum2);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
  return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
sub compareManifestFiles {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
  my $self = shift ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
  my $referenceManifest = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
  my $nominatedManifest = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
  my %diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
  my $referenceManifestObj = Symbian::CBR::Component::Manifest->new($referenceManifest);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
  my $nominatedManifestObj = Symbian::CBR::Component::Manifest->new($nominatedManifest);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
  my $comp = lc($referenceManifestObj->{componentName});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
  $nominatedManifestObj->Compare($referenceManifestObj,1,1); # 1 = validatesource, 1 = keepgoing
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
  foreach my $zipName (keys %{$nominatedManifestObj->GetDiffZipFiles()}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
    foreach my $thisFile (keys %{$nominatedManifestObj->GetDiffFilesForZip($zipName)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
      my $fileStatus = $nominatedManifestObj->GetFileStatus($zipName, $thisFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
      $diffFiles{$comp}{zips}{$zipName}{$fileStatus}{$thisFile} = 1;
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
  return  \%diffFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
sub isExportableCat {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
  my $zipFile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
  my $exportPgp = [ ];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
  return 1 if($self->{exportAll});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
  if ($zipFile =~ /^source([a-z])\.zip$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
    $exportPgp  = $self->{exportData}->PgpKeysForSource($comp,$1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
  elsif ($zipFile =~ /^exports([A-Z])\.zip$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
    $exportPgp  = $self->{exportData}->PgpKeysForExports($comp,$1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
  elsif ($zipFile =~ /^binaries/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
    $exportPgp  = $self->{exportData}->PgpKeysForBinaries($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
  if (scalar @{$exportPgp} > 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
    foreach  my $thisKey (@{$exportPgp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
      return 1 if ($self->{pgpKey} eq $thisKey);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
  return 0;
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
sub createDeltaEnv {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
  my $referenceComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
  my $referenceVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
  my $nominatedComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
  my $nominatedVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
  my $destination = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
  Utils::InitialiseTempDir($self->{iniData});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
  $self->{tempDir} = Utils::TempDir();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
  my $deltaDestination = File::Spec->catdir($self->{tempDir},"modified");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
  my $newCompPath = File::Spec->catdir($self->{tempDir}, "new");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
  $self->{exportData} = ExportData->New(exports_file => $self->{iniData}->ExportDataFile(),verbose => $self->{verbose}) unless ($self->{exportAll});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
  my $referenceRelData = RelData->Open($self->{iniData}, $referenceComp, $referenceVersion, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
  my $nominatedRelData = RelData->Open($self->{iniData}, $nominatedComp, $nominatedVersion, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
  my $referenceEnv = $referenceRelData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
  my $nominatedEnv = $nominatedRelData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
  unless ($self->{exportAll}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
    my $foundPgpKey = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
    foreach my $thisPgpKeys (@{$self->{exportData}->AllPgpKeys()}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
      if ($thisPgpKeys eq $self->{pgpKey}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
        $foundPgpKey = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
        last;
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
    croak "Error: PGP key ".$self->{pgpKey}." is not defined in ".$self->{iniData}->ExportDataFile()." file.\n" unless($foundPgpKey);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
    foreach  my $thisComp (keys %{$nominatedEnv}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
      unless ($self->{exportData}->ComponentIsExportable($thisComp)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
        print "Warning: component \"$thisComp\" is not defined in export table.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
  unless ($self->{noevalid} or eval { require EvalidCompare }) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
    print "Warning: EvalidCompare is not installed. Setting --noevalid option. ($@)\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
    $self->{noevalid} = 1;
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
  $self->{DeltaManifest} = Symbian::CBR::DeltaRelease::Manifest->new();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
  $self->{DeltaManifest}->SetReferenceBaselineComp($referenceComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
  $self->{DeltaManifest}->SetReferenceBaselineVer($referenceVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
  $self->{DeltaManifest}->SetNominatedBaselineComp($nominatedComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
  $self->{DeltaManifest}->SetNominatedBaselineVer($nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
  $self->compareEnvironments($referenceComp,$referenceVersion,$nominatedComp,$nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
  foreach my $thisComp ( sort keys %{$self->{diffComps}{modified}} ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
    eval{ $self->createDeltaForComp($thisComp,$$referenceEnv{$thisComp},$$nominatedEnv{$thisComp}, $deltaDestination) };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
    print "Error: Unable to create Deltas for $thisComp,$$referenceEnv{$thisComp},$$nominatedEnv{$thisComp} $@\n" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
  foreach my $thisComp (sort keys %{$self->{diffComps}{added}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
    $self->addComponent($thisComp, $newCompPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
  foreach my $thisComp (sort keys %{$self->{diffComps}{identical}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
    $self->recordIdenticalOrDeletedComponent($thisComp, "identical");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
  foreach my $thisComp (sort keys %{$self->{diffComps}{deleted}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
    $self->recordIdenticalOrDeletedComponent($thisComp, "deleted");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
  $self->{DeltaManifest}->Save($self->{tempDir}); # Write delta manifest file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
  #Package modified, new directories and delta manifest file into zip files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
  my @filesToBeZipped ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
  my @allFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
  my $tempRefPath = File::Spec->catdir($self->{tempDir},"ref");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
  my $tempNomPath = File::Spec->catdir($self->{tempDir},"nom");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
  rmtree($tempRefPath) if($tempRefPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
  rmtree($tempNomPath) if($tempNomPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
  Utils::ListAllFiles($self->{tempDir}, \@allFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
  foreach  my $thisFile (@allFiles) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
    my $file = substr($thisFile, (length($self->{tempDir})+1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
    push @filesToBeZipped, $file;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
  my $tempPackageZipFile = $referenceVersion."_".$nominatedVersion.".tmp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
  $tempPackageZipFile = File::Spec->catfile($destination, $tempPackageZipFile );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
  my $packageZipFile = $referenceVersion."_".$nominatedVersion.".zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
  $packageZipFile = File::Spec->catfile($destination, $packageZipFile );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
  if (-e $packageZipFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
    print "Overwriting $packageZipFile.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
    unlink ($packageZipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
  print "Packaging all files into $packageZipFile.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
  Utils::ZipList( $tempPackageZipFile, \@filesToBeZipped, $self->{verbose}, 0,$self->{tempDir});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
  rename ($tempPackageZipFile, $packageZipFile) or croak "Error: Couldn't rename $tempPackageZipFile to $packageZipFile.\n ";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
  rmtree ($self->{tempDir});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
sub recordIdenticalOrDeletedComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
  my $compStatus = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
  $self->{DeltaManifest}->SetComponentDetails($comp, $compStatus, $self->{diffComps}{$compStatus}{$comp}, undef); # undef for nominated version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
  print "$comp is $compStatus.\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
sub addComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
  my $newCompPath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
  print "$comp is newly added.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
  $self->{DeltaManifest}->SetComponentDetails($comp, "added", undef, $self->{diffComps}{added}{$comp}); # undef for reference version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
  $newCompPath = File::Spec->catdir($newCompPath,$comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
  mkpath($newCompPath) unless (-e $newCompPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
  my $archiveForComp = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $self->{diffComps}{added}{$comp});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
  my $archiveFiles = Utils::ReadDir($archiveForComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
  foreach my $thisFile (@{$archiveFiles}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
    my $archiveFilePath = File::Spec->catdir($archiveForComp,$thisFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
    my $destFilePath = File::Spec->catfile($newCompPath,$thisFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
    if ($thisFile =~ /\.zip$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
      if ($self->isExportableCat($comp,$thisFile)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
        $self->{DeltaManifest}->SetZipfileDetails($comp, $thisFile, "added");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
        eval{ copy($archiveFilePath,$destFilePath) ;};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
		croak "Error: File $archiveFilePath cannot be copied to $destFilePath. $@" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
     eval{ copy($archiveFilePath,$destFilePath) ;};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
	 croak "Error: File $archiveFilePath cannot be copied to $destFilePath. $@" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
      $self->{DeltaManifest}->RecordMetaFile($comp, $thisFile);
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
sub createDeltaForComp {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
  my $referenceVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
  my $nominatedVersion = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
  my $deltaDestination = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
  print "Creating Delta for $comp component.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
  my $referenceCompPath = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $referenceVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
  my $nominatedCompPath = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
  my $relDataManifestDestination = File::Spec->catdir($self->{tempDir},META_FILES);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
  $self->{DeltaManifest}->SetComponentDetails($comp, "modified", $referenceVersion, $nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
  my $filesList = $self->compareFiles($comp,$referenceVersion,$nominatedVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
  foreach my $zipFile (keys %{$filesList->{$comp}{zips}}) { #Iterate through all zip files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
    if ($self->isExportableCat($comp,$zipFile)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
      if ($self->{deltaAllFiles} or $self->{releaseManifest}->FileExists($comp, $zipFile)) { #Check whether zip file is present at receiving site or.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
        $self->{DeltaManifest}->SetZipfileDetails($comp, $zipFile, "modified");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
        $self->createDeltaForZip($comp, $referenceCompPath, $nominatedCompPath, $zipFile, $deltaDestination, $filesList);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
      else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
        $self->{DeltaManifest}->SetZipfileDetails($comp, $zipFile, "added"); #added zip file for the component.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
        my $newZipFilePath = File::Spec->catdir($deltaDestination, ADDED_ZIPS, $comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
        mkpath ($newZipFilePath) unless(-d $newZipFilePath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
        my $addedZipFile = File::Spec->catfile($newZipFilePath, $zipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
        my $archiveFile = File::Spec->catfile($nominatedCompPath,$zipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
        copy($archiveFile,$addedZipFile) or print "Warning: Couldn't copy $zipFile\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
      print "Warning: $zipFile is not exportable.\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
  foreach my $thisFile (@{Utils::ReadDir($referenceCompPath)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
    if ($thisFile =~/\.zip$/ and $self->isExportableCat($comp,$thisFile)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
      unless (defined $filesList->{$comp}{zips}{$thisFile}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
        $self->{DeltaManifest}->SetZipfileDetails($comp, $thisFile, "identical");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
    } 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
  #Process reldata manifest and export.txt files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
  foreach my $thisFile (keys %{$filesList->{$comp}{files}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
    $self->{DeltaManifest}->RecordMetaFile($comp, $thisFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
    my $archiveFile = File::Spec->catfile($nominatedCompPath, $thisFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
    my $destinationFile = $comp."_".$thisFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
    mkpath($relDataManifestDestination) unless(-d $relDataManifestDestination);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
    $destinationFile = File::Spec->catfile($relDataManifestDestination, $destinationFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
    copy($archiveFile,$destinationFile) or print "Warning: Couldn't copy $thisFile\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
sub createDeltaForZip {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
  my $referenceCompPath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
  my $nominatedCompPath  = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
  my $zipFile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
  my $deltaDestination = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
  my $filesList = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
  my $refZipFilePath = File::Spec->catfile($referenceCompPath, $zipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
  my $nomZipFilePath = File::Spec->catfile($nominatedCompPath, $zipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
  my $tempRefPath = File::Spec->catdir($self->{tempDir},"ref");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
  my $tempNomPath = File::Spec->catdir($self->{tempDir},"nom");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
  print "Creating delta for $zipFile\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
  #Process all files of a zip file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
  foreach my $file (keys %{$filesList->{$comp}{zips}{$zipFile}{'modified'}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
    #create delta for a file if it is modified.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
    unless ($self->{nodelta}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
      #Extract and create delta for a file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
      print "Extracting $file from nominated $zipFile.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
      eval{Utils::UnzipSingleFile($nomZipFilePath,$file,$tempNomPath,0,1, $comp)};  # 0 = verbose. 1 = overwrite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
      croak "Error: Couldn't Extract File $file $@\n" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
      my $file2 = File::Spec->catfile($tempNomPath,$file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
      my $outputDeltaPath = File::Spec->catdir($deltaDestination, dirname($file));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
      my $size = -s $file2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
      if (!defined $self->{maxdelta} or $size <= $self->{maxdelta}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   486
        print "Extracting $file from reference $zipFile.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   487
        eval{Utils::UnzipSingleFile($refZipFilePath,$file,$tempRefPath,0,1, $comp)};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   488
        croak "Error: Couldn't Extract File $file $@\n" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   489
        my $file1 = File::Spec->catfile($tempRefPath,$file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   490
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   491
        $self->{DeltaManifest}->SetFileDetails($comp, $zipFile, $file, "modified", "delta");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   492
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   493
        $self->generateFileDelta($file1,$file2,$outputDeltaPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   494
      } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   495
        # File is too big to delta
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   496
        $self->{DeltaManifest}->SetFileDetails($comp, $zipFile, $file, "modified", "file");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   497
        print "Not creating a delta of $file due to it being $size bytes\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   498
        if (! -d $outputDeltaPath) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   499
          mkpath($outputDeltaPath) or croak "Error: Couldn't create directory for large file $file2 in delta\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   500
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   501
        system("move /Y \"".$file2."\" \"".$outputDeltaPath."\"") and croak "Error: Couldn't move large file $file2 into delta\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   502
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   503
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   504
      #add file to output delta package.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   505
      $self->{DeltaManifest}->SetFileDetails($comp, $zipFile, $file, "modified", "file");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   506
      print "Extracting $file from $zipFile.\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   507
      eval{Utils::UnzipSingleFile($nomZipFilePath,$file,$deltaDestination,0,1, $comp); # 0 = verbose. 1 = overwrite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   508
      };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   509
      croak "Error: Couldn't Extract File $file $@\n" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   510
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   511
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   512
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   513
  foreach my $file (keys %{$filesList->{$comp}{zips}{$zipFile}{'added'}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   514
    #Newly added file to component.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   515
    print "$file is newly added.\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   516
    $self->{DeltaManifest}->SetFileDetails($comp, $zipFile, $file, "added", "file"); 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   517
    print "Extracting $file from $zipFile\n" if($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   518
    eval{Utils::UnzipSingleFile($nomZipFilePath,$file,$deltaDestination,0, 1, $comp)};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   519
    croak "Error: Couldn't Extract File $file:$@\n" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   520
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   521
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   522
  foreach my $file (keys %{$filesList->{$comp}{zips}{$zipFile}{'deleted'}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   523
    #deleted file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   524
    print "$file is deleted.\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   525
    $self->{DeltaManifest}->SetFileDetails($comp, $zipFile, $file, "deleted", "file"); 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   526
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   527
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   528
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   529
sub generateFileDelta {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   530
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   531
  my $file1 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   532
  my $file2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   533
  my $destination = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   534
  my $deltaFile = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   535
  mkpath($destination) unless (-e $destination);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   536
  $deltaFile =  basename($file2).".delta" unless(defined $deltaFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   537
  $deltaFile = File::Spec->catfile($destination,$deltaFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   538
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   539
  $file1  =~ s/^\\/\\\\/g; # Replace leading \ by \\.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   540
  $file2  =~ s/^\\/\\\\/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   541
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   542
  print "Creating delta for file ". basename($file1). "\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   543
  my $status = system "zdc \"$file1\" \"$file2\"  \"$deltaFile\"" ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   544
  if( $status != 0 ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   545
    $status = system "zdc" ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   546
    $! = $? >> 8;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   547
    if ($status != 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   548
      $! = $? >> 8;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   549
      print "Error: The zdelta tool is not installed. Please install zdelta, or use the --nodelta option to skip delta creation.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   550
      croak;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   551
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   552
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   553
      print "Error: The zdelta tool is not installed properly. Please install zdelta once again, or use the --nodelta option to skip delta creation.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   554
      croak;
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
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   558
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   559
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   560
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   561
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   562
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   563
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   564
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   565
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   566
Symbian::CBR::CreateDelta.pm - Creates deltas for modified files from reference baseline to the nominated baseline.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   567
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   568
=head2 new
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   569
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   570
Creates a CreateDelta object. Expects to be passed:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   571
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   572
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   573
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   574
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   575
an C<IniData> reference
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   576
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   577
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   578
a C<Release manifest> reference
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   579
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   580
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   581
a verbosity level
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   582
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   583
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   584
a flag to indicate not to use evalid for comparision
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   585
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   586
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   587
a flag to skip delta creation
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   588
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   589
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   590
a maximum file size (in bytes) above which the tool won't create a delta of the file (assuming the flag to skip delta creating in all cases is not used).  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   591
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   592
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   593
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   594
=head2 compareEnvironments
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   595
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   596
Expects to be passed a reference component name, a reference component version, a nominated component name and a nominated component version. Compares these environments to list identical, modified, added and deleted components.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   597
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   598
=head2 compareFiles
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   599
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   600
Expects to be passed a full path for a reference version and a nominated version of a component. Lists modified, added and deleted files for the component between the two versions. If the manifest file is present for both versions, then it compares using manifest objects. Otherwise it extracts all zip files and compares each file, one at a time.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   601
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   602
=head2 compareFile
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   603
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   604
Expects to be passed full paths for two versions of a file. Compares them using EvalidCompare if noevalid is not specified, otherwise uses Digest::MD5 for the file comparison. Returns 1 if checksum for both the files matches, otherwise 0.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   605
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   606
=head2 createDeltaEnv
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   607
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   608
Expects to be passed a reference component name, a reference component version, a nominated component name, a nominated component version, and a destination. Creates the deltas for the modified files between two baselines, adds newly added files and components and packages these files into a zip file at the path provided as a destination. 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   609
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   610
=head2 createDeltaForComp
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   611
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   612
Expects to be passed a component name, reference version of component, nominated version of a component, and path where deltas to be stored. Compares the modified, added and deleted files from reference version to nominated version and creates the deltas for modified files, then copies the newly added files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   613
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   614
=head2 generateFileDelta 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   615
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   616
Expects to be passed a full path for two versions of a file, destination path where delta file should be stored, and optionally delta file name. Makes use of zdelta third party tool to create delta for a file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   617
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   618
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   619
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   620
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   621
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   622
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   623
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   624
 Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   625
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   626
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   627
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   628
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   629
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   630
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   631
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   632
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   633
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   634
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   635
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   636
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   637
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   638
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   639
=cut