releasing/cbrtools/perl/CopyRel
author Jon Chatten
Mon, 13 Sep 2010 14:04:04 +0100
changeset 641 8dd670a9f34f
parent 602 3145852acc89
permissions -rw-r--r--
sbs version 2.15.2
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) 2004-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 CopyRel;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
# Globals.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
my $force = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
my $commandController = CommandController->New($iniData, 'CopyRel');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $component;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
my $versionToCopy;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $version;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $internalVersion;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $project;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
PrintHeinousWarning();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
CopyRel();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  GetOptions("h" => \$help, "f" => \$force, "v+" => \$verbose, "w=s" => \$project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
    Usage(0);
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
  $component = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  $versionToCopy = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  $version = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
  $internalVersion = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
  unless (defined $component and defined $versionToCopy and defined $version and defined $internalVersion and $#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  Utils::PrintDeathMessage($exitCode, "\nUsage: copyrel [options] <component> <external_version_to_copy> <new_external_version> <new_internal_version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
-h                    help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
-f                    if check fails, overwrite external copy
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
-v                    verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
-w <project>          copy the release in given \"project\"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
\n");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
sub PrintHeinousWarning {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  Utils::QueryUnsupportedTool(<<GUILTY, 0);  # Set $reallyrun as 0
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
Warning: This operation may pollute the archive if used incorrectly. 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
Also note that if the copy fails because of an interruption, disk 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
full or a network error, you must re-run copyrel with -f. 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
Do you want to continue? (y/n)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
GUILTY
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
sub CopyRel {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  my $cr = new CopyRel($iniData, $force, $verbose, $project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  $cr->CopyRelease($component, $versionToCopy, $version, $internalVersion);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  $cr->SummariseErrors(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
CopyRel - Modifies an archive so that an additional release version is created which is a copy of a release version input.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  copyrel [options] <component> <external_version_to_copy> <new_external_version> <new_internal_version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  -h                    help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
  -f                    if check fails, overwrite external copy
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
  -v                    verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
  -w <project>          copy the release in given \"project\"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
The command CopyRel is used to create a new release which is based upon another release. The contents of the new release version is identical to the release input, except the external and internal version is updated as specified.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
By using CopyRel a new baseline release can be created, which will inherit the environment of the original baseline release version that was copied. This is useful renumbering a baseline.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
By default the new release is created in the same archive as the release which is copied. The option -w <project> changes the default behavior so that the archive to create the new release can be set as <project>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
 Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
=cut