1*9780544fSAndrew Rist#**************************************************************
2*9780544fSAndrew Rist#
3*9780544fSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*9780544fSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*9780544fSAndrew Rist#  distributed with this work for additional information
6*9780544fSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*9780544fSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*9780544fSAndrew Rist#  "License"); you may not use this file except in compliance
9*9780544fSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*9780544fSAndrew Rist#
11*9780544fSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*9780544fSAndrew Rist#
13*9780544fSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*9780544fSAndrew Rist#  software distributed under the License is distributed on an
15*9780544fSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9780544fSAndrew Rist#  KIND, either express or implied.  See the License for the
17*9780544fSAndrew Rist#  specific language governing permissions and limitations
18*9780544fSAndrew Rist#  under the License.
19*9780544fSAndrew Rist#
20*9780544fSAndrew Rist#**************************************************************
21*9780544fSAndrew Rist
22*9780544fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirpackage installer::windows::file;
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse Digest::MD5;
27cdf0e10cSrcweiruse installer::existence;
28cdf0e10cSrcweiruse installer::exiter;
29cdf0e10cSrcweiruse installer::files;
30cdf0e10cSrcweiruse installer::globals;
31cdf0e10cSrcweiruse installer::logger;
32cdf0e10cSrcweiruse installer::pathanalyzer;
33cdf0e10cSrcweiruse installer::worker;
34cdf0e10cSrcweiruse installer::windows::font;
35cdf0e10cSrcweiruse installer::windows::idtglobal;
3619d58b3aSEike Rathkeuse installer::windows::msiglobal;
37cdf0e10cSrcweiruse installer::windows::language;
38cdf0e10cSrcweir
39cdf0e10cSrcweir##########################################################################
40cdf0e10cSrcweir# Assigning one cabinet file to each file. This is requrired,
41cdf0e10cSrcweir# if cabinet files shall be equivalent to packages.
42cdf0e10cSrcweir##########################################################################
43cdf0e10cSrcweir
44cdf0e10cSrcweirsub assign_cab_to_files
45cdf0e10cSrcweir{
46cdf0e10cSrcweir	my ( $filesref ) = @_;
47cdf0e10cSrcweir
48cdf0e10cSrcweir	my $infoline = "";
49cdf0e10cSrcweir
50cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$filesref}; $i++ )
51cdf0e10cSrcweir	{
52cdf0e10cSrcweir		if ( ! exists(${$filesref}[$i]->{'modules'}) ) { installer::exiter::exit_program("ERROR: No module assignment found for ${$filesref}[$i]->{'gid'} !", "assign_cab_to_files"); }
53cdf0e10cSrcweir		my $module = ${$filesref}[$i]->{'modules'};
54cdf0e10cSrcweir		# If modules contains a list of modules, only taking the first one.
55cdf0e10cSrcweir		if ( $module =~ /^\s*(.*?)\,/ ) { $module = $1; }
56cdf0e10cSrcweir
57cdf0e10cSrcweir		if ( ! exists($installer::globals::allcabinetassigns{$module}) ) { installer::exiter::exit_program("ERROR: No cabinet file assigned to module \"$module\" (${$filesref}[$i]->{'gid'}) !", "assign_cab_to_files"); }
58cdf0e10cSrcweir		${$filesref}[$i]->{'assignedcabinetfile'} = $installer::globals::allcabinetassigns{$module};
59cdf0e10cSrcweir
60cdf0e10cSrcweir		# Counting the files in each cabinet file
61cdf0e10cSrcweir		if ( ! exists($installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}) )
62cdf0e10cSrcweir		{
63cdf0e10cSrcweir			$installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}} = 1;
64cdf0e10cSrcweir		}
65cdf0e10cSrcweir		else
66cdf0e10cSrcweir		{
67cdf0e10cSrcweir			$installer::globals::cabfilecounter{${$filesref}[$i]->{'assignedcabinetfile'}}++;
68cdf0e10cSrcweir		}
69cdf0e10cSrcweir	}
70cdf0e10cSrcweir
71cdf0e10cSrcweir	# logging the number of files in each cabinet file
72cdf0e10cSrcweir
73cdf0e10cSrcweir	$infoline = "\nCabinet file content:\n";
74cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
75cdf0e10cSrcweir	my $cabfile;
76cdf0e10cSrcweir	foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
77cdf0e10cSrcweir	{
78cdf0e10cSrcweir		$infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile} files\n";
79cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
80cdf0e10cSrcweir	}
81cdf0e10cSrcweir
82cdf0e10cSrcweir	# assigning startsequencenumbers for each cab file
83cdf0e10cSrcweir
84cdf0e10cSrcweir	my $offset = 1;
85cdf0e10cSrcweir	foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
86cdf0e10cSrcweir	{
87cdf0e10cSrcweir		my $filecount = $installer::globals::cabfilecounter{$cabfile};
88cdf0e10cSrcweir		$installer::globals::cabfilecounter{$cabfile} = $offset;
89cdf0e10cSrcweir		$offset = $offset + $filecount;
90cdf0e10cSrcweir
91cdf0e10cSrcweir		$installer::globals::lastsequence{$cabfile} = $offset - 1;
92cdf0e10cSrcweir	}
93cdf0e10cSrcweir
94cdf0e10cSrcweir	# logging the start sequence numbers
95cdf0e10cSrcweir
96cdf0e10cSrcweir	$infoline = "\nCabinet file start sequences:\n";
97cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
98cdf0e10cSrcweir	foreach $cabfile ( sort keys %installer::globals::cabfilecounter )
99cdf0e10cSrcweir	{
100cdf0e10cSrcweir		$infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile}\n";
101cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
102cdf0e10cSrcweir	}
103cdf0e10cSrcweir
104cdf0e10cSrcweir	# logging the last sequence numbers
105cdf0e10cSrcweir
106cdf0e10cSrcweir	$infoline = "\nCabinet file last sequences:\n";
107cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
108cdf0e10cSrcweir	foreach $cabfile ( sort keys %installer::globals::lastsequence )
109cdf0e10cSrcweir	{
110cdf0e10cSrcweir		$infoline = "$cabfile : $installer::globals::lastsequence{$cabfile}\n";
111cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
112cdf0e10cSrcweir	}
113cdf0e10cSrcweir}
114cdf0e10cSrcweir
115cdf0e10cSrcweir##########################################################################
116cdf0e10cSrcweir# Assigning sequencenumbers to files. This is requrired,
117cdf0e10cSrcweir# if cabinet files shall be equivalent to packages.
118cdf0e10cSrcweir##########################################################################
119cdf0e10cSrcweir
120cdf0e10cSrcweirsub assign_sequencenumbers_to_files
121cdf0e10cSrcweir{
122cdf0e10cSrcweir	my ( $filesref ) = @_;
123cdf0e10cSrcweir
124cdf0e10cSrcweir	my %directaccess = ();
125cdf0e10cSrcweir	my %allassigns = ();
126cdf0e10cSrcweir
127cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$filesref}; $i++ )
128cdf0e10cSrcweir	{
129cdf0e10cSrcweir		my $onefile = ${$filesref}[$i];
130cdf0e10cSrcweir
131cdf0e10cSrcweir		# Keeping order in cabinet files
132cdf0e10cSrcweir		# -> collecting all files in one cabinet file
133cdf0e10cSrcweir		# -> sorting files and assigning numbers
134cdf0e10cSrcweir
135cdf0e10cSrcweir		# Saving counter $i for direct access into files array
136cdf0e10cSrcweir		# "destination" of the file is a unique identifier ('Name' is not unique!)
137cdf0e10cSrcweir		if ( exists($directaccess{$onefile->{'destination'}}) ) { installer::exiter::exit_program("ERROR: 'destination' at file not unique: $onefile->{'destination'}", "assign_sequencenumbers_to_files"); }
138cdf0e10cSrcweir		$directaccess{$onefile->{'destination'}} = $i;
139cdf0e10cSrcweir
140cdf0e10cSrcweir		my $cabfilename = $onefile->{'assignedcabinetfile'};
141cdf0e10cSrcweir		# collecting files in cabinet files
142cdf0e10cSrcweir		if ( ! exists($allassigns{$cabfilename}) )
143cdf0e10cSrcweir		{
144cdf0e10cSrcweir			my %onecabfile = ();
145cdf0e10cSrcweir			$onecabfile{$onefile->{'destination'}} = 1;
146cdf0e10cSrcweir			$allassigns{$cabfilename} = \%onecabfile;
147cdf0e10cSrcweir		}
148cdf0e10cSrcweir		else
149cdf0e10cSrcweir		{
150cdf0e10cSrcweir			$allassigns{$cabfilename}->{$onefile->{'destination'}} = 1;
151cdf0e10cSrcweir		}
152cdf0e10cSrcweir	}
153cdf0e10cSrcweir
154cdf0e10cSrcweir	# Sorting each hash and assigning numbers
155cdf0e10cSrcweir	# The destination of the file determines the sort order, not the filename!
156cdf0e10cSrcweir	my $cabfile;
157cdf0e10cSrcweir	foreach $cabfile ( sort keys %allassigns )
158cdf0e10cSrcweir	{
159cdf0e10cSrcweir		my $counter = $installer::globals::cabfilecounter{$cabfile};
160cdf0e10cSrcweir		my $dest;
161cdf0e10cSrcweir		foreach $dest ( sort keys %{$allassigns{$cabfile}} ) # <- sorting the destination!
162cdf0e10cSrcweir		{
163cdf0e10cSrcweir			my $directaccessnumber = $directaccess{$dest};
164cdf0e10cSrcweir			${$filesref}[$directaccessnumber]->{'assignedsequencenumber'} = $counter;
165cdf0e10cSrcweir			$counter++;
166cdf0e10cSrcweir		}
167cdf0e10cSrcweir	}
168cdf0e10cSrcweir}
169cdf0e10cSrcweir
170cdf0e10cSrcweir#########################################################
171cdf0e10cSrcweir# Create a shorter version of a long component name,
172cdf0e10cSrcweir# because maximum length in msi database is 72.
173cdf0e10cSrcweir# Attention: In multi msi installation sets, the short
174cdf0e10cSrcweir# names have to be unique over all packages, because
175cdf0e10cSrcweir# this string is used to create the globally unique id
176cdf0e10cSrcweir# -> no resetting of
177cdf0e10cSrcweir# %installer::globals::allshortcomponents
178cdf0e10cSrcweir# after a package was created.
17919d58b3aSEike Rathke# Using no counter because of reproducibility.
180cdf0e10cSrcweir#########################################################
181cdf0e10cSrcweir
182cdf0e10cSrcweirsub generate_new_short_componentname
183cdf0e10cSrcweir{
184cdf0e10cSrcweir	my ($componentname) = @_;
185cdf0e10cSrcweir
186cdf0e10cSrcweir	my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters
18719d58b3aSEike Rathke	my $subid = installer::windows::msiglobal::calculate_id($componentname, 9); # taking only the first 9 digits
18819d58b3aSEike Rathke	my $shortcomponentname = $startversion . "_" . $subid;
189cdf0e10cSrcweir
19019d58b3aSEike Rathke	if ( exists($installer::globals::allshortcomponents{$shortcomponentname}) ) { installer::exiter::exit_program("Failed to create unique component name: \"$shortcomponentname\"", "generate_new_short_componentname"); }
191cdf0e10cSrcweir
192cdf0e10cSrcweir	$installer::globals::allshortcomponents{$shortcomponentname} = 1;
193cdf0e10cSrcweir
194cdf0e10cSrcweir	return $shortcomponentname;
195cdf0e10cSrcweir}
196cdf0e10cSrcweir
197cdf0e10cSrcweir###############################################
198cdf0e10cSrcweir# Generating the component name from a file
199cdf0e10cSrcweir###############################################
200cdf0e10cSrcweir
201cdf0e10cSrcweirsub get_file_component_name
202cdf0e10cSrcweir{
203cdf0e10cSrcweir	my ($fileref, $filesref) = @_;
204cdf0e10cSrcweir
205cdf0e10cSrcweir	my $componentname = "";
206cdf0e10cSrcweir
207cdf0e10cSrcweir	# Special handling for files with ASSIGNCOMPOMENT
208cdf0e10cSrcweir
209cdf0e10cSrcweir	my $styles = "";
210cdf0e10cSrcweir	if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
211cdf0e10cSrcweir	if ( $styles =~ /\bASSIGNCOMPOMENT\b/ )
212cdf0e10cSrcweir	{
213cdf0e10cSrcweir		$componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref);
214cdf0e10cSrcweir	}
215cdf0e10cSrcweir	else
216cdf0e10cSrcweir	{
217cdf0e10cSrcweir		# In this function exists the rule to create components from files
218cdf0e10cSrcweir		# Rule:
219cdf0e10cSrcweir		# Two files get the same componentid, if:
220cdf0e10cSrcweir		# both have the same destination directory.
221cdf0e10cSrcweir		# both have the same "gid" -> both were packed in the same zip file
222cdf0e10cSrcweir		# All other files are included into different components!
223cdf0e10cSrcweir
224cdf0e10cSrcweir		# my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'};
225cdf0e10cSrcweir
226cdf0e10cSrcweir		# $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'},
227cdf0e10cSrcweir		# but can be in different subdirectories.
228cdf0e10cSrcweir		# Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh
229cdf0e10cSrcweir		# in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are
230cdf0e10cSrcweir		# converted into underline.
231cdf0e10cSrcweir
232cdf0e10cSrcweir		my $destination = $fileref->{'destination'};
233cdf0e10cSrcweir		installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
234cdf0e10cSrcweir		$destination =~ s/\s//g;
235cdf0e10cSrcweir		$destination =~ s/\\/\_/g;
236cdf0e10cSrcweir		$destination =~ s/\//\_/g;
237cdf0e10cSrcweir		$destination =~ s/\_\s*$//g;	# removing ending underline
238cdf0e10cSrcweir
239cdf0e10cSrcweir		$componentname = $fileref->{'gid'} . "__" . $destination;
240cdf0e10cSrcweir
241cdf0e10cSrcweir		# Files with different languages, need to be packed into different components.
242cdf0e10cSrcweir		# Then the installation of the language specific component is determined by a language condition.
243cdf0e10cSrcweir
244cdf0e10cSrcweir		if ( $fileref->{'ismultilingual'} )
245cdf0e10cSrcweir		{
246cdf0e10cSrcweir			my $officelanguage = $fileref->{'specificlanguage'};
247cdf0e10cSrcweir			$componentname = $componentname . "_" . $officelanguage;
248cdf0e10cSrcweir		}
249cdf0e10cSrcweir
250cdf0e10cSrcweir		$componentname = lc($componentname);	# componentnames always lowercase
251cdf0e10cSrcweir
252cdf0e10cSrcweir		$componentname =~ s/\-/\_/g;			# converting "-" to "_"
253cdf0e10cSrcweir		$componentname =~ s/\./\_/g;			# converting "-" to "_"
254cdf0e10cSrcweir
255cdf0e10cSrcweir		# Attention: Maximum length for the componentname is 72
256cdf0e10cSrcweir		# %installer::globals::allcomponents_in_this_database : resetted for each database
257cdf0e10cSrcweir		# %installer::globals::allcomponents : not resetted for each database
258cdf0e10cSrcweir		# Component strings must be unique for the complete product, because they are used for
259cdf0e10cSrcweir		# the creation of the globally unique identifier.
260cdf0e10cSrcweir
261cdf0e10cSrcweir		my $fullname = $componentname;  # This can be longer than 72
262cdf0e10cSrcweir
263cdf0e10cSrcweir		if (( exists($installer::globals::allcomponents{$fullname}) ) && ( ! exists($installer::globals::allcomponents_in_this_database{$fullname}) ))
264cdf0e10cSrcweir		{
265cdf0e10cSrcweir			# This is not allowed: One component cannot be installed with different packages.
266cdf0e10cSrcweir			installer::exiter::exit_program("ERROR: Component \"$fullname\" is already included into another package. This is not allowed.", "get_file_component_name");
267cdf0e10cSrcweir		}
268cdf0e10cSrcweir
269cdf0e10cSrcweir		if ( exists($installer::globals::allcomponents{$fullname}) )
270cdf0e10cSrcweir		{
271cdf0e10cSrcweir			$componentname = $installer::globals::allcomponents{$fullname};
272cdf0e10cSrcweir		}
273cdf0e10cSrcweir		else
274cdf0e10cSrcweir		{
27519d58b3aSEike Rathke			if ( length($componentname) > 70 )
276cdf0e10cSrcweir			{
277cdf0e10cSrcweir				$componentname = generate_new_short_componentname($componentname); # This has to be unique for the complete product, not only one package
278cdf0e10cSrcweir			}
279cdf0e10cSrcweir
280cdf0e10cSrcweir			$installer::globals::allcomponents{$fullname} = $componentname;
281cdf0e10cSrcweir			$installer::globals::allcomponents_in_this_database{$fullname} = 1;
282cdf0e10cSrcweir		}
283cdf0e10cSrcweir
284cdf0e10cSrcweir		# $componentname =~ s/gid_file_/g_f_/g;
285cdf0e10cSrcweir		# $componentname =~ s/_extra_/_e_/g;
286cdf0e10cSrcweir		# $componentname =~ s/_config_/_c_/g;
287cdf0e10cSrcweir		# $componentname =~ s/_org_openoffice_/_o_o_/g;
288cdf0e10cSrcweir		# $componentname =~ s/_program_/_p_/g;
289cdf0e10cSrcweir		# $componentname =~ s/_typedetection_/_td_/g;
290cdf0e10cSrcweir		# $componentname =~ s/_linguistic_/_l_/g;
291cdf0e10cSrcweir		# $componentname =~ s/_module_/_m_/g;
292cdf0e10cSrcweir		# $componentname =~ s/_optional_/_opt_/g;
293cdf0e10cSrcweir		# $componentname =~ s/_packages/_pack/g;
294cdf0e10cSrcweir		# $componentname =~ s/_menubar/_mb/g;
295cdf0e10cSrcweir		# $componentname =~ s/_common_/_cm_/g;
296cdf0e10cSrcweir		# $componentname =~ s/_export_/_exp_/g;
297cdf0e10cSrcweir		# $componentname =~ s/_table_/_tb_/g;
298cdf0e10cSrcweir		# $componentname =~ s/_sofficecfg_/_sc_/g;
299cdf0e10cSrcweir		# $componentname =~ s/_soffice_cfg_/_sc_/g;
300cdf0e10cSrcweir		# $componentname =~ s/_startmodulecommands_/_smc_/g;
301cdf0e10cSrcweir		# $componentname =~ s/_drawimpresscommands_/_dic_/g;
302cdf0e10cSrcweir		# $componentname =~ s/_basiccommands_/_bac_/g;
303cdf0e10cSrcweir		# $componentname =~ s/_basicidecommands_/_baic_/g;
304cdf0e10cSrcweir		# $componentname =~ s/_genericcommands_/_genc_/g;
305cdf0e10cSrcweir		# $componentname =~ s/_bibliographycommands_/_bibc_/g;
306cdf0e10cSrcweir		# $componentname =~ s/_gentiumbookbasicbolditalic_/_gbbbi_/g;
307cdf0e10cSrcweir		# $componentname =~ s/_share_/_s_/g;
308cdf0e10cSrcweir		# $componentname =~ s/_extension_/_ext_/g;
309cdf0e10cSrcweir		# $componentname =~ s/_extensions_/_exs_/g;
310cdf0e10cSrcweir		# $componentname =~ s/_modules_/_ms_/g;
311cdf0e10cSrcweir		# $componentname =~ s/_uiconfig_zip_/_ucz_/g;
312cdf0e10cSrcweir		# $componentname =~ s/_productivity_/_pr_/g;
313cdf0e10cSrcweir		# $componentname =~ s/_wizard_/_wz_/g;
314cdf0e10cSrcweir		# $componentname =~ s/_import_/_im_/g;
315cdf0e10cSrcweir		# $componentname =~ s/_javascript_/_js_/g;
316cdf0e10cSrcweir		# $componentname =~ s/_template_/_tpl_/g;
317cdf0e10cSrcweir		# $componentname =~ s/_tplwizletter_/_twl_/g;
318cdf0e10cSrcweir		# $componentname =~ s/_beanshell_/_bs_/g;
319cdf0e10cSrcweir		# $componentname =~ s/_presentation_/_bs_/g;
320cdf0e10cSrcweir		# $componentname =~ s/_columns_/_cls_/g;
321cdf0e10cSrcweir		# $componentname =~ s/_python_/_py_/g;
322cdf0e10cSrcweir
323cdf0e10cSrcweir		# $componentname =~ s/_tools/_ts/g;
324cdf0e10cSrcweir		# $componentname =~ s/_transitions/_trs/g;
325cdf0e10cSrcweir		# $componentname =~ s/_scriptbinding/_scrb/g;
326cdf0e10cSrcweir		# $componentname =~ s/_spreadsheet/_ssh/g;
327cdf0e10cSrcweir		# $componentname =~ s/_publisher/_pub/g;
328cdf0e10cSrcweir		# $componentname =~ s/_presenter/_pre/g;
329cdf0e10cSrcweir		# $componentname =~ s/_registry/_reg/g;
330cdf0e10cSrcweir
331cdf0e10cSrcweir		# $componentname =~ s/screen/sc/g;
332cdf0e10cSrcweir		# $componentname =~ s/wordml/wm/g;
333cdf0e10cSrcweir		# $componentname =~ s/openoffice/oo/g;
334cdf0e10cSrcweir	}
335cdf0e10cSrcweir
336cdf0e10cSrcweir	return $componentname;
337cdf0e10cSrcweir}
338cdf0e10cSrcweir
339cdf0e10cSrcweir####################################################################
340cdf0e10cSrcweir# Returning the component name for a defined file gid.
341cdf0e10cSrcweir# This is necessary for files with flag ASSIGNCOMPOMENT
342cdf0e10cSrcweir####################################################################
343cdf0e10cSrcweir
344cdf0e10cSrcweirsub get_component_from_assigned_file
345cdf0e10cSrcweir{
346cdf0e10cSrcweir	my ($gid, $filesref) = @_;
347cdf0e10cSrcweir
348cdf0e10cSrcweir	my $onefile = installer::existence::get_specified_file($filesref, $gid);
349cdf0e10cSrcweir	my $componentname = "";
350cdf0e10cSrcweir	if ( $onefile->{'componentname'} ) { $componentname = $onefile->{'componentname'}; }
351cdf0e10cSrcweir	else { installer::exiter::exit_program("ERROR: No component defined for file: $gid", "get_component_from_assigned_file"); }
352cdf0e10cSrcweir
353cdf0e10cSrcweir	return $componentname;
354cdf0e10cSrcweir}
355cdf0e10cSrcweir
356cdf0e10cSrcweir####################################################################
357cdf0e10cSrcweir# Generating the special filename for the database file File.idt
358cdf0e10cSrcweir# Sample: CONTEXTS, CONTEXTS1
359cdf0e10cSrcweir# This name has to be unique.
360cdf0e10cSrcweir# In most cases this is simply the filename.
361cdf0e10cSrcweir####################################################################
362cdf0e10cSrcweir
363cdf0e10cSrcweirsub generate_unique_filename_for_filetable
364cdf0e10cSrcweir{
365cdf0e10cSrcweir	my ($fileref, $component, $uniquefilenamehashref) = @_;
366cdf0e10cSrcweir
367cdf0e10cSrcweir	# This new filename has to be saved into $fileref, because this is needed to find the source.
368cdf0e10cSrcweir	# The filename sbasic.idx/OFFSETS is changed to OFFSETS, but OFFSETS is not unique.
369cdf0e10cSrcweir	# In this procedure names like OFFSETS5 are produced. And exactly this string has to be added to
370cdf0e10cSrcweir	# the array of all files.
371cdf0e10cSrcweir
372cdf0e10cSrcweir	my $uniquefilename = "";
373cdf0e10cSrcweir	my $counter = 0;
374cdf0e10cSrcweir
375cdf0e10cSrcweir	if ( $fileref->{'Name'} ) { $uniquefilename = $fileref->{'Name'}; }
376cdf0e10cSrcweir
377cdf0e10cSrcweir	installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$uniquefilename);	# making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs
378cdf0e10cSrcweir
379cdf0e10cSrcweir	# Reading unique filename with help of "Component_" in File table from old database
380cdf0e10cSrcweir	if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$component/$uniquefilename"}) ))
381cdf0e10cSrcweir	{
382cdf0e10cSrcweir		$uniquefilename = $uniquefilenamehashref->{"$component/$uniquefilename"};  # syntax of $value: ($uniquename;$shortname)
383cdf0e10cSrcweir		if ( $uniquefilename =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $uniquefilename = $1; }
384cdf0e10cSrcweir 		$lcuniquefilename = lc($uniquefilename);
385cdf0e10cSrcweir		$installer::globals::alluniquefilenames{$uniquefilename} = 1;
386cdf0e10cSrcweir		$installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
387cdf0e10cSrcweir		return $uniquefilename;
388cdf0e10cSrcweir	}
389cdf0e10cSrcweir	elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$component/$uniquefilename"}) ))
390cdf0e10cSrcweir	{
391cdf0e10cSrcweir		# If we have a FTK mapping for this component/file, use it.
392cdf0e10cSrcweir		$installer::globals::savedmapping{"$component/$uniquefilename"} =~ m/^(.*);/;
393cdf0e10cSrcweir		$uniquefilename = $1;
394cdf0e10cSrcweir 		$lcuniquefilename = lc($uniquefilename);
395cdf0e10cSrcweir		$installer::globals::alluniquefilenames{$uniquefilename} = 1;
396cdf0e10cSrcweir		$installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
397cdf0e10cSrcweir		return $uniquefilename;
398cdf0e10cSrcweir	}
399cdf0e10cSrcweir
400cdf0e10cSrcweir	$uniquefilename =~ s/\-/\_/g;		# no "-" allowed
401cdf0e10cSrcweir	$uniquefilename =~ s/\@/\_/g;		# no "@" allowed
402cdf0e10cSrcweir	$uniquefilename =~ s/\$/\_/g;		# no "$" allowed
403cdf0e10cSrcweir	$uniquefilename =~ s/^\s*\./\_/g;		# no "." at the beginning allowed allowed
404cdf0e10cSrcweir	$uniquefilename =~ s/^\s*\d/\_d/g;		# no number at the beginning allowed allowed (even file "0.gif", replacing to "_d.gif")
405cdf0e10cSrcweir	$uniquefilename =~ s/org_openoffice_/ooo_/g;	# shorten the unique file name
406cdf0e10cSrcweir
407cdf0e10cSrcweir	my $lcuniquefilename = lc($uniquefilename);	# only lowercase names
408cdf0e10cSrcweir
409cdf0e10cSrcweir	my $newname = 0;
410cdf0e10cSrcweir
411cdf0e10cSrcweir	if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
412cdf0e10cSrcweir	     ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
413cdf0e10cSrcweir	{
414cdf0e10cSrcweir		$installer::globals::alluniquefilenames{$uniquefilename} = 1;
415cdf0e10cSrcweir		$installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
416cdf0e10cSrcweir		$newname = 1;
417cdf0e10cSrcweir	}
418cdf0e10cSrcweir
419cdf0e10cSrcweir	if ( ! $newname )
420cdf0e10cSrcweir	{
421cdf0e10cSrcweir		# adding a number until the name is really unique: OFFSETS, OFFSETS1, OFFSETS2, ...
422cdf0e10cSrcweir		# But attention: Making "abc.xcu" to "abc1.xcu"
423cdf0e10cSrcweir
424cdf0e10cSrcweir		my $uniquefilenamebase = $uniquefilename;
425cdf0e10cSrcweir
426cdf0e10cSrcweir		do
427cdf0e10cSrcweir		{
428cdf0e10cSrcweir			$counter++;
429cdf0e10cSrcweir
430cdf0e10cSrcweir			if ( $uniquefilenamebase =~ /\./ )
431cdf0e10cSrcweir			{
432cdf0e10cSrcweir				$uniquefilename = $uniquefilenamebase;
433cdf0e10cSrcweir				$uniquefilename =~ s/\./$counter\./;
434cdf0e10cSrcweir			}
435cdf0e10cSrcweir			else
436cdf0e10cSrcweir			{
437cdf0e10cSrcweir				$uniquefilename = $uniquefilenamebase . $counter;
438cdf0e10cSrcweir			}
439cdf0e10cSrcweir
440cdf0e10cSrcweir			$newname = 0;
441cdf0e10cSrcweir			$lcuniquefilename = lc($uniquefilename);	# only lowercase names
442cdf0e10cSrcweir
443cdf0e10cSrcweir			if ( ! exists($installer::globals::alllcuniquefilenames{$lcuniquefilename}) &&
444cdf0e10cSrcweir			     ! exists($installer::globals::savedrevmapping{$lcuniquefilename}) )
445cdf0e10cSrcweir			{
446cdf0e10cSrcweir				$installer::globals::alluniquefilenames{$uniquefilename} = 1;
447cdf0e10cSrcweir				$installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1;
448cdf0e10cSrcweir				$newname = 1;
449cdf0e10cSrcweir			}
450cdf0e10cSrcweir		}
451cdf0e10cSrcweir		until ( $newname )
452cdf0e10cSrcweir	}
453cdf0e10cSrcweir
454cdf0e10cSrcweir	return $uniquefilename;
455cdf0e10cSrcweir}
456cdf0e10cSrcweir
457cdf0e10cSrcweir####################################################################
458cdf0e10cSrcweir# Generating the special file column for the database file File.idt
459cdf0e10cSrcweir# Sample: NAMETR~1.TAB|.nametranslation.table
460cdf0e10cSrcweir# The first part has to be 8.3 conform.
461cdf0e10cSrcweir####################################################################
462cdf0e10cSrcweir
463cdf0e10cSrcweirsub generate_filename_for_filetable
464cdf0e10cSrcweir{
465cdf0e10cSrcweir	my ($fileref, $shortnamesref, $uniquefilenamehashref) = @_;
466cdf0e10cSrcweir
467cdf0e10cSrcweir	my $returnstring = "";
468cdf0e10cSrcweir
469cdf0e10cSrcweir	my $filename = $fileref->{'Name'};
470cdf0e10cSrcweir
471cdf0e10cSrcweir	installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$filename);	# making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs
472cdf0e10cSrcweir
473cdf0e10cSrcweir	my $shortstring;
474cdf0e10cSrcweir
475cdf0e10cSrcweir	# Reading short string with help of "FileName" in File table from old database
476cdf0e10cSrcweir	if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"}) ))
477cdf0e10cSrcweir	{
478cdf0e10cSrcweir		my $value = $uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"};  # syntax of $value: ($uniquename;$shortname)
479cdf0e10cSrcweir		if ( $value =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $shortstring = $2; } # already collected in function "collect_shortnames_from_old_database"
480cdf0e10cSrcweir		else { $shortstring = $filename; }
481cdf0e10cSrcweir	}
482cdf0e10cSrcweir	elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"}) ))
483cdf0e10cSrcweir	{
484cdf0e10cSrcweir		$installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"} =~ m/.*;(.*)/;
485cdf0e10cSrcweir		if ($1 ne '')
486cdf0e10cSrcweir		{
487cdf0e10cSrcweir			$shortstring = $1;
488cdf0e10cSrcweir		}
489cdf0e10cSrcweir		else
490cdf0e10cSrcweir		{
491cdf0e10cSrcweir			$shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref);
492cdf0e10cSrcweir		}
493cdf0e10cSrcweir	}
494cdf0e10cSrcweir	else
495cdf0e10cSrcweir	{
496cdf0e10cSrcweir		$shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref);
497cdf0e10cSrcweir	}
498cdf0e10cSrcweir
499cdf0e10cSrcweir	if ( $shortstring eq $filename ) { $returnstring = $filename; }	# nothing changed
500cdf0e10cSrcweir	else {$returnstring = $shortstring . "\|" . $filename; }
501cdf0e10cSrcweir
502cdf0e10cSrcweir	return $returnstring;
503cdf0e10cSrcweir}
504cdf0e10cSrcweir
505cdf0e10cSrcweir#########################################
506cdf0e10cSrcweir# Returning the filesize of a file
507cdf0e10cSrcweir#########################################
508cdf0e10cSrcweir
509cdf0e10cSrcweirsub get_filesize
510cdf0e10cSrcweir{
511cdf0e10cSrcweir	my ($fileref) = @_;
512cdf0e10cSrcweir
513cdf0e10cSrcweir	my $file = $fileref->{'sourcepath'};
514cdf0e10cSrcweir
515cdf0e10cSrcweir	my $filesize;
516cdf0e10cSrcweir
517cdf0e10cSrcweir	if ( -f $file )	# test of existence. For instance services.rdb does not always exist
518cdf0e10cSrcweir	{
519cdf0e10cSrcweir		$filesize = ( -s $file );	# file size can be "0"
520cdf0e10cSrcweir	}
521cdf0e10cSrcweir	else
522cdf0e10cSrcweir	{
523cdf0e10cSrcweir		$filesize = -1;
524cdf0e10cSrcweir	}
525cdf0e10cSrcweir
526cdf0e10cSrcweir	return $filesize;
527cdf0e10cSrcweir}
528cdf0e10cSrcweir
529cdf0e10cSrcweir#############################################
530cdf0e10cSrcweir# Returning the file version, if required
531cdf0e10cSrcweir# Sample: "8.0.1.8976";
532cdf0e10cSrcweir#############################################
533cdf0e10cSrcweir
534cdf0e10cSrcweirsub get_fileversion
535cdf0e10cSrcweir{
536cdf0e10cSrcweir	my ($onefile, $allvariables, $styles) = @_;
537cdf0e10cSrcweir
538cdf0e10cSrcweir	my $fileversion = "";
539cdf0e10cSrcweir
540cdf0e10cSrcweir	if ( $allvariables->{'USE_FILEVERSION'} )
541cdf0e10cSrcweir	{
542cdf0e10cSrcweir		if ( ! $allvariables->{'LIBRARYVERSION'} ) { installer::exiter::exit_program("ERROR: USE_FILEVERSION is set, but not LIBRARYVERSION", "get_fileversion"); }
543cdf0e10cSrcweir		my $libraryversion = $allvariables->{'LIBRARYVERSION'};
544cdf0e10cSrcweir		if ( $libraryversion =~ /^\s*(\d+)\.(\d+)\.(\d+)\s*$/ )
545cdf0e10cSrcweir		{
546cdf0e10cSrcweir			my $major = $1;
547cdf0e10cSrcweir			my $minor = $2;
548cdf0e10cSrcweir			my $micro = $3;
549cdf0e10cSrcweir			my $concat = 100 * $minor + $micro;
550cdf0e10cSrcweir			$libraryversion = $major . "\." . $concat;
551cdf0e10cSrcweir		}
552cdf0e10cSrcweir		my $vendornumber = 0;
553cdf0e10cSrcweir		if ( $allvariables->{'VENDORPATCHVERSION'} ) { $vendornumber = $allvariables->{'VENDORPATCHVERSION'}; }
554cdf0e10cSrcweir		$fileversion = $libraryversion . "\." . $installer::globals::buildid . "\." . $vendornumber;
555cdf0e10cSrcweir		if ( $onefile->{'FileVersion'} ) { $fileversion = $onefile->{'FileVersion'}; } # overriding FileVersion in scp
556cdf0e10cSrcweir
557cdf0e10cSrcweir		# if ( $styles =~ /\bFONT\b/ )
558cdf0e10cSrcweir		# {
559cdf0e10cSrcweir		#	my $newfileversion = installer::windows::font::get_font_version($onefile->{'sourcepath'});
560cdf0e10cSrcweir		#	if ( $newfileversion != 0 ) { $fileversion = $newfileversion; }
561cdf0e10cSrcweir		# }
562cdf0e10cSrcweir	}
563cdf0e10cSrcweir
564cdf0e10cSrcweir	if ( $installer::globals::prepare_winpatch ) { $fileversion = ""; } # Windows patches do not allow this version # -> who says so?
565cdf0e10cSrcweir
566cdf0e10cSrcweir	return $fileversion;
567cdf0e10cSrcweir}
568cdf0e10cSrcweir
569cdf0e10cSrcweir#############################################
570cdf0e10cSrcweir# Returning the sequence for a file
571cdf0e10cSrcweir#############################################
572cdf0e10cSrcweir
573cdf0e10cSrcweirsub get_sequence_for_file
574cdf0e10cSrcweir{
575cdf0e10cSrcweir	my ($number, $onefile, $fileentry, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, $allfilecomponents) = @_;
576cdf0e10cSrcweir
577cdf0e10cSrcweir	my $sequence = "";
578cdf0e10cSrcweir	my $infoline = "";
579cdf0e10cSrcweir	my $pffcomponentname = $onefile->{'componentname'} . "_pff";
580cdf0e10cSrcweir
581cdf0e10cSrcweir	if ( $installer::globals::updatedatabase )
582cdf0e10cSrcweir	{
583cdf0e10cSrcweir		if (( exists($allupdatesequenceshashref->{$onefile->{'uniquename'}}) ) &&
584cdf0e10cSrcweir		    (( $onefile->{'componentname'} eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) ||
585cdf0e10cSrcweir		     ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} )))
586cdf0e10cSrcweir		{
587cdf0e10cSrcweir			# The second condition is necessary to find shifted files, that have same "uniquename", but are now
588cdf0e10cSrcweir			# located in another directory. This can be seen at the component name.
589cdf0e10cSrcweir			$sequence = $allupdatesequenceshashref->{$onefile->{'uniquename'}};
590cdf0e10cSrcweir			$onefile->{'assignedsequencenumber'} = $sequence;
591cdf0e10cSrcweir			# Collecting all used sequences, to guarantee, that no number is unused
592cdf0e10cSrcweir			$installer::globals::allusedupdatesequences{$sequence} = 1;
593cdf0e10cSrcweir			# Special help for files, that already have a "pff" component name (for example after ServicePack 1)
594cdf0e10cSrcweir			if ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} )
595cdf0e10cSrcweir			{
596cdf0e10cSrcweir				$infoline = "Warning: Special handling for component \"$pffcomponentname\". This file was added after the final, but before this ServicePack.\n";
597cdf0e10cSrcweir				push(@installer::globals::logfileinfo, $infoline);
598cdf0e10cSrcweir				$onefile->{'componentname'} = $pffcomponentname; # pff for "post final file"
599cdf0e10cSrcweir				$fileentry->{'Component_'} = $onefile->{'componentname'};
600cdf0e10cSrcweir				if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; }
601cdf0e10cSrcweir			}
602cdf0e10cSrcweir		}
603cdf0e10cSrcweir		else
604cdf0e10cSrcweir		{
605cdf0e10cSrcweir			$installer::globals::updatesequencecounter++;
606cdf0e10cSrcweir			$sequence = $installer::globals::updatesequencecounter;
607cdf0e10cSrcweir			$onefile->{'assignedsequencenumber'} = $sequence;
608cdf0e10cSrcweir			# $onefile->{'assignedcabinetfile'} = $installer::globals::pffcabfilename; # assigning to cabinet file for "post final files"
609cdf0e10cSrcweir			# Collecting all new files
610cdf0e10cSrcweir			$installer::globals::newupdatefiles{$sequence} = $onefile;
611cdf0e10cSrcweir			# Saving in sequence hash
612cdf0e10cSrcweir			$allupdatefileorderhashref->{$sequence} = $onefile->{'uniquename'};
613cdf0e10cSrcweir
614cdf0e10cSrcweir			# If the new file is part of an existing component, this must be changed now. All files
615cdf0e10cSrcweir			# of one component have to be included in one cabinet file. But because the order must
616cdf0e10cSrcweir			# not change, all new files have to be added to new components.
617cdf0e10cSrcweir			# $onefile->{'componentname'} = $file{'Component_'};
618cdf0e10cSrcweir
619cdf0e10cSrcweir			$onefile->{'componentname'} = $onefile->{'componentname'} . "_pff"; # pff for "post final file"
620cdf0e10cSrcweir			$fileentry->{'Component_'} = $onefile->{'componentname'};
621cdf0e10cSrcweir			if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; }
622cdf0e10cSrcweir			$onefile->{'PostFinalFile'} = 1;
623cdf0e10cSrcweir			# $installer::globals::pfffileexists = 1;
624cdf0e10cSrcweir			# The sequence for this file has changed. It has to be inserted at the end of the files collector.
625cdf0e10cSrcweir			$installer::globals::insert_file_at_end = 1;
626cdf0e10cSrcweir			$installer::globals::newfilescollector{$sequence} = $onefile; # Adding new files to the end of the filescollector
627cdf0e10cSrcweir			$installer::globals::newfilesexist = 1;
628cdf0e10cSrcweir		}
629cdf0e10cSrcweir	}
630cdf0e10cSrcweir	elsif (( $onefile->{'assignedsequencenumber'} ) && ( $installer::globals::use_packages_for_cabs ))
631cdf0e10cSrcweir	{
632cdf0e10cSrcweir		$sequence = $onefile->{'assignedsequencenumber'};
633cdf0e10cSrcweir	}
634cdf0e10cSrcweir	else
635cdf0e10cSrcweir	{
636cdf0e10cSrcweir		$sequence = $number;
637cdf0e10cSrcweir		# my $sequence = $number + 1;
638cdf0e10cSrcweir
639cdf0e10cSrcweir		# Idea: Each component is packed into a cab file.
640cdf0e10cSrcweir		# This requires that all files in one cab file have sequences directly follwing each other,
641cdf0e10cSrcweir		# for instance from 1456 to 1466. Then in the media table the LastSequence for this cab file
642cdf0e10cSrcweir		# is 1466.
643cdf0e10cSrcweir		# Because all files belonging to one component are directly behind each other in the file
644cdf0e10cSrcweir		# collector, it is possible to use simply an increasing number as sequence value.
645cdf0e10cSrcweir		# If files belonging to one component are not directly behind each other in the files collector
646cdf0e10cSrcweir		# this mechanism will no longer work.
647cdf0e10cSrcweir	}
648cdf0e10cSrcweir
649cdf0e10cSrcweir	return $sequence;
650cdf0e10cSrcweir}
651cdf0e10cSrcweir
652cdf0e10cSrcweir#############################################
653cdf0e10cSrcweir# Returning the Windows language of a file
654cdf0e10cSrcweir#############################################
655cdf0e10cSrcweir
656cdf0e10cSrcweirsub get_language_for_file
657cdf0e10cSrcweir{
658cdf0e10cSrcweir	my ($fileref) = @_;
659cdf0e10cSrcweir
660cdf0e10cSrcweir	my $language = "";
661cdf0e10cSrcweir
662cdf0e10cSrcweir	if ( $fileref->{'specificlanguage'} ) { $language = $fileref->{'specificlanguage'}; }
663cdf0e10cSrcweir
664cdf0e10cSrcweir	if ( $language eq "" )
665cdf0e10cSrcweir	{
666cdf0e10cSrcweir		$language = 0;  # language independent
667cdf0e10cSrcweir		# If this is not a font, the return value should be "0" (Check ICE 60)
668cdf0e10cSrcweir		my $styles = "";
669cdf0e10cSrcweir		if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; }
670cdf0e10cSrcweir		if ( $styles =~ /\bFONT\b/ ) { $language = ""; }
671cdf0e10cSrcweir	}
672cdf0e10cSrcweir	else
673cdf0e10cSrcweir	{
674cdf0e10cSrcweir		$language = installer::windows::language::get_windows_language($language);
675cdf0e10cSrcweir	}
676cdf0e10cSrcweir
677cdf0e10cSrcweir	return $language;
678cdf0e10cSrcweir}
679cdf0e10cSrcweir
680cdf0e10cSrcweir####################################################################
681cdf0e10cSrcweir# Creating a new KeyPath for components in TemplatesFolder.
682cdf0e10cSrcweir####################################################################
683cdf0e10cSrcweir
684cdf0e10cSrcweirsub generate_registry_keypath
685cdf0e10cSrcweir{
686cdf0e10cSrcweir	my ($onefile) = @_;
687cdf0e10cSrcweir
688cdf0e10cSrcweir	my $keypath = $onefile->{'Name'};
689cdf0e10cSrcweir	$keypath =~ s/\.//g;
690cdf0e10cSrcweir	$keypath = lc($keypath);
691cdf0e10cSrcweir	$keypath = "userreg_" . $keypath;
692cdf0e10cSrcweir
693cdf0e10cSrcweir	return $keypath;
694cdf0e10cSrcweir}
695cdf0e10cSrcweir
696cdf0e10cSrcweir####################################################################
697cdf0e10cSrcweir# Check, if in an update process files are missing. No removal
698cdf0e10cSrcweir# of files allowed for Windows Patch creation.
699cdf0e10cSrcweir# Also logging all new files, that have to be included in extra
700cdf0e10cSrcweir# components and cab files.
701cdf0e10cSrcweir####################################################################
702cdf0e10cSrcweir
703cdf0e10cSrcweirsub check_file_sequences
704cdf0e10cSrcweir{
705cdf0e10cSrcweir	my ($allupdatefileorderhashref, $allupdatecomponentorderhashref) = @_;
706cdf0e10cSrcweir
707cdf0e10cSrcweir	# All used sequences stored in %installer::globals::allusedupdatesequences
708cdf0e10cSrcweir	# Maximum sequence number of old database stored in $installer::globals::updatelastsequence
709cdf0e10cSrcweir	# All new files stored in %installer::globals::newupdatefiles
710cdf0e10cSrcweir
711cdf0e10cSrcweir	my $infoline = "";
712cdf0e10cSrcweir
713cdf0e10cSrcweir	my @missing_sequences = ();
714cdf0e10cSrcweir	my @really_missing_sequences = ();
715cdf0e10cSrcweir
716cdf0e10cSrcweir	for ( my $i = 1; $i <= $installer::globals::updatelastsequence; $i++ )
717cdf0e10cSrcweir	{
718cdf0e10cSrcweir		if ( ! exists($installer::globals::allusedupdatesequences{$i}) ) { push(@missing_sequences, $i); }
719cdf0e10cSrcweir	}
720cdf0e10cSrcweir
721cdf0e10cSrcweir	if ( $#missing_sequences > -1 )
722cdf0e10cSrcweir	{
723cdf0e10cSrcweir		# Missing sequences can also be caused by files included in merge modules. This files are added later into the file table.
724cdf0e10cSrcweir		# Therefore now it is time to check the content of the merge modules.
725cdf0e10cSrcweir
726cdf0e10cSrcweir		for ( my $j = 0; $j <= $#missing_sequences; $j++ )
727cdf0e10cSrcweir		{
728cdf0e10cSrcweir			my $filename = $allupdatefileorderhashref->{$missing_sequences[$j]};
729cdf0e10cSrcweir
730cdf0e10cSrcweir			# Is this a file from a merge module? Then this is no error.
731cdf0e10cSrcweir			if ( ! exists($installer::globals::mergemodulefiles{$filename}) )
732cdf0e10cSrcweir			{
733cdf0e10cSrcweir				push(@really_missing_sequences, $missing_sequences[$j]);
734cdf0e10cSrcweir			}
735cdf0e10cSrcweir		}
736cdf0e10cSrcweir	}
737cdf0e10cSrcweir
738cdf0e10cSrcweir	if ( $#really_missing_sequences > -1 )
739cdf0e10cSrcweir	{
740cdf0e10cSrcweir		my $errorstring = "";
741cdf0e10cSrcweir		for ( my $j = 0; $j <= $#really_missing_sequences; $j++ )
742cdf0e10cSrcweir		{
743cdf0e10cSrcweir			my $filename = $allupdatefileorderhashref->{$really_missing_sequences[$j]};
744cdf0e10cSrcweir			my $comp = $allupdatecomponentorderhashref->{$really_missing_sequences[$j]};
745cdf0e10cSrcweir			$errorstring = "$errorstring$filename (Sequence: $really_missing_sequences[$j], Component: \"$comp\")\n";
746cdf0e10cSrcweir		}
747cdf0e10cSrcweir
748cdf0e10cSrcweir		$infoline = "ERROR: Files are removed compared with update database.\nThe following files are missing:\n$errorstring";
749cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
750cdf0e10cSrcweir		installer::exiter::exit_program($infoline, "check_file_sequences");
751cdf0e10cSrcweir	}
752cdf0e10cSrcweir
753cdf0e10cSrcweir	# Searching for new files
754cdf0e10cSrcweir
755cdf0e10cSrcweir	my $counter = 0;
756cdf0e10cSrcweir
757cdf0e10cSrcweir	foreach my $key ( keys %installer::globals::newupdatefiles )
758cdf0e10cSrcweir	{
759cdf0e10cSrcweir		my $onefile = $installer::globals::newupdatefiles{$key};
760cdf0e10cSrcweir		$counter++;
761cdf0e10cSrcweir		if ( $counter == 1 )
762cdf0e10cSrcweir		{
763cdf0e10cSrcweir			$infoline = "\nNew files compared to the update database:\n";
764cdf0e10cSrcweir			push(@installer::globals::logfileinfo, $infoline);
765cdf0e10cSrcweir		}
766cdf0e10cSrcweir
767cdf0e10cSrcweir		$infoline = "$onefile->{'Name'} ($onefile->{'gid'}) Sequence: $onefile->{'assignedsequencenumber'}\n";
768cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
769cdf0e10cSrcweir	}
770cdf0e10cSrcweir
771cdf0e10cSrcweir	if ( $counter == 0 )
772cdf0e10cSrcweir	{
773cdf0e10cSrcweir		$infoline = "Info: No new file compared with update database!\n";
774cdf0e10cSrcweir		push(@installer::globals::logfileinfo, $infoline);
775cdf0e10cSrcweir	}
776cdf0e10cSrcweir
777cdf0e10cSrcweir}
778cdf0e10cSrcweir
779cdf0e10cSrcweir###################################################################
780cdf0e10cSrcweir# Collecting further conditions for the component table.
781cdf0e10cSrcweir# This is used by multilayer products, to enable installation
782cdf0e10cSrcweir# of separate layers.
783cdf0e10cSrcweir###################################################################
784cdf0e10cSrcweir
785cdf0e10cSrcweirsub get_tree_condition_for_component
786cdf0e10cSrcweir{
787cdf0e10cSrcweir	my ($onefile, $componentname) = @_;
788cdf0e10cSrcweir
789cdf0e10cSrcweir	if ( $onefile->{'destination'} )
790cdf0e10cSrcweir	{
791cdf0e10cSrcweir		my $dest = $onefile->{'destination'};
792cdf0e10cSrcweir
793cdf0e10cSrcweir		# Comparing the destination path with
794cdf0e10cSrcweir		# $installer::globals::hostnametreestyles{$hostname} = $treestyle;
795cdf0e10cSrcweir		# (-> hostname is the key, the style the value!)
796cdf0e10cSrcweir
797cdf0e10cSrcweir		foreach my $hostname ( keys %installer::globals::hostnametreestyles )
798cdf0e10cSrcweir		{
799cdf0e10cSrcweir			if (( $dest eq $hostname ) || ( $dest =~ /^\s*\Q$hostname\E\\/ ))
800cdf0e10cSrcweir			{
801cdf0e10cSrcweir				# the value is the style
802cdf0e10cSrcweir				my $style = $installer::globals::hostnametreestyles{$hostname};
803cdf0e10cSrcweir				# the condition is saved in %installer::globals::treestyles
804cdf0e10cSrcweir				my $condition = $installer::globals::treestyles{$style};
805cdf0e10cSrcweir				# Saving condition to be added in table Property
806cdf0e10cSrcweir				$installer::globals::usedtreeconditions{$condition} = 1;
807cdf0e10cSrcweir				$condition = $condition . "=1";
808cdf0e10cSrcweir				# saving this condition
809cdf0e10cSrcweir				$installer::globals::treeconditions{$componentname} = $condition;
810cdf0e10cSrcweir
811cdf0e10cSrcweir				# saving also at the file, for usage in fileinfo
812cdf0e10cSrcweir				$onefile->{'layer'} = $installer::globals::treelayername{$style};
813cdf0e10cSrcweir			}
814cdf0e10cSrcweir		}
815cdf0e10cSrcweir	}
816cdf0e10cSrcweir}
817cdf0e10cSrcweir
818cdf0e10cSrcweir############################################
819cdf0e10cSrcweir# Collecting all short names, that are
820cdf0e10cSrcweir# already used by the old database
821cdf0e10cSrcweir############################################
822cdf0e10cSrcweir
823cdf0e10cSrcweirsub collect_shortnames_from_old_database
824cdf0e10cSrcweir{
825cdf0e10cSrcweir	my ($uniquefilenamehashref, $shortnameshashref) = @_;
826cdf0e10cSrcweir
827cdf0e10cSrcweir	foreach my $key ( keys %{$uniquefilenamehashref} )
828cdf0e10cSrcweir	{
829cdf0e10cSrcweir		my $value = $uniquefilenamehashref->{$key};  # syntax of $value: ($uniquename;$shortname)
830cdf0e10cSrcweir
831cdf0e10cSrcweir		if ( $value =~ /^\s*(.*?)\;\s*(.*?)\s*$/ )
832cdf0e10cSrcweir		{
833cdf0e10cSrcweir			my $shortstring = $2;
834cdf0e10cSrcweir			$shortnameshashref->{$shortstring} = 1;	# adding the shortname to the array of all shortnames
835cdf0e10cSrcweir		}
836cdf0e10cSrcweir	}
837cdf0e10cSrcweir}
838cdf0e10cSrcweir
839cdf0e10cSrcweir############################################
840cdf0e10cSrcweir# Creating the file File.idt dynamically
841cdf0e10cSrcweir############################################
842cdf0e10cSrcweir
843cdf0e10cSrcweirsub create_files_table
844cdf0e10cSrcweir{
845cdf0e10cSrcweir	my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_;
846cdf0e10cSrcweir
847cdf0e10cSrcweir	installer::logger::include_timestamp_into_logfile("Performance Info: File Table start");
848cdf0e10cSrcweir
849cdf0e10cSrcweir	# Structure of the files table:
850cdf0e10cSrcweir	# File Component_ FileName FileSize Version Language Attributes Sequence
851cdf0e10cSrcweir	# In this function, all components are created.
852cdf0e10cSrcweir	#
853cdf0e10cSrcweir	# $allfilecomponentsref is empty at the beginning
854cdf0e10cSrcweir
855cdf0e10cSrcweir	my $infoline;
856cdf0e10cSrcweir
857cdf0e10cSrcweir	my @allfiles = ();
858cdf0e10cSrcweir	my @filetable = ();
859cdf0e10cSrcweir	my @filehashtable = ();
860cdf0e10cSrcweir	my %allfilecomponents = ();
861cdf0e10cSrcweir	my $counter = 0;
862cdf0e10cSrcweir
863cdf0e10cSrcweir	if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_pathes($filesref); }
864cdf0e10cSrcweir
865cdf0e10cSrcweir	# The filenames must be collected because of uniqueness
866cdf0e10cSrcweir	# 01-44-~1.DAT, 01-44-~2.DAT, ...
867cdf0e10cSrcweir	# my @shortnames = ();
868cdf0e10cSrcweir	my %shortnames = ();
869cdf0e10cSrcweir
870cdf0e10cSrcweir	if ( $installer::globals::updatedatabase ) { collect_shortnames_from_old_database($uniquefilenamehashref, \%shortnames); }
871cdf0e10cSrcweir
872cdf0e10cSrcweir	installer::windows::idtglobal::write_idt_header(\@filetable, "file");
873cdf0e10cSrcweir	installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash");
874cdf0e10cSrcweir
875cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$filesref}; $i++ )
876cdf0e10cSrcweir	{
877cdf0e10cSrcweir		my %file = ();
878cdf0e10cSrcweir
879cdf0e10cSrcweir		my $onefile = ${$filesref}[$i];
880cdf0e10cSrcweir
881cdf0e10cSrcweir		my $styles = "";
882cdf0e10cSrcweir		if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
883cdf0e10cSrcweir		if (( $styles =~ /\bJAVAFILE\b/ ) && ( ! ($allvariables->{'JAVAPRODUCT'} ))) { next; }
884cdf0e10cSrcweir
885cdf0e10cSrcweir		$file{'Component_'} = get_file_component_name($onefile, $filesref);
886cdf0e10cSrcweir		$file{'File'} = generate_unique_filename_for_filetable($onefile, $file{'Component_'}, $uniquefilenamehashref);
887cdf0e10cSrcweir
888cdf0e10cSrcweir		$onefile->{'uniquename'} = $file{'File'};
889cdf0e10cSrcweir		$onefile->{'componentname'} = $file{'Component_'};
890cdf0e10cSrcweir
891cdf0e10cSrcweir		# Collecting all components
892cdf0e10cSrcweir		# if (!(installer::existence::exists_in_array($file{'Component_'}, $allfilecomponentsref))) { push(@{$allfilecomponentsref}, $file{'Component_'}); }
893cdf0e10cSrcweir
894cdf0e10cSrcweir		if ( ! exists($allfilecomponents{$file{'Component_'}}) ) { $allfilecomponents{$file{'Component_'}} = 1; }
895cdf0e10cSrcweir
896cdf0e10cSrcweir		$file{'FileName'} = generate_filename_for_filetable($onefile, \%shortnames, $uniquefilenamehashref);
897cdf0e10cSrcweir
898cdf0e10cSrcweir		$file{'FileSize'} = get_filesize($onefile);
899cdf0e10cSrcweir
900cdf0e10cSrcweir		$file{'Version'} = get_fileversion($onefile, $allvariables, $styles);
901cdf0e10cSrcweir
902cdf0e10cSrcweir		$file{'Language'} = get_language_for_file($onefile);
903cdf0e10cSrcweir
904cdf0e10cSrcweir		if ( $styles =~ /\bDONT_PACK\b/ ) { $file{'Attributes'} = "8192"; }
905cdf0e10cSrcweir		else { $file{'Attributes'} = "16384"; }
906cdf0e10cSrcweir
907cdf0e10cSrcweir		# $file{'Attributes'} = "16384"; 	# Sourcefile is packed
908cdf0e10cSrcweir		# $file{'Attributes'} = "8192"; 	# Sourcefile is unpacked
909cdf0e10cSrcweir
910cdf0e10cSrcweir		$installer::globals::insert_file_at_end = 0;
911cdf0e10cSrcweir		$counter++;
912cdf0e10cSrcweir		$file{'Sequence'} = get_sequence_for_file($counter, $onefile, \%file, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, \%allfilecomponents);
913cdf0e10cSrcweir
914cdf0e10cSrcweir		$onefile->{'sequencenumber'} = $file{'Sequence'};
915cdf0e10cSrcweir
916cdf0e10cSrcweir		my $oneline = $file{'File'} . "\t" . $file{'Component_'} . "\t" . $file{'FileName'} . "\t"
917cdf0e10cSrcweir				. $file{'FileSize'} . "\t" . $file{'Version'} . "\t" . $file{'Language'} . "\t"
918cdf0e10cSrcweir				. $file{'Attributes'} . "\t" . $file{'Sequence'} . "\n";
919cdf0e10cSrcweir
920cdf0e10cSrcweir		push(@filetable, $oneline);
921cdf0e10cSrcweir
922cdf0e10cSrcweir		if ( ! $installer::globals::insert_file_at_end ) { push(@allfiles, $onefile); }
923cdf0e10cSrcweir
924cdf0e10cSrcweir		# Collecting all component conditions
925cdf0e10cSrcweir		if ( $onefile->{'ComponentCondition'} )
926cdf0e10cSrcweir		{
927cdf0e10cSrcweir			if ( ! exists($installer::globals::componentcondition{$file{'Component_'}}))
928cdf0e10cSrcweir			{
929cdf0e10cSrcweir				$installer::globals::componentcondition{$file{'Component_'}} = $onefile->{'ComponentCondition'};
930cdf0e10cSrcweir			}
931cdf0e10cSrcweir		}
932cdf0e10cSrcweir
933cdf0e10cSrcweir		# Collecting also all tree conditions for multilayer products
934cdf0e10cSrcweir		get_tree_condition_for_component($onefile, $file{'Component_'});
935cdf0e10cSrcweir
936cdf0e10cSrcweir		# Collecting all component names, that have flag VERSION_INDEPENDENT_COMP_ID
937cdf0e10cSrcweir		# This should be all components with constant API, for example URE
938cdf0e10cSrcweir		if ( $styles =~ /\bVERSION_INDEPENDENT_COMP_ID\b/ )
939cdf0e10cSrcweir		{
940cdf0e10cSrcweir			$installer::globals::base_independent_components{$onefile->{'componentname'}} = 1;
941cdf0e10cSrcweir		}
942cdf0e10cSrcweir
943cdf0e10cSrcweir		# Collecting all component ids, that are defined at files in scp project (should not be used anymore)
944cdf0e10cSrcweir		if ( $onefile->{'CompID'} )
945cdf0e10cSrcweir		{
946cdf0e10cSrcweir			if ( ! exists($installer::globals::componentid{$onefile->{'componentname'}}))
947cdf0e10cSrcweir			{
948cdf0e10cSrcweir				$installer::globals::componentid{$onefile->{'componentname'}} = $onefile->{'CompID'};
949cdf0e10cSrcweir			}
950cdf0e10cSrcweir			else
951cdf0e10cSrcweir			{
952cdf0e10cSrcweir				if ( $installer::globals::componentid{$onefile->{'componentname'}} ne $onefile->{'CompID'} )
953cdf0e10cSrcweir				{
954cdf0e10cSrcweir					installer::exiter::exit_program("ERROR: There is already a ComponentID for component \"$onefile->{'componentname'}\" : \"$installer::globals::componentid{$onefile->{'componentname'}}\" . File \"$onefile->{'gid'}\" uses \"$onefile->{'CompID'}\" !", "create_files_table");
955cdf0e10cSrcweir				}
956cdf0e10cSrcweir			}
957cdf0e10cSrcweir
958cdf0e10cSrcweir			# Also checking vice versa. Is this ComponentID already used? If yes, is the componentname the same?
959cdf0e10cSrcweir
960cdf0e10cSrcweir			if ( ! exists($installer::globals::comparecomponentname{$onefile->{'CompID'}}))
961cdf0e10cSrcweir			{
962cdf0e10cSrcweir				$installer::globals::comparecomponentname{$onefile->{'CompID'}} = $onefile->{'componentname'};
963cdf0e10cSrcweir			}
964cdf0e10cSrcweir			else
965cdf0e10cSrcweir			{
966cdf0e10cSrcweir				if ( $installer::globals::comparecomponentname{$onefile->{'CompID'}} ne $onefile->{'componentname'} )
967cdf0e10cSrcweir				{
968cdf0e10cSrcweir					installer::exiter::exit_program("ERROR: There is already a component for ComponentID \"$onefile->{'CompID'}\" : \"$installer::globals::comparecomponentname{$onefile->{'CompID'}}\" . File \"$onefile->{'gid'}\" has same component id but is included in component \"$onefile->{'componentname'}\" !", "create_files_table");
969cdf0e10cSrcweir				}
970cdf0e10cSrcweir			}
971cdf0e10cSrcweir		}
972cdf0e10cSrcweir
973cdf0e10cSrcweir		# Collecting all language specific conditions
974cdf0e10cSrcweir		# if ( $onefile->{'haslanguagemodule'} )
975cdf0e10cSrcweir		if ( $onefile->{'ismultilingual'} )
976cdf0e10cSrcweir		{
977cdf0e10cSrcweir			if ( $onefile->{'ComponentCondition'} ) { installer::exiter::exit_program("ERROR: Cannot set language condition. There is already another component condition for file $onefile->{'gid'}: \"$onefile->{'ComponentCondition'}\" !", "create_files_table"); }
978cdf0e10cSrcweir
979cdf0e10cSrcweir			if ( $onefile->{'specificlanguage'} eq "" ) { installer::exiter::exit_program("ERROR: There is no specific language for file at language module: $onefile->{'gid'} !", "create_files_table"); }
980cdf0e10cSrcweir			my $locallanguage = $onefile->{'specificlanguage'};
981cdf0e10cSrcweir			my $property = "IS" . $file{'Language'};
982cdf0e10cSrcweir			my $value = 1;
983cdf0e10cSrcweir			my $condition = $property . "=" . $value;
984cdf0e10cSrcweir
985cdf0e10cSrcweir			$onefile->{'ComponentCondition'} = $condition;
986cdf0e10cSrcweir
987cdf0e10cSrcweir			if ( exists($installer::globals::componentcondition{$file{'Component_'}}))
988cdf0e10cSrcweir			{
989cdf0e10cSrcweir				if ( $installer::globals::componentcondition{$file{'Component_'}} ne $condition ) { installer::exiter::exit_program("ERROR: There is already another component condition for file $onefile->{'gid'}: \"$installer::globals::componentcondition{$file{'Component_'}}\" and \"$condition\" !", "create_files_table"); }
990cdf0e10cSrcweir			}
991cdf0e10cSrcweir			else
992cdf0e10cSrcweir			{
993cdf0e10cSrcweir				$installer::globals::componentcondition{$file{'Component_'}} = $condition;
994cdf0e10cSrcweir			}
995cdf0e10cSrcweir
996cdf0e10cSrcweir			# collecting all properties for table Property
997cdf0e10cSrcweir			if ( ! exists($installer::globals::languageproperties{$property}) ) { $installer::globals::languageproperties{$property} = $value; }
998cdf0e10cSrcweir		}
999cdf0e10cSrcweir
1000cdf0e10cSrcweir		if ( $installer::globals::prepare_winpatch )
1001cdf0e10cSrcweir		{
1002cdf0e10cSrcweir			my $path = $onefile->{'sourcepath'};
1003cdf0e10cSrcweir			if ( $^O =~ /cygwin/i ) { $path = $onefile->{'cyg_sourcepath'}; }
1004cdf0e10cSrcweir
1005cdf0e10cSrcweir			open(FILE, $path) or die "ERROR: Can't open $path for creating file hash";
1006cdf0e10cSrcweir			binmode(FILE);
1007cdf0e10cSrcweir			my $hashinfo = pack("l", 20);
1008cdf0e10cSrcweir			$hashinfo .= Digest::MD5->new->addfile(*FILE)->digest;
1009cdf0e10cSrcweir
1010cdf0e10cSrcweir			my @i = unpack ('x[l]l4', $hashinfo);
1011cdf0e10cSrcweir			$oneline = $file{'File'} . "\t" .
1012cdf0e10cSrcweir				"0" . "\t" .
1013cdf0e10cSrcweir				$i[0] . "\t" .
1014cdf0e10cSrcweir				$i[1] . "\t" .
1015cdf0e10cSrcweir				$i[2] . "\t" .
1016cdf0e10cSrcweir				$i[3] . "\n";
1017cdf0e10cSrcweir			push (@filehashtable, $oneline);
1018cdf0e10cSrcweir		}
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir		# Saving the sequence number in a hash with uniquefilename as key.
1021cdf0e10cSrcweir		# This is used for better performance in "save_packorder"
1022cdf0e10cSrcweir		$installer::globals::uniquefilenamesequence{$onefile->{'uniquename'}} = $onefile->{'sequencenumber'};
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir		# Special handling for files in PREDEFINED_OSSHELLNEWDIR. These components
1025cdf0e10cSrcweir		# need as KeyPath a RegistryItem in HKCU
1026cdf0e10cSrcweir		my $destdir = "";
1027cdf0e10cSrcweir		if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; }
1028cdf0e10cSrcweir
1029cdf0e10cSrcweir		if (( $destdir =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) || ( $onefile->{'needs_user_registry_key'} ))
1030cdf0e10cSrcweir		{
1031cdf0e10cSrcweir			my $keypath = generate_registry_keypath($onefile);
1032cdf0e10cSrcweir			$onefile->{'userregkeypath'} = $keypath;
1033cdf0e10cSrcweir			push(@installer::globals::userregistrycollector, $onefile);
1034cdf0e10cSrcweir			$installer::globals::addeduserregitrykeys = 1;
1035cdf0e10cSrcweir		}
1036cdf0e10cSrcweir	}
1037cdf0e10cSrcweir
1038cdf0e10cSrcweir	# putting content from %allfilecomponents to $allfilecomponentsref for later usage
1039cdf0e10cSrcweir	foreach $localkey (keys %allfilecomponents ) { push( @{$allfilecomponentsref}, $localkey); }
1040cdf0e10cSrcweir
1041cdf0e10cSrcweir	my $filetablename = $basedir . $installer::globals::separator . "File.idt";
1042cdf0e10cSrcweir	installer::files::save_file($filetablename ,\@filetable);
1043cdf0e10cSrcweir	$infoline = "\nCreated idt file: $filetablename\n";
1044cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
1045cdf0e10cSrcweir
1046cdf0e10cSrcweir	installer::logger::include_timestamp_into_logfile("Performance Info: File Table end");
1047cdf0e10cSrcweir
1048cdf0e10cSrcweir	my $filehashtablename = $basedir . $installer::globals::separator . "MsiFileHash.idt";
1049cdf0e10cSrcweir	installer::files::save_file($filehashtablename ,\@filehashtable);
1050cdf0e10cSrcweir	$infoline = "\nCreated idt file: $filehashtablename\n";
1051cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
1052cdf0e10cSrcweir
1053cdf0e10cSrcweir	# Now the new files can be added to the files collector (only in update packaging processes)
1054cdf0e10cSrcweir	if ( $installer::globals::newfilesexist )
1055cdf0e10cSrcweir	{
1056cdf0e10cSrcweir		foreach my $seq (sort keys %installer::globals::newfilescollector) { push(@allfiles, $installer::globals::newfilescollector{$seq}) }
1057cdf0e10cSrcweir	}
1058cdf0e10cSrcweir
1059cdf0e10cSrcweir	return \@allfiles;
1060cdf0e10cSrcweir}
1061cdf0e10cSrcweir
1062cdf0e10cSrcweir1;
1063