← Index
NYTProf Performance Profile   « block view • line view • sub view »
For C:/lo/libo-master/solenv/bin/make_installer.pl
  Run on Mon Sep 24 00:52:54 2012
Reported on Mon Sep 24 07:34:39 2012

Filename/cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/worker.pm
StatementsExecuted 10599374 statements in 78.8s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
33628944132.9s32.9sinstaller::worker::::CORE:regcompinstaller::worker::CORE:regcomp (opcode)
298662132.6s71.6sinstaller::worker::::replace_variables_in_stringinstaller::worker::replace_variables_in_string
8116.05s6.05sinstaller::worker::::CORE:backtickinstaller::worker::CORE:backtick (opcode)
29867213.80s3.80sinstaller::worker::::CORE:sortinstaller::worker::CORE:sort (opcode)
3315193612.26s2.26sinstaller::worker::::CORE:substinstaller::worker::CORE:subst (opcode)
222372ms6.45sinstaller::worker::::generate_cygwin_pathsinstaller::worker::generate_cygwin_paths
332289ms327msinstaller::worker::::collect_all_items_with_special_flaginstaller::worker::collect_all_items_with_special_flag
111158ms176msinstaller::worker::::remove_all_items_with_special_flaginstaller::worker::remove_all_items_with_special_flag
9364861129ms129msinstaller::worker::::CORE:matchinstaller::worker::CORE:match (opcode)
111102ms401msinstaller::worker::::resolving_hidden_flaginstaller::worker::resolving_hidden_flag
11123.2ms2.67sinstaller::worker::::collect_all_files_from_includepathsinstaller::worker::collect_all_files_from_includepaths
66118.22ms8.22msinstaller::worker::::key_in_a_is_also_key_in_binstaller::worker::key_in_a_is_also_key_in_b
1116.78ms17.0msinstaller::worker::::BEGIN@32installer::worker::BEGIN@32
1115.13ms42.1msinstaller::worker::::BEGIN@35installer::worker::BEGIN@35
16214.69ms4.69msinstaller::worker::::CORE:ftfileinstaller::worker::CORE:ftfile (opcode)
24514.18ms4.18msinstaller::worker::::CORE:ftdirinstaller::worker::CORE:ftdir (opcode)
8113.74ms3.74msinstaller::worker::::CORE:unlinkinstaller::worker::CORE:unlink (opcode)
1112.53ms4.64msinstaller::worker::::set_spellcheckerlanguagesinstaller::worker::set_spellcheckerlanguages
1111.96ms2.41msinstaller::worker::::BEGIN@42installer::worker::BEGIN@42
8111.74ms1.74msinstaller::worker::::find_file_by_idinstaller::worker::find_file_by_id
1111.08ms1.44msinstaller::worker::::BEGIN@45installer::worker::BEGIN@45
111539µs1.61msinstaller::worker::::add_variables_from_inc_to_hashrefinstaller::worker::add_variables_from_inc_to_hashref
111349µs459µsinstaller::worker::::BEGIN@30installer::worker::BEGIN@30
111137µs2.56sinstaller::worker::::analyze_and_save_logfileinstaller::worker::analyze_and_save_logfile
111115µs7.38sinstaller::worker::::clean_output_treeinstaller::worker::clean_output_tree
11164µs548msinstaller::worker::::create_installation_directoryinstaller::worker::create_installation_directory
11156µs1.92msinstaller::worker::::remove_old_installation_setsinstaller::worker::remove_old_installation_sets
11130µs340µsinstaller::worker::::put_scpactions_into_installsetinstaller::worker::put_scpactions_into_installset
11123µs152µsinstaller::worker::::BEGIN@33installer::worker::BEGIN@33
11121µs23µsinstaller::worker::::BEGIN@36installer::worker::BEGIN@36
11119µs68µsinstaller::worker::::BEGIN@31installer::worker::BEGIN@31
11117µs20µsinstaller::worker::::BEGIN@37installer::worker::BEGIN@37
11117µs74µsinstaller::worker::::BEGIN@40installer::worker::BEGIN@40
11117µs20µsinstaller::worker::::BEGIN@39installer::worker::BEGIN@39
11117µs65µsinstaller::worker::::BEGIN@34installer::worker::BEGIN@34
11117µs18µsinstaller::worker::::BEGIN@43installer::worker::BEGIN@43
11116µs16µsinstaller::worker::::collect_scpactionsinstaller::worker::collect_scpactions
11116µs19µsinstaller::worker::::BEGIN@38installer::worker::BEGIN@38
11115µs17µsinstaller::worker::::BEGIN@44installer::worker::BEGIN@44
11115µs18µsinstaller::worker::::BEGIN@41installer::worker::BEGIN@41
0000s0sinstaller::worker::::add_license_into_systemintegrationpackagesinstaller::worker::add_license_into_systemintegrationpackages
0000s0sinstaller::worker::::analyze_patch_filesinstaller::worker::analyze_patch_files
0000s0sinstaller::worker::::call_suminstaller::worker::call_sum
0000s0sinstaller::worker::::call_wcinstaller::worker::call_wc
0000s0sinstaller::worker::::change_onefile_in_pkgmapinstaller::worker::change_onefile_in_pkgmap
0000s0sinstaller::worker::::collect_all_files_without_patch_flaginstaller::worker::collect_all_files_without_patch_flag
0000s0sinstaller::worker::::collect_all_items_without_special_flaginstaller::worker::collect_all_items_without_special_flag
0000s0sinstaller::worker::::collectpackagemapsinstaller::worker::collectpackagemaps
0000s0sinstaller::worker::::create_nopatchlistinstaller::worker::create_nopatchlist
0000s0sinstaller::worker::::get_first_from_listinstaller::worker::get_first_from_list
0000s0sinstaller::worker::::get_language_specific_include_pathsinstaller::worker::get_language_specific_include_paths
0000s0sinstaller::worker::::install_simpleinstaller::worker::install_simple
0000s0sinstaller::worker::::make_systemcallinstaller::worker::make_systemcall
0000s0sinstaller::worker::::prepare_windows_patchfilesinstaller::worker::prepare_windows_patchfiles
0000s0sinstaller::worker::::put_license_into_setupinstaller::worker::put_license_into_setup
0000s0sinstaller::worker::::reorg_patchfileinstaller::worker::reorg_patchfile
0000s0sinstaller::worker::::save_patchlist_fileinstaller::worker::save_patchlist_file
0000s0sinstaller::worker::::select_helppack_itemsinstaller::worker::select_helppack_items
0000s0sinstaller::worker::::select_langpack_itemsinstaller::worker::select_langpack_items
0000s0sinstaller::worker::::select_patch_itemsinstaller::worker::select_patch_items
0000s0sinstaller::worker::::select_patch_items_without_nameinstaller::worker::select_patch_items_without_name
0000s0sinstaller::worker::::set_english_licenseinstaller::worker::set_english_license
0000s0sinstaller::worker::::set_time_stampinstaller::worker::set_time_stamp
0000s0sinstaller::worker::::set_time_stamp_for_fileinstaller::worker::set_time_stamp_for_file
0000s0sinstaller::worker::::shift_file_to_endinstaller::worker::shift_file_to_end
0000s0sinstaller::worker::::shift_section_to_endinstaller::worker::shift_section_to_end
0000s0sinstaller::worker::::shuffle_arrayinstaller::worker::shuffle_array
0000s0sinstaller::worker::::tar_packageinstaller::worker::tar_package
0000s0sinstaller::worker::::write_nopatchlist_headerinstaller::worker::write_nopatchlist_header
Call graph for these subroutines as a Graphviz dot language file.
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
28package installer::worker;
29
30269µs2570µs
# spent 459µs (349+111) within installer::worker::BEGIN@30 which was called: # once (349µs+111µs) by installer::exiter::BEGIN@37 at line 30
use Cwd;
# spent 459µs making 1 call to installer::worker::BEGIN@30 # spent 110µs making 1 call to Exporter::import
31260µs2116µs
# spent 68µs (19+49) within installer::worker::BEGIN@31 which was called: # once (19µs+49µs) by installer::exiter::BEGIN@37 at line 31
use File::Copy;
# spent 68µs making 1 call to installer::worker::BEGIN@31 # spent 48µs making 1 call to Exporter::import
3223.29ms217.1ms
# spent 17.0ms (6.78+10.3) within installer::worker::BEGIN@32 which was called: # once (6.78ms+10.3ms) by installer::exiter::BEGIN@37 at line 32
use File::stat;
# spent 17.0ms making 1 call to installer::worker::BEGIN@32 # spent 7µs making 1 call to File::stat::import
33263µs2281µs
# spent 152µs (23+129) within installer::worker::BEGIN@33 which was called: # once (23µs+129µs) by installer::exiter::BEGIN@37 at line 33
use File::Temp qw(tmpnam);
# spent 152µs making 1 call to installer::worker::BEGIN@33 # spent 129µs making 1 call to Exporter::import
34254µs2114µs
# spent 65µs (17+49) within installer::worker::BEGIN@34 which was called: # once (17µs+49µs) by installer::exiter::BEGIN@37 at line 34
use File::Path;
# spent 65µs making 1 call to installer::worker::BEGIN@34 # spent 48µs making 1 call to Exporter::import
3521.09ms242.1ms
# spent 42.1ms (5.13+37.0) within installer::worker::BEGIN@35 which was called: # once (5.13ms+37.0ms) by installer::exiter::BEGIN@37 at line 35
use installer::control;
# spent 42.1ms making 1 call to installer::worker::BEGIN@35 # spent 7µs making 1 call to UNIVERSAL::import
36257µs225µs
# spent 23µs (21+2) within installer::worker::BEGIN@36 which was called: # once (21µs+2µs) by installer::exiter::BEGIN@37 at line 36
use installer::converter;
# spent 23µs making 1 call to installer::worker::BEGIN@36 # spent 2µs making 1 call to UNIVERSAL::import
37257µs222µs
# spent 20µs (17+3) within installer::worker::BEGIN@37 which was called: # once (17µs+3µs) by installer::exiter::BEGIN@37 at line 37
use installer::exiter;
# spent 20µs making 1 call to installer::worker::BEGIN@37 # spent 2µs making 1 call to UNIVERSAL::import
38256µs222µs
# spent 19µs (16+3) within installer::worker::BEGIN@38 which was called: # once (16µs+3µs) by installer::exiter::BEGIN@37 at line 38
use installer::files;
# spent 19µs making 1 call to installer::worker::BEGIN@38 # spent 2µs making 1 call to UNIVERSAL::import
39254µs222µs
# spent 20µs (17+3) within installer::worker::BEGIN@39 which was called: # once (17µs+3µs) by installer::exiter::BEGIN@37 at line 39
use installer::globals;
# spent 20µs making 1 call to installer::worker::BEGIN@39 # spent 3µs making 1 call to UNIVERSAL::import
40255µs2131µs
# spent 74µs (17+57) within installer::worker::BEGIN@40 which was called: # once (17µs+57µs) by installer::exiter::BEGIN@37 at line 40
use installer::logger;
# spent 74µs making 1 call to installer::worker::BEGIN@40 # spent 57µs making 1 call to Exporter::import
41254µs220µs
# spent 18µs (15+3) within installer::worker::BEGIN@41 which was called: # once (15µs+3µs) by installer::exiter::BEGIN@37 at line 41
use installer::pathanalyzer;
# spent 18µs making 1 call to installer::worker::BEGIN@41 # spent 3µs making 1 call to UNIVERSAL::import
4221.13ms22.41ms
# spent 2.41ms (1.96+454µs) within installer::worker::BEGIN@42 which was called: # once (1.96ms+454µs) by installer::exiter::BEGIN@37 at line 42
use installer::scpzipfiles;
# spent 2.41ms making 1 call to installer::worker::BEGIN@42 # spent 3µs making 1 call to UNIVERSAL::import
43254µs220µs
# spent 18µs (17+2) within installer::worker::BEGIN@43 which was called: # once (17µs+2µs) by installer::exiter::BEGIN@37 at line 43
use installer::scriptitems;
# spent 18µs making 1 call to installer::worker::BEGIN@43 # spent 2µs making 1 call to UNIVERSAL::import
44250µs219µs
# spent 17µs (15+2) within installer::worker::BEGIN@44 which was called: # once (15µs+2µs) by installer::exiter::BEGIN@37 at line 44
use installer::systemactions;
# spent 17µs making 1 call to installer::worker::BEGIN@44 # spent 2µs making 1 call to UNIVERSAL::import
45216.5ms21.44ms
# spent 1.44ms (1.08+354µs) within installer::worker::BEGIN@45 which was called: # once (1.08ms+354µs) by installer::exiter::BEGIN@37 at line 45
use installer::windows::language;
# spent 1.44ms making 1 call to installer::worker::BEGIN@45 # spent 3µs making 1 call to UNIVERSAL::import
46
47#################################################
48# Writing some global information into
49# the list of files without flag PATCH
50#################################################
51
52sub write_nopatchlist_header
53{
54 my ( $content ) = @_;
55
56 my @header = ();
57 my $infoline = "This is a list of files, that are defined in scp-projects without\n";
58 push(@header, $infoline);
59 $infoline = "flag \"PATCH\". Important: This does not mean in any case, that \n";
60 push(@header, $infoline);
61 $infoline = "this files are included into or excluded from a patch. \n\n";
62 push(@header, $infoline);
63 $infoline = "Exception Linux: A patch rpm is a complete rpm. This means that all \n";
64 push(@header, $infoline);
65 $infoline = "files are included into a patch rpm, if only one file of the rpm has the \n";
66 push(@header, $infoline);
67 $infoline = "style \"PATCH\". \n\n";
68 push(@header, $infoline);
69
70 for ( my $i = 0; $i <= $#header; $i++ ) { push(@{$content},$header[$i]); }
71}
72
73#################################################
74# Creating the content of the list of files
75# without flag PATCH.
76# All files are saved in
77# @{$installer::globals::nopatchfilecollector}
78#################################################
79
80sub create_nopatchlist
81{
82 my @content =();
83
84 write_nopatchlist_header(\@content);
85
86 for ( my $i = 0; $i <= $#{$installer::globals::nopatchfilecollector}; $i++ )
87 {
88 my $onefile = ${$installer::globals::nopatchfilecollector}[$i];
89 my $oneline = $onefile->{'destination'};
90 if ( $onefile->{'zipfilename'} ) { $oneline = $oneline . " (" . $onefile->{'zipfilename'} . ")"; }
91 $oneline = $oneline . "\n";
92 push(@content, $oneline);
93 }
94
95 return \@content;
96}
97
98#########################################
99# Saving the patchlist file
100#########################################
101
102sub save_patchlist_file
103{
104 my ($installlogdir, $patchlistfilename) = @_;
105
106 my $installpatchlistdir = installer::systemactions::create_directory_next_to_directory($installlogdir, "patchlist");
107 $patchlistfilename =~ s/log\_/patchfiles\_/;
108 $patchlistfilename =~ s/\.log/\.txt/;
109 installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, \@installer::globals::patchfilecollector);
110 installer::logger::print_message( "... creating patchlist file $patchlistfilename \n" );
111
112 if (( $installer::globals::patch ) && ( ! $installer::globals::creating_windows_installer_patch )) # only for non-Windows patches
113 {
114 $patchlistfilename =~ s/patchfiles\_/nopatchfiles\_/;
115 my $nopatchlist = create_nopatchlist();
116 installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, $nopatchlist);
117 installer::logger::print_message( "... creating patch exclusion file $patchlistfilename \n" );
118 }
119
120}
121
122###############################################################
123# Removing all directories of a special language
124# in the directory $basedir
125###############################################################
126
127sub remove_old_installation_sets
128
# spent 1.92ms (56µs+1.87) within installer::worker::remove_old_installation_sets which was called: # once (56µs+1.87ms) by installer::worker::create_installation_directory at line 166
{
12910473µs my ($basedir) = @_;
130
13118µs installer::logger::print_message( "... removing old installation directories ...\n" );
# spent 8µs making 1 call to installer::logger::print_message
132
133 my $removedir = $basedir;
134
1352862µs if ( -d $removedir ) { installer::systemactions::remove_complete_directory($removedir, 1); }
# spent 773µs making 1 call to installer::systemactions::remove_complete_directory # spent 89µs making 1 call to installer::worker::CORE:ftdir
136
137 # looking for non successful old installation sets
138
139 $removedir = $basedir . "_witherror";
1401168µs if ( -d $removedir ) { installer::systemactions::remove_complete_directory($removedir, 1); }
# spent 168µs making 1 call to installer::worker::CORE:ftdir
141
142 $removedir = $basedir . "_inprogress";
1431166µs if ( -d $removedir ) { installer::systemactions::remove_complete_directory($removedir, 1); }
# spent 166µs making 1 call to installer::worker::CORE:ftdir
144
145 # finally the $basedir can be created empty
146
147 if ( $installer::globals::localinstalldirset ) { installer::systemactions::create_directory_structure($basedir); }
148
1491664µs installer::systemactions::create_directory($basedir);
# spent 664µs making 1 call to installer::systemactions::create_directory
150}
151
152###############################################################
153# Creating the installation directory structure
154###############################################################
155
156sub create_installation_directory
157
# spent 548ms (64µs+548) within installer::worker::create_installation_directory which was called: # once (64µs+548ms) by installer::run at line 1444 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
1581151µs my ($shipinstalldir, $languagestringref, $current_install_number_ref) = @_;
159
160 my $installdir = "";
161
162 my $languageref = $languagestringref;
163
1641410ms $installdir = installer::systemactions::create_directories("install", $languageref);
# spent 410ms making 1 call to installer::systemactions::create_directories
165118µs installer::logger::print_message( "... creating installation set in $installdir ...\n" );
# spent 18µs making 1 call to installer::logger::print_message
16611.92ms remove_old_installation_sets($installdir);
# spent 1.92ms making 1 call to installer::worker::remove_old_installation_sets
167 my $inprogressinstalldir = $installdir . "_inprogress";
1681136ms installer::systemactions::rename_directory($installdir, $inprogressinstalldir);
# spent 136ms making 1 call to installer::systemactions::rename_directory
169 $installdir = $inprogressinstalldir;
170
171 $installer::globals::saveinstalldir = $installdir; # saving directory globally, in case of exiting
172
173 return $installdir;
174}
175
176###############################################################
177# Analyzing and creating the log file
178###############################################################
179
180sub analyze_and_save_logfile
181
# spent 2.56s (137µs+2.56) within installer::worker::analyze_and_save_logfile which was called: # once (137µs+2.56s) by installer::run at line 1777 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
1821484µs my ($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number) = @_;
183
184 my $is_success = 1;
185 my $finalinstalldir = "";
186
187122µs installer::logger::print_message( "... checking log file " . $loggingdir . $installer::globals::logfilename . "\n" );
# spent 22µs making 1 call to installer::logger::print_message
188
18912.40s my $contains_error = installer::control::check_logfile(\@installer::globals::logfileinfo);
# spent 2.40s making 1 call to installer::control::check_logfile
190
191 # Dependent from the success, the installation directory can be renamed.
192
193312µs if ( $contains_error )
194 {
195 my $errordir = installer::systemactions::rename_string_in_directory($installdir, "_inprogress", "_witherror");
196 # Error output to STDERR
197 for ( my $j = 0; $j <= $#installer::globals::errorlogfileinfo; $j++ )
198 {
199 my $line = $installer::globals::errorlogfileinfo[$j];
200 $line =~ s/\s*$//g;
201 installer::logger::print_error( $line );
202 }
203 $is_success = 0;
204
205 $finalinstalldir = $errordir;
206 }
207 else
208 {
209 my $destdir = "";
210
211190.5ms $destdir = installer::systemactions::rename_string_in_directory($installdir, "_inprogress", "");
212
213 $finalinstalldir = $destdir;
214 }
215
216 # Saving the logfile in the log file directory and additionally in a log directory in the install directory
217
218 my $numberedlogfilename = $installer::globals::logfilename;
219125µs installer::logger::print_message( "... creating log file $numberedlogfilename \n" );
# spent 25µs making 1 call to installer::logger::print_message
220136.1ms installer::files::save_file($loggingdir . $numberedlogfilename, \@installer::globals::logfileinfo);
# spent 36.1ms making 1 call to installer::files::save_file
221138.3ms installer::files::save_file($installlogdir . $installer::globals::separator . $numberedlogfilename, \@installer::globals::logfileinfo);
# spent 38.3ms making 1 call to installer::files::save_file
222
223 # Saving the list of patchfiles in a patchlist directory in the install directory
224 if (( $installer::globals::patch ) || ( $installer::globals::creating_windows_installer_patch )) { installer::worker::save_patchlist_file($installlogdir, $numberedlogfilename); }
225
226 if ( $installer::globals::creating_windows_installer_patch ) { $installer::globals::creating_windows_installer_patch = 0; }
227
228 # Exiting the packaging process, if an error occurred.
229 # This is important, to get an error code "-1", if an error was found in the log file,
230 # that did not break the packaging process
231
232 if ( ! $is_success) { installer::exiter::exit_program("ERROR: Found an error in the logfile. Packaging failed.", "analyze_and_save_logfile"); }
233
234 return ($is_success, $finalinstalldir);
235}
236
237###############################################################
238# Removing all directories that are saved in the
239# global directory @installer::globals::removedirs
240###############################################################
241
242sub clean_output_tree
243
# spent 7.38s (115µs+7.38) within installer::worker::clean_output_tree which was called: # once (115µs+7.38s) by installer::run at line 1776 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
244340µs126µs installer::logger::print_message( "... cleaning the output tree ...\n" );
# spent 26µs making 1 call to installer::logger::print_message
245
24671.54ms for ( my $i = 0; $i <= $#installer::globals::removedirs; $i++ )
247 {
248216µs71.49ms if ( -d $installer::globals::removedirs[$i] )
# spent 1.49ms making 7 calls to installer::worker::CORE:ftdir, avg 213µs/call
249 {
250110µs installer::logger::print_message( "... removing directory $installer::globals::removedirs[$i] ...\n" );
# spent 10µs making 1 call to installer::logger::print_message
25117.38s installer::systemactions::remove_complete_directory($installer::globals::removedirs[$i], 1);
252 }
253 }
254
255 # Last try to remove the ship test directory
256
257 if ( $installer::globals::shiptestdirectory )
258 {
259 if ( -d $installer::globals::shiptestdirectory )
260 {
261 my $infoline = "Last try to remove $installer::globals::shiptestdirectory . \n";
262 push(@installer::globals::logfileinfo, $infoline);
263 my $systemcall = "rmdir $installer::globals::shiptestdirectory";
264 my $returnvalue = system($systemcall);
265 }
266 }
267}
268
269###########################################################
270# Setting one language in the language independent
271# array of include paths with $(LANG)
272###########################################################
273
274sub get_language_specific_include_paths
275{
276 my ( $patharrayref, $onelanguage ) = @_;
277
278 my @patharray = ();
279
280 for ( my $i = 0; $i <= $#{$patharrayref}; $i++ )
281 {
282 my $line = ${$patharrayref}[$i];
283 $line =~ s/\$\(LANG\)/$onelanguage/g;
284 push(@patharray ,$line);
285 }
286
287 return \@patharray;
288}
289
290##############################################################
291# Collecting all items with a defined flag
292##############################################################
293
294sub collect_all_items_with_special_flag
295
# spent 327ms (289+37.9) within installer::worker::collect_all_items_with_special_flag which was called 3 times, avg 109ms/call: # once (146ms+19.7ms) by installer::windows::assembly::create_msiassembly_table at line 158 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/assembly.pm # once (143ms+18.1ms) by installer::run at line 1473 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm # once (693µs+145µs) by installer::run at line 1480 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
2961235.7ms my ($itemsref, $flag) = @_;
297
298 my @allitems = ();
299
300127452291ms for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
301 {
302 my $oneitem = ${$itemsref}[$i];
303 my $styles = "";
304 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} };
305
3066372637.9ms if ( $styles =~ /\b$flag\b/ )
# spent 22.5ms making 31863 calls to installer::worker::CORE:regcomp, avg 707ns/call # spent 15.4ms making 31863 calls to installer::worker::CORE:match, avg 483ns/call
307 {
308 push( @allitems, $oneitem );
309 }
310 }
311
312 return \@allitems;
313}
314
315##############################################################
316# Collecting all files without patch flag in
317# $installer::globals::nopatchfilecollector
318##############################################################
319
320sub collect_all_files_without_patch_flag
321{
322 my ($filesref) = @_;
323
324 my $newfiles = collect_all_items_without_special_flag($filesref, "PATCH");
325
326 for ( my $i = 0; $i <= $#{$newfiles}; $i++ ) { push(@{$installer::globals::nopatchfilecollector}, ${$newfiles}[$i]); }
327}
328
329##############################################################
330# Collecting all items without a defined flag
331##############################################################
332
333sub collect_all_items_without_special_flag
334{
335 my ($itemsref, $flag) = @_;
336
337 my @allitems = ();
338
339 for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
340 {
341 my $oneitem = ${$itemsref}[$i];
342 my $styles = "";
343 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} };
344
345 if ( !( $styles =~ /\b$flag\b/ ))
346 {
347 push( @allitems, $oneitem );
348 }
349 }
350
351 return \@allitems;
352}
353
354##############################################################
355# Removing all items with a defined flag from collector
356##############################################################
357
358sub remove_all_items_with_special_flag
359
# spent 176ms (158+18.0) within installer::worker::remove_all_items_with_special_flag which was called: # once (158ms+18.0ms) by installer::run at line 1477 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
360425.6ms my ($itemsref, $flag) = @_;
361
362 my @allitems = ();
363
36479476150ms for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
365 {
366 my $oneitem = ${$itemsref}[$i];
367 my $styles = "";
368 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} };
3693643µs3179418.0ms if ( $styles =~ /\b$flag\b/ )
# spent 11.1ms making 15897 calls to installer::worker::CORE:regcomp, avg 696ns/call # spent 6.97ms making 15897 calls to installer::worker::CORE:match, avg 438ns/call
370 {
371 my $infoline = "Attention: Removing from collector: $oneitem->{'Name'} !\n";
372 push( @installer::globals::logfileinfo, $infoline);
373 if ( $flag eq "BINARYTABLE_ONLY" ) { push(@installer::globals::binarytableonlyfiles, $oneitem); }
374 next;
375 }
376 push( @allitems, $oneitem );
377 }
378
379 return \@allitems;
380}
381
382###########################################################
383# Mechanism for simple installation without packing
384###########################################################
385
386sub install_simple ($$$$$$)
387{
388 my ($packagename, $languagestring, $directoriesarray, $filesarray, $linksarray, $unixlinksarray) = @_;
389
390 installer::logger::print_message( "... installing module $packagename ...\n" );
391
392 my $destdir = $installer::globals::destdir;
393 my @lines = ();
394
395 installer::logger::print_message( "DestDir: $destdir \n" );
396 installer::logger::print_message( "Rootpath: $installer::globals::rootpath \n" );
397
398 `mkdir -p $destdir` if $destdir ne "";
399 `mkdir -p $destdir$installer::globals::rootpath`;
400
401 # Create Directories
402 for ( my $i = 0; $i <= $#{$directoriesarray}; $i++ )
403 {
404 my $onedir = ${$directoriesarray}[$i];
405 my $dir = "";
406
407 if ( $onedir->{'Dir'} ) { $dir = $onedir->{'Dir'}; }
408
409 if ((!($dir =~ /\bPREDEFINED_/ )) || ( $dir =~ /\bPREDEFINED_PROGDIR\b/ ))
410 {
411 my $hostname = $onedir->{'HostName'};
412
413 # ignore '.' subdirectories
414 next if ( $hostname =~ m/\.$/ );
415 # remove './' from the path
416 $hostname =~ s/\.\///g;
417
418 # printf "mkdir $destdir$hostname\n";
419 mkdir $destdir . $hostname;
420 push @lines, "%dir " . $hostname . "\n";
421 }
422 }
423
424 for ( my $i = 0; $i <= $#{$filesarray}; $i++ )
425 {
426 my $onefile = ${$filesarray}[$i];
427 my $unixrights = $onefile->{'UnixRights'};
428 my $destination = $onefile->{'destination'};
429 my $sourcepath = $onefile->{'sourcepath'};
430
431 # This is necessary to install SDK that includes files with $ in its name
432 # Otherwise, the following shell commands does not work and the file list
433 # is not correct
434 $destination =~ s/\$\$/\$/;
435 $sourcepath =~ s/\$\$/\$/;
436
437 # remove './' from the path
438 $sourcepath =~ s/\.\///g;
439 $destination =~ s/\.\///g;
440
441 push @lines, "$destination\n";
442 if(-d "$destdir$destination"){
443 rmtree("$destdir$destination");
444 }
445 if(-e "$destdir$destination") {
446 unlink "$destdir$destination";
447 }
448
449 copy ("$sourcepath", "$destdir$destination") || die "Can't copy file: $sourcepath -> $destdir$destination $!";
450 my $sourcestat = stat($sourcepath);
451 utime ($sourcestat->atime, $sourcestat->mtime, "$destdir$destination");
452 chmod (oct($unixrights), "$destdir$destination") || die "Can't change permissions: $!";
453 push @lines, "$destination\n";
454 }
455
456 for ( my $i = 0; $i <= $#{$linksarray}; $i++ )
457 {
458 my $onelink = ${$linksarray}[$i];
459 my $destination = $onelink->{'destination'};
460 my $destinationfile = $onelink->{'destinationfile'};
461
462 if(-e "$destdir$destination") {
463 unlink "$destdir$destination";
464 }
465 symlink ("$destinationfile", "$destdir$destination") || die "Can't create symlink: $!";
466 push @lines, "$destination\n";
467 }
468
469 for ( my $i = 0; $i <= $#{$unixlinksarray}; $i++ )
470 {
471 my $onelink = ${$unixlinksarray}[$i];
472 my $target = $onelink->{'Target'};
473 my $destination = $onelink->{'destination'};
474 my $cmd = "ln -sf '$target' '$destdir$destination'";
475
476 system($cmd) && die "Failed \"$cmd\"";
477 push @lines, "$destination\n";
478 }
479
480 if ( $destdir ne "" )
481 {
482 my $filelist;
483 my $fname = $installer::globals::destdir . "/$packagename";
484 open ($filelist, ">$fname") || die "Can't open $fname: $!";
485 print $filelist @lines;
486 close ($filelist);
487 }
488
489}
490
491###########################################################
492# Selecting patch items
493###########################################################
494
495sub select_patch_items
496{
497 my ( $itemsref, $itemname ) = @_;
498
499 installer::logger::include_header_into_logfile("Selecting items for patches. Item: $itemname");
500
501 my @itemsarray = ();
502
503 for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
504 {
505 my $oneitem = ${$itemsref}[$i];
506
507 my $name = $oneitem->{'Name'};
508 if (( $name =~ /\bLICENSE/ ) || ( $name =~ /\bREADME/ ))
509 {
510 push(@itemsarray, $oneitem);
511 next;
512 }
513
514 # Items with style "PATCH" have to be included into the patch
515 my $styles = "";
516 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
517 if ( $styles =~ /\bPATCH\b/ ) { push(@itemsarray, $oneitem); }
518 }
519
520 return \@itemsarray;
521}
522
523###########################################################
524# Selecting patch items
525###########################################################
526
527sub select_patch_items_without_name
528{
529 my ( $itemsref, $itemname ) = @_;
530
531 installer::logger::include_header_into_logfile("Selecting RegistryItems for patches");
532
533 my @itemsarray = ();
534
535 for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
536 {
537 my $oneitem = ${$itemsref}[$i];
538
539 # Items with style "PATCH" have to be included into the patch
540 my $styles = "";
541 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
542 if ( $styles =~ /\bPATCH\b/ ) { push(@itemsarray, $oneitem); }
543 }
544
545 return \@itemsarray;
546}
547
548###########################################################
549# Selecting langpack items
550###########################################################
551
552sub select_langpack_items
553{
554 my ( $itemsref, $itemname ) = @_;
555
556 installer::logger::include_header_into_logfile("Selecting RegistryItems for Language Packs");
557
558 my @itemsarray = ();
559
560 for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
561 {
562 my $oneitem = ${$itemsref}[$i];
563
564 # Items with style "LANGUAGEPACK" have to be included into the patch
565 my $styles = "";
566 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
567 if (( $styles =~ /\bLANGUAGEPACK\b/ ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { push(@itemsarray, $oneitem); }
568 }
569
570 return \@itemsarray;
571}
572
573###########################################################
574# Selecting helppack items
575###########################################################
576
577sub select_helppack_items
578{
579 my ( $itemsref, $itemname ) = @_;
580
581 installer::logger::include_header_into_logfile("Selecting RegistryItems for Help Packs");
582
583 my @itemsarray = ();
584
585 for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
586 {
587 my $oneitem = ${$itemsref}[$i];
588
589 # Items with style "HELPPACK" have to be included into the patch
590 my $styles = "";
591 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
592 if (( $styles =~ /\bHELPPACK\b/ ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) { push(@itemsarray, $oneitem); }
593 }
594
595 return \@itemsarray;
596}
597
598###########################################################
599# Searching if LICENSE and README, which are not removed
600# in select_patch_items are really needed for the patch.
601# If not, they are removed now.
602###########################################################
603
604sub analyze_patch_files
605{
606 my ( $filesref ) = @_;
607
608 installer::logger::include_header_into_logfile("Analyzing patch files");
609
610 my @filesarray = ();
611
612 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
613 {
614 my $onefile = ${$filesref}[$i];
615 my $styles = "";
616 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
617 if ( !( $styles =~ /\bPATCH\b/) ) { next; } # removing all files without flag PATCH (LICENSE, README, ...)
618
619 if ( $installer::globals::iswindowsbuild )
620 {
621 # all files of the Windows patch belong to the root module
622 $onefile->{'modules'} = $installer::globals::rootmodulegid;
623 }
624
625 push(@filesarray, $onefile);
626 }
627
628 return \@filesarray;
629}
630
631###########################################################
632# reorganizing the patchfile content,
633# sorting for directory to decrease the file size
634###########################################################
635
636sub reorg_patchfile
637{
638 my ($patchfiles, $patchfiledirectories) = @_;
639
640 my @patchfilesarray = ();
641 my $line = "";
642 my $directory = "";
643
644 # iterating over all directories, writing content into new patchfiles list
645
646 for ( my $i = 0; $i <= $#{$patchfiledirectories}; $i++ )
647 {
648 $directory = ${$patchfiledirectories}[$i];
649 $line = "[" . $directory . "]" . "\n";
650 push(@patchfilesarray, $line);
651
652 for ( my $j = 0; $j <= $#{$patchfiles}; $j++ )
653 {
654 if ( ${$patchfiles}[$j] =~ /^\s*(.*?)\s*\tXXXXX\t\Q$directory\E\s*$/ )
655 {
656 $line = $1 . "\n";
657 push(@patchfilesarray, $line);
658 }
659 }
660 }
661
662 return \@patchfilesarray;
663}
664
665###########################################################
666# One special file has to be the last in patchfile.txt.
667# Controlling this file, guarantees, that all files were
668# patch correctly. Using version.ini makes it easy to
669# control this by looking into the about box
670# -> shifting one section to the end
671###########################################################
672
673sub shift_section_to_end
674{
675 my ($patchfilelist) = @_;
676
677 my @patchfile = ();
678 my @lastsection = ();
679 my $lastsection = "program";
680 my $notlastsection = "Basis\\program";
681 my $record = 0;
682
683 for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
684 {
685 my $line = ${$patchfilelist}[$i];
686
687 if (( $record ) && ( $line =~ /^\s*\[/ )) { $record = 0; }
688
689 if (( $line =~ /^\s*\[\Q$lastsection\E\\\]\s*$/ ) && ( ! ( $line =~ /\Q$notlastsection\E\\\]\s*$/ ))) { $record = 1; }
690
691 if ( $record ) { push(@lastsection, $line); }
692 else { push(@patchfile, $line); }
693 }
694
695 if ( $#lastsection > -1 )
696 {
697 for ( my $i = 0; $i <= $#lastsection; $i++ )
698 {
699 push(@patchfile, $lastsection[$i]);
700 }
701 }
702
703 return \@patchfile;
704}
705
706###########################################################
707# One special file has to be the last in patchfile.txt.
708# Controlling this file, guarantees, that all files were
709# patch correctly. Using version.ini makes it easy to
710# control this by looking into the about box
711# -> shifting one file of the last section to the end
712###########################################################
713
714sub shift_file_to_end
715{
716 my ($patchfilelist) = @_;
717
718 my @patchfile = ();
719 my $lastfilename = "version.ini";
720 my $lastfileline = "";
721 my $foundfile = 0;
722
723 # Only searching this file in the last section
724 my $lastsectionname = "";
725
726 for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
727 {
728 my $line = ${$patchfilelist}[$i];
729 if ( $line =~ /^\s*\[(.*?)\]\s*$/ ) { $lastsectionname = $1; }
730 }
731
732 my $record = 0;
733 for ( my $i = 0; $i <= $#{$patchfilelist}; $i++ )
734 {
735 my $line = ${$patchfilelist}[$i];
736
737 if ( $line =~ /^\s*\[\Q$lastsectionname\E\]\s*$/ ) { $record = 1; }
738
739 if (( $line =~ /^\s*\"\Q$lastfilename\E\"\=/ ) && ( $record ))
740 {
741 $lastfileline = $line;
742 $foundfile = 1;
743 $record = 0;
744 next;
745 }
746
747 push(@patchfile, $line);
748 }
749
750 if ( $foundfile ) { push(@patchfile, $lastfileline); }
751
752 return \@patchfile;
753}
754
755###########################################################
756# Renaming Windows files in Patch and creating file
757# patchfiles.txt
758###########################################################
759
760sub prepare_windows_patchfiles
761{
762 my ( $filesref, $languagestringref, $allvariableshashref ) = @_;
763
764 my @patchfiles = ();
765 my %patchfiledirectories = ();
766 my $patchfilename = "patchlist.txt";
767 my $patchfilename2 = "patchmsi.dll";
768
769 if ( ! $allvariableshashref->{'WINDOWSPATCHLEVEL'} ) { installer::exiter::exit_program("ERROR: No Windows patch level defined in list file (WINDOWSPATCHLEVEL) !", "prepare_windows_patchfiles"); }
770 my $windowspatchlevel = $installer::globals::buildid;
771
772 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
773 {
774 my $onefile = ${$filesref}[$i];
775
776 my $filename = $onefile->{'Name'};
777 if (( $filename eq $patchfilename ) || ( $filename eq $patchfilename2 )) { next; }
778
779 my $styles = "";
780 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
781 if ( $styles =~ /\bDONTRENAMEINPATCH\b/ ) { next; }
782
783 # special handling for files with flag DONTSHOW. This files get the extension ".dontshow" to be filtered by dialogs.
784 my $localwindowspatchlevel = $windowspatchlevel;
785 if ( $styles =~ /\bDONTSHOW\b/ ) { $localwindowspatchlevel = $localwindowspatchlevel . "\.dontshow"; }
786
787 my $olddestination = $onefile->{'destination'};
788 my $newdestination = $olddestination . "." . $localwindowspatchlevel;
789 my $localfilename = $olddestination;
790 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$localfilename); # file name part
791 my $line = "\"" . $localfilename . "\"" . "=" . "\"" . "\." . $localwindowspatchlevel . "\"";
792 $onefile->{'destination'} = $newdestination;
793
794 my $newfilename = $onefile->{'Name'} . "." . $localwindowspatchlevel;
795 $onefile->{'Name'} = $newfilename;
796
797 # adding section information (section is the directory)
798 my $origolddestination = $olddestination;
799 installer::pathanalyzer::get_path_from_fullqualifiedname(\$olddestination); # directory part
800 if ( ! $olddestination ) { $olddestination = "_root"; }
801 if ( ! exists($patchfiledirectories{$olddestination}) ) { $patchfiledirectories{$olddestination} = 1; }
802 $line = $line . "\tXXXXX\t" . $olddestination . "\n";
803
804 push(@patchfiles, $line);
805
806 # also collecting all files from patch in @installer::globals::patchfilecollector
807 my $patchfileline = $origolddestination . "\n";
808 push(@installer::globals::patchfilecollector, $patchfileline);
809 }
810
811 my $winpatchdirname = "winpatch";
812 my $winpatchdir = installer::systemactions::create_directories($winpatchdirname, $languagestringref);
813
814 my ($patchlistfile) = grep {$_->{Name} eq $patchfilename} @{$filesref};
815 if (! defined $patchlistfile) {
816 installer::exiter::exit_program("ERROR: Could not find file $patchfilename in list of files!", "prepare_windows_patchfiles");
817 }
818
819 # reorganizing the patchfile content, sorting for directory to decrease the file size
820 my $sorteddirectorylist = [ sort keys %patchfiledirectories ];
821 my $patchfilelist = reorg_patchfile(\@patchfiles, $sorteddirectorylist);
822
823 # shifting version.ini to the end of the list, to guarantee, that all files are patched
824 # if the correct version is shown in the about box
825 $patchfilelist = shift_section_to_end($patchfilelist);
826 $patchfilelist = shift_file_to_end($patchfilelist);
827
828 # saving the file
829 $patchfilename = $winpatchdir . $installer::globals::separator . $patchfilename;
830 installer::files::save_file($patchfilename, $patchfilelist);
831
832 my $infoline = "\nCreated list of patch files: $patchfilename\n";
833 push( @installer::globals::logfileinfo, $infoline);
834
835 # and assigning the new source
836 $patchlistfile->{'sourcepath'} = $patchfilename;
837
838 # and finally checking the file size
839 if ( -f $patchfilename ) # test of existence
840 {
841 my $filesize = ( -s $patchfilename );
842 $infoline = "Size of patch file list: $filesize\n\n";
843 push( @installer::globals::logfileinfo, $infoline);
844 installer::logger::print_message( "... size of patch list file: $filesize Byte ... \n" );
845 }
846
847}
848
849###########################################################
850# Replacing %-variables with the content
851# of $allvariableshashref
852###########################################################
853
854sub replace_variables_in_string
855
# spent 71.6s (32.6+39.0) within installer::worker::replace_variables_in_string which was called 29866 times, avg 2.40ms/call: # 20274 times (22.2s+26.4s) by installer::windows::registry::get_registry_value at line 283 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/registry.pm, avg 2.40ms/call # 9592 times (10.5s+12.6s) by installer::windows::registry::get_registry_key at line 244 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/registry.pm, avg 2.40ms/call
{
856895981.41s my ( $string, $variableshashref ) = @_;
857
858597324.61s2986698.0ms if ( $string =~ /^.*\%\w+.*$/ )
# spent 98.0ms making 29866 calls to installer::worker::CORE:match, avg 3µs/call
859 {
860 my $key;
861
862 # we want to substitute FOO_BR before FOO to avoid floating _BR suffixes
863298663.80s foreach $key (sort { length ($b) <=> length ($a) } keys %{$variableshashref})
# spent 3.80s making 29866 calls to installer::worker::CORE:sort, avg 127µs/call
864 {
865994537865.7s my $value = $variableshashref->{$key};
866 $key = "\%" . $key;
867663025235.1s $string =~ s/\Q$key\E/$value/g;
# spent 32.9s making 3315126 calls to installer::worker::CORE:regcomp, avg 10µs/call # spent 2.26s making 3315126 calls to installer::worker::CORE:subst, avg 681ns/call
868 }
869 }
870
871 return $string;
872}
873
874######################################################
875# Making systemcall
876######################################################
877
878sub make_systemcall
879{
880 my ($systemcall) = @_;
881
882 my $returnvalue = system($systemcall);
883
884 my $infoline = "Systemcall: $systemcall\n";
885 push( @installer::globals::logfileinfo, $infoline);
886
887 if ($returnvalue)
888 {
889 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
890 push( @installer::globals::logfileinfo, $infoline);
891 }
892 else
893 {
894 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
895 push( @installer::globals::logfileinfo, $infoline);
896 }
897}
898
899#################################################################
900# Copying the files defined as ScpActions into the
901# installation set.
902#################################################################
903
904sub put_scpactions_into_installset
905
# spent 340µs (30+310) within installer::worker::put_scpactions_into_installset which was called: # once (30µs+310µs) by installer::run at line 1720 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
906424µs my ($installdir) = @_;
907
9081202µs installer::logger::include_header_into_logfile("Start: Copying scp action files into installation set");
# spent 202µs making 1 call to installer::logger::include_header_into_logfile
909
910 for ( my $i = 0; $i <= $#installer::globals::allscpactions; $i++ )
911 {
912 my $onescpaction = $installer::globals::allscpactions[$i];
913
914 my $subdir = "";
915 if ( $onescpaction->{'Subdir'} ) { $subdir = $onescpaction->{'Subdir'}; }
916
917 if ( $onescpaction->{'Name'} eq "loader.exe" ) { next; } # do not copy this ScpAction loader
918
919 my $destdir = $installdir;
920 $destdir =~ s/\Q$installer::globals::separator\E\s*$//;
921 if ( $subdir ) { $destdir = $destdir . $installer::globals::separator . $subdir; }
922
923 my $sourcefile = $onescpaction->{'sourcepath'};
924 my $destfile = $destdir . $installer::globals::separator . $onescpaction->{'DestinationName'};
925
926 my $styles = "";
927 if ( $onescpaction->{'Styles'} ) { $styles = $onescpaction->{'Styles'}; }
928 if (( $styles =~ /\bFILE_CAN_MISS\b/ ) && ( $sourcefile eq "" )) { next; }
929
930 if (( $subdir =~ /\// ) || ( $subdir =~ /\\/ ))
931 {
932 installer::systemactions::create_directory_structure($destdir);
933 }
934 else
935 {
936 installer::systemactions::create_directory($destdir);
937 }
938
939 installer::systemactions::copy_one_file($sourcefile, $destfile);
940
941 if ( $onescpaction->{'UnixRights'} )
942 {
943 chmod oct($onescpaction->{'UnixRights'}), $destfile;
944 }
945
946 }
947
9481108µs installer::logger::include_header_into_logfile("End: Copying scp action files into installation set");
# spent 108µs making 1 call to installer::logger::include_header_into_logfile
949
950}
951
952#################################################################
953# Collecting scp actions for all languages
954#################################################################
955
956sub collect_scpactions
957
# spent 16µs within installer::worker::collect_scpactions which was called: # once (16µs+0s) by installer::run at line 972 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
958214µs my ($allscpactions) = @_;
959
960 for ( my $i = 0; $i <= $#{$allscpactions}; $i++ )
961 {
962 push(@installer::globals::allscpactions, ${$allscpactions}[$i]);
963 }
964}
965
966###########################################################
967# Adding additional variables into the variableshashref,
968# that are defined in include files in the solver. The
969# names of the include files are stored in
970# ADD_INCLUDE_FILES (comma separated list).
971###########################################################
972
973sub add_variables_from_inc_to_hashref
974
# spent 1.61ms (539µs+1.07) within installer::worker::add_variables_from_inc_to_hashref which was called: # once (539µs+1.07ms) by installer::run at line 309 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
975420µs my ($allvariables, $includepatharrayref) = @_;
976
977 my $infoline = "";
978 my $includefilelist = $allvariables->{'ADD_INCLUDE_FILES'} || "";
979
980 for my $includefilename (split /,\s*/, $includefilelist)
981 {
98216159µs25µs $includefilename =~ s/^\s*//;
# spent 5µs making 2 calls to installer::worker::CORE:subst, avg 3µs/call
983211µs $includefilename =~ s/\s*$//;
# spent 11µs making 2 calls to installer::worker::CORE:subst, avg 5µs/call
984260µs $includefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$includefilename, $includepatharrayref, 1);
# spent 60µs making 2 calls to installer::scriptitems::get_sourcepath_from_filename_and_includepath, avg 30µs/call
985 if ( $$includefilenameref eq "" ) { installer::exiter::exit_program("Include file $includefilename not found!\nADD_INCLUDE_FILES = $allvariables->{'ADD_INCLUDE_FILES'}", "add_variables_from_inc_to_hashref"); }
986
987 $infoline = "Including inc file: $$includefilenameref \n";
988 push( @installer::globals::globallogfileinfo, $infoline);
989
9902855µs my $includefile = installer::files::read_file($$includefilenameref);
# spent 855µs making 2 calls to installer::files::read_file, avg 428µs/call
991
992122376µs for ( my $j = 0; $j <= $#{$includefile}; $j++ )
993 {
994 # Analyzing all "key=value" lines
995 my $oneline = ${$includefile}[$j];
996
997100125µs61136µs if ( $oneline =~ /^\s*(\S+)\s*\=\s*(.*?)\s*$/ ) # no white space allowed in key
# spent 136µs making 61 calls to installer::worker::CORE:match, avg 2µs/call
998 {
999 my $key = $1;
1000 my $value = $2;
1001 $allvariables->{$key} = $value;
1002 $infoline = "Setting of variable: $key = $value\n";
1003 push( @installer::globals::globallogfileinfo, $infoline);
1004 }
1005 }
1006 }
1007}
1008
1009##############################################
1010# Collecting all files from include paths
1011##############################################
1012
1013sub collect_all_files_from_includepaths
1014
# spent 2.67s (23.2ms+2.64) within installer::worker::collect_all_files_from_includepaths which was called: # once (23.2ms+2.64s) by installer::run at line 290 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
1015957µs my ($patharrayref) = @_;
1016
1017195µs installer::logger::globallog("Reading all directories: Start");
# spent 95µs making 1 call to installer::logger::globallog
1018124µs installer::logger::print_message( "... reading include paths ...\n" );
# spent 24µs making 1 call to installer::logger::print_message
1019 # empty the global
1020
1021 @installer::globals::allincludepaths =();
1022 my $infoline;
1023
1024826.28ms for ( my $i = 0; $i <= $#{$patharrayref}; $i++ )
1025 {
1026 $includepath = ${$patharrayref}[$i];
102714294µs installer::remover::remove_leading_and_ending_whitespaces(\$includepath);
# spent 294µs making 14 calls to installer::remover::remove_leading_and_ending_whitespaces, avg 21µs/call
1028
10291219µs142.26ms if ( ! -d $includepath )
# spent 2.26ms making 14 calls to installer::worker::CORE:ftdir, avg 162µs/call
1030 {
1031 $infoline = "$includepath does not exist. (Can be removed from include path list?)\n";
1032 push( @installer::globals::globallogfileinfo, $infoline);
1033 next;
1034 }
1035
1036 my @sourcefiles = ();
1037 my $pathstring = "";
1038102.64s installer::systemactions::read_full_directory($includepath, $pathstring, \@sourcefiles);
# spent 2.64s making 10 calls to installer::systemactions::read_full_directory, avg 264ms/call
1039
10407019.1ms if ( ! ( $#sourcefiles > -1 ))
1041 {
1042 $infoline = "$includepath is empty. (Can be removed from include path list?)\n";
1043 push( @installer::globals::globallogfileinfo, $infoline);
1044 }
1045 else
1046 {
1047 my $number = $#sourcefiles + 1;
1048 $infoline = "Directory $includepath contains $number files (including subdirs)\n";
1049 push( @installer::globals::globallogfileinfo, $infoline);
1050
1051 my %allfileshash = ();
1052 $allfileshash{'includepath'} = $includepath;
1053
1054 for ( my $j = 0; $j <= $#sourcefiles; $j++ )
1055 {
1056 $allfileshash{$sourcefiles[$j]} = 1;
1057 }
1058
1059 push(@installer::globals::allincludepaths, \%allfileshash);
1060 }
1061 }
1062
1063 $installer::globals::include_paths_read = 1;
1064
1065177µs installer::logger::globallog("Reading all directories: End");
# spent 77µs making 1 call to installer::logger::globallog
1066 push( @installer::globals::globallogfileinfo, "\n");
1067}
1068
1069##############################################
1070# Searching for a file with the gid
1071##############################################
1072
1073sub find_file_by_id
1074
# spent 1.74ms within installer::worker::find_file_by_id which was called 8 times, avg 218µs/call: # 8 times (1.74ms+0s) by installer::setupscript::prepare_non_advertised_files at line 429 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/setupscript.pm, avg 218µs/call
{
107548737µs my ( $filesref, $gid ) = @_;
1076
1077 my $foundfile = 0;
1078 my $onefile;
1079
108020341.01ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
1081 {
1082 $onefile = ${$filesref}[$i];
1083 my $filegid = $onefile->{'gid'};
1084
10851610µs if ( $filegid eq $gid )
1086 {
1087 $foundfile = 1;
1088 last;
1089 }
1090 }
1091
1092 if (! $foundfile ) { $onefile = ""; }
1093
1094 return $onefile;
1095}
1096
1097#########################################################
1098# Calling sum
1099#########################################################
1100
1101sub call_sum
1102{
1103 my ($filename) = @_;
1104
1105 $sumfile = "/usr/bin/sum";
1106
1107 if ( ! -f $sumfile ) { installer::exiter::exit_program("ERROR: No file /usr/bin/sum", "call_sum"); }
1108
1109 my $systemcall = "$sumfile $filename |";
1110
1111 my $sumoutput = "";
1112
1113 open (SUM, "$systemcall");
1114 $sumoutput = <SUM>;
1115 close (SUM);
1116
1117 my $returnvalue = $?; # $? contains the return value of the systemcall
1118
1119 my $infoline = "Systemcall: $systemcall\n";
1120 push( @installer::globals::logfileinfo, $infoline);
1121
1122 if ($returnvalue)
1123 {
1124 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
1125 push( @installer::globals::logfileinfo, $infoline);
1126 }
1127 else
1128 {
1129 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
1130 push( @installer::globals::logfileinfo, $infoline);
1131 }
1132
1133 return $sumoutput;
1134}
1135
1136#########################################################
1137# Calling wc
1138# wc -c pkginfo | cut -f6 -d' '
1139#########################################################
1140
1141sub call_wc
1142{
1143 my ($filename) = @_;
1144
1145 $wcfile = "/usr/bin/wc";
1146
1147 if ( ! -f $wcfile ) { installer::exiter::exit_program("ERROR: No file /usr/bin/wc", "call_wc"); }
1148
1149 my $systemcall = "$wcfile -c $filename |";
1150
1151 my $wcoutput = "";
1152
1153 open (WC, "$systemcall");
1154 $wcoutput = <WC>;
1155 close (WC);
1156
1157 my $returnvalue = $?; # $? contains the return value of the systemcall
1158
1159 my $infoline = "Systemcall: $systemcall\n";
1160 push( @installer::globals::logfileinfo, $infoline);
1161
1162 if ($returnvalue)
1163 {
1164 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
1165 push( @installer::globals::logfileinfo, $infoline);
1166 }
1167 else
1168 {
1169 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
1170 push( @installer::globals::logfileinfo, $infoline);
1171 }
1172
1173 return $wcoutput;
1174}
1175
1176##############################################
1177# Setting time stamp of copied files to avoid
1178# errors from pkgchk.
1179##############################################
1180
1181sub set_time_stamp
1182{
1183 my ($olddir, $newdir, $copyfiles) = @_;
1184
1185 for ( my $i = 0; $i <= $#{$copyfiles}; $i++ )
1186 {
1187 my $sourcefile = $olddir . $installer::globals::separator . ${$copyfiles}[$i];
1188 my $destfile = $newdir . $installer::globals::separator . ${$copyfiles}[$i];
1189
1190 my $systemcall = "touch -r $sourcefile $destfile";
1191
1192 my $returnvalue = system($systemcall);
1193
1194 my $infoline = "Systemcall: $systemcall\n";
1195 push( @installer::globals::logfileinfo, $infoline);
1196
1197 if ($returnvalue)
1198 {
1199 $infoline = "ERROR: \"$systemcall\" failed!\n";
1200 push( @installer::globals::logfileinfo, $infoline);
1201 }
1202 else
1203 {
1204 $infoline = "Success: \"$systemcall\" !\n";
1205 push( @installer::globals::logfileinfo, $infoline);
1206 }
1207 }
1208}
1209
1210#################################################
1211# Generating paths for cygwin (second version)
1212# This function generates smaller files for
1213#################################################
1214
1215sub generate_cygwin_paths
1216
# spent 6.45s (372ms+6.08) within installer::worker::generate_cygwin_paths which was called 2 times, avg 3.23s/call: # once (185ms+3.15s) by installer::windows::msiglobal::generate_cab_file_list at line 174 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/msiglobal.pm # once (188ms+2.93s) by installer::windows::file::create_files_table at line 866 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/file.pm
{
12172273.9ms my ($filesref) = @_;
1218
12192213µs installer::logger::include_timestamp_into_logfile("Starting generating cygwin paths");
# spent 213µs making 2 calls to installer::logger::include_timestamp_into_logfile, avg 107µs/call
1220
1221 my $infoline = "Generating cygwin paths (generate_cygwin_paths)\n";
1222 push( @installer::globals::logfileinfo, $infoline);
1223
1224 my $max = 5000; # number of paths in one file
1225
1226 my @pathcollector = ();
1227 my $startnumber = 0;
1228 my $counter = 0;
1229
1230127236110ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
1231 {
1232 my $line = ${$filesref}[$i]->{'sourcepath'} . "\n";
1233 push(@pathcollector, $line);
1234 $counter++;
1235
12361526.14s if (( $i == $#{$filesref} ) || ((( $counter % $max ) == 0 ) && ( $i > 0 )))
1237 {
1238 my $tmpfilename = "cygwinhelper_" . $i . ".txt";
1239 my $temppath = $installer::globals::temppath;
124016199µs $temppath =~ s/\Q$installer::globals::separator\E\s*$//;
# spent 122µs making 8 calls to installer::worker::CORE:subst, avg 15µs/call # spent 77µs making 8 calls to installer::worker::CORE:regcomp, avg 10µs/call
1241 $tmpfilename = $temppath . $installer::globals::separator . $tmpfilename;
1242 $infoline = "Creating temporary file for cygwin conversion: $tmpfilename (contains $counter paths)\n";
1243 push( @installer::globals::logfileinfo, $infoline);
124482.78ms if ( -f $tmpfilename ) { unlink $tmpfilename; }
# spent 2.78ms making 8 calls to installer::worker::CORE:ftfile, avg 348µs/call
1245
1246822.7ms installer::files::save_file($tmpfilename, \@pathcollector);
# spent 22.7ms making 8 calls to installer::files::save_file, avg 2.84ms/call
1247
1248 my $success = 0;
124986.05s my @cyg_sourcepathlist = qx{cygpath -w -f "$tmpfilename"};
# spent 6.05s making 8 calls to installer::worker::CORE:backtick, avg 756ms/call
1250 chomp @cyg_sourcepathlist;
1251
1252 # Validating the array, it has to contain the correct number of values
1253 my $new_paths = $#cyg_sourcepathlist + 1;
1254 if ( $new_paths == $counter ) { $success = 1; }
1255
12561662µs if ($success)
1257 {
1258 $infoline = "Success: Successfully converted to cygwin paths!\n";
1259 push( @installer::globals::logfileinfo, $infoline);
1260 }
1261 else
1262 {
1263 $infoline = "ERROR: Failed to convert to cygwin paths!\n";
1264 push( @installer::globals::logfileinfo, $infoline);
1265 installer::exiter::exit_program("ERROR: Failed to convert to cygwin paths!", "generate_cygwin_paths");
1266 }
1267
12686361864.8ms for ( my $j = 0; $j <= $#cyg_sourcepathlist; $j++ )
1269 {
1270 my $number = $startnumber + $j;
1271 ${$filesref}[$number]->{'cyg_sourcepath'} = $cyg_sourcepathlist[$j];
1272 }
1273
1274165.65ms if ( -f $tmpfilename ) { unlink $tmpfilename; }
# spent 3.74ms making 8 calls to installer::worker::CORE:unlink, avg 468µs/call # spent 1.91ms making 8 calls to installer::worker::CORE:ftfile, avg 238µs/call
1275
1276 @pathcollector = ();
1277 $startnumber = $startnumber + $max;
1278 $counter = 0;
1279 }
1280 }
1281
1282 # Checking existence fo cyg_sourcepath for every file
12833180942.1ms for ( my $i = 0; $i <= $#{$filesref}; $i++ )
1284 {
1285 if (( ! exists(${$filesref}[$i]->{'cyg_sourcepath'}) ) || ( ${$filesref}[$i]->{'cyg_sourcepath'} eq "" ))
1286 {
1287 $infoline = "ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}\n";
1288 push( @installer::globals::logfileinfo, $infoline);
1289 installer::exiter::exit_program("ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}!", "generate_cygwin_paths");
1290 }
1291 }
1292
12932455µs installer::logger::include_timestamp_into_logfile("Ending generating cygwin paths");
# spent 455µs making 2 calls to installer::logger::include_timestamp_into_logfile, avg 227µs/call
1294}
1295
1296################################################
1297# Files with flag HIDDEN get a dot at the
1298# beginning of the file name. This cannot be
1299# defined in scp2 project, because tooling
1300# cannot handle files with beginning dot
1301# correctly.
1302################################################
1303
1304sub resolving_hidden_flag
1305
# spent 401ms (102+299) within installer::worker::resolving_hidden_flag which was called: # once (102ms+299ms) by installer::run at line 731 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
1306817.7ms my ($filesarrayref, $variableshashref, $item, $languagestringref) = @_;
1307
1308 my $diritem = lc($item);
1309 my $infoline = "";
1310
13111291ms my $hiddendirbase = installer::systemactions::create_directories("hidden_$diritem", $languagestringref);
# spent 291ms making 1 call to installer::systemactions::create_directories
1312
13131169µs installer::logger::include_header_into_logfile("$item with flag HIDDEN:");
# spent 169µs making 1 call to installer::logger::include_header_into_logfile
1314
13156358092.7ms for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
1316 {
1317 my $onefile = ${$filesarrayref}[$i];
1318 my $styles = "";
1319
1320 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
1321
1322158958.53ms if ( $styles =~ /\bHIDDEN\b/ )
# spent 8.53ms making 15895 calls to installer::worker::CORE:match, avg 537ns/call
1323 {
1324 # Language specific subdirectory
1325
1326 my $onelanguage = $onefile->{'specificlanguage'};
1327
1328 if ($onelanguage eq "")
1329 {
1330 $onelanguage = "00"; # files without language into directory "00"
1331 }
1332
1333 my $hiddendir = $hiddendirbase . $installer::globals::separator . $onelanguage . $installer::globals::separator;
1334 installer::systemactions::create_directory($hiddendir); # creating language specific directories
1335
1336 # copy files and edit them with the variables defined in the zip.lst
1337
1338 my $onefilename = $onefile->{'Name'};
1339 my $newfilename = "\." . $onefilename;
1340 my $sourcefile = $onefile->{'sourcepath'};
1341 my $destfile = $hiddendir . $newfilename;
1342
1343 my $copysuccess = installer::systemactions::copy_one_file($sourcefile, $destfile);
1344
1345 if ( $copysuccess )
1346 {
1347 $onefile->{'sourcepath'} = $destfile;
1348 $destination = $onefile->{'destination'};
1349 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
1350 if ( $destination eq "" ) { $onefile->{'destination'} = $newfilename; }
1351 else { $onefile->{'destination'} = $destination . $installer::globals::separator . $newfilename; }
1352
1353 $infoline = "Success: Using file with flag HIDDEN from \"$onefile->{'sourcepath'}\"!\n";
1354 push( @installer::globals::logfileinfo, $infoline);
1355 }
1356 else
1357 {
1358 $infoline = "Error: Failed to copy HIDDEN file from \"$sourcefile\" to \"$destfile\"!\n";
1359 push( @installer::globals::logfileinfo, $infoline);
1360 }
1361 }
1362 }
1363
1364 $infoline = "\n";
1365 push( @installer::globals::logfileinfo, $infoline);
1366}
1367
1368################################################
1369# Controlling that all keys in hash A are
1370# also key in hash B.
1371################################################
1372
1373sub key_in_a_is_also_key_in_b
1374
# spent 8.22ms within installer::worker::key_in_a_is_also_key_in_b which was called 66 times, avg 124µs/call: # 66 times (8.22ms+0s) by installer::scriptitems::get_string_of_modulegids_for_itemgid at line 2149 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/scriptitems.pm, avg 124µs/call
{
13753302.23ms my ( $hashref_a, $hashref_b) = @_;
1376
1377 my $returnvalue = 1;
1378
1379 my $key;
1380 foreach $key ( keys %{$hashref_a} )
1381 {
138272606.14ms if ( ! exists($hashref_b->{$key}) )
1383 {
1384 print "*****\n";
1385 foreach $keyb ( keys %{$hashref_b} ) { print "$keyb : $hashref_b->{$keyb}\n"; }
1386 print "*****\n";
1387 $returnvalue = 0;
1388 }
1389 }
1390
1391 return $returnvalue;
1392}
1393
1394######################################################
1395# Getting the first entry from a list of languages
1396######################################################
1397
1398sub get_first_from_list
1399{
1400 my ( $list ) = @_;
1401
1402 my $first = $list;
1403
1404 if ( $list =~ /^\s*(.+?),(.+)\s*$/) # "?" for minimal matching
1405 {
1406 $first = $1;
1407 }
1408
1409 return $first;
1410}
1411
1412################################################
1413# Setting all spellchecker languages
1414################################################
1415
1416sub set_spellcheckerlanguages
1417
# spent 4.64ms (2.53+2.11) within installer::worker::set_spellcheckerlanguages which was called: # once (2.53ms+2.11ms) by installer::run at line 626 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
141818499µs my ( $productlanguagesarrayref, $allvariables ) = @_;
1419
1420 my %productlanguages = ();
1421 for ( my $i = 0; $i <= $#{$productlanguagesarrayref}; $i++ ) { $productlanguages{${$productlanguagesarrayref}[$i]} = 1; }
1422
1423 my $spellcheckfilename = $allvariables->{'SPELLCHECKERFILE'};
1424
1425140µs my $spellcheckfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$spellcheckfilename, "", 1);
1426
1427 if ($$spellcheckfileref eq "") { installer::exiter::exit_program("ERROR: Could not find $spellcheckfilename!", "set_spellcheckerlanguages"); }
1428
1429 my $infoline = "Using spellchecker file: $$spellcheckfileref \n";
1430 push( @installer::globals::globallogfileinfo, $infoline);
1431
14321776µs my $spellcheckfile = installer::files::read_file($$spellcheckfileref);
# spent 776µs making 1 call to installer::files::read_file
1433 my %spellcheckhash = ();
1434
1435132448µs for ( my $j = 0; $j <= $#{$spellcheckfile}; $j++ )
1436 {
1437 # Analyzing all "key=value" lines
1438 my $oneline = ${$spellcheckfile}[$j];
1439
1440216230µs66165µs if ( $oneline =~ /^\s*(\S+)\s*\=\s*\"(.*?)\"\s*$/ ) # no white space allowed in key
# spent 165µs making 66 calls to installer::worker::CORE:match, avg 3µs/call
1441 {
1442 my $onelang = $1;
1443 my $languagelist = $2;
1444
1445 # Special handling for language packs. Only include the first language of the language list.
1446 # If no spellchecker shall be included, the keyword "EMPTY" can be used.
1447
144854196µs if ( $installer::globals::languagepack )
1449 {
1450 my $first = get_first_from_list($languagelist);
1451
1452 if ( $first eq "EMPTY" ) # no spellchecker into language pack
1453 {
1454 $languagelist = "";
1455 }
1456 else
1457 {
1458 $languagelist = $first;
1459 }
1460 }
1461 else # no language pack, so EMPTY is not required
1462 {
14635431µs $languagelist =~ s/^\s*EMPTY\s*,//; # removing the entry EMPTY
# spent 31µs making 54 calls to installer::worker::CORE:subst, avg 574ns/call
1464 }
1465
1466 $spellcheckhash{$onelang} = $languagelist;
1467 }
1468 }
1469
1470 # Collecting all required languages in %installer::globals::spellcheckerlanguagehash
1471
1472 foreach my $lang (keys %productlanguages)
1473 {
1474436964µs my $languagelist = "";
14755623µs if ( exists($spellcheckhash{$lang}) ) { $languagelist = $spellcheckhash{$lang}; }
1476 else { $languagelist = ""; } # no dictionary unless defined in SPELLCHECKERFILE
1477
14781091.06ms my $langlisthash = installer::converter::convert_stringlist_into_hash(\$languagelist, ",");
# spent 1.06ms making 109 calls to installer::converter::convert_stringlist_into_hash, avg 10µs/call
147994147µs foreach my $onelang ( keys %{$langlisthash} ) { $installer::globals::spellcheckerlanguagehash{$onelang} = 1; }
1480 }
1481
1482 $installer::globals::analyze_spellcheckerlanguage = 1;
1483
1484 # Logging
1485
1486 my $langstring = "";
14874760µs132µs foreach my $lang (sort keys %installer::globals::spellcheckerlanguagehash) { $langstring = $langstring . "," . $lang }
# spent 32µs making 1 call to installer::worker::CORE:sort
148818µs $langstring =~ s/^\s*,//;
# spent 8µs making 1 call to installer::worker::CORE:subst
1489
1490 $infoline = "Collected spellchecker languages for spellchecker: $langstring \n";
1491 push( @installer::globals::globallogfileinfo, $infoline);
1492}
1493
1494################################################
1495# Including a license text into setup script
1496################################################
1497
1498sub put_license_into_setup
1499{
1500 my ($installdir, $includepatharrayref) = @_;
1501
1502 # find and read english license file
1503 my $licenselanguage = "en-US"; # always english !
1504 # my $licensefilename = "LICENSE"; # _" . $licenselanguage;
1505 my $licensefilename = "license"; # . $licenselanguage . ".txt";
1506 my $licenseincludepatharrayref = get_language_specific_include_paths($includepatharrayref, $licenselanguage);
1507
1508 my $licenseref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $licenseincludepatharrayref, 0);
1509 if ($$licenseref eq "") { installer::exiter::exit_program("ERROR: Could not find License file $licensefilename!", "put_license_into_setup"); }
1510 my $licensefile = installer::files::read_file($$licenseref);
1511
1512 # Read setup
1513 my $setupfilename = $installdir . $installer::globals::separator . "setup";
1514 my $setupfile = installer::files::read_file($setupfilename);
1515
1516 # Replacement
1517 my $infoline = "Adding licensefile into setup script\n";
1518 push( @installer::globals::logfileinfo, $infoline);
1519
1520 my $includestring = "";
1521 for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) { $includestring = $includestring . ${$licensefile}[$i]; }
1522 for ( my $i = 0; $i <= $#{$setupfile}; $i++ ) { ${$setupfile}[$i] =~ s/LICENSEFILEPLACEHOLDER/$includestring/; }
1523
1524 # Write setup
1525 installer::files::save_file($setupfilename, $setupfile);
1526}
1527
1528#########################################################
1529# Create a tar file from the binary package
1530#########################################################
1531
1532sub tar_package
1533{
1534 my ( $installdir, $packagename, $tarfilename, $getuidlibrary) = @_;
1535
1536 my $ldpreloadstring = "";
1537 if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; }
1538
1539 my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - $packagename > $tarfilename";
1540
1541 my $returnvalue = system($systemcall);
1542
1543 my $infoline = "Systemcall: $systemcall\n";
1544 push( @installer::globals::logfileinfo, $infoline);
1545
1546 if ($returnvalue)
1547 {
1548 $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
1549 push( @installer::globals::logfileinfo, $infoline);
1550 }
1551 else
1552 {
1553 $infoline = "Success: Executed \"$systemcall\" successfully!\n";
1554 push( @installer::globals::logfileinfo, $infoline);
1555 }
1556
1557 chmod 0775, $tarfilename;
1558
1559 my $fulltarfile = $installdir . $installer::globals::separator . $tarfilename;
1560 my $filesize = ( -s $fulltarfile );
1561
1562 return $filesize;
1563}
1564
1565#########################################################
1566# Shuffle an array (Fisher Yates shuffle)
1567#########################################################
1568
1569sub shuffle_array
1570{
1571 my ( $arrayref ) = @_;
1572
1573 my $i = @$arrayref;
1574 while (--$i)
1575 {
1576 my $j = int rand ($i+1);
1577 @$arrayref[$i,$j] = @$arrayref[$j,$i];
1578 }
1579}
1580
1581################################################
1582# Defining the English license text to add
1583# it into Solaris packages.
1584################################################
1585
1586sub set_english_license
1587{
1588 my $additional_license_name = $installer::globals::englishsolarislicensename; # always the English file
1589 my $licensefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$additional_license_name, "" , 0);
1590 if ( $$licensefileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find license file $additional_license_name!", "set_english_license"); }
1591 $installer::globals::englishlicenseset = 1;
1592 $installer::globals::englishlicense = installer::files::read_file($$licensefileref);
1593 installer::scpzipfiles::replace_all_ziplistvariables_in_file($installer::globals::englishlicense, $variableshashref);
1594}
1595
1596##############################################
1597# Setting time stamp of copied files to avoid
1598# errors from pkgchk.
1599##############################################
1600
1601sub set_time_stamp_for_file
1602{
1603 my ($sourcefile, $destfile) = @_;
1604
1605 my $systemcall = "touch -r $sourcefile $destfile";
1606
1607 my $returnvalue = system($systemcall);
1608
1609 my $infoline = "Systemcall: $systemcall\n";
1610 push( @installer::globals::logfileinfo, $infoline);
1611
1612 if ($returnvalue)
1613 {
1614 $infoline = "ERROR: \"$systemcall\" failed!\n";
1615 push( @installer::globals::logfileinfo, $infoline);
1616 }
1617 else
1618 {
1619 $infoline = "Success: \"$systemcall\" !\n";
1620 push( @installer::globals::logfileinfo, $infoline);
1621 }
1622}
1623
1624##############################################
1625# Setting checksum and wordcount for changed
1626# pkginfo file into pkgmap.
1627##############################################
1628
1629sub change_onefile_in_pkgmap
1630{
1631 my ($pkgmapfile, $fullfilename, $shortfilename) = @_;
1632
1633 # 1 i pkginfo 442 34577 1166716297
1634 # ->
1635 # 1 i pkginfo 443 34737 1166716297
1636 #
1637 # wc -c pkginfo | cut -f6 -d' ' -> 442 (variable)
1638 # sum pkginfo | cut -f1 -d' ' -> 34577 (variable)
1639 # grep 'pkginfo' pkgmap | cut -f6 -d' ' -> 1166716297 (fix)
1640
1641 my $checksum = call_sum($fullfilename);
1642 if ( $checksum =~ /^\s*(\d+)\s+.*$/ ) { $checksum = $1; }
1643
1644 my $wordcount = call_wc($fullfilename);
1645 if ( $wordcount =~ /^\s*(\d+)\s+.*$/ ) { $wordcount = $1; }
1646
1647 for ( my $i = 0; $i <= $#{$pkgmapfile}; $i++ )
1648 {
1649 if ( ${$pkgmapfile}[$i] =~ /(^.*\b\Q$shortfilename\E\b\s+)(\d+)(\s+)(\d+)(\s+)(\d+)(\s*$)/ )
1650 {
1651 my $newline = $1 . $wordcount . $3 . $checksum . $5 . $6 . $7;
1652 ${$pkgmapfile}[$i] = $newline;
1653 last;
1654 }
1655 }
1656}
1657
1658################################################
1659# Adding the content of the English license
1660# file into the system integration packages.
1661################################################
1662
1663sub add_license_into_systemintegrationpackages
1664{
1665 my ($destdir, $packages) = @_;
1666
1667 for ( my $i = 0; $i <= $#{$packages}; $i++ )
1668 {
1669 my $copyrightfilename = ${$packages}[$i] . $installer::globals::separator . "install" . $installer::globals::separator . "copyright";
1670 if ( ! -f $copyrightfilename ) { installer::exiter::exit_program("ERROR: Could not find license file in system integration package: $copyrightfilename!", "add_license_into_systemintegrationpackages"); }
1671 my $copyrightfile = installer::files::read_file($copyrightfilename);
1672
1673 # Saving time stamp of old copyrightfile
1674 my $savcopyrightfilename = $copyrightfilename . ".sav";
1675 installer::systemactions::copy_one_file($copyrightfilename, $savcopyrightfilename);
1676 set_time_stamp_for_file($copyrightfilename, $savcopyrightfilename); # now $savcopyrightfile has the time stamp of $copyrightfile
1677
1678 # Adding license content to copyright file
1679 push(@{$copyrightfile}, "\n");
1680 for ( my $i = 0; $i <= $#{$installer::globals::englishlicense}; $i++ ) { push(@{$copyrightfile}, ${$installer::globals::englishlicense}[$i]); }
1681 installer::files::save_file($copyrightfilename, $copyrightfile);
1682
1683 # Setting the old time stamp saved with $savcopyrightfilename
1684 set_time_stamp_for_file($savcopyrightfilename, $copyrightfilename); # now $copyrightfile has the time stamp of $savcopyrightfile
1685 unlink($savcopyrightfilename);
1686
1687 # Changing content of copyright file in pkgmap
1688 my $pkgmapfilename = ${$packages}[$i] . $installer::globals::separator . "pkgmap";
1689 if ( ! -f $pkgmapfilename ) { installer::exiter::exit_program("ERROR: Could not find pkgmap in system integration package: $pkgmapfilename!", "add_license_into_systemintegrationpackages"); }
1690 my $pkgmap = installer::files::read_file($pkgmapfilename);
1691 change_onefile_in_pkgmap($pkgmap, $copyrightfilename, "copyright");
1692 installer::files::save_file($pkgmapfilename, $pkgmap);
1693 }
1694}
1695
1696#########################################################
1697# Collecting all pkgmap files from an installation set
1698#########################################################
1699
1700sub collectpackagemaps
1701{
1702 my ( $installdir, $languagestringref, $allvariables ) = @_;
1703
1704 installer::logger::include_header_into_logfile("Collecing all packagemaps (pkgmap):");
1705
1706 my $pkgmapdir = installer::systemactions::create_directories("pkgmap", $languagestringref);
1707 my $subdirname = $allvariables->{'UNIXPRODUCTNAME'} . "_pkgmaps";
1708 my $pkgmapsubdir = $pkgmapdir . $installer::globals::separator . $subdirname;
1709 if ( -d $pkgmapsubdir ) { installer::systemactions::remove_complete_directory($pkgmapsubdir); }
1710 if ( ! -d $pkgmapsubdir ) { installer::systemactions::create_directory($pkgmapsubdir); }
1711
1712 $installdir =~ s/\/\s*$//;
1713 # Collecting all packages in $installdir and its sub package ("packages")
1714 my $searchdir = $installdir . $installer::globals::separator . $installer::globals::epmoutpath;
1715
1716 my $allpackages = installer::systemactions::get_all_directories_without_path($searchdir);
1717
1718 for ( my $i = 0; $i <= $#{$allpackages}; $i++ )
1719 {
1720 my $pkgmapfile = $searchdir . $installer::globals::separator . ${$allpackages}[$i] . $installer::globals::separator . "pkgmap";
1721 my $destfilename = $pkgmapsubdir . $installer::globals::separator . ${$allpackages}[$i] . "_pkgmap";
1722 installer::systemactions::copy_one_file($pkgmapfile, $destfilename);
1723 }
1724
1725 # Create a tar gz file with all package maps
1726 my $tarfilename = $subdirname . ".tar";
1727 my $targzname = $tarfilename . ".gz";
1728 $systemcall = "cd $pkgmapdir; tar -cf - $subdirname | gzip > $targzname";
1729 make_systemcall($systemcall);
1730 installer::systemactions::remove_complete_directory($pkgmapsubdir, 1);
1731}
1732
1733110µs1;
 
# spent 6.05s within installer::worker::CORE:backtick which was called 8 times, avg 756ms/call: # 8 times (6.05s+0s) by installer::worker::generate_cygwin_paths at line 1249, avg 756ms/call
sub installer::worker::CORE:backtick; # opcode
# spent 4.18ms within installer::worker::CORE:ftdir which was called 24 times, avg 174µs/call: # 14 times (2.26ms+0s) by installer::worker::collect_all_files_from_includepaths at line 1029, avg 162µs/call # 7 times (1.49ms+0s) by installer::worker::clean_output_tree at line 248, avg 213µs/call # once (168µs+0s) by installer::worker::remove_old_installation_sets at line 140 # once (166µs+0s) by installer::worker::remove_old_installation_sets at line 143 # once (89µs+0s) by installer::worker::remove_old_installation_sets at line 135
sub installer::worker::CORE:ftdir; # opcode
# spent 4.69ms within installer::worker::CORE:ftfile which was called 16 times, avg 293µs/call: # 8 times (2.78ms+0s) by installer::worker::generate_cygwin_paths at line 1244, avg 348µs/call # 8 times (1.91ms+0s) by installer::worker::generate_cygwin_paths at line 1274, avg 238µs/call
sub installer::worker::CORE:ftfile; # opcode
# spent 129ms within installer::worker::CORE:match which was called 93648 times, avg 1µs/call: # 31863 times (15.4ms+0s) by installer::worker::collect_all_items_with_special_flag at line 306, avg 483ns/call # 29866 times (98.0ms+0s) by installer::worker::replace_variables_in_string at line 858, avg 3µs/call # 15897 times (6.97ms+0s) by installer::worker::remove_all_items_with_special_flag at line 369, avg 438ns/call # 15895 times (8.53ms+0s) by installer::worker::resolving_hidden_flag at line 1322, avg 537ns/call # 66 times (165µs+0s) by installer::worker::set_spellcheckerlanguages at line 1440, avg 3µs/call # 61 times (136µs+0s) by installer::worker::add_variables_from_inc_to_hashref at line 997, avg 2µs/call
sub installer::worker::CORE:match; # opcode
# spent 32.9s within installer::worker::CORE:regcomp which was called 3362894 times, avg 10µs/call: # 3315126 times (32.9s+0s) by installer::worker::replace_variables_in_string at line 867, avg 10µs/call # 31863 times (22.5ms+0s) by installer::worker::collect_all_items_with_special_flag at line 306, avg 707ns/call # 15897 times (11.1ms+0s) by installer::worker::remove_all_items_with_special_flag at line 369, avg 696ns/call # 8 times (77µs+0s) by installer::worker::generate_cygwin_paths at line 1240, avg 10µs/call
sub installer::worker::CORE:regcomp; # opcode
# spent 3.80s within installer::worker::CORE:sort which was called 29867 times, avg 127µs/call: # 29866 times (3.80s+0s) by installer::worker::replace_variables_in_string at line 863, avg 127µs/call # once (32µs+0s) by installer::worker::set_spellcheckerlanguages at line 1487
sub installer::worker::CORE:sort; # opcode
# spent 2.26s within installer::worker::CORE:subst which was called 3315193 times, avg 681ns/call: # 3315126 times (2.26s+0s) by installer::worker::replace_variables_in_string at line 867, avg 681ns/call # 54 times (31µs+0s) by installer::worker::set_spellcheckerlanguages at line 1463, avg 574ns/call # 8 times (122µs+0s) by installer::worker::generate_cygwin_paths at line 1240, avg 15µs/call # 2 times (11µs+0s) by installer::worker::add_variables_from_inc_to_hashref at line 983, avg 5µs/call # 2 times (5µs+0s) by installer::worker::add_variables_from_inc_to_hashref at line 982, avg 3µs/call # once (8µs+0s) by installer::worker::set_spellcheckerlanguages at line 1488
sub installer::worker::CORE:subst; # opcode
# spent 3.74ms within installer::worker::CORE:unlink which was called 8 times, avg 468µs/call: # 8 times (3.74ms+0s) by installer::worker::generate_cygwin_paths at line 1274, avg 468µs/call
sub installer::worker::CORE:unlink; # opcode