release_prepare.pl (c9b362f6) release_prepare.pl (9f91b7e3)
1#!/usr/bin/perl -w
2
3#**************************************************************
4#
5# Licensed to the Apache Software Foundation (ASF) under one
6# or more contributor license agreements. See the NOTICE file
7# distributed with this work for additional information
8# regarding copyright ownership. The ASF licenses this file

--- 18 unchanged lines hidden (view full) ---

27use installer::patch::ReleasesList;
28use installer::ziplist;
29use installer::logger;
30
31use Getopt::Long;
32use Pod::Usage;
33use Digest;
34
1#!/usr/bin/perl -w
2
3#**************************************************************
4#
5# Licensed to the Apache Software Foundation (ASF) under one
6# or more contributor license agreements. See the NOTICE file
7# distributed with this work for additional information
8# regarding copyright ownership. The ASF licenses this file

--- 18 unchanged lines hidden (view full) ---

27use installer::patch::ReleasesList;
28use installer::ziplist;
29use installer::logger;
30
31use Getopt::Long;
32use Pod::Usage;
33use Digest;
34
35use Carp::Always;
36
35use strict;
36
37=head1 NAME
38
39 release_prepare.pl - Several functions to prepare release builds
40
41=head1 SYNOPSIS
42

--- 58 unchanged lines hidden (view full) ---

101 $arguments->{'languages'} = \@ARGV;
102
103 return $arguments;
104}
105
106
107
108
37use strict;
38
39=head1 NAME
40
41 release_prepare.pl - Several functions to prepare release builds
42
43=head1 SYNOPSIS
44

--- 58 unchanged lines hidden (view full) ---

103 $arguments->{'languages'} = \@ARGV;
104
105 return $arguments;
106}
107
108
109
110
109sub ProcessLanguage ($$$$)
111sub ProcessLanguage ($$$$$)
110{
112{
111 my ($source_version, $language, $package_format, $product_name) = @_;
113 my ($version, $is_current_version, $language, $package_format, $product_name) = @_;
112
113 $installer::logger::Info->printf("%s\n", $language);
114 $installer::logger::Info->increase_indentation();
115
116 # For every language we need
117 # 1. have downloadable installation set available (download if missing)
118 # 2. unpack it to get access to .cab and .msi
119 # 3. unpack .cab so that msimsp.exe can be run
120
114
115 $installer::logger::Info->printf("%s\n", $language);
116 $installer::logger::Info->increase_indentation();
117
118 # For every language we need
119 # 1. have downloadable installation set available (download if missing)
120 # 2. unpack it to get access to .cab and .msi
121 # 3. unpack .cab so that msimsp.exe can be run
122
121 # Create paths to unpacked contents of .exe and .cab and determine if they exist.
122 # The existence of these paths is taken as flag whether the unpacking has already taken place.
123 my $unpacked_exe_path = installer::patch::InstallationSet::GetUnpackedMsiPath(
124 $source_version,
123 installer::patch::InstallationSet::ProvideUnpackedCab(
124 $version,
125 $is_current_version,
125 $language,
126 $package_format,
127 $product_name);
126 $language,
127 $package_format,
128 $product_name);
128 my $unpacked_cab_path = installer::patch::InstallationSet::GetUnpackedCabPath(
129 $source_version,
130 $language,
131 $package_format,
132 $product_name);
133 my $exe_is_unpacked = -d $unpacked_exe_path;
134 my $cab_is_unpacked = -d $unpacked_cab_path;
135
129
136 if ( ! $exe_is_unpacked)
137 {
138 # Interpret existence of path as proof that the installation
139 # set and the cab file have been successfully unpacked.
140 # Nothing to do.
141 my $filename = installer::patch::InstallationSet::ProvideDownloadSet(
142 $source_version,
143 $language,
144 $package_format);
145 if (defined $filename)
146 {
147 if ( ! -d $unpacked_exe_path)
148 {
149 installer::patch::InstallationSet::UnpackExe($filename, $unpacked_exe_path);
150 }
151 }
152 else
153 {
154 installer::logger::PrintError("could not provide .exe installation set at '%s'\n", $filename);
155 }
156 }
157 else
158 {
159 $installer::logger::Info->printf("downloadable installation set has already been unpacked to '%s'\n",
160 $unpacked_exe_path);
161 }
162
163 if ( ! $cab_is_unpacked)
164 {
165 my $cab_filename = File::Spec->catfile($unpacked_exe_path, "openoffice1.cab");
166 if ( ! -f $cab_filename)
167 {
168 # Cab file does not exist.
169 installer::logger::PrintError(
170 "could not find .cab file at '%s'. Extraction of .exe seems to have failed.\n",
171 $cab_filename);
172 }
173
174 # Unpack the cab file.
175 my $msi = new installer::patch::Msi(
176 $source_version,
177 $language,
178 $product_name);
179
180 $installer::logger::Info->printf("unpacking cab file '%s' to '%s'\n",
181 $cab_filename, $unpacked_cab_path);
182 installer::patch::InstallationSet::UnpackCab(
183 $cab_filename,
184 $msi,
185 $unpacked_cab_path);
186 }
187 else
188 {
189 $installer::logger::Info->printf("cab has already been unpacked to\n");
190 $installer::logger::Info->printf(" %s\n", $unpacked_cab_path);
191 }
192
193 $installer::logger::Info->decrease_indentation();
194}
195
196
197
198
130 $installer::logger::Info->decrease_indentation();
131}
132
133
134
135
199installer::logger::SetupSimpleLogging("c:/tmp/log");
136sub main ()
137{
138 installer::logger::SetupSimpleLogging();
200
139
201my $arguments = ProcessCommandline();
202$arguments->{'package-format'} = 'msi';
140 my $arguments = ProcessCommandline();
141 $arguments->{'package-format'} = 'msi';
203
142
204print "preparing release build\n";
205my ($variables, undef, undef)
206 = installer::ziplist::read_openoffice_lst_file(
143 $installer::logger::Info->print("preparing release build\n");
144 my ($variables, undef, undef)
145 = installer::ziplist::read_openoffice_lst_file(
207 $arguments->{'lst-file'},
208 $arguments->{'product-name'},
209 undef);
146 $arguments->{'lst-file'},
147 $arguments->{'product-name'},
148 undef);
210if ( ! defined $arguments->{'source-version'})
211{
212 $arguments->{'source-version'} = $variables->{'PREVIOUS_VERSION'};
213}
214$installer::logger::Info->printf(" reading data from '%s'\n", $arguments->{'lst-file'});
215$installer::logger::Info->printf(" product name is '%s'\n", $arguments->{'product-name'});
216$installer::logger::Info->printf(" output path is '%s'\n", $arguments->{'output-path'});
217$installer::logger::Info->printf(" source version is '%s'\n", $arguments->{'source-version'});
149 if ( ! defined $arguments->{'source-version'})
150 {
151 $arguments->{'source-version'} = $variables->{'PREVIOUS_VERSION'};
152 if ( ! defined $arguments->{'source-version'})
153 {
154 $arguments->{'source-version'} = installer::patch::ReleasesList::GetPreviousVersion(
155 $variables->{'PRODUCTVERSION'});
156 if ( ! defined $arguments->{'source-version'})
157 {
158 $installer::logger::Info->printf("ERROR: can not autodetect previous version\n");
159 $installer::logger::Info->printf(" please specify via 'PREVIOUS_VERSION' in %s\n",
160 $arguments->{'lst-file'});
161 $installer::logger::Info->printf(" or the --source-version commandline option\n");
162 exit(1);
163 }
164 }
165 }
166 my $current_version = $variables->{'PRODUCTVERSION'};
167 $installer::logger::Info->printf("data from '%s'\n", $arguments->{'lst-file'});
168 $installer::logger::Info->printf("name is '%s'\n", $arguments->{'product-name'});
169 $installer::logger::Info->printf("path is '%s'\n", $arguments->{'output-path'});
170 $installer::logger::Info->printf("source version is '%s'\n", $arguments->{'source-version'});
171 $installer::logger::Info->printf("target version is '%s'\n", $current_version);
218
172
219foreach my $language (@{$arguments->{'languages'}})
220{
221 ProcessLanguage(
222 $arguments->{'source-version'},
223 $language,
224 $arguments->{'package-format'},
225 $arguments->{'product-name'});
173 foreach my $language (@{$arguments->{'languages'}})
174 {
175 ProcessLanguage(
176 $arguments->{'source-version'},
177 $arguments->{'source-version'} eq $current_version,
178 $language,
179 $arguments->{'package-format'},
180 $arguments->{'product-name'});
181 }
226}
182}
183
184
185main();