← 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:54 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
{
4912µs my ( $filesref ) = @_;
50
5112µs my $infoline = "";
52
53117.5ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
54 {
551588815.5ms if ( ! exists(${$filesref}[$i]->{'modules'}) ) { installer::exiter::exit_program("ERROR: No module assignment found for ${$filesref}[$i]->{'gid'} !", "assign_cab_to_files"); }
561588813.9ms my $module = ${$filesref}[$i]->{'modules'};
57 # If modules contains a list of modules, only taking the first one.
581588855.8ms1588810.2ms if ( $module =~ /^\s*(.*?)\,/ ) { $module = $1; }
# spent 10.2ms making 15888 calls to installer::windows::file::CORE:match, avg 641ns/call
59
601588812.3ms 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"); }
611588827.3ms ${$filesref}[$i]->{'assignedcabinetfile'} = $installer::globals::allcabinetassigns{$module};
62
63 # Counting the files in each cabinet file
641588822.2ms if ( ! exists($installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}) )
65 {
66 $installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}} = 1;
67 }
68 else
69 {
701504213.9ms $installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}++;
71 }
72 }
73
74 # logging the number of files in each cabinet file
75
7612µs $infoline = "\nCabinet file content:\n";
7713µs push(@installer::globals::logfileinfo, $infoline);
781500ns my $cabfile;
7911.19ms1799µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 799µs making 1 call to installer::windows::file::CORE:sort
80 {
818461.28ms $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile} files\n";
828461.17ms push(@installer::globals::logfileinfo, $infoline);
83 }
84
85 # assigning startsequencenumbers for each cab file
86
8712µs my $offset = 1;
8811.02ms1804µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 804µs making 1 call to installer::windows::file::CORE:sort
89 {
90846483µs my $filecount = $installer::globals::cabfilecounter{$cabfile};
91846427µs $installer::globals::cabfilecounter{$cabfile} = $offset;
92846308µs $offset = $offset + $filecount;
93
948461.01ms $installer::globals::lastsequence{$cabfile} = $offset - 1;
95 }
96
97 # logging the start sequence numbers
98
9911µs $infoline = "\nCabinet file start sequences:\n";
10011µs push(@installer::globals::logfileinfo, $infoline);
1011981µs1791µs foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
# spent 791µs making 1 call to installer::windows::file::CORE:sort
102 {
103846847µs $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile}\n";
1048461.10ms push(@installer::globals::logfileinfo, $infoline);
105 }
106
107 # logging the last sequence numbers
108
10911µs $infoline = "\nCabinet file last sequences:\n";
11011µs push(@installer::globals::logfileinfo, $infoline);
1111964µs1794µs foreach $cabfile ( sort keys %installer::globals::lastsequence )
# spent 794µs making 1 call to installer::windows::file::CORE:sort
112 {
1138461.23ms $infoline = "$cabfile : $installer::globals::lastsequence{$cabfile}\n";
1148461.10ms 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
{
12513µs my ( $filesref ) = @_;
126
12712µs my %directaccess = ();
12811µs my %allassigns = ();
129
130116.8ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
131 {
1321588810.0ms 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!)
1401588819.4ms if ( exists($directaccess{$onefile->{'destination'}}) ) { installer::exiter::exit_program("ERROR: 'destination' at file not unique: $onefile->{'destination'}", "assign_sequencenumbers_to_files"); }
1411588828.7ms $directaccess{$onefile->{'destination'}} = $i;
142
1431588811.2ms my $cabfilename = $onefile->{'assignedcabinetfile'};
144 # collecting files in cabinet files
1451588818.1ms if ( ! exists($allassigns{$cabfilename}) )
146 {
147846389µs my %onecabfile = ();
1488461.13ms $onecabfile{$onefile->{'destination'}} = 1;
1498461.10ms $allassigns{$cabfilename} = \%onecabfile;
150 }
151 else
152 {
1531504223.5ms $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!
1591500ns my $cabfile;
160112.5ms1795µs foreach $cabfile ( sort keys %allassigns )
# spent 795µs making 1 call to installer::windows::file::CORE:sort
161 {
162846883µs my $counter = $installer::globals::cabfilecounter{$cabfile};
163846280µs my $dest;
16484630.9ms84620.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 {
166158889.82ms my $directaccessnumber = $directaccess{$dest};
1671588828.2ms ${$filesref}[$directaccessnumber]->{'assignedsequencenumber'} = $counter;
1681588812.8ms $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
{
18625322.47ms my ($componentname) = @_;
187
18825321.61ms my $shortcomponentname = "";
18925321.18ms my $counter = 1;
190
19125323.61ms my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters
19225321.26ms $startversion = $startversion . "_";
193
19425322.04ms $shortcomponentname = $startversion . $counter;
195
19625324.31ms while ( exists($installer::globals::allshortcomponents{$shortcomponentname}) )
197 {
198335779117ms $counter++;
199335779515ms $shortcomponentname = $startversion . $counter;
200 }
201
20225325.56ms $installer::globals::allshortcomponents{$shortcomponentname} = 1;
203
204253214.4ms 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
{
2131588815.0ms my ($fileref, $filesref) = @_;
214
215158888.11ms my $componentname = "";
216
217 # Special handling for files with ASSIGNCOMPOMENT
218
219158887.14ms my $styles = "";
2201588813.2ms if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
2211588884.7ms1589359.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
2421588326.3ms my $destination = $fileref->{'destination'};
2431588345.4ms15883424ms installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
# spent 424ms making 15883 calls to installer::pathanalyzer::get_path_from_fullqualifiedname, avg 27µs/call
24415883140ms1588382.5ms $destination =~ s/\s//g;
# spent 82.5ms making 15883 calls to installer::windows::file::CORE:subst, avg 5µs/call
2451588359.6ms1588311.8ms $destination =~ s/\\/\_/g;
# spent 11.8ms making 15883 calls to installer::windows::file::CORE:subst, avg 743ns/call
24615883176ms15883124ms $destination =~ s/\//\_/g;
# spent 124ms making 15883 calls to installer::windows::file::CORE:subst, avg 8µs/call
24715883132ms1588378.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
2491588330.4ms $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
2541588314.6ms if ( $fileref->{'ismultilingual'} )
255 {
25670006.88ms my $officelanguage = $fileref->{'specificlanguage'};
25770006.90ms $componentname = $componentname . "_" . $officelanguage;
258 }
259
2601588313.7ms $componentname = lc($componentname); # componentnames always lowercase
261
2621588388.0ms1588335.4ms $componentname =~ s/\-/\_/g; # converting "-" to "_"
# spent 35.4ms making 15883 calls to installer::windows::file::CORE:subst, avg 2µs/call
26315883121ms1588369.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
2711588310.5ms my $fullname = $componentname; # This can be longer than 72
272
2731588328.2ms 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
2791588331.4ms if ( exists($installer::globals::allcomponents{$fullname}) )
280 {
281 $componentname = $installer::globals::allcomponents{$fullname};
282 }
283 else
284 {
285901514.7ms2532661ms 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
293901523.1ms $installer::globals::allcomponents{$fullname} = $componentname;
294901514.0ms $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
3491588877.5ms 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
{
35958µs my ($gid, $filesref) = @_;
360
361545.0ms my ($onefile) = grep {$_->{gid} eq $gid} @{$filesref};
36257µs 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
366511µs my $componentname = "";
367515µs 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
3705122µs 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
{
3821588820.1ms 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
389158888.22ms my $uniquefilename = "";
390158886.98ms my $counter = 0;
391
3921588820.6ms if ( $fileref->{'Name'} ) { $uniquefilename = $fileref->{'Name'}; }
393
3941588841.8ms15888174ms 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
3971588810.1ms 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
4171588876.1ms1588824.0ms $uniquefilename =~ s/\-/\_/g; # no "-" allowed
# spent 24.0ms making 15888 calls to installer::windows::file::CORE:subst, avg 2µs/call
4181588856.3ms158888.06ms $uniquefilename =~ s/\@/\_/g; # no "@" allowed
# spent 8.06ms making 15888 calls to installer::windows::file::CORE:subst, avg 507ns/call
4191588855.0ms158888.06ms $uniquefilename =~ s/\$/\_/g; # no "$" allowed
# spent 8.06ms making 15888 calls to installer::windows::file::CORE:subst, avg 507ns/call
4201588867.2ms1588817.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
4211588863.7ms1588814.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
4221588854.9ms158888.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
4241588813.3ms my $lcuniquefilename = lc($uniquefilename); # only lowercase names
425
426158887.43ms my $newname = 0;
427
4281588824.8ms if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
429 ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
430 {
4311005918.0ms $installer::globals::alluniquefilenames{$uniquefilename} = 1;
432100599.52ms $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
433100595.39ms $newname = 1;
434 }
435
436158888.88ms 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
44158293.29ms my $uniquefilenamebase = $uniquefilename;
442
443 do
4445829594ms {
445653296251ms $counter++;
446
4476532963.41s6532961.07s if ( $uniquefilenamebase =~ /\./ )
# spent 1.07s making 653296 calls to installer::windows::file::CORE:match, avg 2µs/call
448 {
449599004275ms $uniquefilename = $uniquefilenamebase;
4505990043.92s5990041.76s $uniquefilename =~ s/\./$counter\./;
# spent 1.76s making 599004 calls to installer::windows::file::CORE:subst, avg 3µs/call
451 }
452 else
453 {
4545429233.8ms $uniquefilename = $uniquefilenamebase . $counter;
455 }
456
457653296278ms $newname = 0;
458653296393ms $lcuniquefilename = lc($uniquefilename); # only lowercase names
459
460653296633ms if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
461 ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
462 {
463582911.7ms $installer::globals::alluniquefilenames{$uniquefilename} = 1;
46458295.97ms $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
46558292.70ms $newname = 1;
466 }
467 }
468 until ( $newname )
469 }
470
4711588884.5ms 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
{
4821588816.6ms my ($fileref, $shortnamesref, $uniquefilenamehashref) = @_;
483
484158888.57ms my $returnstring = "";
485
4861588812.0ms my $filename = $fileref->{'Name'};
487
4881588838.8ms15888162ms 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
490158886.75ms my $shortstring;
491
492 # Reading short string with help of "FileName" in File table from old database
4931588818.4ms 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 {
5131588854.2ms158887.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
5162322421.2ms if ( $shortstring eq $filename ) { $returnstring = $filename; } # nothing changed
517 else {$returnstring = $shortstring . "\|" . $filename; }
518
5191588871.2ms 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
{
5281588813.6ms my ($fileref) = @_;
529
5301588816.7ms my $file = $fileref->{'sourcepath'};
531
532158885.89ms my $filesize;
533
534158884.44s317764.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
5431588882.0ms 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
{
5531588823.1ms my ($onefile, $allvariables, $styles) = @_;
554
555158889.07ms my $fileversion = "";
556
55715888114ms1588848.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 {
55938584.3ms38581.4ms open (EXE, "<$onefile->{'sourcepath'}");
# spent 81.4ms making 385 calls to installer::windows::file::CORE:open, avg 212µs/call
5603852.47ms385919µs binmode EXE;
# spent 919µs making 385 calls to installer::windows::file::CORE:binmode, avg 2µs/call
56111554.82s3854.81s {local $/ = undef; $exedata = <EXE>;}
# spent 4.81s making 385 calls to installer::windows::file::CORE:readline, avg 12.5ms/call
56238515.8ms38513.7ms close EXE;
# spent 13.7ms making 385 calls to installer::windows::file::CORE:close, avg 36µs/call
563
564385497µs 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
566385311ms770306ms 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 {
5683274.46ms3271.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
5693271.36ms $fileversion = $version . "." . $subversion . "." . $microversion . "." . $vervariant;
570 }
571 }
572
5731588874.0ms 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
{
5821588822.8ms my ($number, $onefile, $fileentry, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, $allfilecomponents) = @_;
583
584158887.96ms my $sequence = "";
585158887.09ms my $infoline = "";
5861588818.5ms my $pffcomponentname = $onefile->{'componentname'} . "_pff";
587
5881588814.0ms 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 {
639158887.97ms $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
6521588873.8ms 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
{
6611588814.2ms my ($fileref) = @_;
662
663158888.77ms my $language = "";
664
6651588813.5ms if ( $fileref->{'specificlanguage'} ) { $language = $fileref->{'specificlanguage'}; }
666
6671588818.1ms if ( $language eq "" )
668 {
66988883.98ms $language = 0; # language independent
670 # If this is not a font, the return value should be "0" (Check ICE 60)
67188884.92ms my $styles = "";
67288888.22ms if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
673888841.8ms88888.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 {
677700020.9ms700041.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
6801588865.9ms 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
{
68987µs my ($onefile) = @_;
690
69187µs my $keypath = $onefile->{'Name'};
692878µs843µs $keypath =~ s/\.//g;
# spent 43µs making 8 calls to installer::windows::file::CORE:subst, avg 5µs/call
69388µs $keypath = lc($keypath);
694817µs $keypath = "userreg_" . $keypath;
695
696845µs 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
{
7901588817.5ms my ($onefile, $componentname) = @_;
791
7921588883.1ms if ( $onefile->{'destination'} )
793 {
7941588811.5ms 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
8001588847.3ms 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
{
84818µs my ($filesref, $dirref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_;
849
85017µs1219µ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
8581500ns my $infoline;
859
86011µs my @allfiles = ();
8611500ns my @filetable = ();
8621500ns my @filehashtable = ();
86312µs my %allfilecomponents = ();
8641500ns my $counter = 0;
865
866123µs23.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, ...
87012µs my %shortnames = ();
871
8721500ns if ( $installer::globals::updatedatabase ) { collect_shortnames_from_old_database($uniquefilenamehashref, \%shortnames); }
873
87417µs128µs installer::windows::idtglobal::write_idt_header(\@filetable, "file");
# spent 28µs making 1 call to installer::windows::idtglobal::write_idt_header
87513µs117µs installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash");
# spent 17µs making 1 call to installer::windows::idtglobal::write_idt_header
87613µs116µ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
878128.3ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
879 {
8801588813.3ms my %file = ();
881
8821588814.5ms my $onefile = ${$filesref}[$i];
883
884158888.08ms my $styles = "";
8851588821.2ms if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
886
8871588858.3ms158882.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
8881588859.1ms1588810.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
8901588822.3ms $onefile->{'uniquename'} = $file{'File'};
8911588820.7ms $onefile->{'componentname'} = $file{'Component_'};
892
893 # Collecting all components
894
8951588827.8ms if ( ! exists($allfilecomponents{$file{'Component_'}}) ) { $allfilecomponents{$file{'Component_'}} = 1; }
896
8971588857.4ms158888.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
8991588858.4ms158884.52s $file{'FileSize'} = get_filesize($onefile);
# spent 4.52s making 15888 calls to installer::windows::file::get_filesize, avg 285µs/call
900
9011588863.7ms158885.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
9031588853.2ms15888233ms $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
9051588867.1ms1588810.5ms if ( $styles =~ /\bDONT_PACK\b/ ) { $file{'Attributes'} = "8192"; }
# spent 10.5ms making 15888 calls to installer::windows::file::CORE:match, avg 662ns/call
9061588823.0ms else { $file{'Attributes'} = "16384"; }
907
908 # $file{'Attributes'} = "16384"; # Sourcefile is packed
909 # $file{'Attributes'} = "8192"; # Sourcefile is unpacked
910
911158888.32ms $installer::globals::insert_file_at_end = 0;
912158887.57ms $counter++;
9131588868.7ms15888121ms $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
9151588815.8ms $onefile->{'sequencenumber'} = $file{'Sequence'};
916
9171588878.7ms 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
9211588820.0ms push(@filetable, $oneline);
922
9231588870.6ms1588815.9ms if ( $file{'File'} =~ /\.py$/ )
# spent 15.9ms making 15888 calls to installer::windows::file::CORE:match, avg 1000ns/call
924 {
925688818µs my %removefile = ();
926
9276881.60ms $removefile{'FileKey'} = "remove_" . $file{'File'} . "c";
928688854µs $removefile{'Component_'} = $file{'Component_'};
929688835µs $removefile{'FileName'} = $file{'FileName'};
9306886.12ms6882.91ms $removefile{'FileName'} =~ s/\.py$/.pyc/;
# spent 2.91ms making 688 calls to installer::windows::file::CORE:subst, avg 4µs/call
9316884.52ms6881.62ms $removefile{'FileName'} =~ s/\.PY\|/.PYC|/;
# spent 1.62ms making 688 calls to installer::windows::file::CORE:subst, avg 2µs/call
9326884.82ms68817.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
933688895µs $removefile{'InstallMode'} = 2; # msiInstallStateAbsent
9346884.68ms $oneline = $removefile{'FileKey'} . "\t" . $removefile{'Component_'} . "\t" . $removefile{'FileName'} . "\t"
935 . $removefile{'DirProperty'} . "\t" . $removefile{'InstallMode'} . "\n";
936
9376884.93ms push(@installer::globals::removefiletable, $oneline);
938 }
939
9401588813.8ms if ( ! $installer::globals::insert_file_at_end ) { push(@allfiles, $onefile); }
941
942 # Collecting all component conditions
9431588811.7ms 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
9521588852.7ms15888125ms 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
9561588859.2ms158889.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)
9621588810.4ms 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
9911588817.2ms unless ( $file{'Version'} )
992 {
9931556112.9ms my $path = $onefile->{'sourcepath'};
99415561112ms1556149.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.18s155614.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
9971556186.6ms1556131.1ms binmode(FILE);
# spent 31.1ms making 15561 calls to installer::windows::file::CORE:binmode, avg 2µs/call
9981556176.9ms1556119.5ms my $hashinfo = pack("l", 20);
# spent 19.5ms making 15561 calls to installer::windows::file::CORE:pack, avg 1µs/call
9991556111.4s4668311.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
100115561112ms3112272.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
10021556197.7ms $oneline = $file{'File'} . "\t" .
1003 "0" . "\t" .
1004 $i[0] . "\t" .
1005 $i[1] . "\t" .
1006 $i[2] . "\t" .
1007 $i[3] . "\n";
10081556157.4ms 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"
10131588838.4ms $installer::globals::uniquefilenamesequence{$onefile->{'uniquename'}} = $onefile->{'sequencenumber'};
1014
1015158889.23ms my $destdir = "";
10161588816.0ms if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; }
1017
10181588881.8ms if ( $onefile->{'needs_user_registry_key'} )
1019 {
1020830µs8146µs my $keypath = generate_registry_keypath($onefile);
# spent 146µs making 8 calls to installer::windows::file::generate_registry_keypath, avg 18µs/call
1021813µs $onefile->{'userregkeypath'} = $keypath;
102288µs push(@installer::globals::userregistrycollector, $onefile);
102387µs $installer::globals::addeduserregitrykeys = 1;
1024 }
1025 }
1026
1027 # putting content from %allfilecomponents to $allfilecomponentsref for later usage
1028901614.4ms foreach $localkey (keys %allfilecomponents ) { push( @{$allfilecomponentsref}, $localkey); }
1029
103015µs my $filetablename = $basedir . $installer::globals::separator . "File.idt";
1031112µs19.63ms installer::files::save_file($filetablename ,\@filetable);
# spent 9.63ms making 1 call to installer::files::save_file
103216µs $infoline = "\nCreated idt file: $filetablename\n";
103314µs push(@installer::globals::logfileinfo, $infoline);
1034
1035110µs1213µ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
103714µs my $filehashtablename = $basedir . $installer::globals::separator . "MsiFileHash.idt";
103815µs17.12ms installer::files::save_file($filehashtablename ,\@filehashtable);
# spent 7.12ms making 1 call to installer::files::save_file
103918µs $infoline = "\nCreated idt file: $filehashtablename\n";
104014µs push(@installer::globals::logfileinfo, $infoline);
1041
1042 # Now the new files can be added to the files collector (only in update packaging processes)
10431500ns if ( $installer::globals::newfilesexist )
1044 {
1045 foreach my $seq (sort keys %installer::globals::newfilescollector) { push(@allfiles, $installer::globals::newfilescollector{$seq}) }
1046 }
1047
1048126.0ms 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