Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/media.pm |
Statements | Executed 190716 statements in 160ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 158ms | 159ms | create_media_table | installer::windows::media::
1 | 1 | 1 | 393µs | 396µs | BEGIN@30 | installer::windows::media::
1 | 1 | 1 | 48µs | 56µs | generate_cab_filename_for_some_cabs | installer::windows::media::
3 | 3 | 1 | 20µs | 20µs | CORE:subst (opcode) | installer::windows::media::
1 | 1 | 1 | 17µs | 17µs | get_maximum_filenumber | installer::windows::media::
1 | 1 | 1 | 17µs | 17µs | get_media_diskid | installer::windows::media::
1 | 1 | 1 | 14µs | 16µs | BEGIN@33 | installer::windows::media::
1 | 1 | 1 | 14µs | 16µs | BEGIN@31 | installer::windows::media::
1 | 1 | 1 | 14µs | 16µs | BEGIN@32 | installer::windows::media::
1 | 1 | 1 | 5µs | 5µs | get_media_volumelabel | installer::windows::media::
1 | 1 | 1 | 4µs | 4µs | get_media_source | installer::windows::media::
1 | 1 | 1 | 4µs | 4µs | get_media_diskprompt | installer::windows::media::
0 | 0 | 0 | 0s | 0s | generate_cab_filename | installer::windows::media::
0 | 0 | 0 | 0s | 0s | get_cabfilename | installer::windows::media::
0 | 0 | 0 | 0s | 0s | get_last_sequence | installer::windows::media::
0 | 0 | 0 | 0s | 0s | get_media_cabinet | installer::windows::media::
0 | 0 | 0 | 0s | 0s | get_media_lastsequence | installer::windows::media::
0 | 0 | 0 | 0s | 0s | set_cabinetfilename_for_component_in_file_collector | installer::windows::media::
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::windows::media; | ||||
29 | |||||
30 | 2 | 66µs | 2 | 399µs | # spent 396µs (393+3) within installer::windows::media::BEGIN@30 which was called:
# once (393µs+3µs) by installer::BEGIN@73 at line 30 # spent 396µs making 1 call to installer::windows::media::BEGIN@30
# spent 3µs making 1 call to UNIVERSAL::import |
31 | 2 | 54µs | 2 | 18µs | # spent 16µs (14+2) within installer::windows::media::BEGIN@31 which was called:
# once (14µs+2µs) by installer::BEGIN@73 at line 31 # spent 16µs making 1 call to installer::windows::media::BEGIN@31
# spent 2µs making 1 call to UNIVERSAL::import |
32 | 2 | 51µs | 2 | 19µs | # spent 16µs (14+3) within installer::windows::media::BEGIN@32 which was called:
# once (14µs+3µs) by installer::BEGIN@73 at line 32 # spent 16µs making 1 call to installer::windows::media::BEGIN@32
# spent 3µs making 1 call to UNIVERSAL::import |
33 | 2 | 2.20ms | 2 | 18µs | # spent 16µs (14+2) within installer::windows::media::BEGIN@33 which was called:
# once (14µs+2µs) by installer::BEGIN@73 at line 33 # spent 16µs making 1 call to installer::windows::media::BEGIN@33
# spent 2µs making 1 call to UNIVERSAL::import |
34 | |||||
35 | ############################################################## | ||||
36 | # Returning the diskid for the media table. | ||||
37 | ############################################################## | ||||
38 | |||||
39 | sub get_media_diskid | ||||
40 | # spent 17µs within installer::windows::media::get_media_diskid which was called:
# once (17µs+0s) by installer::windows::media::create_media_table at line 287 | ||||
41 | 1 | 2µs | my ($id) = @_; | ||
42 | |||||
43 | 1 | 28µs | return $id; | ||
44 | } | ||||
45 | |||||
46 | ############################################################## | ||||
47 | # Returning the lastsequence for the media table. | ||||
48 | ############################################################## | ||||
49 | |||||
50 | sub get_media_lastsequence | ||||
51 | { | ||||
52 | my ($fileref) = @_; | ||||
53 | |||||
54 | return $fileref->{'sequencenumber'}; | ||||
55 | } | ||||
56 | |||||
57 | ############################################################## | ||||
58 | # Returning the diskprompt for the media table. | ||||
59 | ############################################################## | ||||
60 | |||||
61 | sub get_media_diskprompt | ||||
62 | # spent 4µs within installer::windows::media::get_media_diskprompt which was called:
# once (4µs+0s) by installer::windows::media::create_media_table at line 289 | ||||
63 | 1 | 9µs | return 1; | ||
64 | } | ||||
65 | |||||
66 | ############################################################## | ||||
67 | # Returning the cabinet file name for the media table. | ||||
68 | ############################################################## | ||||
69 | |||||
70 | sub get_media_cabinet | ||||
71 | { | ||||
72 | my ($id) = @_; | ||||
73 | |||||
74 | my $number = 1000 + $id; | ||||
75 | my $filename = "f_" . $number . ".cab"; | ||||
76 | |||||
77 | if ( $installer::globals::include_cab_in_msi ) { $filename = "\#" . $filename; } | ||||
78 | |||||
79 | return $filename; | ||||
80 | } | ||||
81 | |||||
82 | ############################################################## | ||||
83 | # Returning the volumelabel for the media table. | ||||
84 | ############################################################## | ||||
85 | |||||
86 | sub get_media_volumelabel | ||||
87 | # spent 5µs within installer::windows::media::get_media_volumelabel which was called:
# once (5µs+0s) by installer::windows::media::create_media_table at line 291 | ||||
88 | 1 | 11µs | return "DISK1"; | ||
89 | } | ||||
90 | |||||
91 | ############################################################## | ||||
92 | # Returning the source for the media table. | ||||
93 | ############################################################## | ||||
94 | |||||
95 | sub get_media_source | ||||
96 | # spent 4µs within installer::windows::media::get_media_source which was called:
# once (4µs+0s) by installer::windows::media::create_media_table at line 292 | ||||
97 | 1 | 10µs | return ""; | ||
98 | } | ||||
99 | |||||
100 | ############################################################## | ||||
101 | # Saving the cabinet file name in the files collector. | ||||
102 | # This is useful for making a list to connect the | ||||
103 | # source of each file with the destination cabinet file. | ||||
104 | ############################################################## | ||||
105 | |||||
106 | sub set_cabinetfilename_for_component_in_file_collector | ||||
107 | { | ||||
108 | my ($cabinetfilename, $filesref, $componentname, $max) = @_; | ||||
109 | |||||
110 | for ( my $i = 0; $i <= $max; $i++ ) | ||||
111 | { | ||||
112 | my $onefile = ${$filesref}[$i]; | ||||
113 | my $component = $onefile->{'componentname'}; | ||||
114 | |||||
115 | if ( $component eq $componentname ) | ||||
116 | { | ||||
117 | my $cabinet = ""; | ||||
118 | |||||
119 | if ( $onefile->{'cabinet'} ) { $cabinet = $onefile->{'cabinet'}; } | ||||
120 | |||||
121 | if ( $cabinet eq "" ) | ||||
122 | { | ||||
123 | $onefile->{'cabinet'} = $cabinetfilename; | ||||
124 | } | ||||
125 | } | ||||
126 | } | ||||
127 | } | ||||
128 | |||||
129 | ################################################# | ||||
130 | # Creating the cab file name dynamically | ||||
131 | ################################################# | ||||
132 | |||||
133 | sub generate_cab_filename_for_some_cabs | ||||
134 | # spent 56µs (48+8) within installer::windows::media::generate_cab_filename_for_some_cabs which was called:
# once (48µs+8µs) by installer::windows::media::create_media_table at line 290 | ||||
135 | 1 | 2µs | my ( $allvariables, $id ) = @_; | ||
136 | |||||
137 | 1 | 5µs | my $name = $allvariables->{'PRODUCTNAME'}; | ||
138 | |||||
139 | 1 | 3µs | $name = lc($name); | ||
140 | 1 | 21µs | 1 | 5µs | $name =~ s/\.//g; # spent 5µs making 1 call to installer::windows::media::CORE:subst |
141 | 1 | 9µs | 1 | 3µs | $name =~ s/\s//g; # spent 3µs making 1 call to installer::windows::media::CORE:subst |
142 | |||||
143 | # possibility to overwrite the name with variable CABFILENAME | ||||
144 | 1 | 2µs | if ( $allvariables->{'CABFILENAME'} ) { $name = $allvariables->{'CABFILENAME'}; } | ||
145 | |||||
146 | 1 | 7µs | $name = $name . $id . ".cab"; | ||
147 | |||||
148 | 1 | 3µs | if ( $installer::globals::include_cab_in_msi ) { $name = "\#" . $name; } | ||
149 | |||||
150 | 1 | 11µs | return $name; | ||
151 | } | ||||
152 | |||||
153 | ################################################# | ||||
154 | # Creating the cab file name for cab files | ||||
155 | # defined in packages. | ||||
156 | ################################################# | ||||
157 | |||||
158 | sub get_cabfilename | ||||
159 | { | ||||
160 | my ($name) = @_; | ||||
161 | |||||
162 | if ( $installer::globals::include_cab_in_msi ) { $name = "\#" . $name; } | ||||
163 | |||||
164 | return $name; | ||||
165 | } | ||||
166 | |||||
167 | ################################################# | ||||
168 | # Creating the cab file name dynamically | ||||
169 | ################################################# | ||||
170 | |||||
171 | sub generate_cab_filename | ||||
172 | { | ||||
173 | my ( $allvariables ) = @_; | ||||
174 | |||||
175 | my $name = $allvariables->{'PRODUCTNAME'}; | ||||
176 | |||||
177 | $name = lc($name); | ||||
178 | $name =~ s/\.//g; | ||||
179 | $name =~ s/\s//g; | ||||
180 | |||||
181 | # possibility to overwrite the name with variable CABFILENAME | ||||
182 | if ( $allvariables->{'CABFILENAME'} ) { $name = $allvariables->{'CABFILENAME'}; } | ||||
183 | |||||
184 | $name = $name . ".cab"; | ||||
185 | |||||
186 | if ( $installer::globals::include_cab_in_msi ) { $name = "\#" . $name; } | ||||
187 | |||||
188 | return $name; | ||||
189 | } | ||||
190 | |||||
191 | sub get_maximum_filenumber | ||||
192 | # spent 17µs within installer::windows::media::get_maximum_filenumber which was called:
# once (17µs+0s) by installer::windows::media::create_media_table at line 254 | ||||
193 | 1 | 2µs | my ($allfiles, $maxcabfilenumber) = @_; | ||
194 | |||||
195 | 1 | 600ns | my $maxfile = 0; | ||
196 | |||||
197 | 1 | 5µs | while ( ! ( $allfiles%$maxcabfilenumber == 0 )) | ||
198 | { | ||||
199 | $allfiles++; | ||||
200 | } | ||||
201 | |||||
202 | 1 | 3µs | $maxfile = $allfiles / $maxcabfilenumber; | ||
203 | |||||
204 | 1 | 2µs | $maxfile++; # for securitry | ||
205 | |||||
206 | 1 | 12µs | return $maxfile; | ||
207 | } | ||||
208 | |||||
209 | ################################################################################# | ||||
210 | # Setting the last sequence for the cabinet files | ||||
211 | ################################################################################# | ||||
212 | |||||
213 | sub get_last_sequence | ||||
214 | { | ||||
215 | my ( $cabfilename, $alludpatelastsequences ) = @_; | ||||
216 | |||||
217 | my $sequence = 0; | ||||
218 | |||||
219 | if (( $installer::globals::updatedatabase ) && ( exists($alludpatelastsequences->{$cabfilename}) )) | ||||
220 | { | ||||
221 | $sequence = $alludpatelastsequences->{$cabfilename}; | ||||
222 | } | ||||
223 | else | ||||
224 | { | ||||
225 | $sequence = $installer::globals::lastsequence{$cabfilename}; | ||||
226 | } | ||||
227 | |||||
228 | return $sequence; | ||||
229 | } | ||||
230 | |||||
231 | ################################################################################# | ||||
232 | # Creating the file Media.idt dynamically | ||||
233 | # Content: | ||||
234 | # DiskId LastSequence DiskPrompt Cabinet VolumeLabel Source | ||||
235 | # Idea: Every component is packed into each own cab file | ||||
236 | ################################################################################# | ||||
237 | |||||
238 | sub create_media_table | ||||
239 | # spent 159ms (158+1.22) within installer::windows::media::create_media_table which was called:
# once (158ms+1.22ms) by installer::run at line 1511 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
240 | 1 | 6µs | my ($filesref, $basedir, $allvariables, $alludpatelastsequences, $allupdatediskids) = @_; | ||
241 | |||||
242 | 1 | 2µs | my @mediatable = (); | ||
243 | |||||
244 | 1 | 2µs | my $diskid = 0; | ||
245 | |||||
246 | 1 | 7µs | 1 | 29µs | installer::windows::idtglobal::write_idt_header(\@mediatable, "media"); # spent 29µs making 1 call to installer::windows::idtglobal::write_idt_header |
247 | |||||
248 | 1 | 2µs | if ( $installer::globals::fix_number_of_cab_files ) | ||
249 | { | ||||
250 | # number of cabfiles | ||||
251 | 1 | 2µs | my $maxcabfilenumber = $installer::globals::number_of_cabfiles; | ||
252 | 1 | 4µs | if ( $allvariables->{'CABFILENUMBER'} ) { $maxcabfilenumber = $allvariables->{'CABFILENUMBER'}; } | ||
253 | 1 | 4µs | my $allfiles = $#{$filesref} + 1; | ||
254 | 1 | 5µs | 1 | 17µs | my $maxfilenumber = get_maximum_filenumber($allfiles, $maxcabfilenumber); # spent 17µs making 1 call to installer::windows::media::get_maximum_filenumber |
255 | 1 | 500ns | my $cabfilenumber = 0; | ||
256 | 1 | 500ns | my $cabfull = 0; | ||
257 | 1 | 500ns | my $counter = 0; | ||
258 | |||||
259 | # Sorting of files collector files required ! | ||||
260 | # Attention: The order in the cab file is not guaranteed (especially in udpate process) | ||||
261 | |||||
262 | 1 | 13.8ms | for ( my $i = 0; $i <= $#{$filesref}; $i++ ) | ||
263 | { | ||||
264 | 15888 | 9.16ms | if (( $counter >= $maxfilenumber ) || ( $i == $#{$filesref} )) { $cabfull = 1; } | ||
265 | |||||
266 | 15888 | 5.94ms | $counter++; # counting the files in the cab file | ||
267 | |||||
268 | 15888 | 7.83ms | my $onefile = ${$filesref}[$i]; | ||
269 | 15888 | 11.3ms | my $nextfile = ${$filesref}[$i+1]; | ||
270 | |||||
271 | 15888 | 7.18ms | my $filecomponent = ""; | ||
272 | 15888 | 6.18ms | my $nextcomponent = ""; | ||
273 | |||||
274 | 15888 | 10.6ms | if ( $onefile->{'componentname'} ) { $filecomponent = $onefile->{'componentname'}; } | ||
275 | 15888 | 17.3ms | if ( $nextfile->{'componentname'} ) { $nextcomponent = $nextfile->{'componentname'}; } | ||
276 | |||||
277 | 15888 | 8.87ms | if ( $filecomponent eq $nextcomponent ) # all files of one component have to be in one cab file | ||
278 | { | ||||
279 | 6481 | 3.93ms | next; # nothing to do, this is not the last file of a component | ||
280 | } | ||||
281 | |||||
282 | 9407 | 4.87ms | if ( $cabfull ) | ||
283 | { | ||||
284 | 1 | 4µs | my %media = (); | ||
285 | 1 | 500ns | $cabfilenumber++; | ||
286 | |||||
287 | 1 | 17µs | 1 | 17µs | $media{'DiskId'} = get_media_diskid($cabfilenumber); # spent 17µs making 1 call to installer::windows::media::get_media_diskid |
288 | 1 | 2µs | $media{'LastSequence'} = $i + 1; # This should be correct, also for unsorted files collectors | ||
289 | 1 | 6µs | 1 | 4µs | $media{'DiskPrompt'} = get_media_diskprompt(); # spent 4µs making 1 call to installer::windows::media::get_media_diskprompt |
290 | 1 | 7µs | 1 | 56µs | $media{'Cabinet'} = generate_cab_filename_for_some_cabs($allvariables, $cabfilenumber); # spent 56µs making 1 call to installer::windows::media::generate_cab_filename_for_some_cabs |
291 | 1 | 6µs | 1 | 5µs | $media{'VolumeLabel'} = get_media_volumelabel(); # spent 5µs making 1 call to installer::windows::media::get_media_volumelabel |
292 | 1 | 5µs | 1 | 4µs | $media{'Source'} = get_media_source(); # spent 4µs making 1 call to installer::windows::media::get_media_source |
293 | |||||
294 | 1 | 9µs | my $oneline = $media{'DiskId'} . "\t" . $media{'LastSequence'} . "\t" . $media{'DiskPrompt'} . "\t" | ||
295 | . $media{'Cabinet'} . "\t" . $media{'VolumeLabel'} . "\t" . $media{'Source'} . "\n"; | ||||
296 | |||||
297 | 1 | 2µs | push(@mediatable, $oneline); | ||
298 | |||||
299 | # Saving the cabinet file name in the file collector | ||||
300 | |||||
301 | 1 | 20µs | 1 | 12µs | $media{'Cabinet'} =~ s/^\s*\#//; # removing leading hash # spent 12µs making 1 call to installer::windows::media::CORE:subst |
302 | |||||
303 | 1 | 14.1ms | for ( my $j = 0; $j <= $i; $j++ ) | ||
304 | { | ||||
305 | 15888 | 10.9ms | my $onefile = ${$filesref}[$j]; | ||
306 | 15888 | 25.9ms | if ( ! $onefile->{'cabinet'} ) { $onefile->{'cabinet'} = $media{'Cabinet'}; } | ||
307 | } | ||||
308 | |||||
309 | 1 | 500ns | $cabfull = 0; | ||
310 | 1 | 12µs | $counter = 0; | ||
311 | } | ||||
312 | } | ||||
313 | } | ||||
314 | else | ||||
315 | { | ||||
316 | installer::exiter::exit_program("ERROR: No cab file specification in globals.pm !", "create_media_table"); | ||||
317 | } | ||||
318 | |||||
319 | # Saving the file | ||||
320 | |||||
321 | 1 | 7µs | my $mediatablename = $basedir . $installer::globals::separator . "Media.idt"; | ||
322 | 1 | 12µs | 1 | 1.07ms | installer::files::save_file($mediatablename ,\@mediatable); # spent 1.07ms making 1 call to installer::files::save_file |
323 | 1 | 4µs | my $infoline = "Created idt file: $mediatablename\n"; | ||
324 | 1 | 13µs | push(@installer::globals::logfileinfo, $infoline); | ||
325 | } | ||||
326 | |||||
327 | 1 | 7µs | 1; | ||
# spent 20µs within installer::windows::media::CORE:subst which was called 3 times, avg 7µs/call:
# once (12µs+0s) by installer::windows::media::create_media_table at line 301
# once (5µs+0s) by installer::windows::media::generate_cab_filename_for_some_cabs at line 140
# once (3µs+0s) by installer::windows::media::generate_cab_filename_for_some_cabs at line 141 |