releasing/cbrtools/perl/PrepRel
author jjkang
Fri, 25 Jun 2010 18:37:20 +0800
changeset 602 3145852acc89
permissions -rw-r--r--
add releasing to new structure
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) 2000-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 EnvDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use PrepRel;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use CommandController;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
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
# Globals.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $mrpName;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
my $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $intVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
my $commandController = CommandController->New($iniData, 'PrepRel');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
my $envDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
PrepRel();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
# Subs.
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
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  GetOptions("h" => \$help, "m=s" => \$mrpName, "v+" => \$verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
    Usage(0);
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
  $comp = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  $ver = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  $intVer = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
  unless (defined $comp and $#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
    print "Error: Invalid number of arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
  $envDb = EnvDb->Open($iniData, $verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
  Utils::PrintDeathMessage($exitCode, "\nUsage: preprel [options] <component> [<version>] [<internal_version>]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
-h             help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
-m <mrp_name>  specify a new mrp file name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
-v             verbose output (-vv very verbose)\n");
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
sub PrepRel {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  my $updating = $envDb->Version($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  PrepRel::PrepRel($iniData, $envDb, $comp, $ver, $intVer, $mrpName);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
  if (not $ver and not $mrpName) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    print "$comp removed\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  elsif (not $ver and $mrpName) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
    print "$comp mrp updated\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  elsif ($updating) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
    print "$comp updated\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
    print "$comp added\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
PrepRel - Prepares a component for release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  preprel [options] <component> [<version>] [<internal_version>]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
  -h             help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
  -m <mrp_name>  specify a new mrp file name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
  -v             verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   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.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   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.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
=cut