| Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/profiles.pm |
| Statements | Executed 12238 statements in 104ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 8 | 1 | 1 | 83.1ms | 83.5ms | installer::profiles::add_profile_into_filelist |
| 1 | 1 | 1 | 12.6ms | 397ms | installer::profiles::create_profiles |
| 8 | 1 | 1 | 2.56ms | 2.56ms | installer::profiles::CORE:ftdir (opcode) |
| 8 | 1 | 1 | 2.11ms | 4.02ms | installer::profiles::sorting_profile |
| 762 | 3 | 1 | 764µs | 764µs | installer::profiles::CORE:match (opcode) |
| 8 | 1 | 1 | 421µs | 717µs | installer::profiles::include_windows_lineends |
| 1 | 1 | 1 | 369µs | 372µs | installer::profiles::BEGIN@30 |
| 74 | 1 | 1 | 297µs | 297µs | installer::profiles::CORE:subst (opcode) |
| 1 | 1 | 1 | 16µs | 17µs | installer::profiles::BEGIN@36 |
| 1 | 1 | 1 | 15µs | 18µs | installer::profiles::BEGIN@31 |
| 1 | 1 | 1 | 15µs | 18µs | installer::profiles::BEGIN@33 |
| 1 | 1 | 1 | 15µs | 66µs | installer::profiles::BEGIN@34 |
| 1 | 1 | 1 | 14µs | 16µs | installer::profiles::BEGIN@35 |
| 1 | 1 | 1 | 14µs | 17µs | installer::profiles::BEGIN@32 |
| 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::profiles; | ||||
| 29 | |||||
| 30 | 2 | 61µs | 2 | 376µs | # spent 372µs (369+4) within installer::profiles::BEGIN@30 which was called:
# once (369µs+4µs) by installer::BEGIN@52 at line 30 # spent 372µs making 1 call to installer::profiles::BEGIN@30
# spent 4µs making 1 call to UNIVERSAL::import |
| 31 | 2 | 56µs | 2 | 20µs | # spent 18µs (15+3) within installer::profiles::BEGIN@31 which was called:
# once (15µs+3µs) by installer::BEGIN@52 at line 31 # spent 18µs making 1 call to installer::profiles::BEGIN@31
# spent 3µs making 1 call to UNIVERSAL::import |
| 32 | 2 | 53µs | 2 | 20µs | # spent 17µs (14+3) within installer::profiles::BEGIN@32 which was called:
# once (14µs+3µs) by installer::BEGIN@52 at line 32 # spent 17µs making 1 call to installer::profiles::BEGIN@32
# spent 3µs making 1 call to UNIVERSAL::import |
| 33 | 2 | 53µs | 2 | 20µs | # spent 18µs (15+3) within installer::profiles::BEGIN@33 which was called:
# once (15µs+3µs) by installer::BEGIN@52 at line 33 # spent 18µs making 1 call to installer::profiles::BEGIN@33
# spent 3µs making 1 call to UNIVERSAL::import |
| 34 | 2 | 54µs | 2 | 117µs | # spent 66µs (15+51) within installer::profiles::BEGIN@34 which was called:
# once (15µs+51µs) by installer::BEGIN@52 at line 34 # spent 66µs making 1 call to installer::profiles::BEGIN@34
# spent 51µs making 1 call to Exporter::import |
| 35 | 2 | 54µs | 2 | 18µs | # spent 16µs (14+2) within installer::profiles::BEGIN@35 which was called:
# once (14µs+2µs) by installer::BEGIN@52 at line 35 # spent 16µs making 1 call to installer::profiles::BEGIN@35
# spent 2µs making 1 call to UNIVERSAL::import |
| 36 | 2 | 1.78ms | 2 | 18µs | # spent 17µs (16+1) within installer::profiles::BEGIN@36 which was called:
# once (16µs+1µs) by installer::BEGIN@52 at line 36 # spent 17µs making 1 call to installer::profiles::BEGIN@36
# spent 2µs making 1 call to UNIVERSAL::import |
| 37 | |||||
| 38 | ############################# | ||||
| 39 | # Profiles | ||||
| 40 | ############################# | ||||
| 41 | |||||
| 42 | ####################################################### | ||||
| 43 | # Sorting the content of a profile | ||||
| 44 | ####################################################### | ||||
| 45 | |||||
| 46 | sub sorting_profile | ||||
| 47 | # spent 4.02ms (2.11+1.91) within installer::profiles::sorting_profile which was called 8 times, avg 502µs/call:
# 8 times (2.11ms+1.91ms) by installer::profiles::create_profiles at line 208, avg 502µs/call | ||||
| 48 | 40 | 253µs | my ($profilesref) = @_; | ||
| 49 | |||||
| 50 | my @profile = (); | ||||
| 51 | my @definedsections = (); | ||||
| 52 | |||||
| 53 | 260 | 786µs | for ( my $i = 0; $i <= $#{$profilesref}; $i++ ) | ||
| 54 | { | ||||
| 55 | my $line = ${$profilesref}[$i]; | ||||
| 56 | |||||
| 57 | 130 | 173µs | 130 | 258µs | if ( $line =~ /^\s*(\[.*\])\s*$/ ) # this is a section (every second line) # spent 258µs making 130 calls to installer::profiles::CORE:match, avg 2µs/call |
| 58 | { | ||||
| 59 | my $section = $1; | ||||
| 60 | |||||
| 61 | 36 | 224µs | if (! grep {$_ eq $section} @definedsections) | ||
| 62 | { | ||||
| 63 | my $sectionline = $section . "\n"; | ||||
| 64 | push(@definedsections, $section); | ||||
| 65 | push(@profile, $sectionline); | ||||
| 66 | |||||
| 67 | 420 | 560µs | for ( my $j = 0; $j <= $#{$profilesref}; $j++ ) | ||
| 68 | { | ||||
| 69 | my $oneline = ${$profilesref}[$j]; | ||||
| 70 | 140 | 1.65ms | installer::remover::remove_leading_and_ending_whitespaces(\$oneline); # spent 1.65ms making 140 calls to installer::remover::remove_leading_and_ending_whitespaces, avg 12µs/call | ||
| 71 | |||||
| 72 | 130 | 158µs | if ( $oneline eq $section ) | ||
| 73 | { | ||||
| 74 | my $nextline = ${$profilesref}[$j+1]; | ||||
| 75 | push(@profile, $nextline); | ||||
| 76 | } | ||||
| 77 | } | ||||
| 78 | } | ||||
| 79 | } | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | return \@profile; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | ##################################################################### | ||||
| 86 | # Adding the newly created profile into the file list | ||||
| 87 | ##################################################################### | ||||
| 88 | |||||
| 89 | sub add_profile_into_filelist | ||||
| 90 | # spent 83.5ms (83.1+352µs) within installer::profiles::add_profile_into_filelist which was called 8 times, avg 10.4ms/call:
# 8 times (83.1ms+352µs) by installer::profiles::create_profiles at line 222, avg 10.4ms/call | ||||
| 91 | 144 | 83.1ms | my ($filesarrayref, $oneprofile, $completeprofilename, $allvariables) = @_; | ||
| 92 | |||||
| 93 | my %profile = (); | ||||
| 94 | |||||
| 95 | # Taking the base data from the "gid_File_Lib_Vcl" | ||||
| 96 | |||||
| 97 | my $vclgid = "gid_File_Lib_Vcl"; | ||||
| 98 | if ( $allvariables->{'GLOBALFILEGID'} ) { $vclgid = $allvariables->{'GLOBALFILEGID'}; } | ||||
| 99 | my ($vclfile) = grep {$_->{gid} eq $vclgid} @{$filesarrayref}; | ||||
| 100 | if (! defined $vclfile) { | ||||
| 101 | installer::exiter::exit_program("ERROR: Could not find file $vclgid in list of files!", "add_profile_into_filelist"); | ||||
| 102 | } | ||||
| 103 | |||||
| 104 | # copying all base data | ||||
| 105 | 8 | 352µs | installer::converter::copy_item_object($vclfile, \%profile); # spent 352µs making 8 calls to installer::converter::copy_item_object, avg 44µs/call | ||
| 106 | |||||
| 107 | # and overriding all new values | ||||
| 108 | |||||
| 109 | $profile{'ismultilingual'} = 0; | ||||
| 110 | $profile{'sourcepath'} = $completeprofilename; | ||||
| 111 | $profile{'Name'} = $oneprofile->{'Name'}; | ||||
| 112 | $profile{'UnixRights'} = "644"; | ||||
| 113 | $profile{'gid'} = $oneprofile->{'gid'}; | ||||
| 114 | $profile{'Dir'} = $oneprofile->{'Dir'}; | ||||
| 115 | $profile{'destination'} = $oneprofile->{'destination'}; | ||||
| 116 | $profile{'Styles'} = ""; | ||||
| 117 | if ( $oneprofile->{'Styles'} ) { $profile{'Styles'} = $oneprofile->{'Styles'}; } | ||||
| 118 | $profile{'modules'} = $oneprofile->{'ModuleID'}; # Profiles can only be added completely to a module | ||||
| 119 | |||||
| 120 | push(@{$filesarrayref}, \%profile); | ||||
| 121 | } | ||||
| 122 | |||||
| 123 | ################################################### | ||||
| 124 | # Including Windows line ends in ini files | ||||
| 125 | # Profiles on Windows shall have \r\n line ends | ||||
| 126 | ################################################### | ||||
| 127 | |||||
| 128 | sub include_windows_lineends | ||||
| 129 | # spent 717µs (421+297) within installer::profiles::include_windows_lineends which was called 8 times, avg 90µs/call:
# 8 times (421µs+297µs) by installer::profiles::create_profiles at line 210, avg 90µs/call | ||||
| 130 | 16 | 160µs | my ($onefile) = @_; | ||
| 131 | |||||
| 132 | 74 | 568µs | for ( my $i = 0; $i <= $#{$onefile}; $i++ ) | ||
| 133 | { | ||||
| 134 | 74 | 297µs | ${$onefile}[$i] =~ s/\r?\n$/\r\n/; # spent 297µs making 74 calls to installer::profiles::CORE:subst, avg 4µs/call | ||
| 135 | } | ||||
| 136 | } | ||||
| 137 | |||||
| 138 | #################################### | ||||
| 139 | # Create profiles | ||||
| 140 | #################################### | ||||
| 141 | |||||
| 142 | sub create_profiles | ||||
| 143 | # spent 397ms (12.6+385) within installer::profiles::create_profiles which was called:
# once (12.6ms+385ms) by installer::run at line 830 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
| 144 | 7 | 60µs | my ($profilesref, $profileitemsref, $filesarrayref, $languagestringref, $allvariables) = @_; | ||
| 145 | |||||
| 146 | my $infoline; | ||||
| 147 | |||||
| 148 | 1 | 280ms | my $profilesdir = installer::systemactions::create_directories("profiles", $languagestringref); # spent 280ms making 1 call to installer::systemactions::create_directories | ||
| 149 | |||||
| 150 | 1 | 149µs | installer::logger::include_header_into_logfile("Creating profiles:"); # spent 149µs making 1 call to installer::logger::include_header_into_logfile | ||
| 151 | |||||
| 152 | # Attention: The module dependencies from ProfileItems have to be ignored, because | ||||
| 153 | # the Profile has to be installed completely with all of its content and the correct name. | ||||
| 154 | # Only complete profiles can belong to a specified module, but not ProfileItems! | ||||
| 155 | |||||
| 156 | # iterating over all files | ||||
| 157 | |||||
| 158 | 144 | 3.91ms | for ( my $i = 0; $i <= $#{$profilesref}; $i++ ) | ||
| 159 | { | ||||
| 160 | my $oneprofile = ${$profilesref}[$i]; | ||||
| 161 | my $dir = $oneprofile->{'Dir'}; | ||||
| 162 | if ( $dir eq "PREDEFINED_CONFIGDIR" ) { next; } # ignoring the profile sversion file | ||||
| 163 | |||||
| 164 | my $profilegid = $oneprofile->{'gid'}; | ||||
| 165 | my $profilename = $oneprofile->{'Name'}; | ||||
| 166 | |||||
| 167 | my $localprofilesdir = $profilesdir . $installer::globals::separator . $profilegid; # uniqueness guaranteed by gid | ||||
| 168 | 16 | 9.27ms | if ( ! -d $localprofilesdir ) { installer::systemactions::create_directory($localprofilesdir); } # spent 6.71ms making 8 calls to installer::systemactions::create_directory, avg 839µs/call
# spent 2.56ms making 8 calls to installer::profiles::CORE:ftdir, avg 319µs/call | ||
| 169 | |||||
| 170 | my @onefile = (); | ||||
| 171 | my $profileempty = 1; | ||||
| 172 | |||||
| 173 | 3600 | 4.24ms | for ( my $j = 0; $j <= $#{$profileitemsref}; $j++ ) | ||
| 174 | { | ||||
| 175 | my $oneprofileitem = ${$profileitemsref}[$j]; | ||||
| 176 | |||||
| 177 | my $styles = ""; | ||||
| 178 | if ( $oneprofileitem->{'Styles'} ) { $styles = $oneprofileitem->{'Styles'}; } | ||||
| 179 | 72 | 64µs | 624 | 466µs | if ( $styles =~ /\bINIFILETABLE\b/ ) { next; } # these values are written during installation, not during packing # spent 466µs making 624 calls to installer::profiles::CORE:match, avg 747ns/call |
| 180 | |||||
| 181 | my $profileid = $oneprofileitem->{'ProfileID'}; | ||||
| 182 | |||||
| 183 | 650 | 3.52ms | if ( $profileid eq $profilegid ) | ||
| 184 | { | ||||
| 185 | my $section = $oneprofileitem->{'Section'}; | ||||
| 186 | my $key = $oneprofileitem->{'Key'}; | ||||
| 187 | my $value = $oneprofileitem->{'Value'}; | ||||
| 188 | 6500 | 3.81ms | for (my $pk = 1; $pk <= 50; $pk++) | ||
| 189 | { | ||||
| 190 | my $key = "ValueList" . $pk; | ||||
| 191 | if ( $oneprofileitem->{$key} ) | ||||
| 192 | { $value = $value . " " . $oneprofileitem->{$key} } | ||||
| 193 | } | ||||
| 194 | my $order = $oneprofileitem->{'Order'}; # ignoring order at the moment | ||||
| 195 | |||||
| 196 | my $line = "[" . $section . "]" . "\n"; | ||||
| 197 | push(@onefile, $line); | ||||
| 198 | $line = $key . "=" . $value . "\n"; | ||||
| 199 | push(@onefile, $line); | ||||
| 200 | |||||
| 201 | $profileempty = 0; | ||||
| 202 | } | ||||
| 203 | } | ||||
| 204 | |||||
| 205 | if ( $profileempty ) { next; } # ignoring empty profiles | ||||
| 206 | |||||
| 207 | # Sorting the array @onefile | ||||
| 208 | 8 | 4.02ms | my $onefileref = sorting_profile(\@onefile); # spent 4.02ms making 8 calls to installer::profiles::sorting_profile, avg 502µs/call | ||
| 209 | |||||
| 210 | 16 | 756µs | if ( $installer::globals::iswin && $^O =~ /cygwin/i) # Windows line ends only for Cygwin # spent 717µs making 8 calls to installer::profiles::include_windows_lineends, avg 90µs/call
# spent 39µs making 8 calls to installer::profiles::CORE:match, avg 5µs/call | ||
| 211 | { | ||||
| 212 | include_windows_lineends($onefileref); | ||||
| 213 | } | ||||
| 214 | |||||
| 215 | # Saving the profile as a file | ||||
| 216 | $completeprofilename = $localprofilesdir . $installer::globals::separator . $profilename; | ||||
| 217 | |||||
| 218 | 8 | 6.29ms | installer::files::save_file($completeprofilename, $onefileref); # spent 6.29ms making 8 calls to installer::files::save_file, avg 786µs/call | ||
| 219 | |||||
| 220 | # Adding the file to the filearray | ||||
| 221 | # Some data are set now, others are taken from the file "soffice.exe" ("soffice.bin") | ||||
| 222 | 8 | 83.5ms | add_profile_into_filelist($filesarrayref, $oneprofile, $completeprofilename, $allvariables); # spent 83.5ms making 8 calls to installer::profiles::add_profile_into_filelist, avg 10.4ms/call | ||
| 223 | |||||
| 224 | $infoline = "Created Profile: $completeprofilename\n"; | ||||
| 225 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 226 | } | ||||
| 227 | |||||
| 228 | $infoline = "\n"; | ||||
| 229 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 230 | } | ||||
| 231 | |||||
| 232 | |||||
| 233 | 1 | 7µs | 1; | ||
# spent 2.56ms within installer::profiles::CORE:ftdir which was called 8 times, avg 319µs/call:
# 8 times (2.56ms+0s) by installer::profiles::create_profiles at line 168, avg 319µs/call | |||||
# spent 764µs within installer::profiles::CORE:match which was called 762 times, avg 1µs/call:
# 624 times (466µs+0s) by installer::profiles::create_profiles at line 179, avg 747ns/call
# 130 times (258µs+0s) by installer::profiles::sorting_profile at line 57, avg 2µs/call
# 8 times (39µs+0s) by installer::profiles::create_profiles at line 210, avg 5µs/call | |||||
# spent 297µs within installer::profiles::CORE:subst which was called 74 times, avg 4µs/call:
# 74 times (297µs+0s) by installer::profiles::include_windows_lineends at line 134, avg 4µs/call |