← Index
NYTProf Performance Profile   « block view • line view • sub view »
For C:/lo/libo-master/solenv/bin/make_installer.pl
  Run on Mon Sep 24 00:52:54 2012
Reported on Mon Sep 24 07:34:43 2012

Filename/cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/file.pm
StatementsExecuted 7425686 statements in 41.0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
15888117.57s10.6sinstaller::windows::file::::generate_unique_filename_for_filetableinstaller::windows::file::generate_unique_filename_for_filetable
385114.81s4.81sinstaller::windows::file::::CORE:readlineinstaller::windows::file::CORE:readline (opcode)
15946214.17s4.17sinstaller::windows::file::::CORE:openinstaller::windows::file::CORE:open (opcode)
15888112.42s2.42sinstaller::windows::file::::CORE:ftfileinstaller::windows::file::CORE:ftfile (opcode)
1112.26s69.5sinstaller::windows::file::::create_files_tableinstaller::windows::file::create_files_table
7910141612.24s2.24sinstaller::windows::file::::CORE:substinstaller::windows::file::CORE:subst (opcode)
15888111.86s1.86sinstaller::windows::file::::CORE:ftsizeinstaller::windows::file::CORE:ftsize (opcode)
7734591111.54s1.54sinstaller::windows::file::::CORE:matchinstaller::windows::file::CORE:match (opcode)
1588811785ms2.33sinstaller::windows::file::::get_file_component_nameinstaller::windows::file::get_file_component_name
253211661ms661msinstaller::windows::file::::generate_new_short_componentnameinstaller::windows::file::generate_new_short_componentname
1588811283ms8.01sinstaller::windows::file::::generate_filename_for_filetableinstaller::windows::file::generate_filename_for_filetable
1588811243ms4.52sinstaller::windows::file::::get_filesizeinstaller::windows::file::get_filesize
111205ms226msinstaller::windows::file::::assign_sequencenumbers_to_filesinstaller::windows::file::assign_sequencenumbers_to_files
1588811183ms233msinstaller::windows::file::::get_language_for_fileinstaller::windows::file::get_language_for_file
1588811178ms5.45sinstaller::windows::file::::get_fileversioninstaller::windows::file::get_fileversion
111178ms191msinstaller::windows::file::::assign_cab_to_filesinstaller::windows::file::assign_cab_to_files
1588811125ms125msinstaller::windows::file::::get_tree_condition_for_componentinstaller::windows::file::get_tree_condition_for_component
1588811121ms121msinstaller::windows::file::::get_sequence_for_fileinstaller::windows::file::get_sequence_for_file
51145.1ms45.1msinstaller::windows::file::::get_component_from_assigned_fileinstaller::windows::file::get_component_from_assigned_file
158882136.1ms36.1msinstaller::windows::file::::CORE:unpackinstaller::windows::file::CORE:unpack (opcode)
159462132.1ms32.1msinstaller::windows::file::::CORE:binmodeinstaller::windows::file::CORE:binmode (opcode)
8516124.4ms24.4msinstaller::windows::file::::CORE:sortinstaller::windows::file::CORE:sort (opcode)
155611119.5ms19.5msinstaller::windows::file::::CORE:packinstaller::windows::file::CORE:pack (opcode)
3851113.7ms13.7msinstaller::windows::file::::CORE:closeinstaller::windows::file::CORE:close (opcode)
1116.89ms8.81msinstaller::windows::file::::BEGIN@30installer::windows::file::BEGIN@30
1111.30ms1.76msinstaller::windows::file::::BEGIN@37installer::windows::file::BEGIN@37
38511492µs492µsinstaller::windows::file::::CORE:regcompinstaller::windows::file::CORE:regcomp (opcode)
811103µs146µsinstaller::windows::file::::generate_registry_keypathinstaller::windows::file::generate_registry_keypath
11118µs21µsinstaller::windows::file::::BEGIN@31installer::windows::file::BEGIN@31
11115µs17µsinstaller::windows::file::::BEGIN@40installer::windows::file::BEGIN@40
11115µs43µsinstaller::windows::file::::BEGIN@34installer::windows::file::BEGIN@34
11114µs17µsinstaller::windows::file::::BEGIN@32installer::windows::file::BEGIN@32
11114µs16µsinstaller::windows::file::::BEGIN@36installer::windows::file::BEGIN@36
11114µs16µsinstaller::windows::file::::BEGIN@38installer::windows::file::BEGIN@38
11114µs16µsinstaller::windows::file::::BEGIN@39installer::windows::file::BEGIN@39
11114µs16µsinstaller::windows::file::::BEGIN@33installer::windows::file::BEGIN@33
11114µs16µsinstaller::windows::file::::BEGIN@35installer::windows::file::BEGIN@35
0000s0sinstaller::windows::file::::check_file_sequencesinstaller::windows::file::check_file_sequences
0000s0sinstaller::windows::file::::collect_shortnames_from_old_databaseinstaller::windows::file::collect_shortnames_from_old_database
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org. If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28package installer::windows::file;
29
3022.76ms28.86ms
# spent 8.81ms (6.89+1.92) within installer::windows::file::BEGIN@30 which was called: # once (6.89ms+1.92ms) by installer::BEGIN@68 at line 30
use Digest::MD5;
# spent 8.81ms making 1 call to installer::windows::file::BEGIN@30 # spent 48µs making 1 call to Exporter::import
31254µs224µs
# spent 21µs (18+3) within installer::windows::file::BEGIN@31 which was called: # once (18µs+3µs) by installer::BEGIN@68 at line 31
use installer::exiter;
# spent 21µs making 1 call to installer::windows::file::BEGIN@31 # spent 3µs making 1 call to UNIVERSAL::import
32253µs220µs
# spent 17µs (14+3) within installer::windows::file::BEGIN@32 which was called: # once (14µs+3µs) by installer::BEGIN@68 at line 32
use installer::files;
# spent 17µs making 1 call to installer::windows::file::BEGIN@32 # spent 3µs making 1 call to UNIVERSAL::import
33252µs219µs
# spent 16µs (14+3) within installer::windows::file::BEGIN@33 which was called: # once (14µs+3µs) by installer::BEGIN@68 at line 33
use installer::globals;
# spent 16µs making 1 call to installer::windows::file::BEGIN@33 # spent 2µs making 1 call to UNIVERSAL::import
34253µs272µs
# spent 43µs (15+28) within installer::windows::file::BEGIN@34 which was called: # once (15µs+28µs) by installer::BEGIN@68 at line 34
use installer::logger;
# spent 43µs making 1 call to installer::windows::file::BEGIN@34 # spent 28µs making 1 call to Exporter::import
35252µs219µs
# spent 16µs (14+3) within installer::windows::file::BEGIN@35 which was called: # once (14µs+3µs) by installer::BEGIN@68 at line 35
use installer::pathanalyzer;
# spent 16µs making 1 call to installer::windows::file::BEGIN@35 # spent 3µs making 1 call to UNIVERSAL::import
36253µs219µs
# spent 16µs (14+2) within installer::windows::file::BEGIN@36 which was called: # once (14µs+2µs) by installer::BEGIN@68 at line 36
use installer::worker;
# spent 16µs making 1 call to installer::windows::file::BEGIN@36 # spent 2µs making 1 call to UNIVERSAL::import
3721.21ms21.76ms
# spent 1.76ms (1.30+458µs) within installer::windows::file::BEGIN@37 which was called: # once (1.30ms+458µs) by installer::BEGIN@68 at line 37
use installer::windows::font;
# spent 1.76ms making 1 call to installer::windows::file::BEGIN@37 # spent 3µs making 1 call to UNIVERSAL::import
38253µs219µs
# spent 16µs (14+2) within installer::windows::file::BEGIN@38 which was called: # once (14µs+2µs) by installer::BEGIN@68 at line 38
use installer::windows::idtglobal;
# spent 16µs making 1 call to installer::windows::file::BEGIN@38 # spent 2µs making 1 call to UNIVERSAL::import
39252µs218µs
# spent 16µs (14+2) within installer::windows::file::BEGIN@39 which was called: # once (14µs+2µs) by installer::BEGIN@68 at line 39
use installer::windows::language;
# spent 16µs making 1 call to installer::windows::file::BEGIN@39 # spent 2µs making 1 call to UNIVERSAL::import
4028.64ms219µs
# spent 17µs (15+2) within installer::windows::file::BEGIN@40 which was called: # once (15µs+2µs) by installer::BEGIN@68 at line 40
use installer::windows::component;
# spent 17µs making 1 call to installer::windows::file::BEGIN@40 # spent 2µs making 1 call to UNIVERSAL::import
41
42##########################################################################
43# Assigning one cabinet file to each file. This is requrired,
44# if cabinet files shall be equivalent to packages.
45##########################################################################
46
47sub assign_cab_to_files
48
# spent 191ms (178+13.4) within installer::windows::file::assign_cab_to_files which was called: # once (178ms+13.4ms) by installer::run at line 1487 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
491521.7ms my ( $filesref ) = @_;
50
51 my $infoline = "";
52
5395328147ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
54 {
55 if ( ! exists(${$filesref}[$i]->{'modules'}) ) { installer::exiter::exit_program("ERROR: No module assignment found for ${$filesref}[$i]->{'gid'} !", "assign_cab_to_files"); }
56 my $module = ${$filesref}[$i]->{'modules'};
57 # If modules contains a list of modules, only taking the first one.
581588810.2ms if ( $module =~ /^\s*(.*?)\,/ ) { $module = $1; }
# spent 10.2ms making 15888 calls to installer::windows::file::CORE:match, avg 641ns/call
59
60 if ( ! exists($installer::globals::allcabinetassigns{$module}) ) { installer::exiter::exit_program("ERROR: No cabinet file assigned to module \"$module\" (${$filesref}[$i]->{'gid'}) !", "assign_cab_to_files"); }
61 ${$filesref}[$i]->{'assignedcabinetfile'} = $installer::globals::allcabinetassigns{$module};
62
63 # Counting the files in each cabinet file
641504213.9ms if ( ! exists($installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}) )
65 {
66 $installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}} = 1;
67 }
68 else
69 {
70 $installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}++;
71 }
72 }
73
74 # logging the number of files in each cabinet file
75
76 $infoline = "\nCabinet file content:\n";
77 push(@installer::globals::logfileinfo, $infoline);
78 my $cabfile;
791799µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 799µs making 1 call to installer::windows::file::CORE:sort
80 {
8116922.45ms $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile} files\n";
82 push(@installer::globals::logfileinfo, $infoline);
83 }
84
85 # assigning startsequencenumbers for each cab file
86
87 my $offset = 1;
881804µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 804µs making 1 call to installer::windows::file::CORE:sort
89 {
9033842.23ms my $filecount = $installer::globals::cabfilecounter{$cabfile};
91 $installer::globals::cabfilecounter{$cabfile} = $offset;
92 $offset = $offset + $filecount;
93
94 $installer::globals::lastsequence{$cabfile} = $offset - 1;
95 }
96
97 # logging the start sequence numbers
98
99 $infoline = "\nCabinet file start sequences:\n";
100 push(@installer::globals::logfileinfo, $infoline);
1011791µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 791µs making 1 call to installer::windows::file::CORE:sort
102 {
10316921.95ms $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile}\n";
104 push(@installer::globals::logfileinfo, $infoline);
105 }
106
107 # logging the last sequence numbers
108
109 $infoline = "\nCabinet file last sequences:\n";
110 push(@installer::globals::logfileinfo, $infoline);
1111794µs foreach $cabfile ( sort keys %installer::globals::lastsequence )
# spent 794µs making 1 call to installer::windows::file::CORE:sort
112 {
11316922.33ms $infoline = "$cabfile : $installer::globals::lastsequence{$cabfile}\n";
114 push(@installer::globals::logfileinfo, $infoline);
115 }
116}
117
118##########################################################################
119# Assigning sequencenumbers to files. This is requrired,
120# if cabinet files shall be equivalent to packages.
121##########################################################################
122
123sub assign_sequencenumbers_to_files
124
# spent 226ms (205+21.2) within installer::windows::file::assign_sequencenumbers_to_files which was called: # once (205ms+21.2ms) by installer::run at line 1488 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
125629.3ms my ( $filesref ) = @_;
126
127 my %directaccess = ();
128 my %allassigns = ();
129
1307944087.4ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
131 {
132 my $onefile = ${$filesref}[$i];
133
134 # Keeping order in cabinet files
135 # -> collecting all files in one cabinet file
136 # -> sorting files and assigning numbers
137
138 # Saving counter $i for direct access into files array
139 # "destination" of the file is a unique identifier ('Name' is not unique!)
140 if ( exists($directaccess{$onefile->{'destination'}}) ) { installer::exiter::exit_program("ERROR: 'destination' at file not unique: $onefile->{'destination'}", "assign_sequencenumbers_to_files"); }
141 $directaccess{$onefile->{'destination'}} = $i;
142
143 my $cabfilename = $onefile->{'assignedcabinetfile'};
144 # collecting files in cabinet files
1451758026.1ms if ( ! exists($allassigns{$cabfilename}) )
146 {
147 my %onecabfile = ();
148 $onecabfile{$onefile->{'destination'}} = 1;
149 $allassigns{$cabfilename} = \%onecabfile;
150 }
151 else
152 {
153 $allassigns{$cabfilename}->{$onefile->{'destination'}} = 1;
154 }
155 }
156
157 # Sorting each hash and assigning numbers
158 # The destination of the file determines the sort order, not the filename!
159 my $cabfile;
1601795µs foreach $cabfile ( sort keys %allassigns )
# spent 795µs making 1 call to installer::windows::file::CORE:sort
161 {
162253832.1ms my $counter = $installer::globals::cabfilecounter{$cabfile};
163 my $dest;
16484620.4ms foreach $dest ( sort keys %{$allassigns{$cabfile}} ) # <- sorting the destination!
# spent 20.4ms making 846 calls to installer::windows::file::CORE:sort, avg 24µs/call
165 {
1664766450.9ms my $directaccessnumber = $directaccess{$dest};
167 ${$filesref}[$directaccessnumber]->{'assignedsequencenumber'} = $counter;
168 $counter++;
169 }
170 }
171}
172
173#########################################################
174# Create a shorter version of a long component name,
175# because maximum length in msi database is 72.
176# Attention: In multi msi installation sets, the short
177# names have to be unique over all packages, because
178# this string is used to create the globally unique id
179# -> no resetting of
180# %installer::globals::allshortcomponents
181# after a package was created.
182#########################################################
183
184sub generate_new_short_componentname
185
# spent 661ms within installer::windows::file::generate_new_short_componentname which was called 2532 times, avg 261µs/call: # 2532 times (661ms+0s) by installer::windows::file::get_file_component_name at line 285, avg 261µs/call
{
1862278836.5ms my ($componentname) = @_;
187
188 my $shortcomponentname = "";
189 my $counter = 1;
190
191 my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters
192 $startversion = $startversion . "_";
193
194 $shortcomponentname = $startversion . $counter;
195
196 while ( exists($installer::globals::allshortcomponents{$shortcomponentname}) )
197 {
198671558631ms $counter++;
199 $shortcomponentname = $startversion . $counter;
200 }
201
202 $installer::globals::allshortcomponents{$shortcomponentname} = 1;
203
204 return $shortcomponentname;
205}
206
207###############################################
208# Generating the component name from a file
209###############################################
210
211sub get_file_component_name
212
# spent 2.33s (785ms+1.55) within installer::windows::file::get_file_component_name which was called 15888 times, avg 147µs/call: # 15888 times (785ms+1.55s) by installer::windows::file::create_files_table at line 887, avg 147µs/call
{
21395328206ms my ($fileref, $filesref) = @_;
214
215 my $componentname = "";
216
217 # Special handling for files with ASSIGNCOMPOMENT
218
219 my $styles = "";
220 if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
221222362917ms1589359.5ms if ( $styles =~ /\bASSIGNCOMPOMENT\b/ )
# spent 45.1ms making 5 calls to installer::windows::file::get_component_from_assigned_file, avg 9.03ms/call # spent 14.4ms making 15888 calls to installer::windows::file::CORE:match, avg 903ns/call
222 {
223 $componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref);
224 }
225 else
226 {
227 # In this function exists the rule to create components from files
228 # Rule:
229 # Two files get the same componentid, if:
230 # both have the same destination directory.
231 # both have the same "gid" -> both were packed in the same zip file
232 # All other files are included into different components!
233
234 # my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'};
235
236 # $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'},
237 # but can be in different subdirectories.
238 # Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh
239 # in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are
240 # converted into underline.
241
242 my $destination = $fileref->{'destination'};
24315883424ms installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
# spent 424ms making 15883 calls to installer::pathanalyzer::get_path_from_fullqualifiedname, avg 27µs/call
2441588382.5ms $destination =~ s/\s//g;
# spent 82.5ms making 15883 calls to installer::windows::file::CORE:subst, avg 5µs/call
2451588311.8ms $destination =~ s/\\/\_/g;
# spent 11.8ms making 15883 calls to installer::windows::file::CORE:subst, avg 743ns/call
24615883124ms $destination =~ s/\//\_/g;
# spent 124ms making 15883 calls to installer::windows::file::CORE:subst, avg 8µs/call
2471588378.4ms $destination =~ s/\_\s*$//g; # removing ending underline
# spent 78.4ms making 15883 calls to installer::windows::file::CORE:subst, avg 5µs/call
248
249 $componentname = $fileref->{'gid'} . "__" . $destination;
250
251 # Files with different languages, need to be packed into different components.
252 # Then the installation of the language specific component is determined by a language condition.
253
2541400013.8ms if ( $fileref->{'ismultilingual'} )
255 {
256 my $officelanguage = $fileref->{'specificlanguage'};
257 $componentname = $componentname . "_" . $officelanguage;
258 }
259
260 $componentname = lc($componentname); # componentnames always lowercase
261
2621588335.4ms $componentname =~ s/\-/\_/g; # converting "-" to "_"
# spent 35.4ms making 15883 calls to installer::windows::file::CORE:subst, avg 2µs/call
2631588369.8ms $componentname =~ s/\./\_/g; # converting "-" to "_"
# spent 69.8ms making 15883 calls to installer::windows::file::CORE:subst, avg 4µs/call
264
265 # Attention: Maximum length for the componentname is 72
266 # %installer::globals::allcomponents_in_this_database : resetted for each database
267 # %installer::globals::allcomponents : not resetted for each database
268 # Component strings must be unique for the complete product, because they are used for
269 # the creation of the globally unique identifier.
270
271 my $fullname = $componentname; # This can be longer than 72
272
273 if (( exists($installer::globals::allcomponents{$fullname}) ) && ( ! exists($installer::globals::allcomponents_in_this_database{$fullname}) ))
274 {
275 # This is not allowed: One component cannot be installed with different packages.
276 installer::exiter::exit_program("ERROR: Component \"$fullname\" is already included into another package. This is not allowed.", "get_file_component_name");
277 }
278
2792704551.9ms if ( exists($installer::globals::allcomponents{$fullname}) )
280 {
281 $componentname = $installer::globals::allcomponents{$fullname};
282 }
283 else
284 {
2852532661ms if ( length($componentname) > 60 )
# spent 661ms making 2532 calls to installer::windows::file::generate_new_short_componentname, avg 261µs/call
286 {
287 # Using md5sum needs much time
288 # chomp(my $shorter = `echo $componentname | md5sum | sed -e "s/ .*//g"`);
289 # $componentname = "comp_$shorter";
290 $componentname = generate_new_short_componentname($componentname); # This has to be unique for the complete product, not only one package
291 }
292
293 $installer::globals::allcomponents{$fullname} = $componentname;
294 $installer::globals::allcomponents_in_this_database{$fullname} = 1;
295 }
296
297 # $componentname =~ s/gid_file_/g_f_/g;
298 # $componentname =~ s/_extra_/_e_/g;
299 # $componentname =~ s/_config_/_c_/g;
300 # $componentname =~ s/_org_openoffice_/_o_o_/g;
301 # $componentname =~ s/_program_/_p_/g;
302 # $componentname =~ s/_typedetection_/_td_/g;
303 # $componentname =~ s/_linguistic_/_l_/g;
304 # $componentname =~ s/_module_/_m_/g;
305 # $componentname =~ s/_optional_/_opt_/g;
306 # $componentname =~ s/_packages/_pack/g;
307 # $componentname =~ s/_menubar/_mb/g;
308 # $componentname =~ s/_common_/_cm_/g;
309 # $componentname =~ s/_export_/_exp_/g;
310 # $componentname =~ s/_table_/_tb_/g;
311 # $componentname =~ s/_sofficecfg_/_sc_/g;
312 # $componentname =~ s/_soffice_cfg_/_sc_/g;
313 # $componentname =~ s/_startmodulecommands_/_smc_/g;
314 # $componentname =~ s/_drawimpresscommands_/_dic_/g;
315 # $componentname =~ s/_basiccommands_/_bac_/g;
316 # $componentname =~ s/_basicidecommands_/_baic_/g;
317 # $componentname =~ s/_genericcommands_/_genc_/g;
318 # $componentname =~ s/_bibliographycommands_/_bibc_/g;
319 # $componentname =~ s/_gentiumbookbasicbolditalic_/_gbbbi_/g;
320 # $componentname =~ s/_share_/_s_/g;
321 # $componentname =~ s/_extension_/_ext_/g;
322 # $componentname =~ s/_extensions_/_exs_/g;
323 # $componentname =~ s/_modules_/_ms_/g;
324 # $componentname =~ s/_uiconfig_zip_/_ucz_/g;
325 # $componentname =~ s/_productivity_/_pr_/g;
326 # $componentname =~ s/_wizard_/_wz_/g;
327 # $componentname =~ s/_import_/_im_/g;
328 # $componentname =~ s/_javascript_/_js_/g;
329 # $componentname =~ s/_template_/_tpl_/g;
330 # $componentname =~ s/_tplwizletter_/_twl_/g;
331 # $componentname =~ s/_beanshell_/_bs_/g;
332 # $componentname =~ s/_presentation_/_bs_/g;
333 # $componentname =~ s/_columns_/_cls_/g;
334 # $componentname =~ s/_python_/_py_/g;
335
336 # $componentname =~ s/_tools/_ts/g;
337 # $componentname =~ s/_transitions/_trs/g;
338 # $componentname =~ s/_scriptbinding/_scrb/g;
339 # $componentname =~ s/_spreadsheet/_ssh/g;
340 # $componentname =~ s/_publisher/_pub/g;
341 # $componentname =~ s/_presenter/_pre/g;
342 # $componentname =~ s/_registry/_reg/g;
343
344 # $componentname =~ s/screen/sc/g;
345 # $componentname =~ s/wordml/wm/g;
346 # $componentname =~ s/openoffice/oo/g;
347 }
348
349 return $componentname;
350}
351
352####################################################################
353# Returning the component name for a defined file gid.
354# This is necessary for files with flag ASSIGNCOMPOMENT
355####################################################################
356
357sub get_component_from_assigned_file
358
# spent 45.1ms within installer::windows::file::get_component_from_assigned_file which was called 5 times, avg 9.03ms/call: # 5 times (45.1ms+0s) by installer::windows::file::get_file_component_name at line 221, avg 9.03ms/call
{
3593045.2ms my ($gid, $filesref) = @_;
360
361 my ($onefile) = grep {$_->{gid} eq $gid} @{$filesref};
362 if (! defined $onefile) {
363 installer::exiter::exit_program("ERROR: Could not find file $gid in list of files!", "get_component_from_assigned_file");
364 }
365
366 my $componentname = "";
367 if ( $onefile->{'componentname'} ) { $componentname = $onefile->{'componentname'}; }
368 else { installer::exiter::exit_program("ERROR: No component defined for file: $gid", "get_component_from_assigned_file"); }
369
370 return $componentname;
371}
372
373####################################################################
374# Generating the special filename for the database file File.idt
375# Sample: CONTEXTS, CONTEXTS1
376# This name has to be unique.
377# In most cases this is simply the filename.
378####################################################################
379
380sub generate_unique_filename_for_filetable
381
# spent 10.6s (7.57+3.08) within installer::windows::file::generate_unique_filename_for_filetable which was called 15888 times, avg 670µs/call: # 15888 times (7.57s+3.08s) by installer::windows::file::create_files_table at line 888, avg 670µs/call
{
382270096620ms my ($fileref, $component, $uniquefilenamehashref) = @_;
383
384 # This new filename has to be saved into $fileref, because this is needed to find the source.
385 # The filename sbasic.idx/OFFSETS is changed to OFFSETS, but OFFSETS is not unique.
386 # In this procedure names like OFFSETS5 are produced. And exactly this string has to be added to
387 # the array of all files.
388
389 my $uniquefilename = "";
390 my $counter = 0;
391
392 if ( $fileref->{'Name'} ) { $uniquefilename = $fileref->{'Name'}; }
393
39415888174ms installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$uniquefilename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs
# spent 174ms making 15888 calls to installer::pathanalyzer::make_absolute_filename_to_relative_filename, avg 11µs/call
395
396 # Reading unique filename with help of "Component_" in File table from old database
397 if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$component/$uniquefilename"}) ))
398 {
399 $uniquefilename = $uniquefilenamehashref->{"$component/$uniquefilename"}; # syntax of $value: ($uniquename;$shortname)
400 if ( $uniquefilename =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $uniquefilename = $1; }
401 $lcuniquefilename = lc($uniquefilename);
402 $installer::globals::alluniquefilenames{$uniquefilename} = 1;
403 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
404 return $uniquefilename;
405 }
406 elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$component/$uniquefilename"}) ))
407 {
408 # If we have a FTK mapping for this component/file, use it.
409 $installer::globals::savedmapping{"$component/$uniquefilename"} =~ m/^(.*);/;
410 $uniquefilename = $1;
411 $lcuniquefilename = lc($uniquefilename);
412 $installer::globals::alluniquefilenames{$uniquefilename} = 1;
413 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
414 return $uniquefilename;
415 }
416
4171588824.0ms $uniquefilename =~ s/\-/\_/g; # no "-" allowed
# spent 24.0ms making 15888 calls to installer::windows::file::CORE:subst, avg 2µs/call
418158888.06ms $uniquefilename =~ s/\@/\_/g; # no "@" allowed
# spent 8.06ms making 15888 calls to installer::windows::file::CORE:subst, avg 507ns/call
419158888.06ms $uniquefilename =~ s/\$/\_/g; # no "$" allowed
# spent 8.06ms making 15888 calls to installer::windows::file::CORE:subst, avg 507ns/call
4201588817.4ms $uniquefilename =~ s/^\s*\./\_/g; # no "." at the beginning allowed allowed
# spent 17.4ms making 15888 calls to installer::windows::file::CORE:subst, avg 1µs/call
4211588814.0ms $uniquefilename =~ s/^\s*\d/\_d/g; # no number at the beginning allowed allowed (even file "0.gif", replacing to "_d.gif")
# spent 14.0ms making 15888 calls to installer::windows::file::CORE:subst, avg 882ns/call
422158888.24ms $uniquefilename =~ s/org_openoffice_/ooo_/g; # shorten the unique file name
# spent 8.24ms making 15888 calls to installer::windows::file::CORE:subst, avg 518ns/call
423
424 my $lcuniquefilename = lc($uniquefilename); # only lowercase names
425
426 my $newname = 0;
427
4283017732.9ms if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
429 ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
430 {
431 $installer::globals::alluniquefilenames{$uniquefilename} = 1;
432 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
433 $newname = 1;
434 }
435
4361165817.4ms if ( ! $newname )
437 {
438 # adding a number until the name is really unique: OFFSETS, OFFSETS1, OFFSETS2, ...
439 # But attention: Making "abc.xcu" to "abc1.xcu"
440
441 my $uniquefilenamebase = $uniquefilename;
442
443 do
44432664805.55s {
445 $counter++;
446
44712523004.23s6532961.07s if ( $uniquefilenamebase =~ /\./ )
# spent 1.07s making 653296 calls to installer::windows::file::CORE:match, avg 2µs/call
448 {
449 $uniquefilename = $uniquefilenamebase;
4505990041.76s $uniquefilename =~ s/\./$counter\./;
# spent 1.76s making 599004 calls to installer::windows::file::CORE:subst, avg 3µs/call
451 }
452 else
453 {
454 $uniquefilename = $uniquefilenamebase . $counter;
455 }
456
457 $newname = 0;
458 $lcuniquefilename = lc($uniquefilename); # only lowercase names
459
4601748720.4ms if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
461 ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
462 {
463 $installer::globals::alluniquefilenames{$uniquefilename} = 1;
464 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
465 $newname = 1;
466 }
467 }
468 until ( $newname )
469 }
470
471 return $uniquefilename;
472}
473
474####################################################################
475# Generating the special file column for the database file File.idt
476# Sample: NAMETR~1.TAB|.nametranslation.table
477# The first part has to be 8.3 conform.
478####################################################################
479
480sub generate_filename_for_filetable
481
# spent 8.01s (283ms+7.73) within installer::windows::file::generate_filename_for_filetable which was called 15888 times, avg 504µs/call: # 15888 times (283ms+7.73s) by installer::windows::file::create_files_table at line 897, avg 504µs/call
{
482127104187ms my ($fileref, $shortnamesref, $uniquefilenamehashref) = @_;
483
484 my $returnstring = "";
485
486 my $filename = $fileref->{'Name'};
487
48815888162ms installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$filename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs
# spent 162ms making 15888 calls to installer::pathanalyzer::make_absolute_filename_to_relative_filename, avg 10µs/call
489
490 my $shortstring;
491
492 # Reading short string with help of "FileName" in File table from old database
4931588854.2ms if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"}) ))
494 {
495 my $value = $uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"}; # syntax of $value: ($uniquename;$shortname)
496 if ( $value =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $shortstring = $2; } # already collected in function "collect_shortnames_from_old_database"
497 else { $shortstring = $filename; }
498 }
499 elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"}) ))
500 {
501 $installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"} =~ m/.*;(.*)/;
502 if ($1 ne '')
503 {
504 $shortstring = $1;
505 }
506 else
507 {
508 $shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref);
509 }
510 }
511 else
512 {
513158887.57s $shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref);
# spent 7.57s making 15888 calls to installer::windows::idtglobal::make_eight_three_conform_with_hash, avg 476µs/call
514 }
515
51673366.90ms if ( $shortstring eq $filename ) { $returnstring = $filename; } # nothing changed
517 else {$returnstring = $shortstring . "\|" . $filename; }
518
519 return $returnstring;
520}
521
522#########################################
523# Returning the filesize of a file
524#########################################
525
526sub get_filesize
527
# spent 4.52s (243ms+4.28) within installer::windows::file::get_filesize which was called 15888 times, avg 285µs/call: # 15888 times (243ms+4.28s) by installer::windows::file::create_files_table at line 899, avg 285µs/call
{
528794404.56s my ($fileref) = @_;
529
530 my $file = $fileref->{'sourcepath'};
531
532 my $filesize;
533
534317764.28s if ( -f $file ) # test of existence. For instance services.rdb does not always exist
# spent 2.42s making 15888 calls to installer::windows::file::CORE:ftfile, avg 152µs/call # spent 1.86s making 15888 calls to installer::windows::file::CORE:ftsize, avg 117µs/call
535 {
536 $filesize = ( -s $file ); # file size can be "0"
537 }
538 else
539 {
540 $filesize = -1;
541 }
542
543 return $filesize;
544}
545
546#############################################
547# Returning the file version, if required
548# Sample: "8.0.1.8976";
549#############################################
550
551sub get_fileversion
552
# spent 5.45s (178ms+5.27) within installer::windows::file::get_fileversion which was called 15888 times, avg 343µs/call: # 15888 times (178ms+5.27s) by installer::windows::file::create_files_table at line 901, avg 343µs/call
{
55363552220ms my ($onefile, $allvariables, $styles) = @_;
554
555 my $fileversion = "";
556
5572310414ms1588848.9ms if ( $onefile->{'Name'} =~ /\.bin$|\.com$|\.dll$|\.exe$|\.pyd$/ )
# spent 48.9ms making 15888 calls to installer::windows::file::CORE:match, avg 3µs/call
558 {
55938581.4ms open (EXE, "<$onefile->{'sourcepath'}");
# spent 81.4ms making 385 calls to installer::windows::file::CORE:open, avg 212µs/call
560385919µs binmode EXE;
# spent 919µs making 385 calls to installer::windows::file::CORE:binmode, avg 2µs/call
5617704.82s3854.81s {local $/ = undef; $exedata = <EXE>;}
# spent 4.81s making 385 calls to installer::windows::file::CORE:readline, avg 12.5ms/call
56238513.7ms close EXE;
# spent 13.7ms making 385 calls to installer::windows::file::CORE:close, avg 36µs/call
563
564 my $binaryfileversion = "(V\x00S\x00_\x00V\x00E\x00R\x00S\x00I\x00O\x00N\x00_\x00I\x00N\x00F\x00O\x00\x00\x00\x00\x00\xbd\x04\xef\xfe\x00\x00\x01\x00)(........)";
565
5666545.83ms770306ms if ($exedata =~ /$binaryfileversion/ms)
# spent 306ms making 385 calls to installer::windows::file::CORE:match, avg 794µs/call # spent 492µs making 385 calls to installer::windows::file::CORE:regcomp, avg 1µs/call
567 {
5683271.84ms my ($header, $subversion, $version, $vervariant, $microversion) = ($1,unpack( "vvvv", $2));
# spent 1.84ms making 327 calls to installer::windows::file::CORE:unpack, avg 6µs/call
569 $fileversion = $version . "." . $subversion . "." . $microversion . "." . $vervariant;
570 }
571 }
572
573 return $fileversion;
574}
575
576#############################################
577# Returning the sequence for a file
578#############################################
579
580sub get_sequence_for_file
581
# spent 121ms within installer::windows::file::get_sequence_for_file which was called 15888 times, avg 8µs/call: # 15888 times (121ms+0s) by installer::windows::file::create_files_table at line 913, avg 8µs/call
{
58295328144ms my ($number, $onefile, $fileentry, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, $allfilecomponents) = @_;
583
584 my $sequence = "";
585 my $infoline = "";
586 my $pffcomponentname = $onefile->{'componentname'} . "_pff";
587
588158887.97ms if ( $installer::globals::updatedatabase )
589 {
590 if (( exists($allupdatesequenceshashref->{$onefile->{'uniquename'}}) ) &&
591 (( $onefile->{'componentname'} eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) ||
592 ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} )))
593 {
594 # The second condition is necessary to find shifted files, that have same "uniquename", but are now
595 # located in another directory. This can be seen at the component name.
596 $sequence = $allupdatesequenceshashref->{$onefile->{'uniquename'}};
597 $onefile->{'assignedsequencenumber'} = $sequence;
598 # Collecting all used sequences, to guarantee, that no number is unused
599 $installer::globals::allusedupdatesequences{$sequence} = 1;
600 # Special help for files, that already have a "pff" component name (for example after ServicePack 1)
601 if ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} )
602 {
603 $infoline = "Warning: Special handling for component \"$pffcomponentname\". This file was added after the final, but before this ServicePack.\n";
604 push(@installer::globals::logfileinfo, $infoline);
605 $onefile->{'componentname'} = $pffcomponentname; # pff for "post final file"
606 $fileentry->{'Component_'} = $onefile->{'componentname'};
607 if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; }
608 }
609 }
610 else
611 {
612 $installer::globals::updatesequencecounter++;
613 $sequence = $installer::globals::updatesequencecounter;
614 $onefile->{'assignedsequencenumber'} = $sequence;
615 # $onefile->{'assignedcabinetfile'} = $installer::globals::pffcabfilename; # assigning to cabinet file for "post final files"
616 # Collecting all new files
617 $installer::globals::newupdatefiles{$sequence} = $onefile;
618 # Saving in sequence hash
619 $allupdatefileorderhashref->{$sequence} = $onefile->{'uniquename'};
620
621 # If the new file is part of an existing component, this must be changed now. All files
622 # of one component have to be included in one cabinet file. But because the order must
623 # not change, all new files have to be added to new components.
624 # $onefile->{'componentname'} = $file{'Component_'};
625
626 $onefile->{'componentname'} = $onefile->{'componentname'} . "_pff"; # pff for "post final file"
627 $fileentry->{'Component_'} = $onefile->{'componentname'};
628 if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; }
629 $onefile->{'PostFinalFile'} = 1;
630 # $installer::globals::pfffileexists = 1;
631 # The sequence for this file has changed. It has to be inserted at the end of the files collector.
632 $installer::globals::insert_file_at_end = 1;
633 $installer::globals::newfilescollector{$sequence} = $onefile; # Adding new files to the end of the filescollector
634 $installer::globals::newfilesexist = 1;
635 }
636 }
637 else
638 {
639 $sequence = $number;
640 # my $sequence = $number + 1;
641
642 # Idea: Each component is packed into a cab file.
643 # This requires that all files in one cab file have sequences directly follwing each other,
644 # for instance from 1456 to 1466. Then in the media table the LastSequence for this cab file
645 # is 1466.
646 # Because all files belonging to one component are directly behind each other in the file
647 # collector, it is possible to use simply an increasing number as sequence value.
648 # If files belonging to one component are not directly behind each other in the files collector
649 # this mechanism will no longer work.
650 }
651
652 return $sequence;
653}
654
655#############################################
656# Returning the Windows language of a file
657#############################################
658
659sub get_language_for_file
660
# spent 233ms (183+50.6) within installer::windows::file::get_language_for_file which was called 15888 times, avg 15µs/call: # 15888 times (183ms+50.6ms) by installer::windows::file::create_files_table at line 903, avg 15µs/call
{
66179440121ms my ($fileref) = @_;
662
663 my $language = "";
664
665 if ( $fileref->{'specificlanguage'} ) { $language = $fileref->{'specificlanguage'}; }
666
6674255279.9ms if ( $language eq "" )
668 {
669 $language = 0; # language independent
670 # If this is not a font, the return value should be "0" (Check ICE 60)
671 my $styles = "";
672 if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
67388888.86ms if ( $styles =~ /\bFONT\b/ ) { $language = ""; }
# spent 8.86ms making 8888 calls to installer::windows::file::CORE:match, avg 997ns/call
674 }
675 else
676 {
677700041.7ms $language = installer::windows::language::get_windows_language($language);
# spent 41.7ms making 7000 calls to installer::windows::language::get_windows_language, avg 6µs/call
678 }
679
680 return $language;
681}
682
683####################################################################
684# Creating a new KeyPath for components in TemplatesFolder.
685####################################################################
686
687sub generate_registry_keypath
688
# spent 146µs (103+43) within installer::windows::file::generate_registry_keypath which was called 8 times, avg 18µs/call: # 8 times (103µs+43µs) by installer::windows::file::create_files_table at line 1020, avg 18µs/call
{
68948163µs my ($onefile) = @_;
690
691 my $keypath = $onefile->{'Name'};
692843µs $keypath =~ s/\.//g;
# spent 43µs making 8 calls to installer::windows::file::CORE:subst, avg 5µs/call
693 $keypath = lc($keypath);
694 $keypath = "userreg_" . $keypath;
695
696 return $keypath;
697}
698
699####################################################################
700# Check, if in an update process files are missing. No removal
701# of files allowed for Windows Patch creation.
702# Also logging all new files, that have to be included in extra
703# components and cab files.
704####################################################################
705
706sub check_file_sequences
707{
708 my ($allupdatefileorderhashref, $allupdatecomponentorderhashref) = @_;
709
710 # All used sequences stored in %installer::globals::allusedupdatesequences
711 # Maximum sequence number of old database stored in $installer::globals::updatelastsequence
712 # All new files stored in %installer::globals::newupdatefiles
713
714 my $infoline = "";
715
716 my @missing_sequences = ();
717 my @really_missing_sequences = ();
718
719 for ( my $i = 1; $i <= $installer::globals::updatelastsequence; $i++ )
720 {
721 if ( ! exists($installer::globals::allusedupdatesequences{$i}) ) { push(@missing_sequences, $i); }
722 }
723
724 if ( $#missing_sequences > -1 )
725 {
726 # Missing sequences can also be caused by files included in merge modules. This files are added later into the file table.
727 # Therefore now it is time to check the content of the merge modules.
728
729 for ( my $j = 0; $j <= $#missing_sequences; $j++ )
730 {
731 my $filename = $allupdatefileorderhashref->{$missing_sequences[$j]};
732
733 # Is this a file from a merge module? Then this is no error.
734 if ( ! exists($installer::globals::mergemodulefiles{$filename}) )
735 {
736 push(@really_missing_sequences, $missing_sequences[$j]);
737 }
738 }
739 }
740
741 if ( $#really_missing_sequences > -1 )
742 {
743 my $errorstring = "";
744 for ( my $j = 0; $j <= $#really_missing_sequences; $j++ )
745 {
746 my $filename = $allupdatefileorderhashref->{$really_missing_sequences[$j]};
747 my $comp = $allupdatecomponentorderhashref->{$really_missing_sequences[$j]};
748 $errorstring = "$errorstring$filename (Sequence: $really_missing_sequences[$j], Component: \"$comp\")\n";
749 }
750
751 $infoline = "ERROR: Files are removed compared with update database.\nThe following files are missing:\n$errorstring";
752 push(@installer::globals::logfileinfo, $infoline);
753 installer::exiter::exit_program($infoline, "check_file_sequences");
754 }
755
756 # Searching for new files
757
758 my $counter = 0;
759
760 foreach my $key ( keys %installer::globals::newupdatefiles )
761 {
762 my $onefile = $installer::globals::newupdatefiles{$key};
763 $counter++;
764 if ( $counter == 1 )
765 {
766 $infoline = "\nNew files compared to the update database:\n";
767 push(@installer::globals::logfileinfo, $infoline);
768 }
769
770 $infoline = "$onefile->{'Name'} ($onefile->{'gid'}) Sequence: $onefile->{'assignedsequencenumber'}\n";
771 push(@installer::globals::logfileinfo, $infoline);
772 }
773
774 if ( $counter == 0 )
775 {
776 $infoline = "Info: No new file compared with update database!\n";
777 push(@installer::globals::logfileinfo, $infoline);
778 }
779
780}
781
782###################################################################
783# Collecting further conditions for the component table.
784# This is used by multilayer products, to enable installation
785# of separate layers.
786###################################################################
787
788sub get_tree_condition_for_component
789
# spent 125ms within installer::windows::file::get_tree_condition_for_component which was called 15888 times, avg 8µs/call: # 15888 times (125ms+0s) by installer::windows::file::create_files_table at line 952, avg 8µs/call
{
79031776101ms my ($onefile, $componentname) = @_;
791
7923177658.8ms if ( $onefile->{'destination'} )
793 {
794 my $dest = $onefile->{'destination'};
795
796 # Comparing the destination path with
797 # $installer::globals::hostnametreestyles{$hostname} = $treestyle;
798 # (-> hostname is the key, the style the value!)
799
800 foreach my $hostname ( keys %installer::globals::hostnametreestyles )
801 {
802 if (( $dest eq $hostname ) || ( $dest =~ /^\s*\Q$hostname\E\\/ ))
803 {
804 # the value is the style
805 my $style = $installer::globals::hostnametreestyles{$hostname};
806 # the condition is saved in %installer::globals::treestyles
807 my $condition = $installer::globals::treestyles{$style};
808 # Saving condition to be added in table Property
809 $installer::globals::usedtreeconditions{$condition} = 1;
810 $condition = $condition . "=1";
811 # saving this condition
812 $installer::globals::treeconditions{$componentname} = $condition;
813
814 # saving also at the file, for usage in fileinfo
815 $onefile->{'layer'} = $installer::globals::treelayername{$style};
816 }
817 }
818 }
819}
820
821############################################
822# Collecting all short names, that are
823# already used by the old database
824############################################
825
826sub collect_shortnames_from_old_database
827{
828 my ($uniquefilenamehashref, $shortnameshashref) = @_;
829
830 foreach my $key ( keys %{$uniquefilenamehashref} )
831 {
832 my $value = $uniquefilenamehashref->{$key}; # syntax of $value: ($uniquename;$shortname)
833
834 if ( $value =~ /^\s*(.*?)\;\s*(.*?)\s*$/ )
835 {
836 my $shortstring = $2;
837 $shortnameshashref->{$shortstring} = 1; # adding the shortname to the array of all shortnames
838 }
839 }
840}
841
842############################################
843# Creating the file File.idt dynamically
844############################################
845
846sub create_files_table
847
# spent 69.5s (2.26+67.2) within installer::windows::file::create_files_table which was called: # once (2.26s+67.2s) by installer::run at line 1496 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
8482759.8ms my ($filesref, $dirref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_;
849
8501219µs installer::logger::include_timestamp_into_logfile("Performance Info: File Table start");
# spent 219µs making 1 call to installer::logger::include_timestamp_into_logfile
851
852 # Structure of the files table:
853 # File Component_ FileName FileSize Version Language Attributes Sequence
854 # In this function, all components are created.
855 #
856 # $allfilecomponentsref is empty at the beginning
857
858 my $infoline;
859
860 my @allfiles = ();
861 my @filetable = ();
862 my @filehashtable = ();
863 my %allfilecomponents = ();
864 my $counter = 0;
865
86623.12s if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_paths($filesref); }
# spent 3.12s making 1 call to installer::worker::generate_cygwin_paths # spent 7µs making 1 call to installer::windows::file::CORE:match
867
868 # The filenames must be collected because of uniqueness
869 # 01-44-~1.DAT, 01-44-~2.DAT, ...
870 my %shortnames = ();
871
872 if ( $installer::globals::updatedatabase ) { collect_shortnames_from_old_database($uniquefilenamehashref, \%shortnames); }
873
874128µs installer::windows::idtglobal::write_idt_header(\@filetable, "file");
# spent 28µs making 1 call to installer::windows::idtglobal::write_idt_header
875117µs installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash");
# spent 17µs making 1 call to installer::windows::idtglobal::write_idt_header
876116µs installer::windows::idtglobal::write_idt_header(\@installer::globals::removefiletable, "removefile");
# spent 16µs making 1 call to installer::windows::idtglobal::write_idt_header
877
8784925281.13s for ( my $i = 0; $i <= $#{$filesref}; $i++ )
879 {
880 my %file = ();
881
882 my $onefile = ${$filesref}[$i];
883
884 my $styles = "";
885 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
886
887158882.33s $file{'Component_'} = get_file_component_name($onefile, $filesref);
# spent 2.33s making 15888 calls to installer::windows::file::get_file_component_name, avg 147µs/call
8881588810.6s $file{'File'} = generate_unique_filename_for_filetable($onefile, $file{'Component_'}, $uniquefilenamehashref);
# spent 10.6s making 15888 calls to installer::windows::file::generate_unique_filename_for_filetable, avg 670µs/call
889
890 $onefile->{'uniquename'} = $file{'File'};
891 $onefile->{'componentname'} = $file{'Component_'};
892
893 # Collecting all components
894
895 if ( ! exists($allfilecomponents{$file{'Component_'}}) ) { $allfilecomponents{$file{'Component_'}} = 1; }
896
897158888.01s $file{'FileName'} = generate_filename_for_filetable($onefile, \%shortnames, $uniquefilenamehashref);
# spent 8.01s making 15888 calls to installer::windows::file::generate_filename_for_filetable, avg 504µs/call
898
899158884.52s $file{'FileSize'} = get_filesize($onefile);
# spent 4.52s making 15888 calls to installer::windows::file::get_filesize, avg 285µs/call
900
901158885.45s $file{'Version'} = get_fileversion($onefile, $allvariables, $styles);
# spent 5.45s making 15888 calls to installer::windows::file::get_fileversion, avg 343µs/call
902
90315888233ms $file{'Language'} = get_language_for_file($onefile);
# spent 233ms making 15888 calls to installer::windows::file::get_language_for_file, avg 15µs/call
904
9051588823.0ms1588810.5ms if ( $styles =~ /\bDONT_PACK\b/ ) { $file{'Attributes'} = "8192"; }
# spent 10.5ms making 15888 calls to installer::windows::file::CORE:match, avg 662ns/call
906 else { $file{'Attributes'} = "16384"; }
907
908 # $file{'Attributes'} = "16384"; # Sourcefile is packed
909 # $file{'Attributes'} = "8192"; # Sourcefile is unpacked
910
911 $installer::globals::insert_file_at_end = 0;
912 $counter++;
91315888121ms $file{'Sequence'} = get_sequence_for_file($counter, $onefile, \%file, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, \%allfilecomponents);
# spent 121ms making 15888 calls to installer::windows::file::get_sequence_for_file, avg 8µs/call
914
915 $onefile->{'sequencenumber'} = $file{'Sequence'};
916
917 my $oneline = $file{'File'} . "\t" . $file{'Component_'} . "\t" . $file{'FileName'} . "\t"
918 . $file{'FileSize'} . "\t" . $file{'Version'} . "\t" . $file{'Language'} . "\t"
919 . $file{'Attributes'} . "\t" . $file{'Sequence'} . "\n";
920
921 push(@filetable, $oneline);
922
923688030.1ms1588815.9ms if ( $file{'File'} =~ /\.py$/ )
# spent 15.9ms making 15888 calls to installer::windows::file::CORE:match, avg 1000ns/call
924 {
925 my %removefile = ();
926
927 $removefile{'FileKey'} = "remove_" . $file{'File'} . "c";
928 $removefile{'Component_'} = $file{'Component_'};
929 $removefile{'FileName'} = $file{'FileName'};
9306882.91ms $removefile{'FileName'} =~ s/\.py$/.pyc/;
# spent 2.91ms making 688 calls to installer::windows::file::CORE:subst, avg 4µs/call
9316881.62ms $removefile{'FileName'} =~ s/\.PY\|/.PYC|/;
# spent 1.62ms making 688 calls to installer::windows::file::CORE:subst, avg 2µs/call
93268817.3s $removefile{'DirProperty'} = installer::windows::component::get_file_component_directory($file{'Component_'}, $filesref, $dirref);
# spent 17.3s making 688 calls to installer::windows::component::get_file_component_directory, avg 25.2ms/call
933 $removefile{'InstallMode'} = 2; # msiInstallStateAbsent
934 $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t"
935 . $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n";
936
937 push(@installer::globals::removefiletable, $oneline);
938 }
939
940 if ( ! $installer::globals::insert_file_at_end ) { push(@allfiles, $onefile); }
941
942 # Collecting all component conditions
943 if ( $onefile->{'ComponentCondition'} )
944 {
945 if ( ! exists($installer::globals::componentcondition{$file{'Component_'}}))
946 {
947 $installer::globals::componentcondition{$file{'Component_'}} = $onefile->{'ComponentCondition'};
948 }
949 }
950
951 # Collecting also all tree conditions for multilayer products
95215888125ms get_tree_condition_for_component($onefile, $file{'Component_'});
# spent 125ms making 15888 calls to installer::windows::file::get_tree_condition_for_component, avg 8µs/call
953
954 # Collecting all component names, that have flag VERSION_INDEPENDENT_COMP_ID
955 # This should be all components with constant API, for example URE
956158889.54ms if ( $styles =~ /\bVERSION_INDEPENDENT_COMP_ID\b/ )
# spent 9.54ms making 15888 calls to installer::windows::file::CORE:match, avg 600ns/call
957 {
958 $installer::globals::base_independent_components{$onefile->{'componentname'}} = 1;
959 }
960
961 # Collecting all component ids, that are defined at files in scp project (should not be used anymore)
962 if ( $onefile->{'CompID'} )
963 {
964 if ( ! exists($installer::globals::componentid{$onefile->{'componentname'}}))
965 {
966 $installer::globals::componentid{$onefile->{'componentname'}} = $onefile->{'CompID'};
967 }
968 else
969 {
970 if ( $installer::globals::componentid{$onefile->{'componentname'}} ne $onefile->{'CompID'} )
971 {
972 installer::exiter::exit_program("ERROR: There is already a ComponentID for component \"$onefile->{'componentname'}\" : \"$installer::globals::componentid{$onefile->{'componentname'}}\" . File \"$onefile->{'gid'}\" uses \"$onefile->{'CompID'}\" !", "create_files_table");
973 }
974 }
975
976 # Also checking vice versa. Is this ComponentID already used? If yes, is the componentname the same?
977
978 if ( ! exists($installer::globals::comparecomponentname{$onefile->{'CompID'}}))
979 {
980 $installer::globals::comparecomponentname{$onefile->{'CompID'}} = $onefile->{'componentname'};
981 }
982 else
983 {
984 if ( $installer::globals::comparecomponentname{$onefile->{'CompID'}} ne $onefile->{'componentname'} )
985 {
986 installer::exiter::exit_program("ERROR: There is already a component for ComponentID \"$onefile->{'CompID'}\" : \"$installer::globals::comparecomponentname{$onefile->{'CompID'}}\" . File \"$onefile->{'gid'}\" has same component id but is included in component \"$onefile->{'componentname'}\" !", "create_files_table");
987 }
988 }
989 }
990
99114004916.2s unless ( $file{'Version'} )
992 {
993 my $path = $onefile->{'sourcepath'};
9941556149.8ms if ( $^O =~ /cygwin/i ) { $path = $onefile->{'cyg_sourcepath'}; }
# spent 49.8ms making 15561 calls to installer::windows::file::CORE:match, avg 3µs/call
995
996155614.08s open(FILE, $path) or die "ERROR: Can't open $path for creating file hash";
# spent 4.08s making 15561 calls to installer::windows::file::CORE:open, avg 262µs/call
9971556131.1ms binmode(FILE);
# spent 31.1ms making 15561 calls to installer::windows::file::CORE:binmode, avg 2µs/call
9981556119.5ms my $hashinfo = pack("l", 20);
# spent 19.5ms making 15561 calls to installer::windows::file::CORE:pack, avg 1µs/call
9994668311.1s $hashinfo .= Digest::MD5->new->addfile(*FILE)->digest;
# spent 10.9s making 15561 calls to Digest::MD5::addfile, avg 703µs/call # spent 78.1ms making 15561 calls to Digest::MD5::new, avg 5µs/call # spent 48.7ms making 15561 calls to Digest::MD5::digest, avg 3µs/call
1000
10013112272.6ms my @i = unpack ('x[l]l4', $hashinfo);
# spent 38.3ms making 15561 calls to Digest::MD5::DESTROY, avg 2µs/call # spent 34.3ms making 15561 calls to installer::windows::file::CORE:unpack, avg 2µs/call
1002 $oneline = $file{'File'} . "\t" .
1003 "0" . "\t" .
1004 $i[0] . "\t" .
1005 $i[1] . "\t" .
1006 $i[2] . "\t" .
1007 $i[3] . "\n";
1008 push (@filehashtable, $oneline);
1009 }
1010
1011 # Saving the sequence number in a hash with uniquefilename as key.
1012 # This is used for better performance in "save_packorder"
1013 $installer::globals::uniquefilenamesequence{$onefile->{'uniquename'}} = $onefile->{'sequencenumber'};
1014
1015 my $destdir = "";
1016 if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; }
1017
10183257µs if ( $onefile->{'needs_user_registry_key'} )
1019 {
10208146µs my $keypath = generate_registry_keypath($onefile);
# spent 146µs making 8 calls to installer::windows::file::generate_registry_keypath, avg 18µs/call
1021 $onefile->{'userregkeypath'} = $keypath;
1022 push(@installer::globals::userregistrycollector, $onefile);
1023 $installer::globals::addeduserregitrykeys = 1;
1024 }
1025 }
1026
1027 # putting content from %allfilecomponents to $allfilecomponentsref for later usage
102890159.07ms foreach $localkey (keys %allfilecomponents ) { push( @{$allfilecomponentsref}, $localkey); }
1029
1030 my $filetablename = $basedir . $installer::globals::separator . "File.idt";
103119.63ms installer::files::save_file($filetablename ,\@filetable);
# spent 9.63ms making 1 call to installer::files::save_file
1032 $infoline = "\nCreated idt file: $filetablename\n";
1033 push(@installer::globals::logfileinfo, $infoline);
1034
10351213µs installer::logger::include_timestamp_into_logfile("Performance Info: File Table end");
# spent 213µs making 1 call to installer::logger::include_timestamp_into_logfile
1036
1037 my $filehashtablename = $basedir . $installer::globals::separator . "MsiFileHash.idt";
103817.12ms installer::files::save_file($filehashtablename ,\@filehashtable);
# spent 7.12ms making 1 call to installer::files::save_file
1039 $infoline = "\nCreated idt file: $filehashtablename\n";
1040 push(@installer::globals::logfileinfo, $infoline);
1041
1042 # Now the new files can be added to the files collector (only in update packaging processes)
1043 if ( $installer::globals::newfilesexist )
1044 {
1045 foreach my $seq (sort keys %installer::globals::newfilescollector) { push(@allfiles, $installer::globals::newfilescollector{$seq}) }
1046 }
1047
1048 return \@allfiles;
1049}
1050
105118µs1;
 
# spent 32.1ms within installer::windows::file::CORE:binmode which was called 15946 times, avg 2µs/call: # 15561 times (31.1ms+0s) by installer::windows::file::create_files_table at line 997, avg 2µs/call # 385 times (919µs+0s) by installer::windows::file::get_fileversion at line 560, avg 2µs/call
sub installer::windows::file::CORE:binmode; # opcode
# spent 13.7ms within installer::windows::file::CORE:close which was called 385 times, avg 36µs/call: # 385 times (13.7ms+0s) by installer::windows::file::get_fileversion at line 562, avg 36µs/call
sub installer::windows::file::CORE:close; # opcode
# spent 2.42s within installer::windows::file::CORE:ftfile which was called 15888 times, avg 152µs/call: # 15888 times (2.42s+0s) by installer::windows::file::get_filesize at line 534, avg 152µs/call
sub installer::windows::file::CORE:ftfile; # opcode
# spent 1.86s within installer::windows::file::CORE:ftsize which was called 15888 times, avg 117µs/call: # 15888 times (1.86s+0s) by installer::windows::file::get_filesize at line 534, avg 117µs/call
sub installer::windows::file::CORE:ftsize; # opcode
# spent 1.54s within installer::windows::file::CORE:match which was called 773459 times, avg 2µs/call: # 653296 times (1.07s+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 447, avg 2µs/call # 15888 times (48.9ms+0s) by installer::windows::file::get_fileversion at line 557, avg 3µs/call # 15888 times (15.9ms+0s) by installer::windows::file::create_files_table at line 923, avg 1000ns/call # 15888 times (14.4ms+0s) by installer::windows::file::get_file_component_name at line 221, avg 903ns/call # 15888 times (10.5ms+0s) by installer::windows::file::create_files_table at line 905, avg 662ns/call # 15888 times (10.2ms+0s) by installer::windows::file::assign_cab_to_files at line 58, avg 641ns/call # 15888 times (9.54ms+0s) by installer::windows::file::create_files_table at line 956, avg 600ns/call # 15561 times (49.8ms+0s) by installer::windows::file::create_files_table at line 994, avg 3µs/call # 8888 times (8.86ms+0s) by installer::windows::file::get_language_for_file at line 673, avg 997ns/call # 385 times (306ms+0s) by installer::windows::file::get_fileversion at line 566, avg 794µs/call # once (7µs+0s) by installer::windows::file::create_files_table at line 866
sub installer::windows::file::CORE:match; # opcode
# spent 4.17s within installer::windows::file::CORE:open which was called 15946 times, avg 261µs/call: # 15561 times (4.08s+0s) by installer::windows::file::create_files_table at line 996, avg 262µs/call # 385 times (81.4ms+0s) by installer::windows::file::get_fileversion at line 559, avg 212µs/call
sub installer::windows::file::CORE:open; # opcode
# spent 19.5ms within installer::windows::file::CORE:pack which was called 15561 times, avg 1µs/call: # 15561 times (19.5ms+0s) by installer::windows::file::create_files_table at line 998, avg 1µs/call
sub installer::windows::file::CORE:pack; # opcode
# spent 4.81s within installer::windows::file::CORE:readline which was called 385 times, avg 12.5ms/call: # 385 times (4.81s+0s) by installer::windows::file::get_fileversion at line 561, avg 12.5ms/call
sub installer::windows::file::CORE:readline; # opcode
# spent 492µs within installer::windows::file::CORE:regcomp which was called 385 times, avg 1µs/call: # 385 times (492µs+0s) by installer::windows::file::get_fileversion at line 566, avg 1µs/call
sub installer::windows::file::CORE:regcomp; # opcode
# spent 24.4ms within installer::windows::file::CORE:sort which was called 851 times, avg 29µs/call: # 846 times (20.4ms+0s) by installer::windows::file::assign_sequencenumbers_to_files at line 164, avg 24µs/call # once (804µs+0s) by installer::windows::file::assign_cab_to_files at line 88 # once (799µs+0s) by installer::windows::file::assign_cab_to_files at line 79 # once (795µs+0s) by installer::windows::file::assign_sequencenumbers_to_files at line 160 # once (794µs+0s) by installer::windows::file::assign_cab_to_files at line 111 # once (791µs+0s) by installer::windows::file::assign_cab_to_files at line 101
sub installer::windows::file::CORE:sort; # opcode
# spent 2.24s within installer::windows::file::CORE:subst which was called 791014 times, avg 3µs/call: # 599004 times (1.76s+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 450, avg 3µs/call # 15888 times (24.0ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 417, avg 2µs/call # 15888 times (17.4ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 420, avg 1µs/call # 15888 times (14.0ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 421, avg 882ns/call # 15888 times (8.24ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 422, avg 518ns/call # 15888 times (8.06ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 418, avg 507ns/call # 15888 times (8.06ms+0s) by installer::windows::file::generate_unique_filename_for_filetable at line 419, avg 507ns/call # 15883 times (124ms+0s) by installer::windows::file::get_file_component_name at line 246, avg 8µs/call # 15883 times (82.5ms+0s) by installer::windows::file::get_file_component_name at line 244, avg 5µs/call # 15883 times (78.4ms+0s) by installer::windows::file::get_file_component_name at line 247, avg 5µs/call # 15883 times (69.8ms+0s) by installer::windows::file::get_file_component_name at line 263, avg 4µs/call # 15883 times (35.4ms+0s) by installer::windows::file::get_file_component_name at line 262, avg 2µs/call # 15883 times (11.8ms+0s) by installer::windows::file::get_file_component_name at line 245, avg 743ns/call # 688 times (2.91ms+0s) by installer::windows::file::create_files_table at line 930, avg 4µs/call # 688 times (1.62ms+0s) by installer::windows::file::create_files_table at line 931, avg 2µs/call # 8 times (43µs+0s) by installer::windows::file::generate_registry_keypath at line 692, avg 5µs/call
sub installer::windows::file::CORE:subst; # opcode
# spent 36.1ms within installer::windows::file::CORE:unpack which was called 15888 times, avg 2µs/call: # 15561 times (34.3ms+0s) by installer::windows::file::create_files_table at line 1001, avg 2µs/call # 327 times (1.84ms+0s) by installer::windows::file::get_fileversion at line 568, avg 6µs/call
sub installer::windows::file::CORE:unpack; # opcode