| Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/download.pm |
| Statements | Executed 72 statements in 9.99ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.83ms | 2.85ms | installer::download::BEGIN@42 |
| 1 | 1 | 1 | 352µs | 359µs | installer::download::BEGIN@30 |
| 1 | 1 | 1 | 89µs | 179µs | installer::download::set_download_filename |
| 1 | 1 | 1 | 30µs | 67µs | installer::download::BEGIN@37 |
| 1 | 1 | 1 | 21µs | 24µs | installer::download::BEGIN@33 |
| 1 | 1 | 1 | 18µs | 21µs | installer::download::BEGIN@40 |
| 1 | 1 | 1 | 17µs | 20µs | installer::download::get_download_architecture |
| 1 | 1 | 1 | 17µs | 20µs | installer::download::BEGIN@39 |
| 1 | 1 | 1 | 16µs | 16µs | installer::download::get_downloadname_productname |
| 1 | 1 | 1 | 16µs | 19µs | installer::download::BEGIN@38 |
| 1 | 1 | 1 | 16µs | 34µs | installer::download::BEGIN@31 |
| 1 | 1 | 1 | 15µs | 18µs | installer::download::BEGIN@34 |
| 4 | 2 | 1 | 15µs | 15µs | installer::download::CORE:match (opcode) |
| 1 | 1 | 1 | 13µs | 16µs | installer::download::BEGIN@36 |
| 1 | 1 | 1 | 13µs | 13µs | installer::download::get_install_type |
| 1 | 1 | 1 | 13µs | 16µs | installer::download::BEGIN@35 |
| 2 | 2 | 1 | 13µs | 13µs | installer::download::CORE:subst (opcode) |
| 1 | 1 | 1 | 11µs | 11µs | installer::download::get_downloadname_language |
| 1 | 1 | 1 | 10µs | 10µs | installer::download::get_download_version |
| 1 | 1 | 1 | 7µs | 7µs | installer::download::get_download_platformname |
| 0 | 0 | 0 | 0s | 0s | installer::download::call_sum |
| 0 | 0 | 0 | 0s | 0s | installer::download::create_download_sets |
| 0 | 0 | 0 | 0s | 0s | installer::download::create_tar_gz_file_from_directory |
| 0 | 0 | 0 | 0s | 0s | installer::download::determine_scriptfile_name |
| 0 | 0 | 0 | 0s | 0s | installer::download::get_language_block_from_language_file |
| 0 | 0 | 0 | 0s | 0s | installer::download::get_language_string_from_language_block |
| 0 | 0 | 0 | 0s | 0s | installer::download::get_path_for_library |
| 0 | 0 | 0 | 0s | 0s | installer::download::include_tar_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::download::put_checksum_and_size_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::download::put_linenumber_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::download::put_productname_into_script |
| 0 | 0 | 0 | 0s | 0s | installer::download::resolve_variables_in_downloadname |
| 0 | 0 | 0 | 0s | 0s | installer::download::save_script_file |
| 0 | 0 | 0 | 0s | 0s | installer::download::tar_package |
| 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::download; | ||||
| 29 | |||||
| 30 | 2 | 67µs | 2 | 366µs | # spent 359µs (352+7) within installer::download::BEGIN@30 which was called:
# once (352µs+7µs) by installer::BEGIN@39 at line 30 # spent 359µs making 1 call to installer::download::BEGIN@30
# spent 7µs making 1 call to strict::import |
| 31 | 2 | 58µs | 2 | 51µs | # spent 34µs (16+18) within installer::download::BEGIN@31 which was called:
# once (16µs+18µs) by installer::BEGIN@39 at line 31 # spent 34µs making 1 call to installer::download::BEGIN@31
# spent 18µs making 1 call to warnings::import |
| 32 | |||||
| 33 | 2 | 67µs | 2 | 27µs | # spent 24µs (21+3) within installer::download::BEGIN@33 which was called:
# once (21µs+3µs) by installer::BEGIN@39 at line 33 # spent 24µs making 1 call to installer::download::BEGIN@33
# spent 3µs making 1 call to UNIVERSAL::import |
| 34 | 2 | 53µs | 2 | 20µs | # spent 18µs (15+3) within installer::download::BEGIN@34 which was called:
# once (15µs+3µs) by installer::BEGIN@39 at line 34 # spent 18µs making 1 call to installer::download::BEGIN@34
# spent 3µs making 1 call to UNIVERSAL::import |
| 35 | 2 | 51µs | 2 | 18µs | # spent 16µs (13+3) within installer::download::BEGIN@35 which was called:
# once (13µs+3µs) by installer::BEGIN@39 at line 35 # spent 16µs making 1 call to installer::download::BEGIN@35
# spent 2µs making 1 call to UNIVERSAL::import |
| 36 | 2 | 51µs | 2 | 18µs | # spent 16µs (13+2) within installer::download::BEGIN@36 which was called:
# once (13µs+2µs) by installer::BEGIN@39 at line 36 # spent 16µs making 1 call to installer::download::BEGIN@36
# spent 2µs making 1 call to UNIVERSAL::import |
| 37 | 2 | 56µs | 2 | 105µs | # spent 67µs (30+38) within installer::download::BEGIN@37 which was called:
# once (30µs+38µs) by installer::BEGIN@39 at line 37 # spent 67µs making 1 call to installer::download::BEGIN@37
# spent 38µs making 1 call to Exporter::import |
| 38 | 2 | 58µs | 2 | 21µs | # spent 19µs (16+2) within installer::download::BEGIN@38 which was called:
# once (16µs+2µs) by installer::BEGIN@39 at line 38 # spent 19µs making 1 call to installer::download::BEGIN@38
# spent 2µs making 1 call to UNIVERSAL::import |
| 39 | 2 | 55µs | 2 | 23µs | # spent 20µs (17+3) within installer::download::BEGIN@39 which was called:
# once (17µs+3µs) by installer::BEGIN@39 at line 39 # spent 20µs making 1 call to installer::download::BEGIN@39
# spent 3µs making 1 call to UNIVERSAL::import |
| 40 | 2 | 122µs | 2 | 23µs | # spent 21µs (18+3) within installer::download::BEGIN@40 which was called:
# once (18µs+3µs) by installer::BEGIN@39 at line 40 # spent 21µs making 1 call to installer::download::BEGIN@40
# spent 3µs making 1 call to UNIVERSAL::import |
| 41 | |||||
| 42 | # spent 2.85ms (2.83+20µs) within installer::download::BEGIN@42 which was called:
# once (2.83ms+20µs) by installer::BEGIN@39 at line 47 | ||||
| 43 | # (needed for correctly evaluating the -x test.) | ||||
| 44 | 3 | 2.82ms | 1 | 12µs | if( $^O =~ /cygwin/i ) { # spent 12µs making 1 call to installer::download::CORE:match |
| 45 | 1 | 8µs | require filetest; import filetest "access"; # spent 8µs making 1 call to filetest::import | ||
| 46 | } | ||||
| 47 | 1 | 6.35ms | 1 | 2.85ms | } # spent 2.85ms making 1 call to installer::download::BEGIN@42 |
| 48 | |||||
| 49 | ################################################################## | ||||
| 50 | # Including the lowercase product name into the script template | ||||
| 51 | ################################################################## | ||||
| 52 | |||||
| 53 | sub put_productname_into_script | ||||
| 54 | { | ||||
| 55 | my ($scriptfile, $variableshashref) = @_; | ||||
| 56 | |||||
| 57 | my $productname = $variableshashref->{'PRODUCTNAME'}; | ||||
| 58 | $productname = lc($productname); | ||||
| 59 | $productname =~ s/\.//g; # openoffice.org -> openofficeorg | ||||
| 60 | $productname =~ s/\s*//g; | ||||
| 61 | |||||
| 62 | my $infoline = "Adding productname $productname into download shell script\n"; | ||||
| 63 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 64 | |||||
| 65 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 66 | { | ||||
| 67 | ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; | ||||
| 68 | } | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | ######################################################### | ||||
| 72 | # Including the linenumber into the script template | ||||
| 73 | ######################################################### | ||||
| 74 | |||||
| 75 | sub put_linenumber_into_script | ||||
| 76 | { | ||||
| 77 | my ( $scriptfile ) = @_; | ||||
| 78 | |||||
| 79 | my $linenumber = $#{$scriptfile} + 2; | ||||
| 80 | |||||
| 81 | my $infoline = "Adding linenumber $linenumber into download shell script\n"; | ||||
| 82 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 83 | |||||
| 84 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 85 | { | ||||
| 86 | ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/; | ||||
| 87 | } | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | ######################################################### | ||||
| 91 | # Determining the name of the new scriptfile | ||||
| 92 | ######################################################### | ||||
| 93 | |||||
| 94 | sub determine_scriptfile_name | ||||
| 95 | { | ||||
| 96 | my ( $filename ) = @_; | ||||
| 97 | |||||
| 98 | $installer::globals::downloadfileextension = ".sh"; | ||||
| 99 | $filename = $filename . $installer::globals::downloadfileextension; | ||||
| 100 | $installer::globals::downloadfilename = $filename; | ||||
| 101 | |||||
| 102 | my $infoline = "Setting download shell script file name to $filename\n"; | ||||
| 103 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 104 | |||||
| 105 | return $filename; | ||||
| 106 | } | ||||
| 107 | |||||
| 108 | ######################################################### | ||||
| 109 | # Saving the script file in the installation directory | ||||
| 110 | ######################################################### | ||||
| 111 | |||||
| 112 | sub save_script_file | ||||
| 113 | { | ||||
| 114 | my ($directory, $newscriptfilename, $scriptfile) = @_; | ||||
| 115 | |||||
| 116 | $newscriptfilename = $directory . $installer::globals::separator . $newscriptfilename; | ||||
| 117 | installer::files::save_file($newscriptfilename, $scriptfile); | ||||
| 118 | |||||
| 119 | my $infoline = "Saving script file $newscriptfilename\n"; | ||||
| 120 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 121 | |||||
| 122 | if ( ! $installer::globals::iswindowsbuild ) | ||||
| 123 | { | ||||
| 124 | chmod 0775, $newscriptfilename; | ||||
| 125 | } | ||||
| 126 | |||||
| 127 | return $newscriptfilename; | ||||
| 128 | } | ||||
| 129 | |||||
| 130 | ######################################################### | ||||
| 131 | # Including checksum and size into script file | ||||
| 132 | ######################################################### | ||||
| 133 | |||||
| 134 | sub put_checksum_and_size_into_script | ||||
| 135 | { | ||||
| 136 | my ($scriptfile, $sumout) = @_; | ||||
| 137 | |||||
| 138 | my $checksum = ""; | ||||
| 139 | my $size = ""; | ||||
| 140 | |||||
| 141 | if ( $sumout =~ /^\s*(\d+)\s+(\d+)\s*$/ ) | ||||
| 142 | { | ||||
| 143 | $checksum = $1; | ||||
| 144 | $size = $2; | ||||
| 145 | } | ||||
| 146 | else | ||||
| 147 | { | ||||
| 148 | installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/sum: $sumout", "put_checksum_and_size_into_script"); | ||||
| 149 | } | ||||
| 150 | |||||
| 151 | my $infoline = "Adding checksum $checksum and size $size into download shell script\n"; | ||||
| 152 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 153 | |||||
| 154 | for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) | ||||
| 155 | { | ||||
| 156 | ${$scriptfile}[$i] =~ s/CHECKSUMPLACEHOLDER/$checksum/; | ||||
| 157 | ${$scriptfile}[$i] =~ s/DISCSPACEPLACEHOLDER/$size/; | ||||
| 158 | } | ||||
| 159 | |||||
| 160 | } | ||||
| 161 | |||||
| 162 | ######################################################### | ||||
| 163 | # Determining checksum and size of tar file | ||||
| 164 | ######################################################### | ||||
| 165 | |||||
| 166 | sub call_sum | ||||
| 167 | { | ||||
| 168 | my ($filename, $getuidlibrary) = @_; | ||||
| 169 | |||||
| 170 | my $systemcall = "/usr/bin/sum $filename |"; | ||||
| 171 | |||||
| 172 | my $sumoutput = ""; | ||||
| 173 | |||||
| 174 | open (SUM, "$systemcall"); | ||||
| 175 | $sumoutput = <SUM>; | ||||
| 176 | close (SUM); | ||||
| 177 | |||||
| 178 | my $returnvalue = $?; # $? contains the return value of the systemcall | ||||
| 179 | |||||
| 180 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 181 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 182 | |||||
| 183 | if ($returnvalue) | ||||
| 184 | { | ||||
| 185 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 186 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 187 | } | ||||
| 188 | else | ||||
| 189 | { | ||||
| 190 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 191 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 192 | } | ||||
| 193 | |||||
| 194 | $sumoutput =~ s/\s+$filename\s$//; | ||||
| 195 | return $sumoutput; | ||||
| 196 | } | ||||
| 197 | |||||
| 198 | ######################################################### | ||||
| 199 | # Searching for the getuid.so in the solver | ||||
| 200 | ######################################################### | ||||
| 201 | |||||
| 202 | sub get_path_for_library | ||||
| 203 | { | ||||
| 204 | my ($includepatharrayref) = @_; | ||||
| 205 | |||||
| 206 | my $getuidlibraryname = "getuid.so"; | ||||
| 207 | |||||
| 208 | my $getuidlibraryref = ""; | ||||
| 209 | |||||
| 210 | if ( $installer::globals::include_paths_read ) | ||||
| 211 | { | ||||
| 212 | $getuidlibraryref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$getuidlibraryname, $includepatharrayref, 0); | ||||
| 213 | } | ||||
| 214 | else | ||||
| 215 | { | ||||
| 216 | $getuidlibraryref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$getuidlibraryname, $includepatharrayref, 0); | ||||
| 217 | } | ||||
| 218 | |||||
| 219 | if ($$getuidlibraryref eq "") { installer::exiter::exit_program("ERROR: Could not find $getuidlibraryname!", "get_path_for_library"); } | ||||
| 220 | |||||
| 221 | return $$getuidlibraryref; | ||||
| 222 | } | ||||
| 223 | |||||
| 224 | ######################################################### | ||||
| 225 | # Include the tar file into the script | ||||
| 226 | ######################################################### | ||||
| 227 | |||||
| 228 | sub include_tar_into_script | ||||
| 229 | { | ||||
| 230 | my ($scriptfile, $temporary_tarfile) = @_; | ||||
| 231 | |||||
| 232 | my $systemcall = "cat $temporary_tarfile >> $scriptfile && rm $temporary_tarfile"; | ||||
| 233 | my $returnvalue = system($systemcall); | ||||
| 234 | |||||
| 235 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 236 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 237 | |||||
| 238 | if ($returnvalue) | ||||
| 239 | { | ||||
| 240 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 241 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 242 | } | ||||
| 243 | else | ||||
| 244 | { | ||||
| 245 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 246 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 247 | } | ||||
| 248 | return $returnvalue; | ||||
| 249 | } | ||||
| 250 | |||||
| 251 | ######################################################### | ||||
| 252 | # Create a tar file from the binary package | ||||
| 253 | ######################################################### | ||||
| 254 | |||||
| 255 | sub tar_package | ||||
| 256 | { | ||||
| 257 | my ( $installdir, $tarfilename, $getuidlibrary) = @_; | ||||
| 258 | |||||
| 259 | my $ldpreloadstring = ""; | ||||
| 260 | if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; } | ||||
| 261 | |||||
| 262 | my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - * > $tarfilename"; | ||||
| 263 | |||||
| 264 | my $returnvalue = system($systemcall); | ||||
| 265 | |||||
| 266 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 267 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 268 | |||||
| 269 | if ($returnvalue) | ||||
| 270 | { | ||||
| 271 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 272 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 273 | } | ||||
| 274 | else | ||||
| 275 | { | ||||
| 276 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 277 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 278 | } | ||||
| 279 | |||||
| 280 | chmod 0775, $tarfilename; | ||||
| 281 | |||||
| 282 | return ( -s $tarfilename ); | ||||
| 283 | } | ||||
| 284 | |||||
| 285 | ######################################################### | ||||
| 286 | # Setting installation languages | ||||
| 287 | ######################################################### | ||||
| 288 | |||||
| 289 | sub get_downloadname_language | ||||
| 290 | # spent 11µs within installer::download::get_downloadname_language which was called:
# once (11µs+0s) by installer::download::set_download_filename at line 528 | ||||
| 291 | 5 | 15µs | my ($languagestringref) = @_; | ||
| 292 | |||||
| 293 | my $languages = $$languagestringref; | ||||
| 294 | |||||
| 295 | if ( $installer::globals::added_english ) | ||||
| 296 | { | ||||
| 297 | $languages =~ s/en-US_//; | ||||
| 298 | $languages =~ s/_en-US//; | ||||
| 299 | } | ||||
| 300 | |||||
| 301 | if ( length ($languages) > $installer::globals::max_lang_length ) | ||||
| 302 | { | ||||
| 303 | $languages = 'multi'; | ||||
| 304 | } | ||||
| 305 | |||||
| 306 | return $languages; | ||||
| 307 | } | ||||
| 308 | |||||
| 309 | ######################################################### | ||||
| 310 | # Setting download name | ||||
| 311 | ######################################################### | ||||
| 312 | |||||
| 313 | sub get_downloadname_productname | ||||
| 314 | # spent 16µs within installer::download::get_downloadname_productname which was called:
# once (16µs+0s) by installer::download::set_download_filename at line 523 | ||||
| 315 | 11 | 22µs | my ($allvariables) = @_; | ||
| 316 | |||||
| 317 | my $start = "LibO"; | ||||
| 318 | |||||
| 319 | if ( $allvariables->{'PRODUCTNAME'} eq "LibreOffice" ) { $start = "LibO"; } | ||||
| 320 | |||||
| 321 | if ( $allvariables->{'PRODUCTNAME'} eq "LOdev" ) { $start = "LibO-Dev"; } | ||||
| 322 | |||||
| 323 | if (( $allvariables->{'PRODUCTNAME'} eq "LibreOffice" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "LibO-SDK"; } | ||||
| 324 | |||||
| 325 | if (( $allvariables->{'PRODUCTNAME'} eq "LOdev" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "LibO-Dev-SDK"; } | ||||
| 326 | |||||
| 327 | if (( $allvariables->{'PRODUCTNAME'} eq "LibreOffice" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "TEST" )) { $start = "LibO-Test"; } | ||||
| 328 | |||||
| 329 | if (( $allvariables->{'PRODUCTNAME'} eq "LOdev" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "TEST" )) { $start = "LibO-Dev-Test"; } | ||||
| 330 | |||||
| 331 | if ( $allvariables->{'PRODUCTNAME'} eq "URE" ) { $start = "LibO-URE"; } | ||||
| 332 | |||||
| 333 | if ( $allvariables->{'PRODUCTNAME'} eq "OxygenOffice" ) { $start = "OOOP"; } | ||||
| 334 | |||||
| - - | |||||
| 337 | return $start; | ||||
| 338 | } | ||||
| 339 | |||||
| 340 | ######################################################### | ||||
| 341 | # Setting download version | ||||
| 342 | ######################################################### | ||||
| 343 | |||||
| 344 | sub get_download_version | ||||
| 345 | # spent 10µs within installer::download::get_download_version which was called:
# once (10µs+0s) by installer::download::set_download_filename at line 524 | ||||
| 346 | 5 | 14µs | my ($allvariables) = @_; | ||
| 347 | |||||
| 348 | my $version = ""; | ||||
| 349 | |||||
| 350 | $version = $allvariables->{'PRODUCTVERSION'}; | ||||
| 351 | if (( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) && ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ne "" )) { $version = $version . $allvariables->{'SHORT_PRODUCTEXTENSION'}; } | ||||
| 352 | |||||
| 353 | return $version; | ||||
| 354 | } | ||||
| 355 | |||||
| 356 | ################################################################# | ||||
| 357 | # Setting the platform name for download | ||||
| 358 | ################################################################# | ||||
| 359 | |||||
| 360 | sub get_download_platformname | ||||
| 361 | # spent 7µs within installer::download::get_download_platformname which was called:
# once (7µs+0s) by installer::download::set_download_filename at line 525 | ||||
| 362 | 3 | 12µs | my $platformname = ""; | ||
| 363 | |||||
| 364 | if ( $installer::globals::islinuxbuild ) | ||||
| 365 | { | ||||
| 366 | $platformname = "Linux"; | ||||
| 367 | } | ||||
| 368 | elsif ( $installer::globals::issolarisbuild ) | ||||
| 369 | { | ||||
| 370 | $platformname = "Solaris"; | ||||
| 371 | } | ||||
| 372 | elsif ( $installer::globals::iswindowsbuild ) | ||||
| 373 | { | ||||
| 374 | $platformname = "Win"; | ||||
| 375 | } | ||||
| 376 | elsif ( $installer::globals::isfreebsdbuild ) | ||||
| 377 | { | ||||
| 378 | $platformname = "FreeBSD"; | ||||
| 379 | } | ||||
| 380 | elsif ( $installer::globals::ismacbuild ) | ||||
| 381 | { | ||||
| 382 | $platformname = "MacOS"; | ||||
| 383 | } | ||||
| 384 | else | ||||
| 385 | { | ||||
| 386 | $platformname = $installer::globals::compiler; | ||||
| 387 | } | ||||
| 388 | |||||
| 389 | return $platformname; | ||||
| 390 | } | ||||
| 391 | |||||
| 392 | ######################################################### | ||||
| 393 | # Setting the architecture for the download name | ||||
| 394 | ######################################################### | ||||
| 395 | |||||
| 396 | sub get_download_architecture | ||||
| 397 | # spent 20µs (17+3) within installer::download::get_download_architecture which was called:
# once (17µs+3µs) by installer::download::set_download_filename at line 526 | ||||
| 398 | 3 | 26µs | my $arch = ""; | ||
| 399 | |||||
| 400 | 3 | 3µs | if ( $installer::globals::compiler =~ /unxlngi/ ) # spent 3µs making 3 calls to installer::download::CORE:match, avg 1µs/call | ||
| 401 | { | ||||
| 402 | $arch = "x86"; | ||||
| 403 | } | ||||
| 404 | elsif ( $installer::globals::compiler =~ /unxlngppc/ ) | ||||
| 405 | { | ||||
| 406 | $arch = "PPC"; | ||||
| 407 | } | ||||
| 408 | elsif ( $installer::globals::compiler =~ /unxlngx/ ) | ||||
| 409 | { | ||||
| 410 | $arch = "x86-64"; | ||||
| 411 | } | ||||
| 412 | elsif ( $installer::globals::issolarissparcbuild ) | ||||
| 413 | { | ||||
| 414 | $arch = "Sparc"; | ||||
| 415 | } | ||||
| 416 | elsif ( $installer::globals::issolarisx86build ) | ||||
| 417 | { | ||||
| 418 | $arch = "x86"; | ||||
| 419 | } | ||||
| 420 | elsif ( $installer::globals::iswindowsbuild ) | ||||
| 421 | { | ||||
| 422 | $arch = "x86"; | ||||
| 423 | } | ||||
| 424 | elsif ( $installer::globals::compiler =~ /^unxmacxi/ ) | ||||
| 425 | { | ||||
| 426 | $arch = "x86"; | ||||
| 427 | } | ||||
| 428 | elsif ( $installer::globals::compiler =~ /^unxmacxp/ ) | ||||
| 429 | { | ||||
| 430 | $arch = "PPC"; | ||||
| 431 | } | ||||
| 432 | |||||
| 433 | return $arch; | ||||
| 434 | } | ||||
| 435 | |||||
| 436 | ######################################################### | ||||
| 437 | # Setting the installation type for the download name | ||||
| 438 | ######################################################### | ||||
| 439 | |||||
| 440 | sub get_install_type | ||||
| 441 | # spent 13µs within installer::download::get_install_type which was called:
# once (13µs+0s) by installer::download::set_download_filename at line 527 | ||||
| 442 | 4 | 13µs | my ($allvariables) = @_; | ||
| 443 | |||||
| 444 | my $type = ""; | ||||
| 445 | |||||
| 446 | 5 | 5µs | if ( $installer::globals::languagepack ) | ||
| 447 | { | ||||
| 448 | $type = "langpack"; | ||||
| 449 | |||||
| 450 | if ( $installer::globals::isrpmbuild ) | ||||
| 451 | { | ||||
| 452 | $type = $type . "-rpm"; | ||||
| 453 | } | ||||
| 454 | |||||
| 455 | if ( $installer::globals::isdebbuild ) | ||||
| 456 | { | ||||
| 457 | $type = $type . "-deb"; | ||||
| 458 | } | ||||
| 459 | |||||
| 460 | if ( $installer::globals::packageformat eq "archive" ) | ||||
| 461 | { | ||||
| 462 | $type = $type . "-arc"; | ||||
| 463 | } | ||||
| 464 | } | ||||
| 465 | elsif ( $installer::globals::helppack ) | ||||
| 466 | { | ||||
| 467 | $type = "helppack"; | ||||
| 468 | |||||
| 469 | if ( $installer::globals::isrpmbuild ) | ||||
| 470 | { | ||||
| 471 | $type = $type . "-rpm"; | ||||
| 472 | } | ||||
| 473 | |||||
| 474 | if ( $installer::globals::isdebbuild ) | ||||
| 475 | { | ||||
| 476 | $type = $type . "-deb"; | ||||
| 477 | } | ||||
| 478 | |||||
| 479 | if ( $installer::globals::packageformat eq "archive" ) | ||||
| 480 | { | ||||
| 481 | $type = $type . "-arc"; | ||||
| 482 | } | ||||
| 483 | } | ||||
| 484 | else | ||||
| 485 | { | ||||
| 486 | $type = "install"; | ||||
| 487 | |||||
| 488 | if ( $installer::globals::isrpmbuild ) | ||||
| 489 | { | ||||
| 490 | $type = $type . "-rpm"; | ||||
| 491 | } | ||||
| 492 | |||||
| 493 | if ( $installer::globals::isdebbuild ) | ||||
| 494 | { | ||||
| 495 | $type = $type . "-deb"; | ||||
| 496 | } | ||||
| 497 | |||||
| 498 | if ( $installer::globals::packageformat eq "archive" ) | ||||
| 499 | { | ||||
| 500 | $type = $type . "-arc"; | ||||
| 501 | } | ||||
| 502 | |||||
| 503 | if (( $allvariables->{'WITHJREPRODUCT'} ) && ( $allvariables->{'WITHJREPRODUCT'} == 1 )) | ||||
| 504 | { | ||||
| 505 | $type = $type . "-wJRE"; | ||||
| 506 | } | ||||
| 507 | |||||
| 508 | } | ||||
| 509 | |||||
| 510 | return $type; | ||||
| 511 | } | ||||
| 512 | |||||
| 513 | ############################################################################################### | ||||
| 514 | # Setting the download file name | ||||
| 515 | # Syntax: | ||||
| 516 | # (PRODUCTNAME)_(VERSION)_(OS)_(ARCH)_(INSTALLTYPE)_(LANGUAGE).(FILEEXTENSION) | ||||
| 517 | ############################################################################################### | ||||
| 518 | |||||
| 519 | sub set_download_filename | ||||
| 520 | # spent 179µs (89+90) within installer::download::set_download_filename which was called:
# once (89µs+90µs) by installer::run at line 1808 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
| 521 | 12 | 77µs | my ($languagestringref, $allvariables) = @_; | ||
| 522 | |||||
| 523 | 1 | 16µs | my $start = get_downloadname_productname($allvariables); # spent 16µs making 1 call to installer::download::get_downloadname_productname | ||
| 524 | 1 | 10µs | my $versionstring = get_download_version($allvariables); # spent 10µs making 1 call to installer::download::get_download_version | ||
| 525 | 1 | 7µs | my $platform = get_download_platformname(); # spent 7µs making 1 call to installer::download::get_download_platformname | ||
| 526 | 1 | 20µs | my $architecture = get_download_architecture(); # spent 20µs making 1 call to installer::download::get_download_architecture | ||
| 527 | 1 | 13µs | my $type = get_install_type($allvariables); # spent 13µs making 1 call to installer::download::get_install_type | ||
| 528 | 1 | 11µs | my $language = get_downloadname_language($languagestringref); # spent 11µs making 1 call to installer::download::get_downloadname_language | ||
| 529 | |||||
| 530 | # Setting the extension happens automatically | ||||
| 531 | |||||
| 532 | my $filename = $start . "_" . $versionstring . "_" . "_" . $platform . "_" . $architecture . "_" . $type . "_" . $language; | ||||
| 533 | |||||
| 534 | 1 | 9µs | $filename =~ s/\_\_/\_/g; # necessary, if $versionstring or $platform or $language are empty # spent 9µs making 1 call to installer::download::CORE:subst | ||
| 535 | 1 | 4µs | $filename =~ s/\_\s*$//; # necessary, if $language and $addon are empty # spent 4µs making 1 call to installer::download::CORE:subst | ||
| 536 | |||||
| 537 | $installer::globals::ooodownloadfilename = $filename; | ||||
| 538 | |||||
| 539 | return $filename; | ||||
| 540 | } | ||||
| 541 | |||||
| 542 | ######################################################### | ||||
| 543 | # Creating a tar.gz file | ||||
| 544 | ######################################################### | ||||
| 545 | |||||
| 546 | sub create_tar_gz_file_from_directory | ||||
| 547 | { | ||||
| 548 | my ($installdir, $getuidlibrary, $downloaddir, $downloadfilename) = @_; | ||||
| 549 | |||||
| 550 | my $infoline = ""; | ||||
| 551 | |||||
| 552 | my $packdir = $installdir; | ||||
| 553 | installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packdir); | ||||
| 554 | my $changedir = $installdir; | ||||
| 555 | installer::pathanalyzer::get_path_from_fullqualifiedname(\$changedir); | ||||
| 556 | |||||
| 557 | my $ldpreloadstring = ""; | ||||
| 558 | if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; } | ||||
| 559 | |||||
| 560 | $installer::globals::downloadfileextension = ".tar.gz"; | ||||
| 561 | $installer::globals::downloadfilename = $downloadfilename . $installer::globals::downloadfileextension; | ||||
| 562 | my $targzname = $downloaddir . $installer::globals::separator . $installer::globals::downloadfilename; | ||||
| 563 | |||||
| 564 | my $systemcall = "cd $changedir; $ldpreloadstring tar -cf - $packdir | gzip > $targzname"; | ||||
| 565 | |||||
| 566 | my $returnvalue = system($systemcall); | ||||
| 567 | |||||
| 568 | $infoline = "Systemcall: $systemcall\n"; | ||||
| 569 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 570 | |||||
| 571 | if ($returnvalue) | ||||
| 572 | { | ||||
| 573 | $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; | ||||
| 574 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 575 | } | ||||
| 576 | else | ||||
| 577 | { | ||||
| 578 | $infoline = "Success: Executed \"$systemcall\" successfully!\n"; | ||||
| 579 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 580 | } | ||||
| 581 | |||||
| 582 | return $targzname; | ||||
| 583 | } | ||||
| 584 | |||||
| 585 | ######################################################### | ||||
| 586 | # Setting the variables in the download name | ||||
| 587 | ######################################################### | ||||
| 588 | |||||
| 589 | sub resolve_variables_in_downloadname | ||||
| 590 | { | ||||
| 591 | my ($allvariables, $downloadname, $languagestringref) = @_; | ||||
| 592 | |||||
| 593 | # Typical name: soa-{productversion}-{extension}-bin-{os}-{languages} | ||||
| 594 | |||||
| 595 | my $productversion = ""; | ||||
| 596 | if ( $allvariables->{'PRODUCTVERSION'} ) { $productversion = $allvariables->{'PRODUCTVERSION'}; } | ||||
| 597 | $downloadname =~ s/\{productversion\}/$productversion/; | ||||
| 598 | |||||
| 599 | my $packageversion = ""; | ||||
| 600 | if ( $allvariables->{'PACKAGEVERSION'} ) { $packageversion = $allvariables->{'PACKAGEVERSION'}; } | ||||
| 601 | $downloadname =~ s/\{packageversion\}/$packageversion/; | ||||
| 602 | |||||
| 603 | my $extension = ""; | ||||
| 604 | if ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) { $extension = $allvariables->{'SHORT_PRODUCTEXTENSION'}; } | ||||
| 605 | $extension = lc($extension); | ||||
| 606 | $downloadname =~ s/\{extension\}/$extension/; | ||||
| 607 | |||||
| 608 | my $os = ""; | ||||
| 609 | if ( $installer::globals::iswindowsbuild ) { $os = "windows"; } | ||||
| 610 | elsif ( $installer::globals::issolarissparcbuild ) { $os = "solsparc"; } | ||||
| 611 | elsif ( $installer::globals::issolarisx86build ) { $os = "solia"; } | ||||
| 612 | elsif ( $installer::globals::islinuxbuild ) { $os = "linux"; } | ||||
| 613 | elsif ( $installer::globals::compiler =~ /unxmacxi/ ) { $os = "macosxi"; } | ||||
| 614 | elsif ( $installer::globals::compiler =~ /unxmacxp/ ) { $os = "macosxp"; } | ||||
| 615 | else { $os = ""; } | ||||
| 616 | $downloadname =~ s/\{os\}/$os/; | ||||
| 617 | |||||
| 618 | my $languages = $$languagestringref; | ||||
| 619 | $downloadname =~ s/\{languages\}/$languages/; | ||||
| 620 | |||||
| 621 | $downloadname =~ s/\-\-\-/\-/g; | ||||
| 622 | $downloadname =~ s/\-\-/\-/g; | ||||
| 623 | $downloadname =~ s/\-\s*$//; | ||||
| 624 | |||||
| 625 | return $downloadname; | ||||
| 626 | } | ||||
| 627 | |||||
| 628 | ############################################################## | ||||
| 629 | # Returning the complete block in all languages | ||||
| 630 | # for a specified string | ||||
| 631 | ############################################################## | ||||
| 632 | |||||
| 633 | sub get_language_block_from_language_file | ||||
| 634 | { | ||||
| 635 | my ($searchstring, $languagefile) = @_; | ||||
| 636 | |||||
| 637 | my @language_block = (); | ||||
| 638 | |||||
| 639 | for ( my $i = 0; $i <= $#{$languagefile}; $i++ ) | ||||
| 640 | { | ||||
| 641 | if ( ${$languagefile}[$i] =~ /^\s*\[\s*$searchstring\s*\]\s*$/ ) | ||||
| 642 | { | ||||
| 643 | my $counter = $i; | ||||
| 644 | |||||
| 645 | push(@language_block, ${$languagefile}[$counter]); | ||||
| 646 | $counter++; | ||||
| 647 | |||||
| 648 | while (( $counter <= $#{$languagefile} ) && (!( ${$languagefile}[$counter] =~ /^\s*\[/ ))) | ||||
| 649 | { | ||||
| 650 | push(@language_block, ${$languagefile}[$counter]); | ||||
| 651 | $counter++; | ||||
| 652 | } | ||||
| 653 | |||||
| 654 | last; | ||||
| 655 | } | ||||
| 656 | } | ||||
| 657 | |||||
| 658 | return \@language_block; | ||||
| 659 | } | ||||
| 660 | |||||
| 661 | ############################################################## | ||||
| 662 | # Returning a specific language string from the block | ||||
| 663 | # of all translations | ||||
| 664 | ############################################################## | ||||
| 665 | |||||
| 666 | sub get_language_string_from_language_block | ||||
| 667 | { | ||||
| 668 | my ($language_block, $language) = @_; | ||||
| 669 | |||||
| 670 | my $newstring = ""; | ||||
| 671 | |||||
| 672 | for ( my $i = 0; $i <= $#{$language_block}; $i++ ) | ||||
| 673 | { | ||||
| 674 | if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) | ||||
| 675 | { | ||||
| 676 | $newstring = $1; | ||||
| 677 | last; | ||||
| 678 | } | ||||
| 679 | } | ||||
| 680 | |||||
| 681 | if ( $newstring eq "" ) | ||||
| 682 | { | ||||
| 683 | $language = "en-US"; # defaulting to english | ||||
| 684 | |||||
| 685 | for ( my $i = 0; $i <= $#{$language_block}; $i++ ) | ||||
| 686 | { | ||||
| 687 | if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) | ||||
| 688 | { | ||||
| 689 | $newstring = $1; | ||||
| 690 | last; | ||||
| 691 | } | ||||
| 692 | } | ||||
| 693 | } | ||||
| 694 | |||||
| 695 | return $newstring; | ||||
| 696 | } | ||||
| 697 | |||||
| 698 | #################################################### | ||||
| 699 | # Creating download installation sets | ||||
| 700 | #################################################### | ||||
| 701 | |||||
| 702 | sub create_download_sets | ||||
| 703 | { | ||||
| 704 | my ($installationdir, $includepatharrayref, $allvariableshashref, $downloadname, $languagestringref, $languagesarrayref) = @_; | ||||
| 705 | |||||
| 706 | my $infoline = ""; | ||||
| 707 | |||||
| 708 | my $force = 1; # print this message even in 'quiet' mode | ||||
| 709 | installer::logger::print_message( "\n******************************************\n" ); | ||||
| 710 | installer::logger::print_message( "... creating download installation set ...\n", $force ); | ||||
| 711 | installer::logger::print_message( "******************************************\n" ); | ||||
| 712 | |||||
| 713 | installer::logger::include_header_into_logfile("Creating download installation sets:"); | ||||
| 714 | |||||
| 715 | my $firstdir = $installationdir; | ||||
| 716 | installer::pathanalyzer::get_path_from_fullqualifiedname(\$firstdir); | ||||
| 717 | |||||
| 718 | my $lastdir = $installationdir; | ||||
| 719 | installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$lastdir); | ||||
| 720 | |||||
| 721 | if ( $installer::globals::iswindowsbuild && $lastdir =~ /\./ ) { $lastdir =~ s/\./_download_inprogress\./ } | ||||
| 722 | else { $lastdir = $lastdir . "_download_inprogress"; } | ||||
| 723 | |||||
| 724 | # removing existing directory "_native_packed_inprogress" and "_native_packed_witherror" and "_native_packed" | ||||
| 725 | |||||
| 726 | my $downloaddir = $firstdir . $lastdir; | ||||
| 727 | |||||
| 728 | if ( -d $downloaddir ) { installer::systemactions::remove_complete_directory($downloaddir); } | ||||
| 729 | |||||
| 730 | my $olddir = $downloaddir; | ||||
| 731 | $olddir =~ s/_inprogress/_witherror/; | ||||
| 732 | if ( -d $olddir ) { installer::systemactions::remove_complete_directory($olddir); } | ||||
| 733 | |||||
| 734 | $olddir = $downloaddir; | ||||
| 735 | $olddir =~ s/_inprogress//; | ||||
| 736 | if ( -d $olddir ) { installer::systemactions::remove_complete_directory($olddir); } | ||||
| 737 | |||||
| 738 | # creating the new directory | ||||
| 739 | |||||
| 740 | installer::systemactions::create_directory($downloaddir); | ||||
| 741 | |||||
| 742 | $installer::globals::saveinstalldir = $downloaddir; | ||||
| 743 | |||||
| 744 | # evaluating the name of the download file | ||||
| 745 | |||||
| 746 | if ( $allvariableshashref->{'OOODOWNLOADNAME'} ) { $downloadname = set_download_filename($languagestringref, $allvariableshashref); } | ||||
| 747 | else { $downloadname = resolve_variables_in_downloadname($allvariableshashref, $downloadname, $languagestringref); } | ||||
| 748 | |||||
| 749 | if ( ! $installer::globals::iswindowsbuild ) # Unix specific part | ||||
| 750 | { | ||||
| 751 | |||||
| 752 | # getting the path of the getuid.so (only required for Solaris and Linux) | ||||
| 753 | my $getuidlibrary = ""; | ||||
| 754 | if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild )) { $getuidlibrary = get_path_for_library($includepatharrayref); } | ||||
| 755 | |||||
| 756 | if ( $allvariableshashref->{'OOODOWNLOADNAME'} ) | ||||
| 757 | { | ||||
| 758 | my $downloadfile = create_tar_gz_file_from_directory($installationdir, $getuidlibrary, $downloaddir, $downloadname); | ||||
| 759 | } | ||||
| 760 | else | ||||
| 761 | { | ||||
| 762 | # find and read setup script template | ||||
| 763 | my $scriptfilename = "downloadscript.sh"; | ||||
| 764 | |||||
| 765 | my $scriptref = ""; | ||||
| 766 | |||||
| 767 | if ( $installer::globals::include_paths_read ) | ||||
| 768 | { | ||||
| 769 | $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0); | ||||
| 770 | } | ||||
| 771 | else | ||||
| 772 | { | ||||
| 773 | $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$scriptfilename, $includepatharrayref, 0); | ||||
| 774 | } | ||||
| 775 | |||||
| 776 | if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "create_download_sets"); } | ||||
| 777 | my $scriptfile = installer::files::read_file($$scriptref); | ||||
| 778 | |||||
| 779 | $infoline = "Found script file $scriptfilename: $$scriptref \n"; | ||||
| 780 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 781 | |||||
| 782 | # add product name into script template | ||||
| 783 | put_productname_into_script($scriptfile, $allvariableshashref); | ||||
| 784 | |||||
| 785 | # replace linenumber in script template | ||||
| 786 | put_linenumber_into_script($scriptfile); | ||||
| 787 | |||||
| 788 | # create tar file | ||||
| 789 | my $temporary_tarfile_name = $downloaddir . $installer::globals::separator . 'installset.tar'; | ||||
| 790 | my $size = tar_package($installationdir, $temporary_tarfile_name, $getuidlibrary); | ||||
| 791 | installer::exiter::exit_program("ERROR: Could not create tar file $temporary_tarfile_name!", "create_download_sets") unless $size; | ||||
| 792 | |||||
| 793 | # calling sum to determine checksum and size of the tar file | ||||
| 794 | my $sumout = call_sum($temporary_tarfile_name); | ||||
| 795 | |||||
| 796 | # writing checksum and size into scriptfile | ||||
| 797 | put_checksum_and_size_into_script($scriptfile, $sumout); | ||||
| 798 | |||||
| 799 | # saving the script file | ||||
| 800 | my $newscriptfilename = determine_scriptfile_name($downloadname); | ||||
| 801 | $newscriptfilename = save_script_file($downloaddir, $newscriptfilename, $scriptfile); | ||||
| 802 | |||||
| 803 | installer::logger::print_message( "... including installation set into $newscriptfilename ... \n" ); | ||||
| 804 | # Append tar file to script | ||||
| 805 | include_tar_into_script($newscriptfilename, $temporary_tarfile_name); | ||||
| 806 | } | ||||
| 807 | } | ||||
| 808 | |||||
| 809 | return $downloaddir; | ||||
| 810 | } | ||||
| 811 | |||||
| 812 | 1 | 8µs | 1; | ||
sub installer::download::CORE:match; # opcode | |||||
sub installer::download::CORE:subst; # opcode |