| 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 | installer::setupscript::get_all_items_from_script |
| 1956153 | 22 | 1 | 1.45s | 1.45s | installer::setupscript::CORE:match (opcode) |
| 1557859 | 3 | 1 | 1.24s | 1.24s | installer::setupscript::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 707ms | 1.03s | installer::setupscript::replace_all_setupscriptvariables_in_script |
| 233446 | 13 | 1 | 581ms | 581ms | installer::setupscript::CORE:subst (opcode) |
| 1 | 1 | 1 | 393µs | 550µs | installer::setupscript::resolve_lowercase_productname_setupscriptvariable |
| 1 | 1 | 1 | 348µs | 456µs | installer::setupscript::BEGIN@30 |
| 1 | 1 | 1 | 298µs | 442µs | installer::setupscript::add_lowercase_productname_setupscriptvariable |
| 1 | 1 | 1 | 296µs | 402µs | installer::setupscript::add_installationobject_to_variables |
| 1 | 1 | 1 | 222µs | 304µs | installer::setupscript::get_all_scriptvariables_from_installation_object |
| 1 | 1 | 1 | 150µs | 1.92ms | installer::setupscript::prepare_non_advertised_files |
| 1 | 1 | 1 | 77µs | 91µs | installer::setupscript::add_predefined_folder |
| 1 | 1 | 1 | 36µs | 36µs | installer::setupscript::CORE:sort (opcode) |
| 1 | 1 | 1 | 36µs | 153µs | installer::setupscript::set_setupscript_name |
| 1 | 1 | 1 | 24µs | 24µs | installer::setupscript::add_forced_properties |
| 1 | 1 | 1 | 20µs | 20µs | installer::setupscript::replace_preset_properties |
| 1 | 1 | 1 | 16µs | 19µs | installer::setupscript::BEGIN@36 |
| 1 | 1 | 1 | 15µs | 18µs | installer::setupscript::BEGIN@37 |
| 1 | 1 | 1 | 15µs | 17µs | installer::setupscript::BEGIN@32 |
| 1 | 1 | 1 | 14µs | 16µs | installer::setupscript::BEGIN@35 |
| 1 | 1 | 1 | 13µs | 16µs | installer::setupscript::BEGIN@33 |
| 1 | 1 | 1 | 13µs | 118µs | installer::setupscript::BEGIN@34 |
| 2 | 1 | 1 | 3µs | 3µs | installer::setupscript::CORE:substcont (opcode) |
| 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 | 8 | 34µs | my ( $allsettingsarrayref, $includepatharrayref ) = @_; | ||
| 60 | |||||
| 61 | 1 | 90µs | my $scriptnameref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "script"); # spent 90µs making 1 call to installer::ziplist::getinfofromziplist | ||
| 62 | |||||
| 63 | my $scriptname = $$scriptnameref; | ||||
| 64 | |||||
| 65 | 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 | 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 | 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 | $installer::globals::setupscriptname = $$scriptnameref; | ||||
| 85 | |||||
| 86 | 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 | 4 | 16µs | my ($scriptref) = @_; | ||
| 99 | |||||
| 100 | my @installobjectvariables; | ||||
| 101 | |||||
| 102 | 3 | 23µs | for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) | ||
| 103 | { | ||||
| 104 | my $line = ${$scriptref}[$i]; | ||||
| 105 | |||||
| 106 | 3 | 10µ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 | my $counter = $i+1; | ||||
| 109 | my $installline = ${$scriptref}[$counter]; | ||||
| 110 | |||||
| 111 | 1 | 1µs | while (!($installline =~ /^\s*End\s*$/ )) # spent 1µs making 1 call to installer::setupscript::CORE:match | ||
| 112 | { | ||||
| 113 | 90 | 254µ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 | my $key = $1; | ||||
| 116 | my $value = $2; | ||||
| 117 | |||||
| 118 | # removing leading and ending " in $value | ||||
| 119 | |||||
| 120 | 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 | $key = "\%" . uc($key); # $key is %PRODUCTNAME | ||||
| 126 | |||||
| 127 | my $input = $key . " " . $value . "\n"; # $key can only be the first word | ||||
| 128 | |||||
| 129 | push(@installobjectvariables ,$input); | ||||
| 130 | } | ||||
| 131 | |||||
| 132 | $counter++; | ||||
| 133 | 10 | 8µs | $installline = ${$scriptref}[$counter]; # spent 8µs making 10 calls to installer::setupscript::CORE:match, avg 780ns/call | ||
| 134 | } | ||||
| 135 | } | ||||
| 136 | |||||
| 137 | last; # not interesting after installation object | ||||
| 138 | } | ||||
| 139 | |||||
| 140 | 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 | 2 | 38µs | my ( $variablesref ) = @_; | ||
| 150 | |||||
| 151 | 66 | 226µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
| 152 | { | ||||
| 153 | my $variableline = ${$variablesref}[$j]; | ||||
| 154 | |||||
| 155 | my ($key, $value); | ||||
| 156 | |||||
| 157 | 66 | 50µ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 | $key = $1; | ||||
| 160 | $value = $2; | ||||
| 161 | |||||
| 162 | 37 | 130µs | if ( $key eq "PRODUCTNAME" ) | ||
| 163 | { | ||||
| 164 | my $newline = "\%LCPRODUCTNAME " . lc($value) . "\n"; | ||||
| 165 | push(@{$variablesref} ,$newline); | ||||
| 166 | my $original = $value; | ||||
| 167 | 1 | 17µs | $value =~ s/\s*//g; # spent 17µs making 1 call to installer::setupscript::CORE:subst | ||
| 168 | $newline = "\%ONEWORDPRODUCTNAME " . $value . "\n"; | ||||
| 169 | push(@{$variablesref} ,$newline); | ||||
| 170 | $newline = "\%LCONEWORDPRODUCTNAME " . lc($value) . "\n"; | ||||
| 171 | push(@{$variablesref} ,$newline); | ||||
| 172 | $value = $original; | ||||
| 173 | 1 | 7µs | $value =~ s/\s*$//g; # spent 7µs making 1 call to installer::setupscript::CORE:subst | ||
| 174 | 1 | 4µs | $value =~ s/^\s*//g; # spent 4µs making 1 call to installer::setupscript::CORE:subst | ||
| 175 | 1 | 1µs | $value =~ s/ /\%20/g; # spent 1µs making 1 call to installer::setupscript::CORE:subst | ||
| 176 | $newline = "\%MASKEDPRODUCTNAME " . $value . "\n"; | ||||
| 177 | push(@{$variablesref} ,$newline); | ||||
| 178 | $value = $original; | ||||
| 179 | 1 | 2µs | $value =~ s/\s/\_/g; # spent 2µs making 1 call to installer::setupscript::CORE:subst | ||
| 180 | $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; | ||||
| 181 | push(@{$variablesref} ,$newline); | ||||
| 182 | $newline = "\%SYSTEMINTUNIXPACKAGENAME " . lc($value) . "\n"; | ||||
| 183 | push(@{$variablesref} ,$newline); | ||||
| 184 | $newline = "\%UNIXPACKAGENAME " . lc($value) . "\n"; | ||||
| 185 | push(@{$variablesref} ,$newline); | ||||
| 186 | $value = $original; | ||||
| 187 | 1 | 500ns | $value =~ s/\s/\_/g; # spent 500ns making 1 call to installer::setupscript::CORE:subst | ||
| 188 | 1 | 1µs | $value =~ s/\.//g; # spent 1µs making 1 call to installer::setupscript::CORE:subst | ||
| 189 | $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; | ||||
| 190 | push(@{$variablesref} ,$newline); | ||||
| 191 | $newline = "\%WITHOUTDOTUNIXPACKAGENAME " . lc($value) . "\n"; | ||||
| 192 | push(@{$variablesref} ,$newline); | ||||
| 193 | $newline = "\%SOLARISBRANDPACKAGENAME " . lc($value) . "\n"; | ||||
| 194 | push(@{$variablesref} ,$newline); | ||||
| 195 | $value = $original; | ||||
| 196 | } | ||||
| 197 | elsif ( $key eq "PRODUCTEXTENSION" ) | ||||
| 198 | { | ||||
| 199 | my $newline = "\%LCPRODUCTEXTENSION " . lc($value) . "\n"; | ||||
| 200 | push(@{$variablesref} ,$newline); | ||||
| 201 | } | ||||
| 202 | elsif ( $key eq "PRODUCTVERSION" ) | ||||
| 203 | { | ||||
| 204 | 1 | 4µs | $value =~ s/\.//g; # spent 4µs making 1 call to installer::setupscript::CORE:subst | ||
| 205 | my $newline = "\%WITHOUTDOTPRODUCTVERSION " . $value . "\n"; | ||||
| 206 | 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 | 4 | 82µs | my ( $variablesref ) = @_; | ||
| 219 | |||||
| 220 | my %variables = (); | ||||
| 221 | |||||
| 222 | # First step: Collecting variables | ||||
| 223 | |||||
| 224 | 66 | 229µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
| 225 | { | ||||
| 226 | my $variableline = ${$variablesref}[$j]; | ||||
| 227 | |||||
| 228 | my ($key, $value); | ||||
| 229 | |||||
| 230 | 66 | 88µ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 | $key = $1; | ||||
| 233 | $value = $2; | ||||
| 234 | $variables{$key} = $value; | ||||
| 235 | } | ||||
| 236 | } | ||||
| 237 | |||||
| 238 | # Second step: Resolving variables | ||||
| 239 | |||||
| 240 | 22 | 94µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
| 241 | { | ||||
| 242 | 2 | 60µs | 22 | 15µs | if ( ${$variablesref}[$j] =~ /\$\{(.*?)\}/ ) # spent 15µs making 22 calls to installer::setupscript::CORE:match, avg 668ns/call |
| 243 | { | ||||
| 244 | my $key = $1; | ||||
| 245 | 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 | 13 | 100ms | my ( $scriptref, $variablesref ) = @_; | ||
| 258 | |||||
| 259 | 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 | my %subs; | ||||
| 263 | 44 | 277µs | for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) | ||
| 264 | { | ||||
| 265 | my $variableline = ${$variablesref}[$j]; | ||||
| 266 | |||||
| 267 | 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 | my $bigstring = ''; | ||||
| 275 | 129144 | 139ms | for my $line (@{$scriptref}) { $bigstring = $bigstring . $line; } | ||
| 276 | |||||
| 277 | 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 | 44 | 253ms | my $value = $subs{$key}; | ||
| 281 | 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 | my @newlines = split /\n/, $bigstring; | ||||
| 285 | $scriptref = \@newlines; | ||||
| 286 | |||||
| 287 | # now check for any mis-named '%' variables that we have left | ||||
| 288 | my $num = 0; | ||||
| 289 | for my $check (@newlines) | ||||
| 290 | { | ||||
| 291 | 258286 | 535ms | $num++; | ||
| 292 | 452 | 2.05ms | 129143 | 68.9ms | if ( $check =~ /^.*\%\w+.*$/ ) # spent 68.9ms making 129143 calls to installer::setupscript::CORE:match, avg 534ns/call |
| 293 | { | ||||
| 294 | 185 | 106µs | 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 | my $infoline = "WARNING: mis-named or un-known '%' variable in setup script at line $num:\n$check\n"; | ||||
| 296 | push( @installer::globals::globallogfileinfo, $infoline); | ||||
| 297 | } | ||||
| 298 | } | ||||
| 299 | |||||
| 300 | 1 | 92µs | globallog("Replacing variables in setup script (end)"); # spent 92µs making 1 call to installer::logger::globallog | ||
| 301 | |||||
| 302 | 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 | 65 | 1.03s | my ($scriptref, $searchitem) = @_; | ||
| 312 | |||||
| 313 | my @allitemarray = (); | ||||
| 314 | |||||
| 315 | my ($itemkey, $itemvalue); | ||||
| 316 | |||||
| 317 | 3144050 | 11.8s | for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) | ||
| 318 | { | ||||
| 319 | my $line = ${$scriptref}[$i]; | ||||
| 320 | |||||
| 321 | 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 | my $gid = $1; | ||||
| 323 | |||||
| 324 | my %oneitemhash = (); | ||||
| 325 | my $ismultilang = 0; | ||||
| 326 | |||||
| 327 | $oneitemhash{'gid'} = $gid; | ||||
| 328 | |||||
| 329 | 4054 | 3.18ms | while (!( $line =~ /^\s*End\s*$/ )) # spent 3.18ms making 4054 calls to installer::setupscript::CORE:match, avg 785ns/call | ||
| 330 | { | ||||
| 331 | 362319 | 1.50s | 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 | $line = ${$scriptref}[++$i]; | ||||
| 335 | |||||
| 336 | 817033 | 1.87s | 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 | $itemkey = $1; | ||||
| 339 | $itemvalue = $2; | ||||
| 340 | |||||
| 341 | 116696 | 224ms | $itemkey =~ s/\s+$//; # spent 224ms making 116696 calls to installer::setupscript::CORE:subst, avg 2µs/call | ||
| 342 | 116696 | 116ms | $itemvalue =~ s/\s+$//; # spent 116ms making 116696 calls to installer::setupscript::CORE:subst, avg 991ns/call | ||
| 343 | |||||
| 344 | 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 | $oneitemhash{$itemkey} = $itemvalue; | ||||
| 347 | |||||
| 348 | 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 | 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 | $itemkey = $1; | ||||
| 356 | $itemvalue = $2; | ||||
| 357 | |||||
| 358 | # collecting the complete itemvalue | ||||
| 359 | do | ||||
| 360 | 1000 | 2.24ms | 250 | 239µs | { # spent 239µs making 250 calls to installer::setupscript::CORE:match, avg 954ns/call |
| 361 | if ( $i >= $#{$scriptref} ) { | ||||
| 362 | installer::exiter::exit_program("Invalid setup script file. Premature end of file.", "get_all_items_from_script"); | ||||
| 363 | } | ||||
| 364 | $line = ${$scriptref}[++$i]; | ||||
| 365 | 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 | $itemvalue .= $line; | ||||
| 367 | } while (!($line =~ /\)\;\s*$/)); | ||||
| 368 | |||||
| 369 | # removing ending ";" | ||||
| 370 | 23 | 91µs | $itemvalue =~ s/\;\s*$//; # spent 91µs making 23 calls to installer::setupscript::CORE:subst, avg 4µs/call | ||
| 371 | |||||
| 372 | $oneitemhash{$itemkey} = $itemvalue; | ||||
| 373 | |||||
| 374 | 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 | $oneitemhash{'ismultilingual'} = $ismultilang+0; | ||||
| 379 | |||||
| 380 | push(@allitemarray, \%oneitemhash); | ||||
| 381 | } | ||||
| 382 | |||||
| 383 | 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 | 2 | 265µs | my ( $folderitemref, $folderref ) = @_; | ||
| 394 | |||||
| 395 | for my $folderid ( map { $_->{FolderID} } @{$folderitemref} ) { | ||||
| 396 | # FIXME: Anchor to start of line? | ||||
| 397 | 10 | 57µs | 8 | 14µs | next unless ( $folderid =~ /PREDEFINED_/ ); # spent 14µs making 8 calls to installer::setupscript::CORE:match, avg 2µs/call |
| 398 | next if grep { $_->{gid} eq $folderid } @{$folderref}; | ||||
| 399 | |||||
| 400 | 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 | 2 | 19µs | my ( $folderitemref, $filesref ) = @_; | ||
| 418 | |||||
| 419 | 32 | 84µs | for ( my $i = 0; $i <= $#{$folderitemref}; $i++ ) | ||
| 420 | { | ||||
| 421 | my $folderitem = ${$folderitemref}[$i]; | ||||
| 422 | my $styles = ""; | ||||
| 423 | if ( $folderitem->{'Styles'} ) { $styles = $folderitem->{'Styles'}; } | ||||
| 424 | |||||
| 425 | 32 | 58µ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 | my $fileid = $folderitem->{'FileID'}; | ||||
| 428 | if ( $folderitem->{'ComponentIDFile'} ) { $fileid = $folderitem->{'ComponentIDFile'}; } | ||||
| 429 | 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 | 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 | 2 | 51µs | my ($allvariables, $allscriptvariablesref) = @_; | ||
| 450 | |||||
| 451 | 44 | 242µs | for ( my $i = 0; $i <= $#{$allscriptvariablesref}; $i++ ) | ||
| 452 | { | ||||
| 453 | my $line = ${$allscriptvariablesref}[$i]; | ||||
| 454 | |||||
| 455 | 66 | 99µ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 | my $key = $1; | ||||
| 458 | my $value = $2; | ||||
| 459 | |||||
| 460 | $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 | 3 | 18µs | my ($allvariables) = @_; | ||
| 472 | |||||
| 473 | my @forced_properties = qw( | ||||
| 474 | SERVICETAG_PRODUCTNAME | ||||
| 475 | SERVICETAG_PRODUCTVERSION | ||||
| 476 | SERVICETAG_PARENTNAME | ||||
| 477 | SERVICETAG_SOURCE | ||||
| 478 | SERVICETAG_URN | ||||
| 479 | ); | ||||
| 480 | |||||
| 481 | 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 | 5 | 19µs | my ($allvariables) = @_; | ||
| 499 | |||||
| 500 | # SOLARISBRANDPACKAGENAME | ||||
| 501 | # needs to be replaced by | ||||
| 502 | # PRESETSOLARISBRANDPACKAGENAME | ||||
| 503 | |||||
| 504 | my @presetproperties = (); | ||||
| 505 | push(@presetproperties, "SOLARISBRANDPACKAGENAME"); | ||||
| 506 | push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); | ||||
| 507 | |||||
| 508 | |||||
| 509 | foreach $property ( @presetproperties ) | ||||
| 510 | { | ||||
| 511 | 4 | 8µs | my $presetproperty = "PRESET" . $property; | ||
| 512 | 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 |