releasing/cbrtools/perl/DeltaEnv
author marvin shi <marvin.shi@nokia.com>
Wed, 17 Nov 2010 16:47:55 +0800
changeset 696 30aa553e9465
parent 602 3145852acc89
permissions -rw-r--r--
features: bsym for rofsbuild and log input support for rombuild
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
#!perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# Description:
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use FindBin;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use lib "$FindBin::Bin";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use Getopt::Long;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use CommandController;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use Cwd 'abs_path';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use Symbian::CBR::CreateDelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use Symbian::CBR::ApplyDelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use Symbian::CBR::Release::Manifest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
use Carp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
use File::Spec;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
# Globals.
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
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $overwrite = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $noevalid = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $nodelta = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
my $commandController = CommandController->New( $iniData, 'DeltaEnv' );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
my $referenceComp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
my $referenceVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
my $nominatedComp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
my $nominatedVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
my $report;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
my $createDelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
my $applyDelta;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
my $releaseManifestFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
my $receivingArchive;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
my $pgpKey;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
my $deltaPackagePath;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
# Main.
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
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
# Subs.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  Getopt::Long::Configure ( "bundling" );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  my $maxdeltasize;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  GetOptions( 'h' => \$help, 'o' => \$overwrite, 'v+' => \$verbose, 'noevalid+' => \$noevalid, 'nodelta+' => \$nodelta, 'c+' => \$createDelta, 'a+' => \$applyDelta, 'r+' => \$report, 'rb=s' => \$referenceComp, 'rv=s' => \$referenceVer, 'nb=s' => \$nominatedComp, 'nv=s' => \$nominatedVer, 'rm=s' => \$releaseManifestFile, 'ra=s' => \$receivingArchive, 'p=s' => \$pgpKey, 'dp=s' => \$deltaPackagePath, 'maxdelta=s' => \$maxdeltasize );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  if ( $help ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
    Usage(0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
  elsif ( $report ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
    generateReleaseManifest();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  elsif ($createDelta) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    createDeltaEnv($maxdeltasize);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
  elsif ($applyDelta) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
    ReconstructEnv();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
    print "Error: Invalid option.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
  if ($report) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
    GenerateReleaseManifestUsage($exitCode);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  if ($createDelta) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
    CreateDeltaUsage($exitCode);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
  if ($applyDelta) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
    ApplyDeltaUsage($exitCode);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  Utils::PrintDeathMessage($exitCode, "\n
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
-h    help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
-r    generate release manifest mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
-c    create delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
-a    apply delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
-v    verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
-r -h generate release manifest mode help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
-c -h create delta mode help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
-a -h apply delta mode help \n" );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
sub GenerateReleaseManifestUsage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
  Utils::PrintDeathMessage($exitCode, "\nUsage: deltaenv -r [options] <component> <version> [report path]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
-h help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
-o overwrite existing release manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
-v verbose output \n" );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
sub CreateDeltaUsage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
  Utils::PrintDeathMessage($exitCode, "\nUsage: deltaenv -c [options] --nb <nominated baseline> --nv <nominated version> [--rm <release manifest>|--rb <reference baseline> --rv <reference version> --ra <receiving archive>] -p <PGP key> [--dp <delta release package>]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
-h         help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
-v         verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
-o         overwrite existing delta release package
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
--nodelta  include whole files where modified (don't create deltas)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
--noevalid use raw binary comparison (don't use evalid)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
--nb       <nominated baseline> nominated baseline component name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
--nv       <nominated version> nominated baseline component version
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
--rm       <release manifest> release manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
--rb       <reference baseline> reference baseline component name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
--rv       <reference version> reference baseline component version
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
--ra       <receiving archive> receiving archive path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
-p         <PGP key> PGP key of recipient
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
--maxdelta <max size> max size to delta (larger files treated as --nodelta)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
--dp       <delta release package> delta release package path \n" );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
sub ApplyDeltaUsage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
  Utils::PrintDeathMessage($exitCode, "\nUsage: deltaenv -a [options] <delta release package>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
-h help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
-o overwrite existing components
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
-v verbose output \n" );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
sub generateReleaseManifest {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  my $comp = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
  my $ver = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  my $destinationManifestPath  = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  unless ( defined $comp and defined $ver and $#ARGV == -1 ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
    print "Error: Reference component and version must be specified.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
    GenerateReleaseManifestUsage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
  my $localArchive = $iniData->PathData->LocalArchivePathForExistingComponent($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
  die "Error: $comp $ver does not exist.\n" unless (defined $localArchive);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
  if ($localArchive !~ s/\Q$comp\E[\\\/]\Q$ver\E([\\\/])?$//) { # Remove the component name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
    die "Error: (INTERNAL) Unable to remove component information $comp $ver from the archive path $localArchive\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
  } 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
  my $archiveReleaseManifestDir = File::Spec->catdir($localArchive, ".cbr");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
  my $archiveFile = $comp."_".$ver."_manifest.xml";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
  $archiveFile = File::Spec->catfile($archiveReleaseManifestDir, $archiveFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  my $releaseManifest = Symbian::CBR::Release::Manifest->new( $iniData, $verbose );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  unless ( defined $destinationManifestPath ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
    $destinationManifestPath = Cwd::cwd();
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
  if (-e $archiveFile and !$overwrite) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
    $releaseManifest->Load($archiveFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
    $releaseManifest->GenerateManifest($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
  if ($overwrite or !-e $archiveFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
    eval{ $releaseManifest->Save($archiveReleaseManifestDir);};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
    print "Warning: Not backing up manifest file in $archiveReleaseManifestDir path because $@" if($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
  $releaseManifest->Save( $destinationManifestPath );
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
sub createDeltaEnv {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
  my $maxdeltasize = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
  unless ( defined $nominatedComp and defined $nominatedVer and $#ARGV == -1 ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
    CreateDeltaUsage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
  unless (defined $releaseManifestFile or (defined $referenceComp and defined $referenceVer)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
    CreateDeltaUsage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
  # Parse max delta file size
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
  my $maxdeltabytes;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  if (defined $maxdeltasize) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    if ($maxdeltasize =~ /^\d+$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
      $maxdeltabytes = $maxdeltasize;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
    } elsif ($maxdeltasize =~ /^(\d+)k$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
      $maxdeltabytes = $1*1024;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
    } elsif ($maxdeltasize =~ /^(\d+)m$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
      $maxdeltabytes = $1*1024*1024;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
    } elsif ($maxdeltasize =~ /^(\d+)g$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
      $maxdeltabytes = $1*1024*1024*1024;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
      die "Error: Option '--maxdelta ".$maxdeltasize."' is not a valid size (sizes must be in bytes, or have a K, M or G postfix)\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
  # Get a release manifest to represent the nominated baseline in the receiving archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  my $deltaAllFiles;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
  my $releaseManifest = Symbian::CBR::Release::Manifest->new( $iniData, $verbose );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
  if ( defined  $releaseManifestFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
    $releaseManifestFile = File::Spec->rel2abs($releaseManifestFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
    print "Reading $releaseManifestFile file.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
    $releaseManifest->Load( $releaseManifestFile );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
  elsif (defined $receivingArchive) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
    $releaseManifest->GenerateManifest($referenceComp, $referenceVer, $receivingArchive);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
    $deltaAllFiles = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
  # Create the delta
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
  $referenceComp = $releaseManifest->{'baselineName'} unless (defined $referenceComp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
  $referenceVer = $releaseManifest->{'baselineVersion'} unless (defined $referenceVer);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
  unless ( defined $deltaPackagePath ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
    $deltaPackagePath = Cwd::cwd();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
  my $packageZipFile = $referenceVer."_".$nominatedVer.".zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
  $packageZipFile = File::Spec->catfile($deltaPackagePath, $packageZipFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
  die "Error: Delta release for $referenceVer and $nominatedVer is already present in $deltaPackagePath. Please use -o option to overwrite.\n" if (-e $packageZipFile and !$overwrite);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
  my $createDelta = Symbian::CBR::CreateDelta->new( $iniData, $pgpKey, $releaseManifest, $verbose, $noevalid, $nodelta, $maxdeltabytes );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
  $createDelta->{deltaAllFiles} = 1 if ($deltaAllFiles);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
  $createDelta->{exportAll} = 1 unless (defined $pgpKey);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
  $createDelta->createDeltaEnv( $referenceComp, $referenceVer, $nominatedComp, $nominatedVer, $deltaPackagePath );
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
  print "Successfully created deltas for baseline.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
sub ReconstructEnv {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
  my $zipFile = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
  unless (defined $zipFile and $#ARGV == -1 ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
    ApplyDeltaUsage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
  print "Reconstructing Environment\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
  my $reconstructEnv = Symbian::CBR::ApplyDelta->new($iniData,$verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
  $reconstructEnv->ReconstructEnv($zipFile, $overwrite);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
  print "Reconstructed baseline successfully.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
}
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
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
DeltaEnv - Creates and applies deltas for modified components between pair of baselines.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
  -h    help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
  -r    generate release manifest mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
  -c    create delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
  -a    apply delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
  -v    verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
  -r -h generate release manifest mode help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
  -c -h create delta mode help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
  -a -h apply delta mode help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
Generate release manifest mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
  deltaenv -r [options] <component> <version> [report path]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
  -h help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
  -o overwrite existing release manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
  -v verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
Create delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
  deltaenv -c [options] --nb <nominated baseline> --nv <nominated version> [--rm <release manifest>|--rb <reference baseline> --rv <reference version> --ra <receiving archive>] -p <PGP key> [--dp <delta release package>]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
  -h         help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
  -v         verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
  -o         overwrite existing delta release package
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
  --nodelta  include whole files where modified (don't create deltas)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
  --noevalid use raw binary comparison (don't use evalid)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
  --nb       <nominated baseline> nominated baseline component name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
  --nv       <nominated version> nominated baseline component version
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
  --rm       <release manifest> release manifest file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
  --rb       <reference baseline> reference baseline component name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
  --rv       <reference version> reference baseline component version
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
  --ra       <receiving archive> receiving archive path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
   -p        <PGP key> PGP key of recipient
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
  --maxdelta <max size> max size to delta (larger files treated as --nodelta)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
  --dp       <delta release package> delta release package path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
Apply delta mode
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
  deltaenv -a [options] <delta release package>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
  -h help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
  -o overwrite existing components
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
  -v verbose output
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
This command can be used in 3 modes: generate release manifest, create delta, and apply delta.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
Generate Release Manifest :
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
Generates a release manifest file, which lists all files available in the reference baseline at the receiving archive. It is used in create delta mode, in order that it has an accurate representation of the reference baseline to make the delta against.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
The release manifest contains the list of components and their versions in the reference baseline environment. It also lists all the files in each component, and all the metadata files, and each file's size, timestamp and MD5 checksum.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
Create delta mode :
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
Creates a smallest possible delta package, using which whole baseline can be reconstructed at the receiving site. this delta package contains deltas for modified files from reference version to the nominated version of a component, newly added files for the existing components, newly added components for the baseline and delta release manifest file. This delta package can be transferred by the user to receiving site instead of whole baseline.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
Apply delta mode : 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
Reconstructs a nominated baseline using reference version and delta release package which is created in create delta mode. Using create delta and apply delta mode, amount of data to be transferred from sending site to receiving site can be reduced.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
 Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
=cut