Msi.pm (9f91b7e3) Msi.pm (60b96b8d)
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

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

46
47 # When $version is the current version we have to search the msi at a different place.
48 my $path;
49 my $filename;
50 my $is_current = 0;
51 $path = installer::patch::InstallationSet::GetUnpackedExePath(
52 $version,
53 $is_current_version,
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

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

46
47 # When $version is the current version we have to search the msi at a different place.
48 my $path;
49 my $filename;
50 my $is_current = 0;
51 $path = installer::patch::InstallationSet::GetUnpackedExePath(
52 $version,
53 $is_current_version,
54 $language,
54 installer::languages::get_normalized_language($language),
55 "msi",
56 $product_name);
57
58 # Find the msi in the path.ls .
59 $filename = File::Spec->catfile($path, "openoffice".$condensed_version.".msi");
60 $is_current = $is_current_version;
61
62 return $class->new($filename, $version, $is_current, $language, $product_name);

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

70=head2 new($class, $filename, $version, $is_current_version, $language, $product_name)
71
72 Create a new object of the Msi class. The values of $version, $language, and $product_name define
73 where to look for the msi file.
74
75 If construction fails then IsValid() will return false.
76
77=cut
55 "msi",
56 $product_name);
57
58 # Find the msi in the path.ls .
59 $filename = File::Spec->catfile($path, "openoffice".$condensed_version.".msi");
60 $is_current = $is_current_version;
61
62 return $class->new($filename, $version, $is_current, $language, $product_name);

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

70=head2 new($class, $filename, $version, $is_current_version, $language, $product_name)
71
72 Create a new object of the Msi class. The values of $version, $language, and $product_name define
73 where to look for the msi file.
74
75 If construction fails then IsValid() will return false.
76
77=cut
78
78sub new ($$$$$$)
79{
80 my ($class, $filename, $version, $is_current_version, $language, $product_name) = @_;
81
82 if ( ! -f $filename)
83 {
84 installer::logger::PrintError("can not find the .msi file for version %s and language %s at '%s'\n",
85 $version,

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

117
118
119
120=head2 Commit($self)
121
122 Write all modified tables back into the databse.
123
124=cut
79sub new ($$$$$$)
80{
81 my ($class, $filename, $version, $is_current_version, $language, $product_name) = @_;
82
83 if ( ! -f $filename)
84 {
85 installer::logger::PrintError("can not find the .msi file for version %s and language %s at '%s'\n",
86 $version,

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

118
119
120
121=head2 Commit($self)
122
123 Write all modified tables back into the databse.
124
125=cut
126
125sub Commit ($)
126{
127 my $self = shift;
128
129 my @tables_to_update = ();
130 foreach my $table (values %{$self->{'tables'}})
131 {
132 push @tables_to_update,$table if ($table->IsModified());

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

154
155=head2 GetTable($seld, $table_name)
156
157 Return an MsiTable object for $table_name. Table objects are kept
158 alive for the life time of the Msi object. Therefore the second
159 call for the same table is very cheap.
160
161=cut
127sub Commit ($)
128{
129 my $self = shift;
130
131 my @tables_to_update = ();
132 foreach my $table (values %{$self->{'tables'}})
133 {
134 push @tables_to_update,$table if ($table->IsModified());

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

156
157=head2 GetTable($seld, $table_name)
158
159 Return an MsiTable object for $table_name. Table objects are kept
160 alive for the life time of the Msi object. Therefore the second
161 call for the same table is very cheap.
162
163=cut
164
162sub GetTable ($$)
163{
164 my ($self, $table_name) = @_;
165
166 my $table = $self->{'tables'}->{$table_name};
167 if ( ! defined $table)
168 {
169 my $table_filename = File::Spec->catfile($self->{'tmpdir'}, $table_name .".idt");

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

192
193
194
195=head2 PutTable($self, $table)
196
197 Write the given table back to the databse.
198
199=cut
165sub GetTable ($$)
166{
167 my ($self, $table_name) = @_;
168
169 my $table = $self->{'tables'}->{$table_name};
170 if ( ! defined $table)
171 {
172 my $table_filename = File::Spec->catfile($self->{'tmpdir'}, $table_name .".idt");

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

195
196
197
198=head2 PutTable($self, $table)
199
200 Write the given table back to the databse.
201
202=cut
203
200sub PutTable ($$)
201{
202 my ($self, $table) = @_;
203
204 # Create text file from the current table content.
205 $table->WriteFile();
206
207 my $table_name = $table->GetName();

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

238
239
240=head2 EnsureAYoungerThanB ($filename_a, $filename_b)
241
242 Internal function (not a method) that compares to files according
243 to their last modification times (mtime).
244
245=cut
204sub PutTable ($$)
205{
206 my ($self, $table) = @_;
207
208 # Create text file from the current table content.
209 $table->WriteFile();
210
211 my $table_name = $table->GetName();

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

242
243
244=head2 EnsureAYoungerThanB ($filename_a, $filename_b)
245
246 Internal function (not a method) that compares to files according
247 to their last modification times (mtime).
248
249=cut
250
246sub EnsureAYoungerThanB ($$)
247{
248 my ($filename_a, $filename_b) = @_;
249
250 die("file $filename_a does not exist") unless -f $filename_a;
251 die("file $filename_b does not exist") unless -f $filename_b;
252
253 my @stat_a = stat($filename_a);

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

271 Split $name (typically from the 'FileName' column in the 'File'
272 table or 'DefaultDir' column in the 'Directory' table) at the '|'
273 into short (8.3) and long names. If there is no '|' in $name then
274 $name is returned as both short and long name.
275
276 Returns long and short name (in this order) as array.
277
278=cut
251sub EnsureAYoungerThanB ($$)
252{
253 my ($filename_a, $filename_b) = @_;
254
255 die("file $filename_a does not exist") unless -f $filename_a;
256 die("file $filename_b does not exist") unless -f $filename_b;
257
258 my @stat_a = stat($filename_a);

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

276 Split $name (typically from the 'FileName' column in the 'File'
277 table or 'DefaultDir' column in the 'Directory' table) at the '|'
278 into short (8.3) and long names. If there is no '|' in $name then
279 $name is returned as both short and long name.
280
281 Returns long and short name (in this order) as array.
282
283=cut
284
279sub SplitLongShortName ($)
280{
281 my ($name) = @_;
282
283 if ($name =~ /^([^\|]*)\|(.*)$/)
284 {
285 return ($2,$1);
286 }

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

295=head2 SplitTargetSourceLongShortName ($name)
296
297 Split $name first at the ':' into target and source parts and each
298 of those at the '|'s into long and short parts. Names that follow
299 this pattern come from the 'DefaultDir' column in the 'Directory'
300 table.
301
302=cut
285sub SplitLongShortName ($)
286{
287 my ($name) = @_;
288
289 if ($name =~ /^([^\|]*)\|(.*)$/)
290 {
291 return ($2,$1);
292 }

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

301=head2 SplitTargetSourceLongShortName ($name)
302
303 Split $name first at the ':' into target and source parts and each
304 of those at the '|'s into long and short parts. Names that follow
305 this pattern come from the 'DefaultDir' column in the 'Directory'
306 table.
307
308=cut
309
303sub SplitTargetSourceLongShortName ($)
304{
305 my ($name) = @_;
306
307 if ($name =~ /^([^:]*):(.*)$/)
308 {
309 return (installer::patch::Msi::SplitLongShortName($1), installer::patch::Msi::SplitLongShortName($2));
310 }

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

317
318
319=head2 GetDirectoryMap($self)
320
321 Return a map that maps directory unique names (column 'Directory' in table 'Directory')
322 to hashes that contains short and long source and target names.
323
324=cut
310sub SplitTargetSourceLongShortName ($)
311{
312 my ($name) = @_;
313
314 if ($name =~ /^([^:]*):(.*)$/)
315 {
316 return (installer::patch::Msi::SplitLongShortName($1), installer::patch::Msi::SplitLongShortName($2));
317 }

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

324
325
326=head2 GetDirectoryMap($self)
327
328 Return a map that maps directory unique names (column 'Directory' in table 'Directory')
329 to hashes that contains short and long source and target names.
330
331=cut
332
325sub GetDirectoryMap ($)
326{
327 my ($self) = @_;
328
329 if (defined $self->{'DirectoryMap'})
330 {
331 return $self->{'DirectoryMap'};
332 }

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

418 Return a map (hash) that maps the unique name (column 'File' in
419 the 'File' table) to data that is associated with that file, like
420 the directory or component.
421
422 The map is kept alive for the lifetime of the Msi object. All
423 calls but the first are cheap.
424
425=cut
333sub GetDirectoryMap ($)
334{
335 my ($self) = @_;
336
337 if (defined $self->{'DirectoryMap'})
338 {
339 return $self->{'DirectoryMap'};
340 }

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

426 Return a map (hash) that maps the unique name (column 'File' in
427 the 'File' table) to data that is associated with that file, like
428 the directory or component.
429
430 The map is kept alive for the lifetime of the Msi object. All
431 calls but the first are cheap.
432
433=cut
434
426sub GetFileMap ($)
427{
428 my ($self) = @_;
429
430 if (defined $self->{'FileMap'})
431 {
432 return $self->{'FileMap'};
433 }

--- 32 unchanged lines hidden ---
435sub GetFileMap ($)
436{
437 my ($self) = @_;
438
439 if (defined $self->{'FileMap'})
440 {
441 return $self->{'FileMap'};
442 }

--- 32 unchanged lines hidden ---