releasing/cbrtools/perl/CopyRel
changeset 602 3145852acc89
equal deleted inserted replaced
600:6d08f4a05d93 602:3145852acc89
       
     1 #!perl
       
     2 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 # 
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 # 
       
    12 # Contributors:
       
    13 # 
       
    14 # Description:
       
    15 # 
       
    16 #
       
    17 
       
    18 use strict;
       
    19 use FindBin;
       
    20 use lib "$FindBin::Bin";
       
    21 use Getopt::Long;
       
    22 use IniData;
       
    23 use CommandController;
       
    24 use CopyRel;
       
    25 
       
    26 #
       
    27 # Globals.
       
    28 #
       
    29 
       
    30 my $verbose = 0;
       
    31 my $force = 0;
       
    32 my $iniData = IniData->New();
       
    33 my $commandController = CommandController->New($iniData, 'CopyRel');
       
    34 my $component;
       
    35 my $versionToCopy;
       
    36 my $version;
       
    37 my $internalVersion;
       
    38 my $project;
       
    39 
       
    40 
       
    41 #
       
    42 # Main.
       
    43 #
       
    44 
       
    45 ProcessCommandLine();
       
    46 PrintHeinousWarning();
       
    47 CopyRel();
       
    48 
       
    49 sub ProcessCommandLine {
       
    50   Getopt::Long::Configure ("bundling");
       
    51   my $help;
       
    52   GetOptions("h" => \$help, "f" => \$force, "v+" => \$verbose, "w=s" => \$project);
       
    53 
       
    54   if ($help) {
       
    55     Usage(0);
       
    56   }
       
    57 
       
    58   $component = shift @ARGV;
       
    59   $versionToCopy = shift @ARGV;
       
    60   $version = shift @ARGV;
       
    61   $internalVersion = shift @ARGV;
       
    62 
       
    63   unless (defined $component and defined $versionToCopy and defined $version and defined $internalVersion and $#ARGV == -1) {
       
    64     print "Error: Invalid arguments\n";
       
    65     Usage(1);
       
    66   }
       
    67 }
       
    68 
       
    69 sub Usage {
       
    70   my $exitCode = shift;
       
    71 
       
    72   Utils::PrintDeathMessage($exitCode, "\nUsage: copyrel [options] <component> <external_version_to_copy> <new_external_version> <new_internal_version>
       
    73 
       
    74 options:
       
    75 
       
    76 -h                    help
       
    77 -f                    if check fails, overwrite external copy
       
    78 -v                    verbose output (-vv very verbose)
       
    79 -w <project>          copy the release in given \"project\"
       
    80 \n");
       
    81 }
       
    82 
       
    83 sub PrintHeinousWarning {
       
    84   Utils::QueryUnsupportedTool(<<GUILTY, 0);  # Set $reallyrun as 0
       
    85 Warning: This operation may pollute the archive if used incorrectly. 
       
    86 Also note that if the copy fails because of an interruption, disk 
       
    87 full or a network error, you must re-run copyrel with -f. 
       
    88 
       
    89 Do you want to continue? (y/n)
       
    90 GUILTY
       
    91 }
       
    92 
       
    93 sub CopyRel {
       
    94   my $cr = new CopyRel($iniData, $force, $verbose, $project);
       
    95   
       
    96   $cr->CopyRelease($component, $versionToCopy, $version, $internalVersion);
       
    97   $cr->SummariseErrors(1);
       
    98 }
       
    99 
       
   100 
       
   101 __END__
       
   102 
       
   103 =head1 NAME
       
   104 
       
   105 CopyRel - Modifies an archive so that an additional release version is created which is a copy of a release version input.
       
   106 
       
   107 =head1 SYNOPSIS
       
   108 
       
   109   copyrel [options] <component> <external_version_to_copy> <new_external_version> <new_internal_version>
       
   110 
       
   111 options:
       
   112 
       
   113   -h                    help
       
   114   -f                    if check fails, overwrite external copy
       
   115   -v                    verbose output (-vv very verbose)
       
   116   -w <project>          copy the release in given \"project\"
       
   117 
       
   118 =head1 DESCRIPTION
       
   119 
       
   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.
       
   121 
       
   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.
       
   123 
       
   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>.
       
   125 
       
   126 =head1 KNOWN BUGS
       
   127 
       
   128 None.
       
   129 
       
   130 =head1 COPYRIGHT
       
   131 
       
   132  Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   133  All rights reserved.
       
   134  This component and the accompanying materials are made available
       
   135  under the terms of the License "Eclipse Public License v1.0"
       
   136  which accompanies this distribution, and is available
       
   137  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   138  
       
   139  Initial Contributors:
       
   140  Nokia Corporation - initial contribution.
       
   141  
       
   142  Contributors:
       
   143  
       
   144  Description:
       
   145  
       
   146 
       
   147 =cut