releasing/cbrtools/perl/PrepRel
changeset 602 3145852acc89
equal deleted inserted replaced
600:6d08f4a05d93 602:3145852acc89
       
     1 #!perl
       
     2 # Copyright (c) 2000-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 EnvDb;
       
    24 use Utils;
       
    25 use PrepRel;
       
    26 use CommandController;
       
    27 
       
    28 
       
    29 #
       
    30 # Globals.
       
    31 #
       
    32 
       
    33 my $verbose = 0;
       
    34 my $mrpName;
       
    35 my $comp;
       
    36 my $ver;
       
    37 my $intVer;
       
    38 my $iniData = IniData->New();
       
    39 my $commandController = CommandController->New($iniData, 'PrepRel');
       
    40 my $envDb;
       
    41 
       
    42 
       
    43 #
       
    44 # Main.
       
    45 #
       
    46 
       
    47 ProcessCommandLine();
       
    48 PrepRel();
       
    49 
       
    50 
       
    51 #
       
    52 # Subs.
       
    53 #
       
    54 
       
    55 sub ProcessCommandLine {
       
    56   Getopt::Long::Configure ("bundling");
       
    57   my $help;
       
    58   GetOptions("h" => \$help, "m=s" => \$mrpName, "v+" => \$verbose);
       
    59 
       
    60   if ($help) {
       
    61     Usage(0);
       
    62   }
       
    63 
       
    64   $comp = shift @ARGV;
       
    65   $ver = shift @ARGV;
       
    66   $intVer = shift @ARGV;
       
    67 
       
    68   unless (defined $comp and $#ARGV == -1) {
       
    69     print "Error: Invalid number of arguments\n";
       
    70     Usage(1);
       
    71   }
       
    72 
       
    73   $envDb = EnvDb->Open($iniData, $verbose);
       
    74 }
       
    75 
       
    76 sub Usage {
       
    77   my $exitCode = shift;
       
    78 
       
    79   Utils::PrintDeathMessage($exitCode, "\nUsage: preprel [options] <component> [<version>] [<internal_version>]
       
    80 
       
    81 options:
       
    82 
       
    83 -h             help
       
    84 -m <mrp_name>  specify a new mrp file name
       
    85 -v             verbose output (-vv very verbose)\n");
       
    86 }
       
    87 
       
    88 sub PrepRel {
       
    89   my $updating = $envDb->Version($comp);
       
    90   PrepRel::PrepRel($iniData, $envDb, $comp, $ver, $intVer, $mrpName);
       
    91   if (not $ver and not $mrpName) {
       
    92     print "$comp removed\n";
       
    93   }
       
    94   elsif (not $ver and $mrpName) {
       
    95     print "$comp mrp updated\n";
       
    96   }
       
    97   elsif ($updating) {
       
    98     print "$comp updated\n";
       
    99   }
       
   100   else {
       
   101     print "$comp added\n";
       
   102   }
       
   103 }
       
   104 
       
   105 __END__
       
   106 
       
   107 =head1 NAME
       
   108 
       
   109 PrepRel - Prepares a component for release.
       
   110 
       
   111 =head1 SYNOPSIS
       
   112 
       
   113   preprel [options] <component> [<version>] [<internal_version>]
       
   114 
       
   115 options:
       
   116 
       
   117   -h             help
       
   118   -m <mrp_name>  specify a new mrp file name
       
   119   -v             verbose output (-vv very verbose)
       
   120 
       
   121 =head1 DESCRIPTION
       
   122 
       
   123 Before a component can be released, it's environment database status must be set to I<pending release>. Also, a new version (and optionally internal version - note, if the C<reltools.ini> keyword C<require_internal_versions> has be set, an internal version is manatory) must be specifed. C<PrepRel> provides a means of editing this information in the environment database. To check that the values have been correctly updated, use C<EnvInfo>. Note, this will now take longer to run because the information in the F<mrp> files of the components pending release will need to be gathered. To remove the environment database entry for a component altogether, execute C<PrepRel> with no version.
       
   124 
       
   125 Note, C<PrepRel> (and its counterpart C<PrepEnv>) do nothing more than update your the environment database. You can execute these commands as many times as you like before running C<MakeEnv> to actually release the environment.
       
   126 
       
   127 =head1 KNOWN BUGS
       
   128 
       
   129 None.
       
   130 
       
   131 =head1 COPYRIGHT
       
   132 
       
   133  Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   134  All rights reserved.
       
   135  This component and the accompanying materials are made available
       
   136  under the terms of the License "Eclipse Public License v1.0"
       
   137  which accompanies this distribution, and is available
       
   138  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   139  
       
   140  Initial Contributors:
       
   141  Nokia Corporation - initial contribution.
       
   142  
       
   143  Contributors:
       
   144  
       
   145  Description:
       
   146  
       
   147 
       
   148 =cut