1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirpackage installer::packagepool;
29*cdf0e10cSrcweir
30*cdf0e10cSrcweiruse Digest::MD5;
31*cdf0e10cSrcweiruse installer::exiter;
32*cdf0e10cSrcweiruse installer::globals;
33*cdf0e10cSrcweiruse installer::logger;
34*cdf0e10cSrcweiruse installer::pathanalyzer;
35*cdf0e10cSrcweiruse installer::worker;
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir######################################################
38*cdf0e10cSrcweir# Checking the md5sum of a file
39*cdf0e10cSrcweir######################################################
40*cdf0e10cSrcweir
41*cdf0e10cSrcweirsub get_md5sum
42*cdf0e10cSrcweir{
43*cdf0e10cSrcweir	my ($filename) = @_;
44*cdf0e10cSrcweir
45*cdf0e10cSrcweir	open(FILE, "<$filename") or die "ERROR: Can't open $filename for creating file hash";
46*cdf0e10cSrcweir	binmode(FILE);
47*cdf0e10cSrcweir	my $digest = Digest::MD5->new->addfile(*FILE)->hexdigest;
48*cdf0e10cSrcweir	close(FILE);
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir	return $digest;
51*cdf0e10cSrcweir}
52*cdf0e10cSrcweir
53*cdf0e10cSrcweir####################################################
54*cdf0e10cSrcweir# Setting a unique sessionid to identify this
55*cdf0e10cSrcweir# packaging process.
56*cdf0e10cSrcweir####################################################
57*cdf0e10cSrcweir
58*cdf0e10cSrcweirsub set_sessionid
59*cdf0e10cSrcweir{
60*cdf0e10cSrcweir	my $pid = $$;		# process id
61*cdf0e10cSrcweir	my $timer = time();	# time
62*cdf0e10cSrcweir	$installer::globals::sessionid = $pid . $timer;
63*cdf0e10cSrcweir	$installer::globals::sessionidset = 1;
64*cdf0e10cSrcweir	my $infoline = "\nPool: Setting session id: $installer::globals::sessionid.\n";
65*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
66*cdf0e10cSrcweir}
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir####################################################
69*cdf0e10cSrcweir# Setting and creating pool path.
70*cdf0e10cSrcweir####################################################
71*cdf0e10cSrcweir
72*cdf0e10cSrcweirsub set_pool_path
73*cdf0e10cSrcweir{
74*cdf0e10cSrcweir	$installer::globals::unpackpath =~ s/\Q$installer::globals::separator\E\s*$//;	# removing ending slashes and backslashes
75*cdf0e10cSrcweir	$installer::globals::poolpath = $installer::globals::unpackpath . $installer::globals::separator . "pool_" . $installer::globals::packageformat;
76*cdf0e10cSrcweir	installer::systemactions::create_directory($installer::globals::poolpath);
77*cdf0e10cSrcweir	$installer::globals::poolpathset = 1;
78*cdf0e10cSrcweir}
79*cdf0e10cSrcweir
80*cdf0e10cSrcweir####################################################
81*cdf0e10cSrcweir# Comparing the content of two epm files.
82*cdf0e10cSrcweir####################################################
83*cdf0e10cSrcweir
84*cdf0e10cSrcweirsub compare_epm_content
85*cdf0e10cSrcweir{
86*cdf0e10cSrcweir	my ($oldcontent, $newcontent) = @_;
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir	my $identical = 1;
89*cdf0e10cSrcweir	my $diffinfo = "";
90*cdf0e10cSrcweir
91*cdf0e10cSrcweir	# Removing empty lines and files from $newcontent
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir	my @newlocalcontent = ();
94*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$newcontent}; $i++ )
95*cdf0e10cSrcweir	{
96*cdf0e10cSrcweir		if ( ${$newcontent}[$i] =~ /^\s*$/ ) { next; } # Removing empty lines from $newcontent. Empty lines are also not included into pcf file, from where $oldcontent was read.
97*cdf0e10cSrcweir		if ( ${$newcontent}[$i] =~ /^\s*f\s+/ ) { next; } # Ignoring files, they can contain temporary pathes
98*cdf0e10cSrcweir		if (( ${$newcontent}[$i] =~ /^\s*%readme\s+/ ) || ( ${$newcontent}[$i] =~ /^\s*%license\s+/ )) { next; } # ignoring license and readme (language specific!)
99*cdf0e10cSrcweir		my $oneline = ${$newcontent}[$i];
100*cdf0e10cSrcweir		$oneline =~ s/\s*$//; # Removing line ends. Also not included in old epm file, that is read from pcf file.
101*cdf0e10cSrcweir		push(@newlocalcontent, $oneline);
102*cdf0e10cSrcweir	}
103*cdf0e10cSrcweir
104*cdf0e10cSrcweir	my $oldmember = $#{$oldcontent} + 1;
105*cdf0e10cSrcweir	my $newmember = $#newlocalcontent + 1;
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir	# comparing the count
108*cdf0e10cSrcweir	if ( $oldmember != $newmember )
109*cdf0e10cSrcweir	{
110*cdf0e10cSrcweir		$identical = 0;
111*cdf0e10cSrcweir		installer::logger::print_message("\n...... changed length of EPM file\n");
112*cdf0e10cSrcweir		$diffinfo = "Pool: EPM, different line count: old epm file: $oldmember, new epm file: $newmember\n";
113*cdf0e10cSrcweir		push(@installer::globals::epmdifflist, $diffinfo);
114*cdf0e10cSrcweir	}
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir	# comparing the content line for line, so the order must not change
117*cdf0e10cSrcweir
118*cdf0e10cSrcweir	if ( $identical )
119*cdf0e10cSrcweir	{
120*cdf0e10cSrcweir		for ( my $i = 0; $i <= $#{$oldcontent}; $i++ )
121*cdf0e10cSrcweir		{
122*cdf0e10cSrcweir			if ( ${$oldcontent}[$i] ne $newlocalcontent[$i] )
123*cdf0e10cSrcweir			{
124*cdf0e10cSrcweir				$identical = 0;
125*cdf0e10cSrcweir				my $line = $i + 1;
126*cdf0e10cSrcweir				installer::logger::print_message("\n...... different content in EPM file\n");
127*cdf0e10cSrcweir				$diffinfo = "Pool: EPM, line $line changed from \"${$oldcontent}[$i]\" to \"$newlocalcontent[$i]\".\n";
128*cdf0e10cSrcweir				push(@installer::globals::epmdifflist, $diffinfo);
129*cdf0e10cSrcweir				last;
130*cdf0e10cSrcweir			}
131*cdf0e10cSrcweir		}
132*cdf0e10cSrcweir	}
133*cdf0e10cSrcweir
134*cdf0e10cSrcweir	return $identical;
135*cdf0e10cSrcweir}
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir####################################################
138*cdf0e10cSrcweir# Comparing the content of two pcf files.
139*cdf0e10cSrcweir####################################################
140*cdf0e10cSrcweir
141*cdf0e10cSrcweirsub compare_package_content
142*cdf0e10cSrcweir{
143*cdf0e10cSrcweir	my ($oldcontent, $newcontent) = @_;
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir	my $identical = 1;
146*cdf0e10cSrcweir	my $infoline = "";
147*cdf0e10cSrcweir
148*cdf0e10cSrcweir	my $oldmember = scalar keys %{$oldcontent};
149*cdf0e10cSrcweir	my $newmember = scalar keys %{$newcontent};
150*cdf0e10cSrcweir
151*cdf0e10cSrcweir	# comparing the count
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir	if ( $oldmember != $newmember )
154*cdf0e10cSrcweir	{
155*cdf0e10cSrcweir		# Logging the difference
156*cdf0e10cSrcweir		$identical = 0;
157*cdf0e10cSrcweir		installer::logger::print_message("\n...... different number of files in packages. New number: $newmember, old number: $oldmember\n");
158*cdf0e10cSrcweir		$infoline = "Different number of files in packages. New number: $newmember, old number: $oldmember\n";
159*cdf0e10cSrcweir		push(@installer::globals::pcfdiffcomment, $infoline);
160*cdf0e10cSrcweir	}
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir	# comparing the keys
163*cdf0e10cSrcweir
164*cdf0e10cSrcweir	if ( $identical )
165*cdf0e10cSrcweir	{
166*cdf0e10cSrcweir		my $first = 1;
167*cdf0e10cSrcweir		my $start = "\n";
168*cdf0e10cSrcweir		foreach my $dest ( keys %{$newcontent} )
169*cdf0e10cSrcweir		{
170*cdf0e10cSrcweir			if ( ! exists($oldcontent->{$dest}) )
171*cdf0e10cSrcweir			{
172*cdf0e10cSrcweir				$identical = 0;
173*cdf0e10cSrcweir				installer::logger::print_message("$start...... file only in one package (A): $dest\n");
174*cdf0e10cSrcweir				$infoline = "File only in existing pool package: $dest\n";
175*cdf0e10cSrcweir				push(@installer::globals::pcfdiffcomment, $infoline);
176*cdf0e10cSrcweir				if ( $first ) { $start = ""; }
177*cdf0e10cSrcweir				$first = 0;
178*cdf0e10cSrcweir			}
179*cdf0e10cSrcweir		}
180*cdf0e10cSrcweir
181*cdf0e10cSrcweir		# collecting all differences
182*cdf0e10cSrcweir		if ( ! $identical )
183*cdf0e10cSrcweir		{
184*cdf0e10cSrcweir			foreach my $dest ( keys %{$oldcontent} )
185*cdf0e10cSrcweir			{
186*cdf0e10cSrcweir				if ( ! exists($newcontent->{$dest}) )
187*cdf0e10cSrcweir				{
188*cdf0e10cSrcweir					$identical = 0;
189*cdf0e10cSrcweir					installer::logger::print_message("$start...... file only in one package (B): $dest\n");
190*cdf0e10cSrcweir					$infoline = "File only in new package: $dest\n";
191*cdf0e10cSrcweir					push(@installer::globals::pcfdiffcomment, $infoline);
192*cdf0e10cSrcweir					if ( $first ) { $start = ""; }
193*cdf0e10cSrcweir					$first = 0;
194*cdf0e10cSrcweir				}
195*cdf0e10cSrcweir			}
196*cdf0e10cSrcweir		}
197*cdf0e10cSrcweir	}
198*cdf0e10cSrcweir
199*cdf0e10cSrcweir	# comparing the checksum
200*cdf0e10cSrcweir
201*cdf0e10cSrcweir	if ( $identical )
202*cdf0e10cSrcweir	{
203*cdf0e10cSrcweir		my $first = 1;
204*cdf0e10cSrcweir
205*cdf0e10cSrcweir		foreach my $dest ( keys %{$newcontent} )
206*cdf0e10cSrcweir		{
207*cdf0e10cSrcweir			if ( $newcontent->{$dest}->{'md5sum'} ne $oldcontent->{$dest}->{'md5sum'} )
208*cdf0e10cSrcweir			{
209*cdf0e10cSrcweir				$identical = 0;
210*cdf0e10cSrcweir				if ( $first == 1 )
211*cdf0e10cSrcweir				{
212*cdf0e10cSrcweir					installer::logger::print_message("\n");
213*cdf0e10cSrcweir					$first = 0;
214*cdf0e10cSrcweir				}
215*cdf0e10cSrcweir				$installer::globals::pcfdifflist{$dest} = 1;
216*cdf0e10cSrcweir				installer::logger::print_message("...... different file: $dest\n");
217*cdf0e10cSrcweir				# last;
218*cdf0e10cSrcweir			}
219*cdf0e10cSrcweir
220*cdf0e10cSrcweir			if ( $installer::globals::iswindowsbuild )
221*cdf0e10cSrcweir			{
222*cdf0e10cSrcweir				if ( $newcontent->{$dest}->{'uniquename'} ne $oldcontent->{$dest}->{'uniquename'} )
223*cdf0e10cSrcweir				{
224*cdf0e10cSrcweir					$identical = 0;
225*cdf0e10cSrcweir					$installer::globals::pcfdifflist{$dest} = 1;
226*cdf0e10cSrcweir					installer::logger::print_message("\n...... different file: $dest");
227*cdf0e10cSrcweir					# last;
228*cdf0e10cSrcweir				}
229*cdf0e10cSrcweir			}
230*cdf0e10cSrcweir		}
231*cdf0e10cSrcweir	}
232*cdf0e10cSrcweir
233*cdf0e10cSrcweir	return $identical;
234*cdf0e10cSrcweir}
235*cdf0e10cSrcweir
236*cdf0e10cSrcweir####################################################
237*cdf0e10cSrcweir# Calculating content of pcf file.
238*cdf0e10cSrcweir####################################################
239*cdf0e10cSrcweir
240*cdf0e10cSrcweirsub calculate_current_content
241*cdf0e10cSrcweir{
242*cdf0e10cSrcweir	my ($filesarray, $packagename) = @_;
243*cdf0e10cSrcweir
244*cdf0e10cSrcweir	installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start");
245*cdf0e10cSrcweir
246*cdf0e10cSrcweir	my %globalcontent = ();
247*cdf0e10cSrcweir
248*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$filesarray}; $i++ )
249*cdf0e10cSrcweir	{
250*cdf0e10cSrcweir		my %onefilehash = ();
251*cdf0e10cSrcweir
252*cdf0e10cSrcweir		my $onefile = ${$filesarray}[$i];
253*cdf0e10cSrcweir		if ( ! $onefile->{'sourcepath'} ) { installer::exiter::exit_program("ERROR: No sourcepath found for file $onefile->{'gid'}", "calculate_current_content");  }
254*cdf0e10cSrcweir		my $source = $onefile->{'sourcepath'};
255*cdf0e10cSrcweir		if ( $onefile->{'zipfilesource'} ) { $source = $onefile->{'zipfilesource'}; }
256*cdf0e10cSrcweir		if ( ! -f $source ) { installer::exiter::exit_program("ERROR: Sourcefile not found: $source ($onefile->{'gid'})", "calculate_current_content"); }
257*cdf0e10cSrcweir
258*cdf0e10cSrcweir		# For Windows the unique name inside the cabinet file also has to be saved
259*cdf0e10cSrcweir		my $uniquename = "";
260*cdf0e10cSrcweir		if ( $installer::globals::iswindowsbuild ) { $uniquename = $onefile->{'uniquename'};}
261*cdf0e10cSrcweir
262*cdf0e10cSrcweir		my $destination = $onefile->{'destination'};
263*cdf0e10cSrcweir		my $checksum = get_md5sum($source);
264*cdf0e10cSrcweir
265*cdf0e10cSrcweir		$onefilehash{'md5sum'} = $checksum;
266*cdf0e10cSrcweir		$onefilehash{'uniquename'} = $uniquename;
267*cdf0e10cSrcweir
268*cdf0e10cSrcweir		if ( exists($globalcontent{$destination}) ) { installer::exiter::exit_program("ERROR: Destination not unique: $destination ($onefile->{'gid'})", "calculate_current_content"); }
269*cdf0e10cSrcweir		$globalcontent{$destination} = \%onefilehash;
270*cdf0e10cSrcweir	}
271*cdf0e10cSrcweir
272*cdf0e10cSrcweir	installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start");
273*cdf0e10cSrcweir
274*cdf0e10cSrcweir	return \%globalcontent;
275*cdf0e10cSrcweir}
276*cdf0e10cSrcweir
277*cdf0e10cSrcweir####################################################
278*cdf0e10cSrcweir# Writing pcf file.
279*cdf0e10cSrcweir####################################################
280*cdf0e10cSrcweir
281*cdf0e10cSrcweirsub create_pcfcontent_file
282*cdf0e10cSrcweir{
283*cdf0e10cSrcweir	my ($realpackagename, $md5sum, $filesize, $fullpackagename, $pkgversion, $epmfilecontent, $pcffilename) = @_;
284*cdf0e10cSrcweir
285*cdf0e10cSrcweir	my @content = ();
286*cdf0e10cSrcweir	my $oneline = "PackageName: $realpackagename\n";
287*cdf0e10cSrcweir	push(@content, $oneline);
288*cdf0e10cSrcweir
289*cdf0e10cSrcweir	$oneline = "md5sum: $md5sum\n";
290*cdf0e10cSrcweir	push(@content, $oneline);
291*cdf0e10cSrcweir
292*cdf0e10cSrcweir	$oneline = "FileSize: $filesize\n";
293*cdf0e10cSrcweir	push(@content, $oneline);
294*cdf0e10cSrcweir
295*cdf0e10cSrcweir	$oneline = "FullPackageName: $fullpackagename\n";
296*cdf0e10cSrcweir	push(@content, $oneline);
297*cdf0e10cSrcweir
298*cdf0e10cSrcweir	$oneline = "PkgVersion: $pkgversion\n";
299*cdf0e10cSrcweir	push(@content, $oneline);
300*cdf0e10cSrcweir
301*cdf0e10cSrcweir	foreach my $dest (keys %{$installer::globals::newpcfcontent} )
302*cdf0e10cSrcweir	{
303*cdf0e10cSrcweir		$oneline = "Files:\t$dest\t$installer::globals::newpcfcontent->{$dest}->{'md5sum'}\t$installer::globals::newpcfcontent->{$dest}->{'uniquename'}\n";
304*cdf0e10cSrcweir		push(@content, $oneline);
305*cdf0e10cSrcweir	}
306*cdf0e10cSrcweir
307*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$epmfilecontent}; $i++ )
308*cdf0e10cSrcweir	{
309*cdf0e10cSrcweir		if ( ${$epmfilecontent}[$i] =~ /^\s*$/ ) { next; } # avoiding empty lines
310*cdf0e10cSrcweir		if ( ${$epmfilecontent}[$i] =~ /^\s*f\s+/ ) { next; } # ignoring files, because they can contain temporary pathes
311*cdf0e10cSrcweir		if (( ${$epmfilecontent}[$i] =~ /^\s*%readme\s+/ ) || ( ${$epmfilecontent}[$i] =~ /^\s*%license\s+/ )) { next; } # ignoring license and readme (language specific!)
312*cdf0e10cSrcweir		$oneline = "EPM:\t${$epmfilecontent}[$i]";
313*cdf0e10cSrcweir		push(@content, $oneline);
314*cdf0e10cSrcweir	}
315*cdf0e10cSrcweir
316*cdf0e10cSrcweir	installer::files::save_file($pcffilename, \@content);
317*cdf0e10cSrcweir}
318*cdf0e10cSrcweir
319*cdf0e10cSrcweir#######################################################
320*cdf0e10cSrcweir# Reading the content of the package content file.
321*cdf0e10cSrcweir#######################################################
322*cdf0e10cSrcweir
323*cdf0e10cSrcweirsub read_pcf_content
324*cdf0e10cSrcweir{
325*cdf0e10cSrcweir	my ($pcffilename) = @_;
326*cdf0e10cSrcweir
327*cdf0e10cSrcweir	my %allcontent = ();
328*cdf0e10cSrcweir	my @epmfile = ();
329*cdf0e10cSrcweir	my $realpackagename = "";
330*cdf0e10cSrcweir
331*cdf0e10cSrcweir	my $content = installer::files::read_file($pcffilename);
332*cdf0e10cSrcweir
333*cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$content}; $i++ )
334*cdf0e10cSrcweir	{
335*cdf0e10cSrcweir		my $line = ${$content}[$i];
336*cdf0e10cSrcweir
337*cdf0e10cSrcweir		if ( $line =~ /^\s*PackageName\:\s*(.*?)\s*$/ )
338*cdf0e10cSrcweir		{
339*cdf0e10cSrcweir			$realpackagename = $1;
340*cdf0e10cSrcweir			$installer::globals::xpdpackageinfo{'RealPackageName'} = $realpackagename;
341*cdf0e10cSrcweir			next;
342*cdf0e10cSrcweir		}
343*cdf0e10cSrcweir
344*cdf0e10cSrcweir		if ( $line =~ /^\s*FullPackageName\:\s*(.*?)\s*$/ )
345*cdf0e10cSrcweir		{
346*cdf0e10cSrcweir			$installer::globals::xpdpackageinfo{'FullPackageName'} = $1;
347*cdf0e10cSrcweir			next;
348*cdf0e10cSrcweir		}
349*cdf0e10cSrcweir
350*cdf0e10cSrcweir		if ( $line =~ /^\s*FileSize\:\s*(.*?)\s*$/ )
351*cdf0e10cSrcweir		{
352*cdf0e10cSrcweir			$installer::globals::xpdpackageinfo{'FileSize'} = $1;
353*cdf0e10cSrcweir			next;
354*cdf0e10cSrcweir		}
355*cdf0e10cSrcweir
356*cdf0e10cSrcweir		if ( $line =~ /^\s*PkgVersion\:\s*(.*?)\s*$/ )
357*cdf0e10cSrcweir		{
358*cdf0e10cSrcweir			$installer::globals::xpdpackageinfo{'PkgVersion'} = $1;
359*cdf0e10cSrcweir			next;
360*cdf0e10cSrcweir		}
361*cdf0e10cSrcweir
362*cdf0e10cSrcweir		if ( $line =~ /^\s*md5sum\:\s*(.*?)\s*$/ )
363*cdf0e10cSrcweir		{
364*cdf0e10cSrcweir			$installer::globals::xpdpackageinfo{'md5sum'} = $1;
365*cdf0e10cSrcweir			next;
366*cdf0e10cSrcweir		}
367*cdf0e10cSrcweir
368*cdf0e10cSrcweir		if ( $line =~ /^\s*Files:\t(.+?)\t(.+?)\t(.*?)\s*$/ )
369*cdf0e10cSrcweir		{
370*cdf0e10cSrcweir			my $destination = $1;
371*cdf0e10cSrcweir			my $checksum = $2;
372*cdf0e10cSrcweir			my $uniquename = $3;
373*cdf0e10cSrcweir
374*cdf0e10cSrcweir			my %onefilehash = ();
375*cdf0e10cSrcweir			$onefilehash{'md5sum'} = $checksum;
376*cdf0e10cSrcweir			$onefilehash{'uniquename'} = $uniquename;
377*cdf0e10cSrcweir
378*cdf0e10cSrcweir			$allcontent{$destination} = \%onefilehash;
379*cdf0e10cSrcweir			next;
380*cdf0e10cSrcweir		}
381*cdf0e10cSrcweir
382*cdf0e10cSrcweir		if ( $line =~ /^\s*EPM:\t(.*?)\s*$/ )	 # A line can be empty in epm file
383*cdf0e10cSrcweir		{
384*cdf0e10cSrcweir			my $epmcontent = $1;
385*cdf0e10cSrcweir			push(@epmfile, $epmcontent);
386*cdf0e10cSrcweir			next;
387*cdf0e10cSrcweir		}
388*cdf0e10cSrcweir	}
389*cdf0e10cSrcweir
390*cdf0e10cSrcweir	if ( $realpackagename eq "" ) { installer::exiter::exit_program("ERROR: Real package name not found in pcf file: \"$pcffilename\"", "read_pcf_content"); }
391*cdf0e10cSrcweir
392*cdf0e10cSrcweir	return ($realpackagename, \%allcontent, \@epmfile);
393*cdf0e10cSrcweir}
394*cdf0e10cSrcweir
395*cdf0e10cSrcweir####################################################
396*cdf0e10cSrcweir# Checking, if a specific package can be
397*cdf0e10cSrcweir# created at the moment.
398*cdf0e10cSrcweir####################################################
399*cdf0e10cSrcweir
400*cdf0e10cSrcweirsub check_package_availability
401*cdf0e10cSrcweir{
402*cdf0e10cSrcweir	my ($packagename) = @_;
403*cdf0e10cSrcweir
404*cdf0e10cSrcweir	my $package_is_available = 1;
405*cdf0e10cSrcweir
406*cdf0e10cSrcweir	my $checkfilename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf.check";
407*cdf0e10cSrcweir	my $lockfilename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf.lock";
408*cdf0e10cSrcweir
409*cdf0e10cSrcweir	if (( -f $checkfilename ) || ( -f $lockfilename )) { $package_is_available = 0; }
410*cdf0e10cSrcweir
411*cdf0e10cSrcweir	return $package_is_available;
412*cdf0e10cSrcweir}
413*cdf0e10cSrcweir
414*cdf0e10cSrcweir####################################################
415*cdf0e10cSrcweir# Check, if the existence of the check or lock
416*cdf0e10cSrcweir# file requires an exit of packaging process.
417*cdf0e10cSrcweir####################################################
418*cdf0e10cSrcweir
419*cdf0e10cSrcweirsub check_pool_exit
420*cdf0e10cSrcweir{
421*cdf0e10cSrcweir	my ( $lockfilename, $timecounter ) = @_;
422*cdf0e10cSrcweir
423*cdf0e10cSrcweir	# How old is this lock file?
424*cdf0e10cSrcweir	my $timeage = installer::logger::get_file_age($lockfilename);
425*cdf0e10cSrcweir
426*cdf0e10cSrcweir	# if ( $timeage > 1800 ) # file is older than half an hour
427*cdf0e10cSrcweir	if ( $timeage > 3600 ) # file is older than an hour
428*cdf0e10cSrcweir	{
429*cdf0e10cSrcweir		my $timestring = installer::logger::convert_timestring($timeage);
430*cdf0e10cSrcweir		my $infoline = "\nPool: Attention: \"$lockfilename\" is too old ($timestring). Removing file!\n";
431*cdf0e10cSrcweir		installer::logger::print_message( "... $infoline" );
432*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
433*cdf0e10cSrcweir		unlink $lockfilename;
434*cdf0e10cSrcweir		# installer::exiter::exit_program("ERROR: Waiting too long for removal of lock file \"$lockfilename\"", "check_pool_exit (packagepool)");
435*cdf0e10cSrcweir	}
436*cdf0e10cSrcweir	else
437*cdf0e10cSrcweir	{
438*cdf0e10cSrcweir		my $filecontent = installer::files::read_file($lockfilename);
439*cdf0e10cSrcweir		my $waittime = $timecounter * 10;
440*cdf0e10cSrcweir		$waittime = installer::logger::convert_timestring($waittime);
441*cdf0e10cSrcweir		my $infoline = "\nPool: Warning: \"$lockfilename\" blocks this process for $waittime. Lock content: \"${$filecontent}[0]\"\n";
442*cdf0e10cSrcweir		installer::logger::print_message( "... $infoline" );
443*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
444*cdf0e10cSrcweir	}
445*cdf0e10cSrcweir}
446*cdf0e10cSrcweir
447*cdf0e10cSrcweir############################################################################
448*cdf0e10cSrcweir# This function logs some information, that can be used to find
449*cdf0e10cSrcweir# pool problems.
450*cdf0e10cSrcweir############################################################################
451*cdf0e10cSrcweir
452*cdf0e10cSrcweirsub log_pool_info
453*cdf0e10cSrcweir{
454*cdf0e10cSrcweir	my ( $file_exists ) = @_;
455*cdf0e10cSrcweir
456*cdf0e10cSrcweir	my $infoline = "";
457*cdf0e10cSrcweir
458*cdf0e10cSrcweir	# Content saved in
459*cdf0e10cSrcweir	# $installer::globals::savelockfilecontent = installer::files::read_file($filename);
460*cdf0e10cSrcweir	# $installer::globals::savelockfilename = $filename;
461*cdf0e10cSrcweir
462*cdf0e10cSrcweir	if ( $file_exists )
463*cdf0e10cSrcweir	{
464*cdf0e10cSrcweir		$infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" belongs to another process. This process has session id: $installer::globals::sessionid .\n";
465*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
466*cdf0e10cSrcweir		$infoline = "Content of Lock file:\n";
467*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
468*cdf0e10cSrcweir		foreach my $line ( @{$installer::globals::savelockfilecontent} ) { push( @installer::globals::logfileinfo, $line); }
469*cdf0e10cSrcweir	}
470*cdf0e10cSrcweir	else
471*cdf0e10cSrcweir	{
472*cdf0e10cSrcweir		$infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" does not exist anymore (this process has session id: $installer::globals::sessionid) .\n";
473*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
474*cdf0e10cSrcweir	}
475*cdf0e10cSrcweir}
476*cdf0e10cSrcweir
477*cdf0e10cSrcweir############################################################################
478*cdf0e10cSrcweir# Checking, if this process is the owner of the lock file in the pool.
479*cdf0e10cSrcweir# This can be determined by the Process ID, that is written at the
480*cdf0e10cSrcweir# beginning of the first line into the lock file.
481*cdf0e10cSrcweir############################################################################
482*cdf0e10cSrcweir
483*cdf0e10cSrcweirsub process_is_owner
484*cdf0e10cSrcweir{
485*cdf0e10cSrcweir	my ( $filename ) = @_;
486*cdf0e10cSrcweir
487*cdf0e10cSrcweir	my $process_is_owner = 0;
488*cdf0e10cSrcweir
489*cdf0e10cSrcweir	$installer::globals::savelockfilecontent = installer::files::read_file($filename);
490*cdf0e10cSrcweir	$installer::globals::savelockfilename = $filename;
491*cdf0e10cSrcweir
492*cdf0e10cSrcweir	if ( ${$installer::globals::savelockfilecontent}[0] =~ /^\s*\Q$installer::globals::sessionid\E\s+/ ) { $process_is_owner = 1; }
493*cdf0e10cSrcweir
494*cdf0e10cSrcweir	return $process_is_owner;
495*cdf0e10cSrcweir}
496*cdf0e10cSrcweir
497*cdf0e10cSrcweir####################################################
498*cdf0e10cSrcweir# Removing a package from installation set, if
499*cdf0e10cSrcweir# there were pooling problems.
500*cdf0e10cSrcweir####################################################
501*cdf0e10cSrcweir
502*cdf0e10cSrcweirsub remove_package_from_installset
503*cdf0e10cSrcweir{
504*cdf0e10cSrcweir	my ($newpackagepath) = @_;
505*cdf0e10cSrcweir
506*cdf0e10cSrcweir	my $infoline = "Pool problem: Removing package \"$newpackagepath\" from installation set!\n";
507*cdf0e10cSrcweir	push(@installer::globals::logfileinfo, $infoline);
508*cdf0e10cSrcweir
509*cdf0e10cSrcweir	if ( -f $newpackagepath ) { unlink $newpackagepath; }
510*cdf0e10cSrcweir	if ( -d $newpackagepath ) { installer::systemactions::remove_complete_directory($newpackagepath, 1); }
511*cdf0e10cSrcweir
512*cdf0e10cSrcweir	# Keeping the content of @installer::globals::installsetcontent up to date. Removing the last package.
513*cdf0e10cSrcweir	pop(@installer::globals::installsetcontent);
514*cdf0e10cSrcweir}
515*cdf0e10cSrcweir
516*cdf0e10cSrcweir####################################################
517*cdf0e10cSrcweir# Check, if the package is in the pool and if
518*cdf0e10cSrcweir# there are no changes in the package.
519*cdf0e10cSrcweir####################################################
520*cdf0e10cSrcweir
521*cdf0e10cSrcweirsub package_is_up_to_date
522*cdf0e10cSrcweir{
523*cdf0e10cSrcweir	my ($allvariables, $onepackage, $packagename, $newepmcontent, $filesinpackage, $installdir, $subdir, $languagestringref) = @_;
524*cdf0e10cSrcweir
525*cdf0e10cSrcweir	installer::logger::print_message_without_newline( "... checking pool package $packagename ..." );
526*cdf0e10cSrcweir
527*cdf0e10cSrcweir	installer::logger::include_header_into_logfile("Checking package in pool: $packagename");
528*cdf0e10cSrcweir
529*cdf0e10cSrcweir	if ( ! $installer::globals::poolpathset ) { installer::packagepool::set_pool_path(); }
530*cdf0e10cSrcweir	if ( ! $installer::globals::sessionidset ) { installer::packagepool::set_sessionid(); }
531*cdf0e10cSrcweir
532*cdf0e10cSrcweir	my $infoline = "";
533*cdf0e10cSrcweir	# Resetting some variables for this package
534*cdf0e10cSrcweir	my $package_is_up_to_date = 0;
535*cdf0e10cSrcweir	my $realpackagename = "";
536*cdf0e10cSrcweir	my $oldepmcontent = "";
537*cdf0e10cSrcweir	my $waited_for_check = 0;
538*cdf0e10cSrcweir	my $waited_for_lock = 0;
539*cdf0e10cSrcweir	$installer::globals::newpcfcontentcalculated = 0;
540*cdf0e10cSrcweir	%installer::globals::pcfdifflist = ();
541*cdf0e10cSrcweir	@installer::globals::pcfdiffcomment = ();
542*cdf0e10cSrcweir	@installer::globals::epmdifflist = ();
543*cdf0e10cSrcweir
544*cdf0e10cSrcweir	# Reading the package content file, if this file exists (extension *.pcf)
545*cdf0e10cSrcweir	my $filename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf";
546*cdf0e10cSrcweir	my $checkfilename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf.check";
547*cdf0e10cSrcweir	my $lockfilename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf.lock";
548*cdf0e10cSrcweir	# Saving name in global variable, so that this file can be removed somewhere else (at the end of "put_content_into_pool").
549*cdf0e10cSrcweir	$installer::globals::poolcheckfilename = $checkfilename;
550*cdf0e10cSrcweir	$installer::globals::poollockfilename = $lockfilename;
551*cdf0e10cSrcweir
552*cdf0e10cSrcweir	my @checkfilecontent = ("$installer::globals::sessionid $installer::globals::product $$languagestringref $checkfilename");	# $$ is the process id
553*cdf0e10cSrcweir	my @lockfilecontent = ("$installer::globals::sessionid $installer::globals::product $$languagestringref $lockfilename");	# $$ is the process id
554*cdf0e10cSrcweir
555*cdf0e10cSrcweir	# Waiting, step 1
556*cdf0e10cSrcweir	# Checking, if another process checks this package at the moment
557*cdf0e10cSrcweir	my $timecounter = 0;
558*cdf0e10cSrcweir	while ( -f $checkfilename )
559*cdf0e10cSrcweir	{
560*cdf0e10cSrcweir		$timecounter++;
561*cdf0e10cSrcweir
562*cdf0e10cSrcweir		# including an exit to enable creation of other packages
563*cdf0e10cSrcweir		if (( $timecounter == 1 ) && ( ! exists($installer::globals::poolshiftedpackages{$packagename}) ))
564*cdf0e10cSrcweir		{
565*cdf0e10cSrcweir			$package_is_up_to_date = 3;	# repeat this package later
566*cdf0e10cSrcweir			return $package_is_up_to_date;
567*cdf0e10cSrcweir		}
568*cdf0e10cSrcweir
569*cdf0e10cSrcweir		$infoline = "Pool: $checkfilename exists. WAITING 10 seconds ($timecounter).\n";
570*cdf0e10cSrcweir		if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); }
571*cdf0e10cSrcweir		installer::logger::print_message( "... $infoline" );
572*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
573*cdf0e10cSrcweir		# if ( $timecounter % 50 == 0 ) { check_pool_exit($checkfilename, $timecounter); }
574*cdf0e10cSrcweir		if ( $timecounter % 100 == 0 ) { check_pool_exit($checkfilename, $timecounter); }
575*cdf0e10cSrcweir		sleep 10; # process sleeps 10 seconds
576*cdf0e10cSrcweir		$waited_for_check = 1;
577*cdf0e10cSrcweir	}
578*cdf0e10cSrcweir
579*cdf0e10cSrcweir	# Creating file, showing that this package is checked at the moment by this process. No other process can reach this.
580*cdf0e10cSrcweir	installer::files::save_file($checkfilename, \@checkfilecontent);	# Creating the Lock, to check this package. This blocks all other processes.
581*cdf0e10cSrcweir	$installer::globals::processhaspoolcheckfile = 1;
582*cdf0e10cSrcweir
583*cdf0e10cSrcweir	# Check, if the Lock file creation was really successful
584*cdf0e10cSrcweir	if ( ! -f $checkfilename )
585*cdf0e10cSrcweir	{
586*cdf0e10cSrcweir		$infoline = "Pool problem: Pool lock file \"$checkfilename\" could not be created successfully or was removed by another process (A)!\n";
587*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
588*cdf0e10cSrcweir		log_pool_info(0);
589*cdf0e10cSrcweir		$package_is_up_to_date = 4;	# repeat this package
590*cdf0e10cSrcweir		return $package_is_up_to_date;
591*cdf0e10cSrcweir	}
592*cdf0e10cSrcweir
593*cdf0e10cSrcweir	if ( ! process_is_owner($checkfilename) )
594*cdf0e10cSrcweir	{
595*cdf0e10cSrcweir		$infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (A)!\n";
596*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
597*cdf0e10cSrcweir		log_pool_info(1);
598*cdf0e10cSrcweir		$package_is_up_to_date = 4;	# repeat this package
599*cdf0e10cSrcweir		return $package_is_up_to_date;
600*cdf0e10cSrcweir	}
601*cdf0e10cSrcweir
602*cdf0e10cSrcweir	$infoline = "Pool: Created file: $checkfilename\n";
603*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
604*cdf0e10cSrcweir	if ( $waited_for_check ) { installer::logger::print_message( "... $infoline" ); }
605*cdf0e10cSrcweir
606*cdf0e10cSrcweir	# Waiting, step 2
607*cdf0e10cSrcweir	# Checking, if another process creates this package at the moment
608*cdf0e10cSrcweir	$timecounter = 0;
609*cdf0e10cSrcweir	while ( -f $lockfilename )
610*cdf0e10cSrcweir	{
611*cdf0e10cSrcweir		$timecounter++;
612*cdf0e10cSrcweir		$infoline = "Pool: $lockfilename exists. WAITING 10 seconds ($timecounter).\n";
613*cdf0e10cSrcweir		if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); }
614*cdf0e10cSrcweir		installer::logger::print_message( "... $infoline" );
615*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
616*cdf0e10cSrcweir		# if ( $timecounter % 50 == 0 ) { check_pool_exit($lockfilename, $timecounter); }
617*cdf0e10cSrcweir		if ( $timecounter % 100 == 0 ) { check_pool_exit($lockfilename, $timecounter); }
618*cdf0e10cSrcweir		sleep 10; # process sleeps 10 seconds
619*cdf0e10cSrcweir		$waited_for_lock = 1;
620*cdf0e10cSrcweir	}
621*cdf0e10cSrcweir
622*cdf0e10cSrcweir	# No lock file exists, therefore no process creates this package at the moment. Check can be done now.
623*cdf0e10cSrcweir	if ( $waited_for_lock ) { installer::logger::print_message( "... Pool: Proceeding, $lockfilename was removed.\n" ); }
624*cdf0e10cSrcweir
625*cdf0e10cSrcweir	my $package_already_exists = 0;
626*cdf0e10cSrcweir
627*cdf0e10cSrcweir	if ( -f $filename )
628*cdf0e10cSrcweir	{
629*cdf0e10cSrcweir		# Calculating content for pcf file
630*cdf0e10cSrcweir		$installer::globals::newpcfcontent = calculate_current_content($filesinpackage, $packagename);
631*cdf0e10cSrcweir		$installer::globals::newpcfcontentcalculated = 1;
632*cdf0e10cSrcweir
633*cdf0e10cSrcweir		# reading the existing pcf file
634*cdf0e10cSrcweir		($realpackagename, $oldpcfcontent, $oldepmcontent) = read_pcf_content($filename);
635*cdf0e10cSrcweir
636*cdf0e10cSrcweir		# First check: Package has to exist in pool (directories on Solaris)
637*cdf0e10cSrcweir		my $fullpackage = $installer::globals::poolpath . $installer::globals::separator . $realpackagename;
638*cdf0e10cSrcweir		if ( $installer::globals::issolarisbuild ) { $fullpackage = $fullpackage . ".tar"; }
639*cdf0e10cSrcweir		if ( -f $fullpackage )
640*cdf0e10cSrcweir		{
641*cdf0e10cSrcweir			$package_already_exists = 1;
642*cdf0e10cSrcweir			# Second check: Only files
643*cdf0e10cSrcweir			my $content_is_identical = compare_package_content($oldpcfcontent, $installer::globals::newpcfcontent);
644*cdf0e10cSrcweir
645*cdf0e10cSrcweir			# Third check for Unix: Changes in the epm file?
646*cdf0e10cSrcweir			if (( $content_is_identical ) && ( ! $installer::globals::iswindowsbuild ))
647*cdf0e10cSrcweir			{
648*cdf0e10cSrcweir				$content_is_identical = compare_epm_content($oldepmcontent, $newepmcontent);
649*cdf0e10cSrcweir			}
650*cdf0e10cSrcweir
651*cdf0e10cSrcweir			if ( $content_is_identical ) { $package_is_up_to_date = 1; }
652*cdf0e10cSrcweir		}
653*cdf0e10cSrcweir	}
654*cdf0e10cSrcweir
655*cdf0e10cSrcweir	if ( $package_is_up_to_date )
656*cdf0e10cSrcweir	{
657*cdf0e10cSrcweir		$infoline = "Pool: $packagename: No new content, using existing package\n";
658*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
659*cdf0e10cSrcweir		installer::logger::print_message( "... using package from pool\n" );
660*cdf0e10cSrcweir	}
661*cdf0e10cSrcweir	else
662*cdf0e10cSrcweir	{
663*cdf0e10cSrcweir		if ( $package_already_exists )
664*cdf0e10cSrcweir		{
665*cdf0e10cSrcweir			$infoline = "Pool: $packagename: Contains new content, creating new package. Differences:\n";
666*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
667*cdf0e10cSrcweir			foreach my $dest ( sort keys %installer::globals::pcfdifflist ) { push( @installer::globals::logfileinfo, "$dest\n"); }
668*cdf0e10cSrcweir			foreach my $dest ( @installer::globals::pcfdiffcomment ) { push( @installer::globals::logfileinfo, "$dest"); }
669*cdf0e10cSrcweir			foreach my $dest ( @installer::globals::epmdifflist ) { push( @installer::globals::logfileinfo, "$dest"); }
670*cdf0e10cSrcweir		}
671*cdf0e10cSrcweir		else
672*cdf0e10cSrcweir		{
673*cdf0e10cSrcweir			$infoline = "Pool: $packagename: Does not exist in pool.\n";
674*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
675*cdf0e10cSrcweir		}
676*cdf0e10cSrcweir
677*cdf0e10cSrcweir		installer::logger::print_message( "... packaging required\n" );
678*cdf0e10cSrcweir		%installer::globals::xpdpackageinfo = (); # reset the filled hash, because the package cannot be used.
679*cdf0e10cSrcweir
680*cdf0e10cSrcweir		# Creating lock mechanism, so that other processes do not create this package, too.
681*cdf0e10cSrcweir		installer::files::save_file($lockfilename, \@lockfilecontent);		# Creating the Lock, to create this package (Lock for check still exists).
682*cdf0e10cSrcweir		$installer::globals::processhaspoollockfile = 1;
683*cdf0e10cSrcweir
684*cdf0e10cSrcweir		# Check if creation of Lock file was really successful
685*cdf0e10cSrcweir
686*cdf0e10cSrcweir		if ( ! -f $lockfilename )
687*cdf0e10cSrcweir		{
688*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$lockfilename\" could not be created successfully or was removed by another process (D)!\n";
689*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
690*cdf0e10cSrcweir			log_pool_info(0);
691*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
692*cdf0e10cSrcweir			return $package_is_up_to_date;
693*cdf0e10cSrcweir		}
694*cdf0e10cSrcweir
695*cdf0e10cSrcweir		if ( ! process_is_owner($lockfilename) )
696*cdf0e10cSrcweir		{
697*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (D)!\n";
698*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
699*cdf0e10cSrcweir			log_pool_info(1);
700*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
701*cdf0e10cSrcweir			return $package_is_up_to_date;
702*cdf0e10cSrcweir		}
703*cdf0e10cSrcweir
704*cdf0e10cSrcweir		$infoline = "Pool: Created file: $lockfilename\n";
705*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
706*cdf0e10cSrcweir	}
707*cdf0e10cSrcweir
708*cdf0e10cSrcweir	my $newpackagepath = "";
709*cdf0e10cSrcweir
710*cdf0e10cSrcweir	if ( $package_is_up_to_date )
711*cdf0e10cSrcweir	{
712*cdf0e10cSrcweir		# Before the package is copied into the installation set, it has to be checked, if this process is really the owner of this lock file..
713*cdf0e10cSrcweir		# Check, if lock file still exists and if this process is the owner.
714*cdf0e10cSrcweir
715*cdf0e10cSrcweir		if ( ! -f $checkfilename )
716*cdf0e10cSrcweir		{
717*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (B)!\n";
718*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
719*cdf0e10cSrcweir			log_pool_info(0);
720*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
721*cdf0e10cSrcweir			return $package_is_up_to_date;
722*cdf0e10cSrcweir		}
723*cdf0e10cSrcweir
724*cdf0e10cSrcweir		if ( ! process_is_owner($checkfilename) )
725*cdf0e10cSrcweir		{
726*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (B)!\n";
727*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
728*cdf0e10cSrcweir			log_pool_info(1);
729*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
730*cdf0e10cSrcweir			return $package_is_up_to_date;
731*cdf0e10cSrcweir		}
732*cdf0e10cSrcweir
733*cdf0e10cSrcweir		# Copying the package from the pool into the installation set
734*cdf0e10cSrcweir		$newpackagepath = copy_package_from_pool($installdir, $subdir, $realpackagename);
735*cdf0e10cSrcweir	}
736*cdf0e10cSrcweir
737*cdf0e10cSrcweir	# Before the lock file in the pool can be removed, it has to be checked, if this process is still the owner of this lock file.
738*cdf0e10cSrcweir	# Check, if lock file still exists and if this process is the owner.
739*cdf0e10cSrcweir	if ( ! -f $checkfilename )
740*cdf0e10cSrcweir	{
741*cdf0e10cSrcweir		$infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (C)!\n";
742*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
743*cdf0e10cSrcweir		log_pool_info(0);
744*cdf0e10cSrcweir
745*cdf0e10cSrcweir		# removing new package from installation set
746*cdf0e10cSrcweir		if ( $newpackagepath ne "" ) { remove_package_from_installset($newpackagepath); } 	# A file was copied and a problem occured with pooling
747*cdf0e10cSrcweir
748*cdf0e10cSrcweir		$package_is_up_to_date = 4;	# repeat this package
749*cdf0e10cSrcweir		return $package_is_up_to_date;
750*cdf0e10cSrcweir	}
751*cdf0e10cSrcweir
752*cdf0e10cSrcweir	if ( ! process_is_owner($checkfilename) )
753*cdf0e10cSrcweir	{
754*cdf0e10cSrcweir		$infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (C)!\n";
755*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
756*cdf0e10cSrcweir		log_pool_info(1);
757*cdf0e10cSrcweir
758*cdf0e10cSrcweir		# removing new package from installation set
759*cdf0e10cSrcweir		if ( $newpackagepath ne "" ) { remove_package_from_installset($newpackagepath); } 	# A file was copied and a problem occured with pooling
760*cdf0e10cSrcweir
761*cdf0e10cSrcweir		$package_is_up_to_date = 4;	# repeat this package
762*cdf0e10cSrcweir		return $package_is_up_to_date;
763*cdf0e10cSrcweir	}
764*cdf0e10cSrcweir
765*cdf0e10cSrcweir	# Removing the check file, releasing this package for the next process.
766*cdf0e10cSrcweir	# The Lock to create this package still exists, if required.
767*cdf0e10cSrcweir	unlink $checkfilename;
768*cdf0e10cSrcweir	$installer::globals::processhaspoolcheckfile = 0;
769*cdf0e10cSrcweir	$infoline = "Pool: Removing file: $checkfilename\n";
770*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
771*cdf0e10cSrcweir
772*cdf0e10cSrcweir	# Last chance before packaging starts, to check, if this process is really still owner
773*cdf0e10cSrcweir	# of the packaging lock file. If not, this packaging process can be repeated.
774*cdf0e10cSrcweir	if ( $installer::globals::processhaspoollockfile )
775*cdf0e10cSrcweir	{
776*cdf0e10cSrcweir		if ( ! -f $lockfilename )
777*cdf0e10cSrcweir		{
778*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$lockfilename\" was removed by another process (E)!\n";
779*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
780*cdf0e10cSrcweir			log_pool_info(0);
781*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
782*cdf0e10cSrcweir			return $package_is_up_to_date;
783*cdf0e10cSrcweir		}
784*cdf0e10cSrcweir
785*cdf0e10cSrcweir		if ( ! process_is_owner($lockfilename) )
786*cdf0e10cSrcweir		{
787*cdf0e10cSrcweir			$infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (E)!\n";
788*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
789*cdf0e10cSrcweir			log_pool_info(1);
790*cdf0e10cSrcweir			$package_is_up_to_date = 4;	# repeat this package
791*cdf0e10cSrcweir			return $package_is_up_to_date;
792*cdf0e10cSrcweir		}
793*cdf0e10cSrcweir	}
794*cdf0e10cSrcweir
795*cdf0e10cSrcweir	# Collecting log information
796*cdf0e10cSrcweir	if ( $package_is_up_to_date == 1 ) { $installer::globals::poolpackages{$packagename} = 1; }
797*cdf0e10cSrcweir	if ( $package_is_up_to_date == 0 )
798*cdf0e10cSrcweir	{
799*cdf0e10cSrcweir		my @packreasons = ();
800*cdf0e10cSrcweir		if ( $package_already_exists )
801*cdf0e10cSrcweir		{
802*cdf0e10cSrcweir			$infoline = "\t\tPool: $packagename: Contains new content, creating new package. Differences:\n";
803*cdf0e10cSrcweir			push( @packreasons, $infoline);
804*cdf0e10cSrcweir			foreach my $dest ( sort keys %installer::globals::pcfdifflist ) { push( @packreasons, "\t\t$dest\n"); }
805*cdf0e10cSrcweir			foreach my $dest ( @installer::globals::pcfdiffcomment ) { push( @packreasons, "\t\t$dest"); }
806*cdf0e10cSrcweir			foreach my $dest ( @installer::globals::epmdifflist ) { push( @packreasons, "\t\t$dest"); }
807*cdf0e10cSrcweir		}
808*cdf0e10cSrcweir		else
809*cdf0e10cSrcweir		{
810*cdf0e10cSrcweir			$infoline = "\t\tPool: $packagename: Does not exist in pool.\n";
811*cdf0e10cSrcweir			push( @packreasons, $infoline);
812*cdf0e10cSrcweir		}
813*cdf0e10cSrcweir
814*cdf0e10cSrcweir		$installer::globals::createpackages{$packagename} = \@packreasons;
815*cdf0e10cSrcweir	}
816*cdf0e10cSrcweir
817*cdf0e10cSrcweir	return $package_is_up_to_date;
818*cdf0e10cSrcweir}
819*cdf0e10cSrcweir
820*cdf0e10cSrcweir###################################################
821*cdf0e10cSrcweir# Determine, which package was created newly
822*cdf0e10cSrcweir###################################################
823*cdf0e10cSrcweir
824*cdf0e10cSrcweirsub determine_new_packagename
825*cdf0e10cSrcweir{
826*cdf0e10cSrcweir	my ( $dir ) = @_;
827*cdf0e10cSrcweir
828*cdf0e10cSrcweir	my ($newcontent, $allcontent) = installer::systemactions::find_new_content_in_directory($dir, \@installer::globals::installsetcontent);
829*cdf0e10cSrcweir	@installer::globals::installsetcontent = ();
830*cdf0e10cSrcweir	foreach my $element ( @{$allcontent} ) { push(@installer::globals::installsetcontent, $element); }
831*cdf0e10cSrcweir
832*cdf0e10cSrcweir	my $newentriesnumber = $#{$newcontent} + 1;
833*cdf0e10cSrcweir	if ( $newentriesnumber > 1 )
834*cdf0e10cSrcweir	{
835*cdf0e10cSrcweir		my $newpackages = "";
836*cdf0e10cSrcweir		foreach my $onepackage ( @{$newcontent} ) { $newpackages = $newpackages . " " . $onepackage; }
837*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: More than one new package in directory $dir ($newpackages)", "determine_new_packagename (packagepool)");
838*cdf0e10cSrcweir	}
839*cdf0e10cSrcweir	elsif ( $newentriesnumber < 1 )
840*cdf0e10cSrcweir	{
841*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: No new package in directory $dir", "determine_new_packagename (packagepool)");
842*cdf0e10cSrcweir	}
843*cdf0e10cSrcweir	my $newpackage = ${$newcontent}[0];
844*cdf0e10cSrcweir
845*cdf0e10cSrcweir	return $newpackage;
846*cdf0e10cSrcweir}
847*cdf0e10cSrcweir
848*cdf0e10cSrcweir####################################################
849*cdf0e10cSrcweir# Including content into the package pool
850*cdf0e10cSrcweir####################################################
851*cdf0e10cSrcweir
852*cdf0e10cSrcweirsub put_content_into_pool
853*cdf0e10cSrcweir{
854*cdf0e10cSrcweir	my ($packagename, $installdir, $subdir, $filesinpackage, $epmfilecontent) = @_;
855*cdf0e10cSrcweir
856*cdf0e10cSrcweir	my $infoline = "";
857*cdf0e10cSrcweir
858*cdf0e10cSrcweir	my $fullinstalldir = $installdir . $installer::globals::separator . $subdir;
859*cdf0e10cSrcweir	my $fullrealpackagename = determine_new_packagename($fullinstalldir);
860*cdf0e10cSrcweir	my $realpackagename = $fullrealpackagename;
861*cdf0e10cSrcweir	installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$realpackagename);
862*cdf0e10cSrcweir
863*cdf0e10cSrcweir	installer::logger::include_header_into_logfile("Adding content into the package pool: $realpackagename (PackageName: $packagename)");
864*cdf0e10cSrcweir
865*cdf0e10cSrcweir	# Calculating content for pcf file, if not already done in "package_is_up_to_date"
866*cdf0e10cSrcweir	if ( ! $installer::globals::newpcfcontentcalculated )
867*cdf0e10cSrcweir	{
868*cdf0e10cSrcweir		$installer::globals::newpcfcontent = calculate_current_content($filesinpackage, $packagename);
869*cdf0e10cSrcweir		$installer::globals::newpcfcontentcalculated = 1;
870*cdf0e10cSrcweir	}
871*cdf0e10cSrcweir
872*cdf0e10cSrcweir	# Determining md5sum and FileSize for the new package and saving in pcf file
873*cdf0e10cSrcweir	my $md5sum = installer::xpdinstaller::get_md5_value($fullrealpackagename);
874*cdf0e10cSrcweir	my $filesize = installer::xpdinstaller::get_size_value($fullrealpackagename);
875*cdf0e10cSrcweir	my $fullpackagename = installer::xpdinstaller::get_fullpkgname_value($fullrealpackagename);
876*cdf0e10cSrcweir	my $pkgversion = installer::xpdinstaller::get_pkgversion_value($fullrealpackagename);
877*cdf0e10cSrcweir
878*cdf0e10cSrcweir	# Put package content file (pcf) into pool
879*cdf0e10cSrcweir	my $pcffilename = $installer::globals::poolpath . $installer::globals::separator . $packagename . ".pcf";
880*cdf0e10cSrcweir	create_pcfcontent_file($realpackagename, $md5sum, $filesize, $fullpackagename, $pkgversion, $epmfilecontent, $pcffilename);
881*cdf0e10cSrcweir
882*cdf0e10cSrcweir	# Creating xpd info
883*cdf0e10cSrcweir	$installer::globals::xpdpackageinfo{'FileSize'} = $filesize;
884*cdf0e10cSrcweir	$installer::globals::xpdpackageinfo{'FullPackageName'} = $fullpackagename;
885*cdf0e10cSrcweir	$installer::globals::xpdpackageinfo{'md5sum'} = $md5sum;
886*cdf0e10cSrcweir	$installer::globals::xpdpackageinfo{'RealPackageName'} = $realpackagename;
887*cdf0e10cSrcweir	$installer::globals::xpdpackageinfo{'PkgVersion'} = $pkgversion;
888*cdf0e10cSrcweir
889*cdf0e10cSrcweir	# Put package into pool
890*cdf0e10cSrcweir	$infoline = "Pool: Adding package \"$packagename\" into pool.\n";
891*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
892*cdf0e10cSrcweir
893*cdf0e10cSrcweir	# Copying with unique name, containing PID. Only renaming if everything was fine.
894*cdf0e10cSrcweir	my $realdestination = "";
895*cdf0e10cSrcweir	my $uniquedestination = "";
896*cdf0e10cSrcweir	if ( -f $fullrealpackagename )
897*cdf0e10cSrcweir	{
898*cdf0e10cSrcweir		$realdestination = $installer::globals::poolpath . $installer::globals::separator . $realpackagename;
899*cdf0e10cSrcweir		$uniquedestination = $realdestination . "." . $installer::globals::sessionid;
900*cdf0e10cSrcweir		installer::systemactions::copy_one_file($fullrealpackagename, $uniquedestination);
901*cdf0e10cSrcweir	}
902*cdf0e10cSrcweir
903*cdf0e10cSrcweir	# Copying Solaris packages (as tar files)
904*cdf0e10cSrcweir	if ( -d $fullrealpackagename )
905*cdf0e10cSrcweir	{
906*cdf0e10cSrcweir		my $tarfilename = $packagename . ".tar";
907*cdf0e10cSrcweir		my $fulltarfilename = $fullinstalldir . $installer::globals::separator . $tarfilename;
908*cdf0e10cSrcweir		my $size = installer::worker::tar_package($fullinstalldir, $packagename, $tarfilename, $installer::globals::getuidpath);
909*cdf0e10cSrcweir		if (( ! -f $fulltarfilename ) || ( ! ( $size > 0 ))) { installer::exiter::exit_program("ERROR: Missing file: $fulltarfilename", "put_content_into_pool"); }
910*cdf0e10cSrcweir		$realdestination = $installer::globals::poolpath . $installer::globals::separator . $tarfilename;
911*cdf0e10cSrcweir		$uniquedestination = $realdestination . "." . $installer::globals::sessionid;
912*cdf0e10cSrcweir		installer::systemactions::copy_one_file($fulltarfilename, $uniquedestination);
913*cdf0e10cSrcweir		unlink $fulltarfilename;
914*cdf0e10cSrcweir	}
915*cdf0e10cSrcweir
916*cdf0e10cSrcweir	# Before the new package is renamed in the pool, it has to be checked, if this process still has the lock for this package.
917*cdf0e10cSrcweir	# Check, if lock file still exists and if this process is the owner. Otherwise a pool error occured.
918*cdf0e10cSrcweir	if ( ! -f $installer::globals::poollockfilename )
919*cdf0e10cSrcweir	{
920*cdf0e10cSrcweir		unlink $uniquedestination;  # removing file from pool
921*cdf0e10cSrcweir		log_pool_info(0);
922*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: Pool lock file \"$installer::globals::poollockfilename\" was removed by another process (F)!", "put_content_into_pool");
923*cdf0e10cSrcweir	}
924*cdf0e10cSrcweir
925*cdf0e10cSrcweir	if ( ! process_is_owner($installer::globals::poollockfilename) )
926*cdf0e10cSrcweir	{
927*cdf0e10cSrcweir		unlink $uniquedestination;  # removing file from pool
928*cdf0e10cSrcweir		log_pool_info(1);
929*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: Pool lock file \"$installer::globals::poollockfilename\" belongs to another process (F)!", "put_content_into_pool");
930*cdf0e10cSrcweir	}
931*cdf0e10cSrcweir
932*cdf0e10cSrcweir	# Renaming the file in the pool (atomic step)
933*cdf0e10cSrcweir	rename($uniquedestination, $realdestination);
934*cdf0e10cSrcweir
935*cdf0e10cSrcweir	$infoline = "Pool: Renamed file: \"$uniquedestination\" to \"$realdestination\".\n";
936*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
937*cdf0e10cSrcweir
938*cdf0e10cSrcweir	# Before the lock file in the pool can be removed, it has to be checked, if this process is still the owner of this lock file.
939*cdf0e10cSrcweir	# Check, if lock file still exists and if this process is the owner. Otherwise a pool error occured.
940*cdf0e10cSrcweir	if ( ! -f $installer::globals::poollockfilename )
941*cdf0e10cSrcweir	{
942*cdf0e10cSrcweir		log_pool_info(0);
943*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: Pool lock file \"$installer::globals::poollockfilename\" was removed by another process (G)!", "put_content_into_pool");
944*cdf0e10cSrcweir	}
945*cdf0e10cSrcweir
946*cdf0e10cSrcweir	if ( ! process_is_owner($installer::globals::poollockfilename) )
947*cdf0e10cSrcweir	{
948*cdf0e10cSrcweir		log_pool_info(1);
949*cdf0e10cSrcweir		installer::exiter::exit_program("ERROR: Pool lock file \"$installer::globals::poollockfilename\" belongs to another process (G)!", "put_content_into_pool");
950*cdf0e10cSrcweir	}
951*cdf0e10cSrcweir
952*cdf0e10cSrcweir	# Removing lock file, so that other processes can use this package now
953*cdf0e10cSrcweir	unlink $installer::globals::poollockfilename;
954*cdf0e10cSrcweir	$installer::globals::processhaspoollockfile = 0;
955*cdf0e10cSrcweir	$infoline = "Pool: Removing file: $installer::globals::poollockfilename\n";
956*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
957*cdf0e10cSrcweir}
958*cdf0e10cSrcweir
959*cdf0e10cSrcweir###################################################################
960*cdf0e10cSrcweir# Copying a package from the pool into the installation set
961*cdf0e10cSrcweir###################################################################
962*cdf0e10cSrcweir
963*cdf0e10cSrcweirsub copy_package_from_pool
964*cdf0e10cSrcweir{
965*cdf0e10cSrcweir	my ($installdir, $subdir, $packagename) = @_;
966*cdf0e10cSrcweir
967*cdf0e10cSrcweir	my $infoline = "Pool: Using package \"$packagename\" from pool.\n";
968*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
969*cdf0e10cSrcweir	my $sourcefile = $installer::globals::poolpath . $installer::globals::separator . $packagename;
970*cdf0e10cSrcweir	if ( $installer::globals::issolarisbuild ) { $sourcefile = $sourcefile . ".tar"; }
971*cdf0e10cSrcweir	if ( ! -f $sourcefile ) { installer::exiter::exit_program("ERROR: Missing package in package pool: \"$sourcefile\"", "copy_package_from_pool"); }
972*cdf0e10cSrcweir	my $destination = $installdir . $installer::globals::separator . $subdir;
973*cdf0e10cSrcweir	if ( ! -d $destination ) { installer::systemactions::create_directory($destination); }
974*cdf0e10cSrcweir	my $destinationfile = $destination . $installer::globals::separator . $packagename;
975*cdf0e10cSrcweir	if ( $installer::globals::issolarisbuild ) { $destinationfile = $destinationfile . ".tar"; }
976*cdf0e10cSrcweir	if ( -f $sourcefile ) { installer::systemactions::copy_one_file($sourcefile, $destinationfile); }
977*cdf0e10cSrcweir	# Unpacking for Solaris
978*cdf0e10cSrcweir	if ( $installer::globals::issolarisbuild )
979*cdf0e10cSrcweir	{
980*cdf0e10cSrcweir		my $tarfilename = $packagename . ".tar";
981*cdf0e10cSrcweir		installer::worker::untar_package($destination, $tarfilename, $installer::globals::getuidpath);
982*cdf0e10cSrcweir		unlink $destinationfile;
983*cdf0e10cSrcweir		$destinationfile =~ s/.tar\s*$//;
984*cdf0e10cSrcweir	}
985*cdf0e10cSrcweir
986*cdf0e10cSrcweir	# Keeping the content of @installer::globals::installsetcontent up to date (with full pathes):
987*cdf0e10cSrcweir	push(@installer::globals::installsetcontent, $destinationfile);
988*cdf0e10cSrcweir
989*cdf0e10cSrcweir	return $destinationfile;
990*cdf0e10cSrcweir}
991*cdf0e10cSrcweir
992*cdf0e10cSrcweir###################################################################
993*cdf0e10cSrcweir# Counting keys in hash
994*cdf0e10cSrcweir###################################################################
995*cdf0e10cSrcweir
996*cdf0e10cSrcweirsub get_count
997*cdf0e10cSrcweir{
998*cdf0e10cSrcweir	my ( $hashref ) = @_;
999*cdf0e10cSrcweir
1000*cdf0e10cSrcweir	my $counter = 0;
1001*cdf0e10cSrcweir	foreach my $onekey ( keys %{$hashref} ) { $counter++; }
1002*cdf0e10cSrcweir	return $counter;
1003*cdf0e10cSrcweir}
1004*cdf0e10cSrcweir
1005*cdf0e10cSrcweir###################################################################
1006*cdf0e10cSrcweir# Logging some pool information
1007*cdf0e10cSrcweir###################################################################
1008*cdf0e10cSrcweir
1009*cdf0e10cSrcweirsub log_pool_statistics
1010*cdf0e10cSrcweir{
1011*cdf0e10cSrcweir	my $infoline = "";
1012*cdf0e10cSrcweir
1013*cdf0e10cSrcweir	installer::logger::include_header_into_logfile("Pool statistics:");
1014*cdf0e10cSrcweir
1015*cdf0e10cSrcweir	# Info collected in global hashes
1016*cdf0e10cSrcweir	# %installer::globals::createpackages
1017*cdf0e10cSrcweir	# %installer::globals::poolpackages
1018*cdf0e10cSrcweir
1019*cdf0e10cSrcweir	my $pool_packages = get_count(\%installer::globals::poolpackages);
1020*cdf0e10cSrcweir	my $created_packages = get_count(\%installer::globals::createpackages);
1021*cdf0e10cSrcweir
1022*cdf0e10cSrcweir	$infoline = "Number of packages from pool: $pool_packages\n";
1023*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
1024*cdf0e10cSrcweir
1025*cdf0e10cSrcweir	foreach my $packagename ( sort keys(%installer::globals::poolpackages) )
1026*cdf0e10cSrcweir	{
1027*cdf0e10cSrcweir		$infoline = "\t$packagename\n";
1028*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
1029*cdf0e10cSrcweir	}
1030*cdf0e10cSrcweir
1031*cdf0e10cSrcweir	$infoline = "\nNumber of packages that were created: $created_packages\n";
1032*cdf0e10cSrcweir	push( @installer::globals::logfileinfo, $infoline);
1033*cdf0e10cSrcweir
1034*cdf0e10cSrcweir	foreach my $packagename ( sort keys(%installer::globals::createpackages) )
1035*cdf0e10cSrcweir	{
1036*cdf0e10cSrcweir		$infoline = "\t$packagename\n";
1037*cdf0e10cSrcweir		push( @installer::globals::logfileinfo, $infoline);
1038*cdf0e10cSrcweir		my $reason = $installer::globals::createpackages{$packagename};
1039*cdf0e10cSrcweir
1040*cdf0e10cSrcweir		for ( my $i = 0; $i <= $#{$reason}; $i++ )
1041*cdf0e10cSrcweir		{
1042*cdf0e10cSrcweir			$infoline = "${$reason}[$i]";
1043*cdf0e10cSrcweir			push( @installer::globals::logfileinfo, $infoline);
1044*cdf0e10cSrcweir		}
1045*cdf0e10cSrcweir	}
1046*cdf0e10cSrcweir}
1047*cdf0e10cSrcweir
1048*cdf0e10cSrcweir1;
1049