602
|
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 MrpData;
|
|
25 |
use MakeRel;
|
|
26 |
use CommandController;
|
|
27 |
|
|
28 |
|
|
29 |
#
|
|
30 |
# Globals.
|
|
31 |
#
|
|
32 |
|
|
33 |
my $verbose = 0;
|
|
34 |
my $fixLibs = 0;
|
|
35 |
my $iniData = IniData->New();
|
|
36 |
my $commandController = CommandController->New($iniData, 'MakeRel');
|
|
37 |
my $envDb;
|
|
38 |
my $makeRel;
|
|
39 |
my $notesSrc;
|
|
40 |
my $project;
|
|
41 |
my $reallyrun;
|
|
42 |
my @mrpData;
|
|
43 |
|
|
44 |
|
|
45 |
#
|
|
46 |
# Main.
|
|
47 |
#
|
|
48 |
|
|
49 |
ProcessCommandLine();
|
|
50 |
PrintHeinousWarning();
|
|
51 |
MakeRel::MakeReleases($iniData, $envDb, \@mrpData, $notesSrc, 'MakeRel', $verbose, $project);
|
|
52 |
|
|
53 |
|
|
54 |
#
|
|
55 |
# Subs.
|
|
56 |
#
|
|
57 |
|
|
58 |
sub ProcessCommandLine {
|
|
59 |
Getopt::Long::Configure ("bundling");
|
|
60 |
my $help;
|
|
61 |
my $stdin;
|
|
62 |
GetOptions("h" => \$help, "v+" => \$verbose, "n=s" => \$notesSrc, "p" => \$stdin, "l" => \$fixLibs, "w=s" => \$project, "f" => \$reallyrun);
|
|
63 |
|
|
64 |
if ($help) {
|
|
65 |
Usage(0);
|
|
66 |
}
|
|
67 |
|
|
68 |
# Create the MrpData objects. These will not write any files to disk, and so if any of
|
|
69 |
# them die, there is no need to perform any file system cleanup.
|
|
70 |
if ($#ARGV == -1 and $stdin) {
|
|
71 |
# Read input from STDIN.
|
|
72 |
MakeMrpData(\@mrpData, *STDIN);
|
|
73 |
}
|
|
74 |
elsif ($#ARGV == 0) {
|
|
75 |
# Read input from a file.
|
|
76 |
if (-f $ARGV[0]) {
|
|
77 |
open (IN, $ARGV[0]) or die "Error: Couldn't open $ARGV[0] for reading: $!\n";
|
|
78 |
MakeMrpData(\@mrpData, *IN);
|
|
79 |
close (IN);
|
|
80 |
}
|
|
81 |
else {
|
|
82 |
print "Error: $ARGV[0] is not a file\n";
|
|
83 |
Usage(1);
|
|
84 |
}
|
|
85 |
}
|
|
86 |
elsif ($#ARGV == 1) {
|
|
87 |
# Read input from a single set of command line arguments.
|
|
88 |
if ($iniData->RequireInternalVersions()) {
|
|
89 |
die "Error: Internal version number not specified\n";
|
|
90 |
}
|
|
91 |
else {
|
|
92 |
push (@mrpData, MrpData->New(shift @ARGV, shift @ARGV, '', $iniData, $verbose, $fixLibs));
|
|
93 |
}
|
|
94 |
}
|
|
95 |
elsif ($#ARGV == 2) {
|
|
96 |
# Read input from a single set of command line arguments.
|
|
97 |
push (@mrpData, MrpData->New(shift @ARGV, shift @ARGV, shift @ARGV, $iniData, $verbose, $fixLibs));
|
|
98 |
}
|
|
99 |
else {
|
|
100 |
print "Error: invalid number of arguments\n";
|
|
101 |
Usage(1);
|
|
102 |
}
|
|
103 |
|
|
104 |
$envDb = EnvDb->Open($iniData, $verbose);
|
|
105 |
}
|
|
106 |
|
|
107 |
sub Usage {
|
|
108 |
my $exitCode = shift;
|
|
109 |
|
|
110 |
Utils::PrintDeathMessage($exitCode, "\nUsage: makerel [options] [[<mrp_file> <version> [<internal_version>]] | [mrp_list_file]]
|
|
111 |
|
|
112 |
options:
|
|
113 |
|
|
114 |
-h help
|
|
115 |
-v verbose output (-vv very verbose)
|
|
116 |
-n <notes_src_file> compile all release notes using a single source file
|
|
117 |
-p read a piped mrp list from STDIN
|
|
118 |
-l copy missing ARMI lib files from THUMB is possible
|
|
119 |
-f force (no prompting)
|
|
120 |
-w <project name> make the release in this \"project\"
|
|
121 |
|
|
122 |
Unsupported tool.\n");
|
|
123 |
}
|
|
124 |
|
|
125 |
sub PrintHeinousWarning {
|
|
126 |
Utils::QueryUnsupportedTool(<<GUILTY, $reallyrun);
|
|
127 |
############################ WARNING ################################
|
|
128 |
# Do not use MakeRel under normal circumstances. If you wish to #
|
|
129 |
# make a component release, use the PrepRel and MakeEnv commands. #
|
|
130 |
# ( PrepRel to specify the version numbers, etc., then MakeEnv to #
|
|
131 |
# actually make the release(s). ) #
|
|
132 |
#####################################################################
|
|
133 |
|
|
134 |
The problem with MakeRel is that it doesn't ensure your environment
|
|
135 |
is clean before making the releases. Hence, component releases made
|
|
136 |
using MakeRel are not subject to the normal guarantees, that ensure
|
|
137 |
users of your release can precisely reproduce what you have on your
|
|
138 |
development drive.
|
|
139 |
|
|
140 |
Usually, releases made using MakeRel are unacceptable to licensee
|
|
141 |
integration teams. Use with caution.
|
|
142 |
|
|
143 |
GUILTY
|
|
144 |
}
|
|
145 |
|
|
146 |
sub MakeMrpData {
|
|
147 |
my $mrpData = shift;
|
|
148 |
local *IN = shift;
|
|
149 |
print "Gathering release info...\n";
|
|
150 |
my @failedReleases;
|
|
151 |
my @lines;
|
|
152 |
while (my $line = <IN>) {
|
|
153 |
# Remove line feed, white space and comments.
|
|
154 |
chomp $line;
|
|
155 |
$line =~ s/^\s*$//;
|
|
156 |
$line =~ s/#.*//;
|
|
157 |
if ($line eq '') {
|
|
158 |
# Nothing left.
|
|
159 |
next;
|
|
160 |
}
|
|
161 |
push @lines, $line;
|
|
162 |
}
|
|
163 |
|
|
164 |
# Reading in a separate loop due to Perl 5.8.0 defect # 21217, due to be fixed in 5.8.1.
|
|
165 |
|
|
166 |
my $lineNum = -1;
|
|
167 |
foreach my $line (@lines) {
|
|
168 |
$lineNum++;
|
|
169 |
eval {
|
|
170 |
(my $mrpName, my $extVer, my $intVer) = split (/\s+/, $line, 4);
|
|
171 |
unless (defined $mrpName and defined $extVer) {
|
|
172 |
die "Error: Invalid arguments at line $lineNum\n";
|
|
173 |
}
|
|
174 |
if (not defined $intVer) {
|
|
175 |
if ($iniData->RequireInternalVersions()) {
|
|
176 |
die "Error: Internal version number not specified\n";
|
|
177 |
}
|
|
178 |
else {
|
|
179 |
$intVer = '';
|
|
180 |
}
|
|
181 |
}
|
|
182 |
my $thisMrpData = MrpData->New($mrpName, $extVer, $intVer, $iniData, $verbose, $fixLibs);
|
|
183 |
push (@$mrpData, $thisMrpData);
|
|
184 |
};
|
|
185 |
if ($@) {
|
|
186 |
print $@;
|
|
187 |
push (@failedReleases, "$line - $@");
|
|
188 |
}
|
|
189 |
}
|
|
190 |
|
|
191 |
if ($#failedReleases >= 0) {
|
|
192 |
print "\nThere was an error making the following release(s):\n\n";
|
|
193 |
foreach my $rel (@failedReleases) {
|
|
194 |
print "$rel";
|
|
195 |
}
|
|
196 |
die "\n";
|
|
197 |
}
|
|
198 |
}
|
|
199 |
|
|
200 |
__END__
|
|
201 |
|
|
202 |
=head1 NAME
|
|
203 |
|
|
204 |
MakeRel - Make a single, or set of component releases.
|
|
205 |
|
|
206 |
=head1 SYNOPSIS
|
|
207 |
|
|
208 |
makerel [options] [[<mrp_file> <version> [<internal_version>]] | [mrp_list_file]]
|
|
209 |
|
|
210 |
options:
|
|
211 |
|
|
212 |
-h help
|
|
213 |
-v verbose output (-vv very verbose)
|
|
214 |
-n <notes_src_file> compile all release notes using a single source file
|
|
215 |
-p read a piped mrp list from STDIN
|
|
216 |
-l copy missing ARMI lib files from THUMB is possible
|
|
217 |
-f force (no prompting)
|
|
218 |
-w <project> make the releases in this "project"
|
|
219 |
|
|
220 |
=head1 DESCRIPTION
|
|
221 |
|
|
222 |
C<MakeRel> is a tool that can generate one or more component releases. Where ever possible the tool C<MakeEnv> should be used instead of C<MakeRel> because this guarantees the ability to reproduce the entire environment from which a release was made, rather than just packaging up a particular set of source and binaries.
|
|
223 |
|
|
224 |
See the document I<Making Releases> for more complete coverage of the process of making releases in general.
|
|
225 |
|
|
226 |
=head1 STATUS
|
|
227 |
|
|
228 |
Unsupported/experimental. If you find a problem, please send us a patch.
|
|
229 |
|
|
230 |
=head1 KNOWN BUGS
|
|
231 |
|
|
232 |
None.
|
|
233 |
|
|
234 |
=head1 COPYRIGHT
|
|
235 |
|
|
236 |
Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
237 |
All rights reserved.
|
|
238 |
This component and the accompanying materials are made available
|
|
239 |
under the terms of the License "Eclipse Public License v1.0"
|
|
240 |
which accompanies this distribution, and is available
|
|
241 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
242 |
|
|
243 |
Initial Contributors:
|
|
244 |
Nokia Corporation - initial contribution.
|
|
245 |
|
|
246 |
Contributors:
|
|
247 |
|
|
248 |
Description:
|
|
249 |
|
|
250 |
|
|
251 |
=cut
|