Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/setupscript.pm |
Statements | Executed 4713297 statements in 17.2s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
13 | 13 | 1 | 13.4s | 17.8s | get_all_items_from_script | installer::setupscript::
1956153 | 22 | 1 | 1.45s | 1.45s | CORE:match (opcode) | installer::setupscript::
1557859 | 3 | 1 | 1.24s | 1.24s | CORE:regcomp (opcode) | installer::setupscript::
1 | 1 | 1 | 707ms | 1.03s | replace_all_setupscriptvariables_in_script | installer::setupscript::
233446 | 13 | 1 | 581ms | 581ms | CORE:subst (opcode) | installer::setupscript::
1 | 1 | 1 | 393µs | 550µs | resolve_lowercase_productname_setupscriptvariable | installer::setupscript::
1 | 1 | 1 | 348µs | 456µs | BEGIN@30 | installer::setupscript::
1 | 1 | 1 | 298µs | 442µs | add_lowercase_productname_setupscriptvariable | installer::setupscript::
1 | 1 | 1 | 296µs | 402µs | add_installationobject_to_variables | installer::setupscript::
1 | 1 | 1 | 222µs | 304µs | get_all_scriptvariables_from_installation_object | installer::setupscript::
1 | 1 | 1 | 150µs | 1.92ms | prepare_non_advertised_files | installer::setupscript::
1 | 1 | 1 | 77µs | 91µs | add_predefined_folder | installer::setupscript::
1 | 1 | 1 | 36µs | 36µs | CORE:sort (opcode) | installer::setupscript::
1 | 1 | 1 | 36µs | 153µs | set_setupscript_name | installer::setupscript::
1 | 1 | 1 | 24µs | 24µs | add_forced_properties | installer::setupscript::
1 | 1 | 1 | 20µs | 20µs | replace_preset_properties | installer::setupscript::
1 | 1 | 1 | 16µs | 19µs | BEGIN@36 | installer::setupscript::
1 | 1 | 1 | 15µs | 18µs | BEGIN@37 | installer::setupscript::
1 | 1 | 1 | 15µs | 17µs | BEGIN@32 | installer::setupscript::
1 | 1 | 1 | 14µs | 16µs | BEGIN@35 | installer::setupscript::
1 | 1 | 1 | 13µs | 16µs | BEGIN@33 | installer::setupscript::
1 | 1 | 1 | 13µs | 118µs | BEGIN@34 | installer::setupscript::
2 | 1 | 1 | 3µs | 3µs | CORE:substcont (opcode) | installer::setupscript::
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 | |||||
28 | package installer::setupscript; | ||||
29 | |||||
30 | 2 | 69µs | 2 | 564µs | # spent 456µs (348+108) within installer::setupscript::BEGIN@30 which was called:
# once (348µs+108µs) by installer::scppatchsoname::BEGIN@33 at line 30 # spent 456µs making 1 call to installer::setupscript::BEGIN@30
# spent 108µs making 1 call to base::import |
31 | |||||
32 | 2 | 54µs | 2 | 20µs | # spent 17µs (15+3) within installer::setupscript::BEGIN@32 which was called:
# once (15µs+3µs) by installer::scppatchsoname::BEGIN@33 at line 32 # spent 17µs making 1 call to installer::setupscript::BEGIN@32
# spent 2µs making 1 call to UNIVERSAL::import |
33 | 2 | 64µs | 2 | 18µs | # spent 16µs (13+3) within installer::setupscript::BEGIN@33 which was called:
# once (13µs+3µs) by installer::scppatchsoname::BEGIN@33 at line 33 # spent 16µs making 1 call to installer::setupscript::BEGIN@33
# spent 3µs making 1 call to UNIVERSAL::import |
34 | 2 | 58µs | 2 | 223µs | # spent 118µs (13+105) within installer::setupscript::BEGIN@34 which was called:
# once (13µs+105µs) by installer::scppatchsoname::BEGIN@33 at line 34 # spent 118µs making 1 call to installer::setupscript::BEGIN@34
# spent 105µs making 1 call to Exporter::import |
35 | 2 | 55µs | 2 | 18µs | # spent 16µs (14+2) within installer::setupscript::BEGIN@35 which was called:
# once (14µs+2µs) by installer::scppatchsoname::BEGIN@33 at line 35 # spent 16µs making 1 call to installer::setupscript::BEGIN@35
# spent 2µs making 1 call to UNIVERSAL::import |
36 | 2 | 54µs | 2 | 22µs | # spent 19µs (16+3) within installer::setupscript::BEGIN@36 which was called:
# once (16µs+3µs) by installer::scppatchsoname::BEGIN@33 at line 36 # spent 19µs making 1 call to installer::setupscript::BEGIN@36
# spent 3µs making 1 call to UNIVERSAL::import |
37 | 2 | 4.34ms | 2 | 21µs | # spent 18µs (15+3) within installer::setupscript::BEGIN@37 which was called:
# once (15µs+3µs) by installer::scppatchsoname::BEGIN@33 at line 37 # spent 18µs making 1 call to installer::setupscript::BEGIN@37
# spent 3µs making 1 call to UNIVERSAL::import |
38 | |||||
39 | 1 | 8µs | our @EXPORT_OK = qw( | ||
40 | add_forced_properties | ||||
41 | add_installationobject_to_variables | ||||
42 | add_lowercase_productname_setupscriptvariable | ||||
43 | add_predefined_folder | ||||
44 | get_all_items_from_script | ||||
45 | get_all_scriptvariables_from_installation_object | ||||
46 | prepare_non_advertised_files | ||||
47 | replace_all_setupscriptvariables_in_script | ||||
48 | replace_preset_properties | ||||
49 | resolve_lowercase_productname_setupscriptvariable | ||||
50 | set_setupscript_name | ||||
51 | ); | ||||
52 | |||||
53 | ####################################################### | ||||
54 | # Set setup script name, if not defined as parameter | ||||
55 | ####################################################### | ||||
56 | |||||
57 | sub set_setupscript_name | ||||
58 | # spent 153µs (36+117) within installer::setupscript::set_setupscript_name which was called:
# once (36µs+117µs) by installer::run at line 315 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
59 | 1 | 2µs | my ( $allsettingsarrayref, $includepatharrayref ) = @_; | ||
60 | |||||
61 | 1 | 5µs | 1 | 90µs | my $scriptnameref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "script"); # spent 90µs making 1 call to installer::ziplist::getinfofromziplist |
62 | |||||
63 | 1 | 1µs | my $scriptname = $$scriptnameref; | ||
64 | |||||
65 | 1 | 1µs | if ( $scriptname eq "" ) # not defined on command line and not in product list | ||
66 | { | ||||
67 | installer::exiter::exit_program("ERROR: Setup script not defined on command line (-l) and not in product list!", "set_setupscript_name"); | ||||
68 | } | ||||
69 | |||||
70 | 1 | 13µs | 1 | 3µs | if ( $installer::globals::compiler =~ /wnt/ ) # spent 3µs making 1 call to installer::setupscript::CORE:match |
71 | { | ||||
72 | $scriptname .= ".inf"; | ||||
73 | } | ||||
74 | else | ||||
75 | { | ||||
76 | $scriptname .= ".ins"; | ||||
77 | } | ||||
78 | |||||
79 | # and now the complete path for the setup script is needed | ||||
80 | # The log file cannot be used, because this is the language independent section | ||||
81 | |||||
82 | 1 | 4µs | 1 | 24µs | $scriptnameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptname, $includepatharrayref, 1); # spent 24µs making 1 call to installer::scriptitems::get_sourcepath_from_filename_and_includepath |
83 | |||||
84 | 1 | 2µs | $installer::globals::setupscriptname = $$scriptnameref; | ||
85 | |||||
86 | 1 | 7µs | if ( $installer::globals::setupscriptname eq "" ) | ||
87 | { | ||||
88 | installer::exiter::exit_program("ERROR: Script $scriptname not found!", "set_setupscript_name"); | ||||
89 | } | ||||
90 | } | ||||
91 | |||||
92 | ##################################################################### | ||||
93 | # Reading script variables from installation object of script file | ||||
94 | ##################################################################### | ||||
95 | |||||
96 | sub get_all_scriptvariables_from_installation_object | ||||
97 | # spent 304µs (222+82) within installer::setupscript::get_all_scriptvariables_from_installation_object which was called:
# once (222µs+82µs) by installer::run at line 330 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
98 | 1 | 3µs | my ($scriptref) = @_; | ||
99 | |||||
100 | 1 | 1µs | my @installobjectvariables; | ||
101 | |||||
102 | 1 | 4µs | for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) | ||
103 | { | ||||
104 | 1 | 2µs | my $line = ${$scriptref}[$i]; | ||
105 | |||||
106 | 1 | 18µs | 1 | 9µs | if ( $line =~ /^\s*Installation\s+\w+\s*$/ ) # should be the first line # spent 9µs making 1 call to installer::setupscript::CORE:match |
107 | { | ||||
108 | 1 | 2µs | my $counter = $i+1; | ||
109 | 1 | 2µs | my $installline = ${$scriptref}[$counter]; | ||
110 | |||||
111 | 1 | 7µs | 1 | 1µs | while (!($installline =~ /^\s*End\s*$/ )) # spent 1µs making 1 call to installer::setupscript::CORE:match |
112 | { | ||||
113 | 10 | 83µs | 10 | 44µs | if ( $installline =~ /^\s*(\w+)\s+\=\s*(.*?)\s*\;\s*$/ ) # spent 44µs making 10 calls to installer::setupscript::CORE:match, avg 4µs/call |
114 | { | ||||
115 | 10 | 11µs | my $key = $1; | ||
116 | 10 | 7µs | my $value = $2; | ||
117 | |||||
118 | # removing leading and ending " in $value | ||||
119 | |||||
120 | 10 | 59µs | 10 | 20µs | if ( $value =~ /^\s*\"(.*)\"\s*$/ ) # spent 20µs making 10 calls to installer::setupscript::CORE:match, avg 2µs/call |
121 | { | ||||
122 | $value = $1; | ||||
123 | } | ||||
124 | |||||
125 | 10 | 10µs | $key = "\%" . uc($key); # $key is %PRODUCTNAME | ||
126 | |||||
127 | 10 | 11µs | my $input = $key . " " . $value . "\n"; # $key can only be the first word | ||
128 | |||||
129 | 10 | 15µs | push(@installobjectvariables ,$input); | ||
130 | } | ||||
131 | |||||
132 | 10 | 5µs | $counter++; | ||
133 | 10 | 53µs | 10 | 8µs | $installline = ${$scriptref}[$counter]; # spent 8µs making 10 calls to installer::setupscript::CORE:match, avg 780ns/call |
134 | } | ||||
135 | } | ||||
136 | |||||
137 | 1 | 2µs | last; # not interesting after installation object | ||
138 | } | ||||
139 | |||||
140 | 1 | 9µs | return \@installobjectvariables; | ||
141 | } | ||||
142 | |||||
143 | ###################################################################### | ||||
144 | # Including LCPRODUCTNAME into the array | ||||
145 | ###################################################################### | ||||
146 | |||||
147 | sub add_lowercase_productname_setupscriptvariable | ||||
148 | # spent 442µs (298+144) within installer::setupscript::add_lowercase_productname_setupscriptvariable which was called:
# once (298µs+144µs) by installer::run at line 332 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
149 | 1 | 2µs | my ( $variablesref ) = @_; | ||
150 | |||||
151 | 1 | 37µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
152 | { | ||||
153 | 22 | 15µs | my $variableline = ${$variablesref}[$j]; | ||
154 | |||||
155 | 22 | 10µs | my ($key, $value); | ||
156 | |||||
157 | 22 | 202µs | 22 | 109µs | if ( $variableline =~ /^\s*\%(\w+?)\s+(.*?)\s*$/ ) # spent 109µs making 22 calls to installer::setupscript::CORE:match, avg 5µs/call |
158 | { | ||||
159 | 22 | 21µs | $key = $1; | ||
160 | 22 | 13µs | $value = $2; | ||
161 | |||||
162 | 22 | 17µs | if ( $key eq "PRODUCTNAME" ) | ||
163 | { | ||||
164 | 1 | 4µs | my $newline = "\%LCPRODUCTNAME " . lc($value) . "\n"; | ||
165 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
166 | 1 | 1µs | my $original = $value; | ||
167 | 1 | 27µs | 1 | 17µs | $value =~ s/\s*//g; # spent 17µs making 1 call to installer::setupscript::CORE:subst |
168 | 1 | 3µs | $newline = "\%ONEWORDPRODUCTNAME " . $value . "\n"; | ||
169 | 1 | 2µs | push(@{$variablesref} ,$newline); | ||
170 | 1 | 3µs | $newline = "\%LCONEWORDPRODUCTNAME " . lc($value) . "\n"; | ||
171 | 1 | 2µs | push(@{$variablesref} ,$newline); | ||
172 | 1 | 600ns | $value = $original; | ||
173 | 1 | 12µs | 1 | 7µs | $value =~ s/\s*$//g; # spent 7µs making 1 call to installer::setupscript::CORE:subst |
174 | 1 | 9µs | 1 | 4µs | $value =~ s/^\s*//g; # spent 4µs making 1 call to installer::setupscript::CORE:subst |
175 | 1 | 6µs | 1 | 1µs | $value =~ s/ /\%20/g; # spent 1µs making 1 call to installer::setupscript::CORE:subst |
176 | 1 | 2µs | $newline = "\%MASKEDPRODUCTNAME " . $value . "\n"; | ||
177 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
178 | 1 | 500ns | $value = $original; | ||
179 | 1 | 6µs | 1 | 2µs | $value =~ s/\s/\_/g; # spent 2µs making 1 call to installer::setupscript::CORE:subst |
180 | 1 | 2µs | $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; | ||
181 | 1 | 2µs | push(@{$variablesref} ,$newline); | ||
182 | 1 | 2µs | $newline = "\%SYSTEMINTUNIXPACKAGENAME " . lc($value) . "\n"; | ||
183 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
184 | 1 | 2µs | $newline = "\%UNIXPACKAGENAME " . lc($value) . "\n"; | ||
185 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
186 | 1 | 500ns | $value = $original; | ||
187 | 1 | 5µs | 1 | 500ns | $value =~ s/\s/\_/g; # spent 500ns making 1 call to installer::setupscript::CORE:subst |
188 | 1 | 6µs | 1 | 1µs | $value =~ s/\.//g; # spent 1µs making 1 call to installer::setupscript::CORE:subst |
189 | 1 | 3µs | $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; | ||
190 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
191 | 1 | 2µs | $newline = "\%WITHOUTDOTUNIXPACKAGENAME " . lc($value) . "\n"; | ||
192 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
193 | 1 | 2µs | $newline = "\%SOLARISBRANDPACKAGENAME " . lc($value) . "\n"; | ||
194 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
195 | 1 | 1µs | $value = $original; | ||
196 | } | ||||
197 | elsif ( $key eq "PRODUCTEXTENSION" ) | ||||
198 | { | ||||
199 | 1 | 4µs | my $newline = "\%LCPRODUCTEXTENSION " . lc($value) . "\n"; | ||
200 | 1 | 2µs | push(@{$variablesref} ,$newline); | ||
201 | } | ||||
202 | elsif ( $key eq "PRODUCTVERSION" ) | ||||
203 | { | ||||
204 | 1 | 10µs | 1 | 4µs | $value =~ s/\.//g; # spent 4µs making 1 call to installer::setupscript::CORE:subst |
205 | 1 | 2µs | my $newline = "\%WITHOUTDOTPRODUCTVERSION " . $value . "\n"; | ||
206 | 1 | 1µs | push(@{$variablesref} ,$newline); | ||
207 | } | ||||
208 | } | ||||
209 | } | ||||
210 | } | ||||
211 | |||||
212 | ###################################################################### | ||||
213 | # Resolving the new introduced lowercase script variables | ||||
214 | ###################################################################### | ||||
215 | |||||
216 | sub resolve_lowercase_productname_setupscriptvariable | ||||
217 | # spent 550µs (393+157) within installer::setupscript::resolve_lowercase_productname_setupscriptvariable which was called:
# once (393µs+157µs) by installer::run at line 334 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
218 | 1 | 1µs | my ( $variablesref ) = @_; | ||
219 | |||||
220 | 1 | 2µs | my %variables = (); | ||
221 | |||||
222 | # First step: Collecting variables | ||||
223 | |||||
224 | 1 | 31µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
225 | { | ||||
226 | 22 | 16µs | my $variableline = ${$variablesref}[$j]; | ||
227 | |||||
228 | 22 | 10µs | my ($key, $value); | ||
229 | |||||
230 | 22 | 204µs | 22 | 110µs | if ( $variableline =~ /^\s*\%(\w+?)\s+(.*?)\s*$/ ) # spent 110µs making 22 calls to installer::setupscript::CORE:match, avg 5µs/call |
231 | { | ||||
232 | 22 | 30µs | $key = $1; | ||
233 | 22 | 15µs | $value = $2; | ||
234 | 22 | 43µs | $variables{$key} = $value; | ||
235 | } | ||||
236 | } | ||||
237 | |||||
238 | # Second step: Resolving variables | ||||
239 | |||||
240 | 1 | 48µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
241 | { | ||||
242 | 22 | 94µs | 22 | 15µs | if ( ${$variablesref}[$j] =~ /\$\{(.*?)\}/ ) # spent 15µs making 22 calls to installer::setupscript::CORE:match, avg 668ns/call |
243 | { | ||||
244 | 1 | 2µs | my $key = $1; | ||
245 | 1 | 58µs | 4 | 32µs | ${$variablesref}[$j] =~ s/\$\{\Q$key\E\}/$variables{$key}/g; # spent 26µs making 1 call to installer::setupscript::CORE:regcomp
# spent 3µs making 2 calls to installer::setupscript::CORE:substcont, avg 2µs/call
# spent 3µs making 1 call to installer::setupscript::CORE:subst |
246 | } | ||||
247 | } | ||||
248 | |||||
249 | } | ||||
250 | |||||
251 | ###################################################################### | ||||
252 | # Replacing all setup script variables inside the setup script file | ||||
253 | ###################################################################### | ||||
254 | |||||
255 | sub replace_all_setupscriptvariables_in_script | ||||
256 | # spent 1.03s (707ms+322ms) within installer::setupscript::replace_all_setupscriptvariables_in_script which was called:
# once (707ms+322ms) by installer::run at line 336 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
257 | 1 | 2µs | my ( $scriptref, $variablesref ) = @_; | ||
258 | |||||
259 | 1 | 5µs | 1 | 80µs | globallog("Replacing variables in setup script (start)"); # spent 80µs making 1 call to installer::logger::globallog |
260 | |||||
261 | # make hash of variables to be substituted if they appear in the script | ||||
262 | 1 | 600ns | my %subs; | ||
263 | 1 | 34µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
264 | { | ||||
265 | 22 | 16µs | my $variableline = ${$variablesref}[$j]; | ||
266 | |||||
267 | 22 | 260µs | 22 | 111µs | if ( $variableline =~ /^\s*(\%\w+?)\s+(.*?)\s*$/ ) # spent 111µs making 22 calls to installer::setupscript::CORE:match, avg 5µs/call |
268 | { | ||||
269 | $subs{$1}= $2; | ||||
270 | } | ||||
271 | } | ||||
272 | |||||
273 | # This is far faster than running a regexp for each line | ||||
274 | 1 | 1µs | my $bigstring = ''; | ||
275 | 129145 | 139ms | for my $line (@{$scriptref}) { $bigstring = $bigstring . $line; } | ||
276 | |||||
277 | 1 | 83µs | 1 | 36µs | foreach my $key (sort { length ($b) <=> length ($a) } keys %subs) # spent 36µs making 1 call to installer::setupscript::CORE:sort |
278 | { | ||||
279 | # Attention: It must be possible to substitute "%PRODUCTNAMEn", "%PRODUCTNAME%PRODUCTVERSIONabc" | ||||
280 | 22 | 100µs | my $value = $subs{$key}; | ||
281 | 22 | 253ms | 44 | 252ms | $bigstring =~ s/$key/$value/g; # spent 241ms making 22 calls to installer::setupscript::CORE:subst, avg 11.0ms/call
# spent 10.9ms making 22 calls to installer::setupscript::CORE:regcomp, avg 495µs/call |
282 | } | ||||
283 | |||||
284 | 1 | 100ms | my @newlines = split /\n/, $bigstring; | ||
285 | 1 | 5µs | $scriptref = \@newlines; | ||
286 | |||||
287 | # now check for any mis-named '%' variables that we have left | ||||
288 | 1 | 2µs | my $num = 0; | ||
289 | 1 | 91µs | for my $check (@newlines) | ||
290 | { | ||||
291 | 129143 | 44.0ms | $num++; | ||
292 | 129143 | 490ms | 129143 | 68.9ms | if ( $check =~ /^.*\%\w+.*$/ ) # spent 68.9ms making 129143 calls to installer::setupscript::CORE:match, avg 534ns/call |
293 | { | ||||
294 | 459 | 1.88ms | 452 | 475µs | if (( $check =~ /%1/ ) || ( $check =~ /%2/ ) || ( $check =~ /%verify/ )) { next; } # spent 475µs making 452 calls to installer::setupscript::CORE:match, avg 1µs/call |
295 | 89 | 134µs | my $infoline = "WARNING: mis-named or un-known '%' variable in setup script at line $num:\n$check\n"; | ||
296 | 89 | 146µs | push( @installer::globals::globallogfileinfo, $infoline); | ||
297 | } | ||||
298 | } | ||||
299 | |||||
300 | 1 | 8µs | 1 | 92µs | globallog("Replacing variables in setup script (end)"); # spent 92µs making 1 call to installer::logger::globallog |
301 | |||||
302 | 1 | 35µs | return $scriptref; | ||
303 | } | ||||
304 | |||||
305 | ####################################################################### | ||||
306 | # Collecting all items of the type "searchitem" from the setup script | ||||
307 | ####################################################################### | ||||
308 | |||||
309 | sub get_all_items_from_script | ||||
310 | # spent 17.8s (13.4+4.37) within installer::setupscript::get_all_items_from_script which was called 13 times, avg 1.37s/call:
# once (2.18s+1.63s) by installer::run at line 466 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (1.26s+578ms) by installer::run at line 447 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (1.06s+361ms) by installer::run at line 372 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (929ms+209ms) by installer::run at line 359 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (901ms+191ms) by installer::run at line 439 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (896ms+179ms) by installer::run at line 453 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (889ms+180ms) by installer::run at line 423 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (890ms+173ms) by installer::run at line 415 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (883ms+177ms) by installer::run at line 419 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (885ms+173ms) by installer::run at line 435 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (881ms+171ms) by installer::run at line 411 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (877ms+173ms) by installer::run at line 400 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (873ms+173ms) by installer::run at line 457 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
311 | 13 | 29µs | my ($scriptref, $searchitem) = @_; | ||
312 | |||||
313 | 13 | 12µs | my @allitemarray = (); | ||
314 | |||||
315 | 13 | 10µs | my ($itemkey, $itemvalue); | ||
316 | |||||
317 | 13 | 1.03s | for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) | ||
318 | { | ||||
319 | 1557836 | 1.00s | my $line = ${$scriptref}[$i]; | ||
320 | |||||
321 | 1557836 | 10.7s | 3115672 | 2.10s | next unless ($line =~ /^\s*\Q$searchitem\E\s+(\S+)\s*$/); # spent 1.23s making 1557836 calls to installer::setupscript::CORE:regcomp, avg 788ns/call
# spent 868ms making 1557836 calls to installer::setupscript::CORE:match, avg 557ns/call |
322 | 4054 | 4.78ms | my $gid = $1; | ||
323 | |||||
324 | 4054 | 2.91ms | my %oneitemhash = (); | ||
325 | 4054 | 1.96ms | my $ismultilang = 0; | ||
326 | |||||
327 | 4054 | 6.78ms | $oneitemhash{'gid'} = $gid; | ||
328 | |||||
329 | 4054 | 26.7ms | 4054 | 3.18ms | while (!( $line =~ /^\s*End\s*$/ )) # spent 3.18ms making 4054 calls to installer::setupscript::CORE:match, avg 785ns/call |
330 | { | ||||
331 | 120773 | 90.5ms | if ( $i >= $#{$scriptref} ) { | ||
332 | installer::exiter::exit_program("Invalid setup script file. End of file reached before 'End' line of '$searchitem' section.", "get_all_items_from_script"); | ||||
333 | } | ||||
334 | 120773 | 89.9ms | $line = ${$scriptref}[++$i]; | ||
335 | |||||
336 | 120773 | 1.32s | 243170 | 495ms | if ( $line =~ /^\s*(.+?)\=\s*(.+?)\;\s*$/ ) # only oneliner! # spent 495ms making 243170 calls to installer::setupscript::CORE:match, avg 2µs/call |
337 | { | ||||
338 | 116696 | 119ms | $itemkey = $1; | ||
339 | 116696 | 78.6ms | $itemvalue = $2; | ||
340 | |||||
341 | 116696 | 585ms | 116696 | 224ms | $itemkey =~ s/\s+$//; # spent 224ms making 116696 calls to installer::setupscript::CORE:subst, avg 2µs/call |
342 | 116696 | 438ms | 116696 | 116ms | $itemvalue =~ s/\s+$//; # spent 116ms making 116696 calls to installer::setupscript::CORE:subst, avg 991ns/call |
343 | |||||
344 | 116696 | 323ms | 116696 | 1.42s | installer::remover::remove_leading_and_ending_quotationmarks(\$itemvalue); # spent 1.42s making 116696 calls to installer::remover::remove_leading_and_ending_quotationmarks, avg 12µs/call |
345 | |||||
346 | 116696 | 179ms | $oneitemhash{$itemkey} = $itemvalue; | ||
347 | |||||
348 | 116696 | 145ms | 21052 | 15.6ms | $ismultilang ||= $itemkey =~ /^\S+\s+\(\S+\)$/; # spent 15.6ms making 21052 calls to installer::setupscript::CORE:match, avg 740ns/call |
349 | } | ||||
350 | elsif (($searchitem eq "Module") && | ||||
351 | ($line =~ /^\s*.+?\s*\=\s*\(/) && | ||||
352 | (!($line =~ /\)\;\s*$/))) # more than one line, for instance files at modules! | ||||
353 | { | ||||
354 | 23 | 324µs | 23 | 245µs | $line =~ /^\s*(.+?)\s*\=\s*(.+?)\s*$/; # the first line # spent 245µs making 23 calls to installer::setupscript::CORE:match, avg 11µs/call |
355 | 23 | 25µs | $itemkey = $1; | ||
356 | 23 | 16µs | $itemvalue = $2; | ||
357 | |||||
358 | # collecting the complete itemvalue | ||||
359 | do | ||||
360 | 23 | 1.12ms | 250 | 239µs | { # spent 239µs making 250 calls to installer::setupscript::CORE:match, avg 954ns/call |
361 | 250 | 184µs | if ( $i >= $#{$scriptref} ) { | ||
362 | installer::exiter::exit_program("Invalid setup script file. Premature end of file.", "get_all_items_from_script"); | ||||
363 | } | ||||
364 | 250 | 192µs | $line = ${$scriptref}[++$i]; | ||
365 | 250 | 614µs | 250 | 2.72ms | installer::remover::remove_leading_and_ending_whitespaces(\$line); # spent 2.72ms making 250 calls to installer::remover::remove_leading_and_ending_whitespaces, avg 11µs/call |
366 | 250 | 157µs | $itemvalue .= $line; | ||
367 | } while (!($line =~ /\)\;\s*$/)); | ||||
368 | |||||
369 | # removing ending ";" | ||||
370 | 23 | 168µs | 23 | 91µs | $itemvalue =~ s/\;\s*$//; # spent 91µs making 23 calls to installer::setupscript::CORE:subst, avg 4µs/call |
371 | |||||
372 | 23 | 52µs | $oneitemhash{$itemkey} = $itemvalue; | ||
373 | |||||
374 | 23 | 70µs | 14 | 12µs | $ismultilang ||= $itemkey =~ /^\S+\s+\(\S+\)$/; # spent 12µs making 14 calls to installer::setupscript::CORE:match, avg 836ns/call |
375 | } | ||||
376 | } | ||||
377 | |||||
378 | 4054 | 4.64ms | $oneitemhash{'ismultilingual'} = $ismultilang+0; | ||
379 | |||||
380 | 4054 | 5.19ms | push(@allitemarray, \%oneitemhash); | ||
381 | } | ||||
382 | |||||
383 | 13 | 246µs | return \@allitemarray; | ||
384 | } | ||||
385 | |||||
386 | ###################################################################### | ||||
387 | # Collecting all folder at folderitems, that are predefined values | ||||
388 | # For example: PREDEFINED_AUTOSTART | ||||
389 | ###################################################################### | ||||
390 | |||||
391 | sub add_predefined_folder | ||||
392 | # spent 91µs (77+13) within installer::setupscript::add_predefined_folder which was called:
# once (77µs+13µs) by installer::run at line 441 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
393 | 1 | 3µs | my ( $folderitemref, $folderref ) = @_; | ||
394 | |||||
395 | 1 | 266µs | for my $folderid ( map { $_->{FolderID} } @{$folderitemref} ) { | ||
396 | # FIXME: Anchor to start of line? | ||||
397 | 8 | 40µs | 8 | 14µs | next unless ( $folderid =~ /PREDEFINED_/ ); # spent 14µs making 8 calls to installer::setupscript::CORE:match, avg 2µs/call |
398 | 1 | 4µs | next if grep { $_->{gid} eq $folderid } @{$folderref}; | ||
399 | |||||
400 | 1 | 8µs | push @{$folderref}, { | ||
401 | ismultilingual => 0, | ||||
402 | Name => "", | ||||
403 | gid => $folderid, | ||||
404 | }; | ||||
405 | } | ||||
406 | } | ||||
407 | |||||
408 | ##################################################################################### | ||||
409 | # If folderitems are non-advertised, the component needs to have a registry key | ||||
410 | # below HKCU as key path. Therefore it is required, to mark the file belonging | ||||
411 | # to a non-advertised shortcut, that a special userreg_xxx registry key can be | ||||
412 | # created during packing process. | ||||
413 | ##################################################################################### | ||||
414 | |||||
415 | sub prepare_non_advertised_files | ||||
416 | # spent 1.92ms (150µs+1.77) within installer::setupscript::prepare_non_advertised_files which was called:
# once (150µs+1.77ms) by installer::run at line 443 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
417 | 1 | 2µs | my ( $folderitemref, $filesref ) = @_; | ||
418 | |||||
419 | 1 | 17µs | for ( my $i = 0; $i <= $#{$folderitemref}; $i++ ) | ||
420 | { | ||||
421 | 8 | 5µs | my $folderitem = ${$folderitemref}[$i]; | ||
422 | 8 | 5µs | my $styles = ""; | ||
423 | 8 | 16µs | if ( $folderitem->{'Styles'} ) { $styles = $folderitem->{'Styles'}; } | ||
424 | |||||
425 | 8 | 59µs | 8 | 23µs | if ( $styles =~ /\bNON_ADVERTISED\b/ ) # spent 23µs making 8 calls to installer::setupscript::CORE:match, avg 3µs/call |
426 | { | ||||
427 | 8 | 8µs | my $fileid = $folderitem->{'FileID'}; | ||
428 | 8 | 6µs | if ( $folderitem->{'ComponentIDFile'} ) { $fileid = $folderitem->{'ComponentIDFile'}; } | ||
429 | 8 | 25µs | 8 | 1.74ms | my $onefile = installer::worker::find_file_by_id($filesref, $fileid); # spent 1.74ms making 8 calls to installer::worker::find_file_by_id, avg 218µs/call |
430 | |||||
431 | # Attention: If $onefile with "FileID" is not found, this is not always an error. | ||||
432 | # FileID can also contain an executable file, for example msiexec.exe. | ||||
433 | 8 | 19µs | if ( $onefile ne "" ) { $onefile->{'needs_user_registry_key'} = 1; } | ||
434 | } | ||||
435 | } | ||||
436 | } | ||||
437 | |||||
438 | ##################################################################################### | ||||
439 | # Adding all variables defined in the installation object into the hash | ||||
440 | # of all variables from the zip list file. | ||||
441 | # This is needed if variables are defined in the installation object, | ||||
442 | # but not in the zip list file. | ||||
443 | # If there is a definition in the zip list file and in the installation | ||||
444 | # object, the installation object is more important | ||||
445 | ##################################################################################### | ||||
446 | |||||
447 | sub add_installationobject_to_variables | ||||
448 | # spent 402µs (296+106) within installer::setupscript::add_installationobject_to_variables which was called:
# once (296µs+106µs) by installer::run at line 342 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
449 | 1 | 5µs | my ($allvariables, $allscriptvariablesref) = @_; | ||
450 | |||||
451 | 1 | 46µs | for ( my $i = 0; $i <= $#{$allscriptvariablesref}; $i++ ) | ||
452 | { | ||||
453 | 22 | 20µs | my $line = ${$allscriptvariablesref}[$i]; | ||
454 | |||||
455 | 22 | 223µs | 22 | 106µs | if ( $line =~ /^\s*\%(\w+)\s+(.*?)\s*$/ ) # spent 106µs making 22 calls to installer::setupscript::CORE:match, avg 5µs/call |
456 | { | ||||
457 | 22 | 30µs | my $key = $1; | ||
458 | 22 | 18µs | my $value = $2; | ||
459 | |||||
460 | 22 | 51µs | $allvariables->{$key} = $value; # overwrite existing values from zip.lst | ||
461 | } | ||||
462 | } | ||||
463 | } | ||||
464 | |||||
465 | ##################################################################################### | ||||
466 | # Adding all variables, that must be defined, but are not defined until now. | ||||
467 | ##################################################################################### | ||||
468 | |||||
469 | sub add_forced_properties | ||||
470 | # spent 24µs within installer::setupscript::add_forced_properties which was called:
# once (24µs+0s) by installer::run at line 345 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
471 | 1 | 2µs | my ($allvariables) = @_; | ||
472 | |||||
473 | 1 | 5µs | my @forced_properties = qw( | ||
474 | SERVICETAG_PRODUCTNAME | ||||
475 | SERVICETAG_PRODUCTVERSION | ||||
476 | SERVICETAG_PARENTNAME | ||||
477 | SERVICETAG_SOURCE | ||||
478 | SERVICETAG_URN | ||||
479 | ); | ||||
480 | |||||
481 | 1 | 11µs | for my $property (@forced_properties) | ||
482 | { | ||||
483 | 5 | 9µs | if ( ! exists($allvariables->{$property}) ) { | ||
484 | $allvariables->{$property} = ""; | ||||
485 | } | ||||
486 | } | ||||
487 | } | ||||
488 | |||||
489 | ##################################################################################### | ||||
490 | # Some properties are created automatically. It should be possible to | ||||
491 | # overwrite them, with PRESET properties. For example UNIXPRODUCTNAME | ||||
492 | # with PRESETUNIXPRODUCTNAME, if this is defined and the automatic process | ||||
493 | # does not deliver the desired results. | ||||
494 | ##################################################################################### | ||||
495 | |||||
496 | sub replace_preset_properties | ||||
497 | # spent 20µs within installer::setupscript::replace_preset_properties which was called:
# once (20µs+0s) by installer::run at line 348 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
498 | 1 | 1µs | my ($allvariables) = @_; | ||
499 | |||||
500 | # SOLARISBRANDPACKAGENAME | ||||
501 | # needs to be replaced by | ||||
502 | # PRESETSOLARISBRANDPACKAGENAME | ||||
503 | |||||
504 | 1 | 1µs | my @presetproperties = (); | ||
505 | 1 | 2µs | push(@presetproperties, "SOLARISBRANDPACKAGENAME"); | ||
506 | 1 | 1µs | push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); | ||
507 | |||||
508 | |||||
509 | 1 | 14µs | foreach $property ( @presetproperties ) | ||
510 | { | ||||
511 | 2 | 4µs | my $presetproperty = "PRESET" . $property; | ||
512 | 2 | 4µs | if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" )) | ||
513 | { | ||||
514 | $allvariables->{$property} = $allvariables->{$presetproperty}; | ||||
515 | } | ||||
516 | } | ||||
517 | } | ||||
518 | |||||
519 | 1 | 17µs | 1; | ||
# spent 1.45s within installer::setupscript::CORE:match which was called 1956153 times, avg 743ns/call:
# 1557836 times (868ms+0s) by installer::setupscript::get_all_items_from_script at line 321, avg 557ns/call
# 243170 times (495ms+0s) by installer::setupscript::get_all_items_from_script at line 336, avg 2µs/call
# 129143 times (68.9ms+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 292, avg 534ns/call
# 21052 times (15.6ms+0s) by installer::setupscript::get_all_items_from_script at line 348, avg 740ns/call
# 4054 times (3.18ms+0s) by installer::setupscript::get_all_items_from_script at line 329, avg 785ns/call
# 452 times (475µs+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 294, avg 1µs/call
# 250 times (239µs+0s) by installer::setupscript::get_all_items_from_script at line 360, avg 954ns/call
# 23 times (245µs+0s) by installer::setupscript::get_all_items_from_script at line 354, avg 11µs/call
# 22 times (111µs+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 267, avg 5µs/call
# 22 times (110µs+0s) by installer::setupscript::resolve_lowercase_productname_setupscriptvariable at line 230, avg 5µs/call
# 22 times (109µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 157, avg 5µs/call
# 22 times (106µs+0s) by installer::setupscript::add_installationobject_to_variables at line 455, avg 5µs/call
# 22 times (15µs+0s) by installer::setupscript::resolve_lowercase_productname_setupscriptvariable at line 242, avg 668ns/call
# 14 times (12µs+0s) by installer::setupscript::get_all_items_from_script at line 374, avg 836ns/call
# 10 times (44µs+0s) by installer::setupscript::get_all_scriptvariables_from_installation_object at line 113, avg 4µs/call
# 10 times (20µs+0s) by installer::setupscript::get_all_scriptvariables_from_installation_object at line 120, avg 2µs/call
# 10 times (8µs+0s) by installer::setupscript::get_all_scriptvariables_from_installation_object at line 133, avg 780ns/call
# 8 times (23µs+0s) by installer::setupscript::prepare_non_advertised_files at line 425, avg 3µs/call
# 8 times (14µs+0s) by installer::setupscript::add_predefined_folder at line 397, avg 2µs/call
# once (9µs+0s) by installer::setupscript::get_all_scriptvariables_from_installation_object at line 106
# once (3µs+0s) by installer::setupscript::set_setupscript_name at line 70
# once (1µs+0s) by installer::setupscript::get_all_scriptvariables_from_installation_object at line 111 | |||||
# spent 1.24s within installer::setupscript::CORE:regcomp which was called 1557859 times, avg 795ns/call:
# 1557836 times (1.23s+0s) by installer::setupscript::get_all_items_from_script at line 321, avg 788ns/call
# 22 times (10.9ms+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 281, avg 495µs/call
# once (26µs+0s) by installer::setupscript::resolve_lowercase_productname_setupscriptvariable at line 245 | |||||
# spent 36µs within installer::setupscript::CORE:sort which was called:
# once (36µs+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 277 | |||||
# spent 581ms within installer::setupscript::CORE:subst which was called 233446 times, avg 2µs/call:
# 116696 times (224ms+0s) by installer::setupscript::get_all_items_from_script at line 341, avg 2µs/call
# 116696 times (116ms+0s) by installer::setupscript::get_all_items_from_script at line 342, avg 991ns/call
# 23 times (91µs+0s) by installer::setupscript::get_all_items_from_script at line 370, avg 4µs/call
# 22 times (241ms+0s) by installer::setupscript::replace_all_setupscriptvariables_in_script at line 281, avg 11.0ms/call
# once (17µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 167
# once (7µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 173
# once (4µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 204
# once (4µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 174
# once (3µs+0s) by installer::setupscript::resolve_lowercase_productname_setupscriptvariable at line 245
# once (2µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 179
# once (1µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 188
# once (1µs+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 175
# once (500ns+0s) by installer::setupscript::add_lowercase_productname_setupscriptvariable at line 187 | |||||
# spent 3µs within installer::setupscript::CORE:substcont which was called 2 times, avg 2µs/call:
# 2 times (3µs+0s) by installer::setupscript::resolve_lowercase_productname_setupscriptvariable at line 245, avg 2µs/call |