You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by st...@apache.org on 2013/11/04 06:32:06 UTC
svn commit: r1538508 [8/15] - in /openoffice/branches/ia2: ./
extras/l10n/source/bg/ main/ main/basegfx/inc/basegfx/polygon/
main/basegfx/source/inc/ main/basegfx/source/polygon/
main/basegfx/source/tools/ main/basegfx/test/ main/canvas/source/tools/ m...
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/epmfile.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/epmfile.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/epmfile.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/epmfile.pm Mon Nov 4 05:32:01 2013
@@ -36,7 +36,7 @@ use installer::remover;
use installer::scriptitems;
use installer::systemactions;
use installer::worker;
-use POSIX;
+use POSIX qw(uname);
############################################################################
# Reading the package map to find Solaris package names for
@@ -50,9 +50,10 @@ sub read_packagemap
my $packagemapname = "";
if ( $allvariables->{'PACKAGEMAP'} ) { $packagemapname = $allvariables->{'PACKAGEMAP'}; }
if ( $packagemapname eq "" ) { installer::exiter::exit_program("ERROR: Property PACKAGEMAP must be defined!", "read_packagemap"); }
-
- my $infoline = "\n\nCollected abbreviations and package names:\n";
- push(@installer::globals::logfileinfo, $infoline);
+
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("nCollected abbreviations and package names:\n");
# Can be a comma separated list. All files have to be found in include pathes
my $allpackagemapnames = installer::converter::convert_stringlist_into_hash(\$packagemapname, ",");
@@ -90,8 +91,10 @@ sub read_packagemap
$local_packagename =~ s/\%LANGUAGESTRING/$onelang/g;
# Logging all abbreviations and packagenames
- $infoline = "$onelang : $local_abbreviation : $local_packagename\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("%s : %s : %s\n",
+ $onelang,
+ $local_abbreviation,
+ $local_packagename);
if ( exists($installer::globals::dependfilenames{$local_abbreviation}) )
{
@@ -106,8 +109,7 @@ sub read_packagemap
else
{
# Logging all abbreviations and packagenames
- $infoline = "$abbreviation : $packagename\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("%s : %s\n", $abbreviation, $packagename);
if ( exists($installer::globals::dependfilenames{$abbreviation}) )
{
@@ -126,10 +128,9 @@ sub read_packagemap
}
}
}
-
- $infoline = "\n\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("\n");
}
############################################################################
@@ -481,8 +482,7 @@ sub create_epm_header
installer::files::save_file($$fileref, $copyrightfile);
}
- $infoline = "Using license file: \"$$fileref\"!\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Using license file: \"%s\"!\n", $$fileref);
$foundlicensefile = 1;
$line = "%license" . " " . $$fileref . "\n";
@@ -824,8 +824,7 @@ sub find_epm_on_system
if (!($$epmfileref eq "")) { $epmname = $$epmfileref; }
}
- my $infoline = "Using epmfile: $epmname\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Using epmfile: %s\n", $epmname);
return $epmname;
}
@@ -854,13 +853,15 @@ sub set_patch_state
if ( $installer::globals::is_special_epm )
{
- $infoline = "\nPatch state: This is a patched version of epm!\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Patch state: This is a patched version of epm!\n");
+ $installer::logger::Lang->print("\n");
}
else
{
- $infoline = "\nPatch state: This is an unpatched version of epm!\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Patch state: This is an unpatched version of epm!\n");
+ $installer::logger::Lang->print("\n");
}
if ( ( $installer::globals::is_special_epm ) && (($installer::globals::islinuxrpmbuild) || ($installer::globals::issolarispkgbuild)) )
@@ -927,7 +928,7 @@ sub call_epm
my $systemcall = $ldpreloadstring . $epmname . " -f " . $packageformat . " " . $extraflags . " " . $localpackagename . " " . $epmlistfilename . $outdirstring . " " . $verboseflag . " " . " 2\>\&1 |";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
my $maxepmcalls = 3;
@@ -941,26 +942,23 @@ sub call_epm
my $returnvalue = $?; # $? contains the return value of the systemcall
- my $infoline = "Systemcall (Try $i): $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall (Try %d): \n", $i, $systemcall);
for ( my $j = 0; $j <= $#epmoutput; $j++ )
{
if ( $i < $maxepmcalls ) { $epmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; }
- push( @installer::globals::logfileinfo, "$epmoutput[$j]");
+ $installer::logger::Lang->print($epmoutput[$j]);
}
if ($returnvalue)
{
- $infoline = "Try $i : Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Try %d : Could not execute \"%s\"!\n", $i, $systemcall);
if ( $i == $maxepmcalls ) { installer::exiter::exit_program("ERROR: \"$systemcall\"!", "call_epm"); }
}
else
{
- installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" );
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Info->printf("Success: Executed (Try %d): \"%s\" successfully\n", $i, $systemcall);
+ $installer::logger::Lang->printf("Success: Executed (Try %d): \"%s\" successfully\n", $i, $systemcall);
last;
}
}
@@ -1000,8 +998,7 @@ sub add_one_line_into_file
}
$insertline =~ s/\s*$//; # removing line end for correct logging
- my $infoline = "Success: Added line $insertline into file $filename!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Added line %s into file !\n", $insertline, $filename);
}
#####################################################################
@@ -1035,8 +1032,10 @@ sub set_revision_in_pkginfo
my $oldstring = $1;
my $newstring = $oldstring . $revisionstring; # also adding the date string
${$file}[$i] =~ s/$oldstring/$newstring/;
- my $infoline = "Info: Changed in $filename file: \"$oldstring\" to \"$newstring\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Changed in %s file: \"%s\" to \"\"!\n",
+ $filename,
+ $oldstring,
+ $newstring);
last;
}
}
@@ -1091,8 +1090,7 @@ sub set_revision_in_pkginfo
${$file}[$i] = $newstring;
$oldstring =~ s/\s*$//;
$newstring =~ s/\s*$//;
- my $infoline = "Info: Changed in $filename file: \"$oldstring\" to \"$newstring\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Changed in %s file: \"%s\" to \"\"!\n", $filename, $oldstring, $newstring);
last;
}
}
@@ -1324,8 +1322,7 @@ sub set_topdir_in_specfile
my $removeline = ${$changefile}[$i];
$removeline =~ s/\s*$//;
splice(@{$changefile},$i,1);
- my $infoline = "Info: Removed line \"$removeline\" from file $filename!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Removed line \"%s\" from file %s!\n", $removeline, $filename);
last;
}
}
@@ -1343,8 +1340,7 @@ sub set_topdir_in_specfile
splice(@{$changefile},$i+1,0,$topdirline);
$inserted_line = 1;
$topdirline =~ s/\s*$//;
- my $infoline = "Success: Added line $topdirline into file $filename!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Added line %s into file %s!\n", $topdirline, $filename);
}
}
@@ -1369,8 +1365,9 @@ sub set_packager_in_specfile
{
my $oldstring = $1;
${$changefile}[$i] =~ s/\Q$oldstring\E/$packager/;
- my $infoline = "Info: Changed Packager in spec file from $oldstring to $packager!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Changed Packager in spec file from %s to %s!\n",
+ $oldstring,
+ $packager);
last;
}
}
@@ -1393,8 +1390,9 @@ sub set_prereq_in_specfile
{
my $oldstring = ${$changefile}[$i];
${$changefile}[$i] =~ s/Requires:/$prereq/;
- my $infoline = "Info: Changed requirements in spec file from $oldstring to ${$changefile}[$i]!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Changed requirements in spec file from %s to %s!\n",
+ $oldstring,
+ ${$changefile}[$i]);
}
}
}
@@ -1427,9 +1425,7 @@ sub set_autoprovreq_in_specfile
{
splice(@{$changefile},$i+1,0,$autoreqprovline);
$autoreqprovline =~ s/\s*$//;
- $infoline = "Success: Added line $autoreqprovline into spec file!\n";
- push( @installer::globals::logfileinfo, $infoline);
-
+ $installer::logger::Lang->printf("Success: Added line %s into spec file!\n", $autoreqprovline);
last;
}
}
@@ -1451,8 +1447,7 @@ sub set_license_in_specfile
if ( ${$changefile}[$i] =~ /^\s*Copyright\s*:\s*(.+?)\s*$/ )
{
${$changefile}[$i] = "License: $license\n";
- my $infoline = "Info: Replaced Copyright with License: $license !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Replaced Copyright with License: %s !\n", $license);
last;
}
}
@@ -1491,8 +1486,7 @@ sub make_prototypefile_relocatable
my $line = ${$prototypefile}[$i];
splice(@{$prototypefile},$i,1); # removing the line
$line =~ s/\s*$//;
- my $infoline = "Info: Removed line \"$line\" from prototype file!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Removed line \"%s\" from prototype file!\n", $line);
last;
}
}
@@ -1504,8 +1498,7 @@ sub make_prototypefile_relocatable
if ( ${$prototypefile}[$i] =~ /\\\$/ )
{
${$prototypefile}[$i] =~ s/\\\$/\$/g;
- my $infoline2 = "Info: Changed line in prototype file: ${$prototypefile}[$i] !\n";
- push( @installer::globals::logfileinfo, $infoline2);
+ $installer::logger::Lang->printf("Info: Changed line in prototype file: %s !\n", ${$prototypefile}[$i]);
}
}
}
@@ -1541,8 +1534,10 @@ sub set_volatilefile_into_prototypefile
my $newline = ${$prototypefile}[$j];
$oldline =~ s/\s*$//;
$newline =~ s/\s*$//;
- my $infoline = "Volatile file: Changing content from \"$oldline\" to \"$newline\" .\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf(
+ "Volatile file: Changing content from \"%s\" to \"%s\" .\n",
+ $oldline,
+ $newline);
last;
}
}
@@ -1566,8 +1561,8 @@ sub replace_variables_in_shellscripts_fo
my $oldline = ${$scriptfile}[$i];
if (( $oldstring eq "PRODUCTDIRECTORYNAME" ) && ( $newstring eq "" )) { $oldstring = $oldstring . "/"; }
${$scriptfile}[$i] =~ s/\Q$oldstring\E/$newstring/g;
- my $infoline = "Info: Substituting in $scriptfilename $oldstring by $newstring\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Substituting in %s %s by %s\n",
+ $scriptfilename, $oldstring, $newstring);
}
}
}
@@ -1594,15 +1589,15 @@ sub replace_variables_in_shellscripts
{
my $oldline = ${$scriptfile}[$i];
${$scriptfile}[$i] =~ s/\Q$oldstring\E/$newstring/g;
- ${$scriptfile}[$i] =~ s/\/\//\//g; # replacing "//" by "/" , if path $newstring is empty!
- my $infoline = "Info: Substituting in $scriptfilename $oldstring by $newstring\n";
- push(@installer::globals::logfileinfo, $infoline);
+ ${$scriptfile}[$i] =~ s/\/\//\//g; # replacing "//" by "/" , if path $newstring is empty!
+ $installer::logger::Lang->printf("Info: Substituting in %s %s by %s\n",
+ $scriptfilename,
+ $oldstring,
+ $newstring);
if ( $debug )
{
- $infoline = "Old Line: $oldline";
- push(@installer::globals::logfileinfo, $infoline);
- $infoline = "New Line: ${$scriptfile}[$i]";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Old Line: %s", $oldline);
+ $installer::logger::Lang->printf("New Line: %s", ${$scriptfile}[$i]);
}
}
}
@@ -1626,8 +1621,7 @@ sub determine_installdir_ooo
$dirname =~ s/\s*$//;
- my $infoline = "Info: Directory created by epm: $dirname\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Info: Directory created by epm: %s\n", $dirname);
return $dirname;
}
@@ -1663,8 +1657,8 @@ sub set_tab_into_datafile
$oldline =~ s/\s*$//;
$newline =~ s/\s*$//;
- my $infoline = "TAB: Changing content from \"$oldline\" to \"$newline\" .\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("TAB: Changing content from \"%s\" to \"%s\" .\n",
+ $oldline, $newline);
# collecting all new classes
if (! installer::existence::exists_in_array($onefile->{'SolarisClass'}, \@newclasses))
@@ -1705,8 +1699,8 @@ sub set_tab_into_datafile
$oldline =~ s/\s*$//;
$newline =~ s/\s*$//;
- my $infoline = "TAB: Changing content from \"$oldline\" to \"$newline\" .\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf(
+ "TAB: Changing content from \"%s\" to \"%s\" .\n", $oldline, $newline);
last;
}
@@ -1736,8 +1730,8 @@ sub include_classes_into_pkginfo
my $newline = ${$changefile}[$i];
$newline =~ s/\s*$//;
- my $infoline = "pkginfo file: Changing content from \"$oldline\" to \"$newline\" .\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("pkginfo file: Changing content from \"%s\" to \"%s\" .\n",
+ $oldline, $newline);
}
}
}
@@ -2196,8 +2190,8 @@ sub check_requirements_in_specfile
$oldline =~ s/\s*$//;
$newline =~ s/\s*$//;
- my $infoline = "Spec File: Changing content from \"$oldline\" to \"$newline\".\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Spec File: Changing content from \"%s\" to \"%s\".\n",
+ $oldline, $newline);
}
}
}
@@ -2261,13 +2255,16 @@ sub determine_rpm_version
{
$rpmout =~ s/\s*$//g;
- my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
- if ( $rpmout eq "" ) { $infoline = "ERROR: Could not find file \"rpm\" !\n"; }
- else { $infoline = "Success: rpm version: $rpmout\n"; }
-
- push( @installer::globals::logfileinfo, $infoline);
+ if ( $rpmout eq "" )
+ {
+ $installer::logger::Lang->printf("ERROR: Could not find file \"rpm\" !\n");
+ }
+ else
+ {
+ $installer::logger::Lang->printf("Success: rpm version: %s\n", $rpmout);
+ }
if ( $rpmout =~ /(\d+)\.(\d+)\.(\d+)/ ) { $rpmversion = $1; }
elsif ( $rpmout =~ /(\d+)\.(\d+)/ ) { $rpmversion = $1; }
@@ -2287,8 +2284,9 @@ sub log_rpm_info
my $systemcall = "";
my $infoline = "";
- $infoline = "\nLogging rpmrc content using --showrc\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("Logging rpmrc content using --showrc\n");
+ $installer::logger::Lang->printf("\n");
if ( $installer::globals::rpm ne "" )
{
@@ -2314,17 +2312,16 @@ sub log_rpm_info
$infoline = "$rpmout\n";
$infoline =~ s/error/e_r_r_o_r/gi; # avoiding log problems
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf($infoline);
}
}
else
{
- $infoline = "Problem in systemcall: $systemcall : No return value\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Problem in systemcall: %s : No return value\n", $systemcall);
}
-
- $infoline = "End of logging rpmrc\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+
+ $installer::logger::Lang->printf("End of logging rpmrc\n");
+ $installer::logger::Lang->print("\n");
}
#################################################
@@ -2350,7 +2347,7 @@ sub create_packages_without_epm
# my $systemcall = "pkgmk -o -f $prototypefile -d $destinationdir \> /dev/null 2\>\&1";
my $systemcall = "pkgmk -l 1073741824 -o -f $prototypefile -d $destinationdir 2\>\&1 |";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
my $maxpkgmkcalls = 3;
@@ -2364,26 +2361,26 @@ sub create_packages_without_epm
my $returnvalue = $?; # $? contains the return value of the systemcall
- my $infoline = "Systemcall (Try $i): $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall (Try %d): %s\n", $i, $systemcall);
for ( my $j = 0; $j <= $#pkgmkoutput; $j++ )
{
if ( $i < $maxpkgmkcalls ) { $pkgmkoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; }
- push( @installer::globals::logfileinfo, "$pkgmkoutput[$j]");
+ $installer::logger::Lang->print($pkgmkoutput[$j]);
}
if ($returnvalue)
{
- $infoline = "Try $i : Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Try %s : Could not execute \"%s\"!\n",
+ $i, $systemcall);
if ( $i == $maxpkgmkcalls ) { installer::exiter::exit_program("ERROR: \"$systemcall\"!", "create_packages_without_epm"); }
}
else
{
- installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" );
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Info->printf("Success: (Try %d): Executed \"%s\" successfully\n",
+ $i, $systemcall);
+ $installer::logger::Lang->printf("Success: (Try %d): Executed \"%s\" successfully\n",
+ $i, $systemcall);
last;
}
}
@@ -2410,28 +2407,25 @@ sub create_packages_without_epm
$systemcall = "cd $destinationdir; cp -p -R $packagename $installer::globals::saved_packages_path;";
make_systemcall($systemcall);
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
# Setting unix rights to "775" for all created directories inside the package,
# that is saved in temp directory
$systemcall = "cd $packagestempdir; find $packagename -type d -exec chmod 775 \{\} \\\;";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
$returnvalue = system($systemcall);
- $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
if ($returnvalue)
{
- $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall);
}
else
{
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall);
}
}
}
@@ -2452,11 +2446,10 @@ sub create_packages_without_epm
make_systemcall($systemcall);
$faspac = $$compressorref;
- $infoline = "Found compressor: $faspac\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Found compressor: %s\n", $faspac);
- installer::logger::print_message( "... $faspac ...\n" );
- installer::logger::include_timestamp_into_logfile("Starting $faspac");
+ $installer::logger::Info->printf("... %s ...\n", $faspac);
+ $installer::logger::Lang->add_timestamp("Starting $faspac");
$systemcall = "/bin/sh $faspac -a -q -d $destinationdir $packagename"; # $faspac has to be the absolute path!
make_systemcall($systemcall);
@@ -2467,83 +2460,31 @@ sub create_packages_without_epm
make_systemcall($systemcall);
if ( -f $pkginfotmp ) { unlink($pkginfotmp); }
- installer::logger::include_timestamp_into_logfile("End of $faspac");
+ $installer::logger::Lang->add_timestamp("End of $faspac");
}
else
{
- $infoline = "Not found: $faspac\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Not found: %s\n", $faspac);
}
}
# Setting unix rights to "775" for all created directories inside the package
$systemcall = "cd $destinationdir; find $packagename -type d -exec chmod 775 \{\} \\\;";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
$returnvalue = system($systemcall);
- $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
if ($returnvalue)
{
- $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall);
}
else
{
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall);
}
-
- ######################
- # making pkg files
- ######################
-
- # my $streamname = $packagename . ".pkg";
- # $systemcall = "pkgtrans $destinationdir $streamname $packagename";
- # print "... $systemcall ...\n";
-
- # $returnvalue = system($systemcall);
-
- # $infoline = "Systemcall: $systemcall\n";
- # push( @installer::globals::logfileinfo, $infoline);
-
- # if ($returnvalue)
- # {
- # $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- # push( @installer::globals::logfileinfo, $infoline);
- # }
- # else
- # {
- # $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- # push( @installer::globals::logfileinfo, $infoline);
- # }
-
- #########################
- # making tar.gz files
- #########################
-
- # my $targzname = $packagename . ".tar.gz";
- # $systemcall = "cd $destinationdir; tar -cf - $packagename | gzip > $targzname";
- # print "... $systemcall ...\n";
-
- # $returnvalue = system($systemcall);
-
- # $infoline = "Systemcall: $systemcall\n";
- # push( @installer::globals::logfileinfo, $infoline);
-
- # if ($returnvalue)
- # {
- # $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- # push( @installer::globals::logfileinfo, $infoline);
- # }
- # else
- # {
- # $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- # push( @installer::globals::logfileinfo, $infoline);
- # }
}
# Linux: rpm -bb so8m35.spec ( -> dependency check abklemmen? )
@@ -2587,7 +2528,7 @@ sub create_packages_without_epm
my $systemcall = "$rpmcommand -bb --define \"_unpackaged_files_terminate_build 0\" $specfilename --target $target $buildrootstring 2\>\&1 |";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
my $maxrpmcalls = 3;
my $rpm_failed = 0;
@@ -2602,27 +2543,24 @@ sub create_packages_without_epm
my $returnvalue = $?; # $? contains the return value of the systemcall
- my $infoline = "Systemcall (Try $i): $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall (Try %d): %s\n", $i, $systemcall);
for ( my $j = 0; $j <= $#rpmoutput; $j++ )
{
# if ( $i < $maxrpmcalls ) { $rpmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig; }
$rpmoutput[$j] =~ s/\bERROR\b/PROBLEM/ig;
- push( @installer::globals::logfileinfo, "$rpmoutput[$j]");
+ $installer::logger::Lang->print($rpmoutput[$j]);
}
if ($returnvalue)
{
- $infoline = "Try $i : Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Try %d : Could not execute \"%s\"!\n", $i, $systemcall);
$rpm_failed = 1;
}
else
{
- installer::logger::print_message( "Success (Try $i): \"$systemcall\"\n" );
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Info->printf("Success (Try %d): Executed \"%s\" successfully!\n", $i, $systemcall);
+ $installer::logger::Lang->printf("Success (Try %d): Executed \"%s\" successfully!\n", $i, $systemcall);
$rpm_failed = 0;
last;
}
@@ -2637,7 +2575,7 @@ sub create_packages_without_epm
if ( $rpmprog ne "" )
{
- installer::logger::print_message( "... $rpmprog ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $rpmprog);
my $helpersystemcall = "$rpmprog -bb $specfilename --target $target $buildrootstring 2\>\&1 |";
@@ -2649,24 +2587,26 @@ sub create_packages_without_epm
my $helperreturnvalue = $?; # $? contains the return value of the systemcall
- $infoline = "\nLast try: Using $rpmprog directly (problem with LD_LIBARY_PATH)\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- $infoline = "\nSystemcall: $helpersystemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- for ( my $j = 0; $j <= $#helperrpmoutput; $j++ ) { push( @installer::globals::logfileinfo, "$helperrpmoutput[$j]"); }
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("Last try: Using %s directly (problem with LD_LIBARY_PATH)\n",
+ $rpmprog);
+
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("Systemcall: %s\n", $helpersystemcall);
+
+ foreach my $line (@helperrpmoutput)
+ {
+ $installer::logger::Lang->print($helperrpmoutput[$j]);
+ }
if ($helperreturnvalue)
{
- $infoline = "Could not execute \"$helpersystemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Could not execute \"%s\"!\n", $helpersystemcall);
}
else
{
- installer::logger::print_message( "Success: \"$helpersystemcall\"\n" );
- $infoline = "Success: Executed \"$helpersystemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $helpersystemcall);
+ $installer::logger::Info->printf("Success: Executed \"%s\" successfully!\n", $helpersystemcall);
$rpm_failed = 0;
}
}
@@ -2707,33 +2647,8 @@ sub remove_temporary_epm_files
my $systemcall = "mv -f $removefile $destfile";
system($systemcall); # ignoring the return value
- $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
}
-
- # removing the package
-
-# my $removedir = $epmdir . $packagename;
-#
-# my $systemcall = "rm -rf $removedir";
-#
-# print "... $systemcall ...\n";
-#
-# my $returnvalue = system($systemcall);
-#
-# my $infoline = "Systemcall: $systemcall\n";
-# push( @installer::globals::logfileinfo, $infoline);
-#
-# if ($returnvalue)
-# {
-# $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
-# push( @installer::globals::logfileinfo, $infoline);
-# }
-# else
-# {
-# $infoline = "Success: Executed \"$systemcall\" successfully!\n";
-# push( @installer::globals::logfileinfo, $infoline);
-# }
}
if ( $installer::globals::islinuxrpmbuild )
@@ -2745,41 +2660,36 @@ sub remove_temporary_epm_files
my $systemcall = "mv -f $removefile $destfile";
system($systemcall); # ignoring the return value
- $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
# removing the directory "buildroot"
my $removedir = $epmdir . "buildroot";
$systemcall = "rm -rf $removedir";
-
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
+
my $returnvalue = system($systemcall);
$removedir = $epmdir . "BUILD";
$systemcall = "rm -rf $removedir";
-
- installer::logger::print_message( "... $systemcall ...\n" );
- $returnvalue = system($systemcall);
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
+ $returnvalue = system($systemcall);
- my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
- if ($returnvalue)
- {
- $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
- else
- {
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
+ if ($returnvalue)
+ {
+ $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall);
+ }
+ else
+ {
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall);
+ }
}
}
@@ -2793,18 +2703,15 @@ sub make_systemcall
my $returnvalue = system($systemcall);
- my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
if ($returnvalue)
{
- $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $systemcall);
}
else
{
- $infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $systemcall);
}
}
@@ -2835,18 +2742,17 @@ sub create_new_directory_structure
my $returnvalue = system($systemcall);
- my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall);
if ($returnvalue)
{
- $infoline = "ERROR: Could not move content of \"$rpmdir\" to \"$newdir\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("ERROR: Could not move content of \"%s\" to \"%s\"!\n",
+ $rpmdir,$newdir);
}
else
{
- $infoline = "Success: Moved content of \"$rpmdir\" to \"$newdir\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Success: Moved content of \"%s\" to \"%s\"!\n",
+ $rpmdir, $newdir);
}
# and removing the empty directory
@@ -2867,18 +2773,15 @@ sub create_new_directory_structure
my $localcall = "chmod 775 $newdir \>\/dev\/null 2\>\&1";
my $callreturnvalue = system($localcall);
- my $callinfoline = "Systemcall: $localcall\n";
- push( @installer::globals::logfileinfo, $callinfoline);
+ $installer::logger::Lang->printf("Systemcall: %s\n", $localcall);
if ($callreturnvalue)
{
- $callinfoline = "ERROR: Could not execute \"$localcall\"!\n";
- push( @installer::globals::logfileinfo, $callinfoline);
+ $installer::logger::Lang->printf("ERROR: Could not execute \"%s\"!\n", $localcall);
}
else
{
- $callinfoline = "Success: Executed \"$localcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $callinfoline);
+ $installer::logger::Lang->printf("Success: Executed \"%s\" successfully!\n", $localcall);
}
}
@@ -3139,8 +3042,7 @@ sub put_systemintegration_into_installse
my $onemodule = ${$allmodules}[$i];
my $packagetarfilename = $onemodule->{'PackageName'};
- my $infoline = "Including into installation set: $packagetarfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Including into installation set: %s\n", $packagetarfilename);
my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$packagetarfilename, $includepatharrayref, 1);
if ( $$sourcepathref eq "" ) { installer::exiter::exit_program("ERROR: Source path not found for $packagetarfilename!", "copy_systemintegration_files"); }
@@ -3259,9 +3161,9 @@ sub put_installsetfiles_into_installset
if ( $installer::globals::addjavainstaller ) { $destfile = $onefile->{'Name'}; }
else { $destfile = $destdir . $installer::globals::separator . $onefile->{'Name'}; }
installer::systemactions::copy_one_file($sourcefile, $destfile);
-
- my $infoline = "Adding to installation set \"$destfile\" from source \"$sourcefile\".\n";
- push( @installer::globals::logfileinfo, $infoline);
+
+ $installer::logger::Lang->printf("Adding to installation set \"%s\" from source \"%s\".\n",
+ $destfile, $sourcefile);
}
}
@@ -3375,8 +3277,7 @@ sub finalize_linux_patch
if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find patch script template $scriptfilename!", "finalize_linux_patch"); }
my $scriptfile = installer::files::read_file($$scriptref);
- my $infoline = "Found script file $scriptfilename: $$scriptref \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Found script file %s: %s \n", $scriptfilename, $$scriptref);
# Collecting all RPMs in the patch directory
@@ -3426,8 +3327,7 @@ sub finalize_linux_patch
$productname = lc($productname);
$productname =~ s/ /_/g; # abc office -> abc_office
- $infoline = "Adding productname $productname into Linux patch script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Adding productname %s into Linux patch script\n", $productname);
for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) { ${$scriptfile}[$j] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; }
@@ -3436,8 +3336,7 @@ sub finalize_linux_patch
my $newscriptfilename = "setup"; # $newepmdir . $installer::globals::separator . "setup";
installer::files::save_file($newscriptfilename, $scriptfile);
- $infoline = "Saved Linux patch setup $newscriptfilename \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Saved Linux patch setup %s\n", $newscriptfilename);
# Setting unix rights 755
my $localcall = "chmod 775 $newscriptfilename \>\/dev\/null 2\>\&1";
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/exiter.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/exiter.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/exiter.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/exiter.pm Mon Nov 4 05:32:01 2013
@@ -60,38 +60,26 @@ sub exit_program
if ( $#installer::globals::logfileinfo > -1 )
{
- $infoline = "\n***************************************************************\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- $infoline = "$message\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- $infoline = "in function: $function\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- $infoline = "***************************************************************\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("***************************************************************\n");
+ $installer::logger::Lang->print($message."\n");
+ $installer::logger::Lang->printf("in function: %s\n", $function);
+ $installer::logger::Lang->printf("***************************************************************\n");
- installer::files::save_file($installer::globals::logfilename ,\@installer::globals::logfileinfo);
+# installer::files::save_file($installer::globals::logfilename ,\@installer::globals::logfileinfo);
}
else
{
- $infoline = "\n***************************************************************\n";
- push(@installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "$message\n";
- push(@installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "in function: $function\n";
- push(@installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "***************************************************************\n";
- push(@installer::globals::globallogfileinfo, $infoline);
+ $installer::logger::Global->print("\n");
+ $installer::logger::Global->print("***************************************************************\n");
+ $installer::logger::Global->print($message."\n");
+ $installer::logger::Global->printf("in function: %s\n", $function);
+ $installer::logger::Global->printf("***************************************************************\n");
- installer::files::save_file($installer::globals::logfilename ,\@installer::globals::globallogfileinfo);
+# installer::files::save_file($installer::globals::logfilename ,\@installer::globals::globallogfileinfo);
}
installer::logger::print_error("$message\nin function: $function");
- installer::logger::print_error("Saved logfile: $installer::globals::logfilename\n");
+# installer::logger::print_error("Saved logfile: $installer::globals::logfilename\n");
# Saving the debug info
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/files.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/files.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/files.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/files.pm Mon Nov 4 05:32:01 2013
@@ -84,9 +84,9 @@ sub save_file
if ( $savefile =~ /\.log/ )
{
- print "\n*************************************************\n";
+ print "*************************************************\n";
print "ERROR: Cannot write log file: $savefile";
- print "\n*************************************************\n";
+ print "*************************************************\n";
exit(-1); # exiting the program to avoid endless loops
}
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/followme.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/followme.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/followme.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/followme.pm Mon Nov 4 05:32:01 2013
@@ -93,7 +93,7 @@ sub save_followme_info
# Saving file
installer::files::save_file($downloadinfodir . $installer::globals::separator . $downloadinfofilename, \@filecontent);
- installer::logger::print_message( "... creating \"follow me\" info file $downloadinfofilename.\n" );
+ $installer::logger::Info->printf("... creating \"follow me\" info file %s.\n", $downloadinfofilename);
}
####################################################
@@ -107,7 +107,8 @@ sub read_followme_info
if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file: $filename", "read_download_info"); }
- installer::logger::print_message( "\n... reading \"follow me\" info file $filename\n" );
+ $installer::logger::Info->print("\n");
+ $installer::logger::Info->printf("... reading \"follow me\" info file %s\n", $filename);
my %contenthash = ();
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/globals.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/globals.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/globals.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/globals.pm Mon Nov 4 05:32:01 2013
@@ -245,9 +245,9 @@ BEGIN
$globallogging = 0;
$globalloggingform21 = 1;
$logfilename = "logfile.log"; # the default logfile name for global errors
- @logfileinfo = ();
- @errorlogfileinfo = ();
- @globallogfileinfo = ();
+# @logfileinfo = ();
+# @errorlogfileinfo = ();
+# @globallogfileinfo = ();
$ignore_error_in_logfile = 0;
$exitlog = "";
$globalinfo_copied = 0;
@@ -508,7 +508,7 @@ BEGIN
$libextension = "\.dll";
$isunix = 0;
$iswin = 1;
- $archiveformat = ".zip";
+ $archiveformat = ".zip";
%savedmapping = ();
%savedrevmapping = ();
%savedrev83mapping = ();
@@ -526,7 +526,7 @@ BEGIN
$isunix = 0;
$iswin = 0;
$isos2 = 1;
- $archiveformat = ".zip";
+ $archiveformat = ".zip";
}
else
{
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/javainstaller.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/javainstaller.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/javainstaller.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/javainstaller.pm Mon Nov 4 05:32:01 2013
@@ -162,8 +162,8 @@ sub set_productname_and_productversion
{
my ($templatefile, $variableshashref) = @_;
- my $infoline = "\nSetting product name and product version in Java template file\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Setting product name and product version in Java template file\n");
my $productname = $variableshashref->{'PRODUCTNAME'};
my $productversion = $variableshashref->{'PRODUCTVERSION'};
@@ -175,7 +175,7 @@ sub set_productname_and_productversion
}
$infoline = "End of: Setting product name and product version in Java template file\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
#######################################################
@@ -186,8 +186,8 @@ sub set_component_name_and_description
{
my ($templatefile, $modulesarrayref, $onelanguage) = @_;
- my $infoline = "\nSetting component names and description in Java template file\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Setting component names and description in Java template file\n");
for ( my $i = 0; $i <= $#{$templatefile}; $i++ )
{
@@ -204,7 +204,7 @@ sub set_component_name_and_description
$oldstring = $1;
$infoline = "Found: $oldstring\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ( $oldstring =~ /^\s*OOO_(gid_\w+)_(\w+?)\s*$/ )
{
@@ -215,14 +215,14 @@ sub set_component_name_and_description
my $newstring = get_module_name_description($modulesarrayref, $onelanguage, $gid, $type);
$infoline = "\tReplacing (language $onelanguage): OLDSTRING: $oldstring NEWSTRING $newstring\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
${$templatefile}[$i] =~ s/$oldstring/$newstring/; # always substitute, even if $newstring eq ""
}
}
$infoline = "End of: Setting component names and description in Java template file\n\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
#######################################################
@@ -276,7 +276,7 @@ sub get_licensefilesource
if ($$licenseref eq "") { installer::exiter::exit_program("ERROR: Could not find License file $licensefilename!", "get_licensefilesource"); }
my $infoline = "Found licensefile $licensefilename: $$licenseref \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
return $$licenseref;
}
@@ -334,7 +334,7 @@ sub convert_licenstring
if ($$converterref eq "") { installer::exiter::exit_program("ERROR: Could not find converter $converter!", "convert_licenstring"); }
my $infoline = "Found converter file $converter: $$converterref \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my $systemcall = "$$converterref $licensefilename |";
open (CONV, "$systemcall");
@@ -357,12 +357,12 @@ sub convert_licenstring
}
$infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ( $licensestring eq "" )
{
$infoline = "ERROR: Could not convert $licensefilename !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
return $licensestring;
@@ -402,7 +402,7 @@ sub make_systemcall
my @returns = ();
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
open (REG, "$systemcall");
while (<REG>) {push(@returns, $_); }
@@ -411,23 +411,26 @@ sub make_systemcall
my $returnvalue = $?; # $? contains the return value of the systemcall
my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ( $logreturn )
{
- for ( my $j = 0; $j <= $#returns; $j++ ) { push( @installer::globals::logfileinfo, "$returns[$j]"); }
+ foreach my $line (@returns)
+ {
+ $installer::logger::Lang->printf($line);
+ }
}
if ($returnvalue)
{
$infoline = "ERROR: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
$error_occured = 1;
}
else
{
$infoline = "SUCCESS: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
return \@returns;
@@ -486,7 +489,7 @@ sub set_classpath_for_install_sdk
$ENV{'CLASSPATH'} = $newclasspathstring;
my $infoline = "Setting CLASSPATH to $ENV{'CLASSPATH'}\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
#######################################################
@@ -619,7 +622,7 @@ sub remove_package
if ( $do_delete )
{
my $infoline = "\tReally removing package $packagename from xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
splice(@{$xmlfile},$i, $linecounter); # removing $linecounter lines, beginning in line $i
$removed_packge = 1;
last;
@@ -630,12 +633,12 @@ sub remove_package
if ( $removed_packge )
{
$infoline = "Package $packagename successfully removed from xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
else
{
$infoline = "Did not find package $packagename in xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -844,7 +847,7 @@ sub remove_empty_packages_in_xmlfile
{
my $packagename = $installer::globals::emptypackages[$i];
my $infoline = "Try to remove package $packagename from xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
remove_package($xmlfile, $packagename);
}
}
@@ -877,7 +880,7 @@ sub get_rpm_unit_from_xmlfile
my ($rpmname, $xmlfile) = @_;
my $infoline = "Searching for $rpmname in xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my @rpmunit = ();
my $includeline = 0;
@@ -906,7 +909,7 @@ sub get_rpm_unit_from_xmlfile
if ( ! $foundrpm ) { installer::exiter::exit_program("ERROR: Did not find rpmunit $rpmname in xml file!", "get_rpm_unit_from_xmlfile"); }
$infoline = "Found $rpmname in xml file. Returning block lines: $#rpmunit + 1. Includeline: $includeline \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
return (\@rpmunit, $includeline);
}
@@ -941,7 +944,7 @@ sub prepare_linkrpm_in_xmlfile
my $rpmline = ${$rpmlist}[$i];
my $infoline = "Preparing link/patch RPM: $rpmline\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ( $rpmline =~ /^\s*(\S.*?\S)\s+(\S.*?\S)\s*$/ )
{
@@ -1033,12 +1036,12 @@ sub remove_scpgid_from_xmlfile
if ($successfully_removed)
{
$infoline = "Module $scpgid successfully removed from xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
else
{
$infoline = "Module $scpgid not found in xml file (no problem).\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -1052,7 +1055,7 @@ sub remove_module_if_not_defined
my ($xmlfile, $modulesarrayref, $scpgid) = @_;
my $infoline = "Checking existence of $scpgid in scp definition\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my $found = 0;
@@ -1066,7 +1069,7 @@ sub remove_module_if_not_defined
if ( ! $found )
{
$infoline = "Module $scpgid not found -> Removing from xml file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
remove_scpgid_from_xmlfile($xmlfile, $scpgid);
}
}
@@ -1224,7 +1227,7 @@ sub replace_component_name_in_java_file
installer::files::save_file($javafilename, $javafile);
$infoline = "Changes in Java file: $javafilename : $oldname \-\> $newname\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -1304,7 +1307,7 @@ sub replace_component_names
if ( $modulename eq "" )
{
$infoline = "Info: Modulename for $gid not defined in modules collector. Looking in Java ulf file.\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
if ( $modulename eq "" ) # the modulename can also be set in the Java ulf file
@@ -1317,7 +1320,7 @@ sub replace_component_names
${$xmlfile}[$i] =~ s/$componentname/$modulename/;
$infoline = "Replacement in xml file (Solaris): $componentname \-\> $modulename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# Replacement has to be done in all Java language files
replace_component_name_in_java_file($alljavafiles, $componentname, $modulename);
@@ -1326,7 +1329,7 @@ sub replace_component_names
if ( $modulename eq "" ) # the modulename can also be set in the Java ulf file
{
$infoline = "WARNING: No replacement in xml file for component: $componentname\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
}
@@ -1359,7 +1362,7 @@ sub get_all_packages_in_installdir
{
${$allrpms}[$i] = $directory . $installer::globals::separator . ${$allrpms}[$i];
$infoline = "Found RPM: ${$allrpms}[$i]\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -1416,7 +1419,7 @@ sub set_filesize_in_xmlfile
${$xmlfile}[$number] =~ s/FILESIZEPLACEHOLDER/$filesize/;
$filesizeset = 1;
$infoline = "Setting filesize for $rpmname : $filesize\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
last;
}
@@ -1430,13 +1433,13 @@ sub set_filesize_in_xmlfile
if ( ! $foundrpm )
{
$infoline = "ERROR: Did not find $rpmname in xml file !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
if ( ! $filesizeset )
{
$infoline = "ERROR: Did not set filesize for $rpmname in xml file !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -1497,24 +1500,24 @@ sub find_rpmname_to_uniquename
{
my $number = $#all_correct_rpms + 1;
$infoline = "There are $number RPMs for the unique name \"$uniquename\" :\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my $allrpmstring = "";
for ( my $i = 0; $i <= $#all_correct_rpms; $i++ ) { $allrpmstring = $allrpmstring . $all_correct_rpms[$i] . "\n"; }
- push( @installer::globals::logfileinfo, $allrpmstring);
+ $installer::logger::Lang->print($allrpmstring);
installer::exiter::exit_program("ERROR: Found $number RPMs that start with unique name \"$uniquename\". Only one allowed!", "find_rpmname_to_uniquename");
}
if ( $#all_correct_rpms < 0 )
{
$infoline = "There is no rpm for the unique name \"$uniquename\"\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
installer::exiter::exit_program("ERROR: There is no RPM that start with unique name \"$uniquename\"!", "find_rpmname_to_uniquename");
}
if ( $#all_correct_rpms == 0 )
{
$infoline = "Found one rpm for the unique name \"$uniquename\" : $all_correct_rpms[0]\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
return $all_correct_rpms[0];
@@ -1549,7 +1552,7 @@ sub set_rpmname_into_xmlfile
${$xmlfile}[$number] =~ s/RPMFILENAMEPLACEHOLDER/$rpmname/;
$rpmnameset = 1;
$infoline = "Setting RPM name for $uniquename : $rpmname\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
last;
}
@@ -1563,13 +1566,13 @@ sub set_rpmname_into_xmlfile
if ( ! $foundrpm )
{
$infoline = "ERROR: Did not find $rpmname in xml file !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
if ( ! $rpmnameset )
{
$infoline = "ERROR: Did not set rpm name for $uniquename in xml file !\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -1590,25 +1593,23 @@ sub put_rpmpath_into_xmlfile
my $number = $#{$listofpackages} + 1;
$infoline = "Number of packages in installation set: $number\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
$number = $#{$alluniquenames} + 1;
$infoline = "Number of unique RPM names in xml file: $number\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
- $infoline = "\nPackages in installation set:\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("Packages in installation set:\n");
for ( my $i = 0; $i <= $#{$listofpackages}; $i++ )
{
- $infoline = "${$listofpackages}[$i]\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print(${$listofpackages}[$i] . "\n");
}
- $infoline = "\nUnique RPM names in xml file:\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Unique RPM names in xml file:\n");
for ( my $i = 0; $i <= $#{$alluniquenames}; $i++ )
{
$infoline = "${$alluniquenames}[$i]\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
if ( $#{$alluniquenames} != $#{$listofpackages} ) { installer::exiter::exit_program("ERROR: xml file contains $#{$alluniquenames} unique names, but there are $#{$listofpackages} packages in installation set!", "put_rpmpath_into_xmlfile"); }
@@ -1644,7 +1645,7 @@ sub put_filesize_into_xmlfile
my $filesize = do_sum($rpmout);
$infoline = "Filesize $rpmname : $filesize\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
set_filesize_in_xmlfile($filesize, $rpmname, $xmlfile);
}
@@ -1695,11 +1696,11 @@ sub create_java_installer
$ulffilename = $installer::globals::javalanguagepath . $installer::globals::separator . $ulffilename;
my $ulffile = installer::files::read_file($ulffilename);
- $infoline = "\nReading ulf file: $ulffilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print("\n");
+ $installer::logger::Lang->print("Reading ulf file: $ulffilename\n");
$infoline = "Translating the Java template file\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ )
{
@@ -1738,7 +1739,7 @@ sub create_java_installer
installer::files::save_file($newfilename, $templatefile);
$infoline = "Saving Java file: $newfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
# renaming one language java file to "MyResources.java"
@@ -1767,14 +1768,14 @@ sub create_java_installer
installer::files::save_file($basedestfilename, $basetemplatefile);
$infoline = "Created base Java file: $basedestfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# deleting the template file
unlink($templatefilename);
$infoline = "Deleted template Java resource file: $templatefilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# changing into Java directory
@@ -1783,7 +1784,7 @@ sub create_java_installer
chdir($javadir);
$infoline = "Changing into directory: $javadir\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# preparing the xml file
@@ -1823,7 +1824,7 @@ sub create_java_installer
if ( $installer::globals::islinuxrpmbuild ) { put_filesize_into_xmlfile($xmlfile, $listofpackages); }
installer::files::save_file($xmlfilename, $xmlfile);
$infoline = "Saving xml file: $xmlfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# Setting the classpath and starting compiler
@@ -1875,7 +1876,7 @@ sub create_java_installer
chdir($from);
$infoline = "Changing into directory: $from\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
1;
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/languagepack.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/languagepack.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/languagepack.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/languagepack.pm Mon Nov 4 05:32:01 2013
@@ -136,7 +136,7 @@ sub put_license_file_into_script
my ($scriptfile, $licensefile) = @_;
my $infoline = "Adding licensefile into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my $includestring = "";
@@ -162,22 +162,22 @@ sub create_tar_gz_file
$packagename =~ s/\.rpm\s*$//;
my $targzname = $packagename . ".tar.gz";
$systemcall = "cd $installdir; tar -cf - $packagestring | gzip > $targzname";
- installer::logger::print_message( "... $systemcall ...\n" );
+ $installer::logger::Info->printf("... %s ...\n", $systemcall);
my $returnvalue = system($systemcall);
my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ($returnvalue)
{
$infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
else
{
$infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
return $targzname;
@@ -268,7 +268,7 @@ sub determine_packagename
}
my $infoline = "Found package in installation directory $installdir : $packagename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
return ( $packagename, $allnames);
}
@@ -285,7 +285,7 @@ sub put_packagename_into_script
my $localpackagename = $packagename;
$localpackagename =~ s/\.tar\.gz//; # making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea"
my $infoline = "Adding packagename $localpackagename into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
my $installline = "";
@@ -319,7 +319,7 @@ sub put_productname_into_script
$productname =~ s/\.//g; # openoffice.org -> openofficeorg
my $infoline = "Adding productname $productname into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
{
@@ -342,7 +342,7 @@ sub put_fullproductname_into_script
my $fullproductname = $productname . " " . $productversion;
my $infoline = "Adding full productname \"$fullproductname\" into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
{
@@ -365,10 +365,10 @@ sub put_searchpackage_into_script
if ( $installer::globals::issolarisbuild ) { $basispackageversion =~ s/\.//g; } # "3.0" -> "30"
my $infoline = "Adding basis package prefix $basispackageprefix into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
$infoline = "Adding basis package version $basispackageversion into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
{
@@ -389,7 +389,7 @@ sub put_linenumber_into_script
my $linenumber = $#{$scriptfile} + $#{$licensefile} + 3; # also adding the content of the license file!
my $infoline = "Adding linenumber $linenumber into language pack script\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
{
@@ -413,7 +413,7 @@ sub determine_scriptfile_name
$scriptfilename =~ s/\.tar\.gz\s*$/\.sh/;
my $infoline = "Setting language pack script file name to $scriptfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
return $scriptfilename;
}
@@ -430,7 +430,7 @@ sub save_script_file
installer::files::save_file($newscriptfilename, $scriptfile);
my $infoline = "Saving script file $newscriptfilename\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
return $newscriptfilename;
}
@@ -449,17 +449,17 @@ sub include_package_into_script
my $returnvalue = system($systemcall);
my $infoline = "Systemcall: $systemcall\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
if ($returnvalue)
{
$infoline = "ERROR: Could not execute \"$systemcall\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
else
{
$infoline = "Success: Executed \"$systemcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1";
@@ -485,7 +485,7 @@ sub remove_package
unlink $longpackagename;
my $infoline = "Removing package: $longpackagename \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
}
}
@@ -499,7 +499,7 @@ sub build_installer_for_languagepack
{
my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_;
- installer::logger::print_message( "... creating shell script installer ...\n" );
+ $installer::logger::Info->print("... creating shell script installer ...\n");
installer::logger::include_header_into_logfile("Creating shell script installer:");
@@ -511,7 +511,7 @@ sub build_installer_for_languagepack
my $scriptfile = installer::files::read_file($$scriptref);
my $infoline = "Found script file $scriptfilename: $$scriptref \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# find and read english license file
my $licenselanguage = "en-US"; # always english !
@@ -523,7 +523,7 @@ sub build_installer_for_languagepack
my $licensefile = installer::files::read_file($$licenseref);
$infoline = "Found licensefile $licensefilename: $$licenseref \n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->print($infoline);
# including variables into license file
installer::scpzipfiles::replace_all_ziplistvariables_in_file($licensefile, $allvariableshashref);
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/logger.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/logger.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/logger.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/logger.pm Mon Nov 4 05:32:01 2013
@@ -25,6 +25,338 @@ package installer::logger;
use installer::files;
use installer::globals;
+use Time::HiRes qw(gettimeofday tv_interval);
+use English;
+use IO::Handle;
+use strict;
+
+my $StartTime = undef;
+
+sub PrintStackTrace ();
+sub Die ($);
+
+=head1 NAME
+
+ installer::logger
+
+ Logging for the installer modules.
+
+=cut
+
+=head1 DESCRIPTION
+
+ This module is in a transition state from a set of loosly connected functions to a single class.
+
+ There are three globaly available logger objects:
+
+=over
+
+=item $Lang
+
+ is language specific and writes messages to a log file.
+
+=cut
+
+=item $Glob
+
+ is independent of the current language. Its messages are prepended to each $Lang logger.
+
+=cut
+
+=item $Info
+
+ is for output to the console.
+
+=cut
+
+=back
+
+=cut
+
+
+our $Global = installer::logger->new("glob",
+ 'is_save_lines' => 1,
+ 'is_print_to_console' => 0,
+ 'is_show_relative_time' => 1);
+our $Lang = installer::logger->new("lang",
+ 'is_print_to_console' => 0,
+ 'is_show_relative_time' => 1,
+ 'is_show_log_id' => 1
+ );
+our $Info = installer::logger->new("info",
+ 'is_show_relative_time' => 0,
+ 'is_show_process_id' => 0,
+ 'is_show_log_id' => 0
+ );
+
+=head2 new($class, $id, @arguments)
+
+ Create a new instance of the logger class.
+ @arguments lets you override default values.
+
+=cut
+
+sub new ($$@)
+{
+ my ($class, $id, @arguments) = @_;
+
+ my $self = {
+ 'id' => $id,
+ 'filename' => "",
+ # When set then lines are printed to this file.
+ 'file' => undef,
+ # When true then lines are printed to the console.
+ 'is_print_to_console' => 1,
+ 'is_save_lines' => 0,
+ # A container of printed lines. Lines are added only when 'is_save_lines' is true.
+ 'lines' => [],
+ # Another logger to which all prints are forwarded.
+ 'forward' => [],
+ # A filter function that for example can recoginze build errors.
+ 'filter' => undef,
+ # Show relative time
+ 'is_show_relative_time' => 0,
+ # Show log id (mostly for debugging the logger)
+ 'is_show_log_id' => 0,
+ # Show the process id, useful on the console when doing a multiprocessor build.
+ 'is_show_process_id' => 0
+ };
+ while (scalar @arguments >= 2)
+ {
+ my $key = shift @arguments;
+ my $value = shift @arguments;
+ $self->{$key} = $value;
+ }
+
+ bless($self, $class);
+
+ return $self;
+}
+
+
+
+=head2 printf($self, $message, @arguments)
+
+ Identical in syntax and semantics to the usual perl (s)printf.
+
+=cut
+sub printf ($$@)
+{
+ my ($self, $format, @arguments) = @_;
+
+ my $message = sprintf($format, @arguments);
+ if ($message =~ /\%/)
+ {
+ PrintStackTrace();
+ }
+ $self->print($message, 0);
+}
+
+
+
+
+=head2 print ($self, $message, [optional] $force)
+
+ Print the given message.
+ If the optional $force parameter is given and it evaluates to true then the message
+ is printed even when the golbal $installer::globals::quiet is true.
+
+=cut
+sub print ($$;$)
+{
+ my ($self, $message, $force) = @_;
+
+ Die "newline at start of line" if ($message =~ /^\n.+/);
+
+ $force = 0 unless defined $force;
+
+ my $relative_time = tv_interval($StartTime, [gettimeofday()]);
+ foreach my $target ($self, @{$self->{'forward'}})
+ {
+ $target->process_line(
+ $relative_time,
+ $self->{'id'},
+ $PID,
+ $message,
+ $force);
+ }
+}
+
+
+
+
+=head2 process_line ($self, $relative_time, $log_id, $pid, $message, $force)
+
+ Internal function that decides whether to
+ a) write to a log file
+ b) print to the console
+ c) store in an array for later use
+ the preformatted message.
+
+=cut
+sub process_line ($$$$$$)
+{
+ my ($self, $relative_time, $log_id, $pid, $message, $force) = @_;
+
+ # Apply the line filter.
+ if (defined $self->{'filter'})
+ {
+ $message = &{$self->{'filter'}}($relative_time, $log_id, $pid, $message);
+ }
+
+ # Format the line.
+ my $line = "";
+ if ($self->{'is_show_relative_time'})
+ {
+ $line .= sprintf("%12.6f : ", $relative_time);
+ }
+ if ($self->{'is_show_log_id'})
+ {
+ $line .= $log_id . " : ";
+ }
+ if ($self->{'is_show_process_id'})
+ {
+ $line .= $pid . " : ";
+ }
+ $line .= $message;
+
+ # Print the line to a file or to the console or store it for later use.
+ my $fid = $self->{'file'};
+ if (defined $fid)
+ {
+ print $fid ($line);
+ }
+ if (($force || ! $installer::globals::quiet)
+ && $self->{'is_print_to_console'})
+ {
+ print($line);
+ }
+ if ($self->{'is_save_lines'})
+ {
+ push @{$self->{'lines'}}, [$relative_time, $log_id, $pid, $message, $force];
+ }
+}
+
+
+
+
+=head2 set_filename (Self, $filename)
+
+ When the name of a writable file is given then all future messages will go to that file.
+ Output to the console is turned off.
+ This method is typically used to tie the language dependent $Lang logger to different log files.
+
+=cut
+sub set_filename ($$)
+{
+ my ($self, $filename) = @_;
+
+ $filename = "" unless defined $filename;
+ if ($self->{'filename'} ne $filename)
+ {
+ if (defined $self->{'file'})
+ {
+ $self->{'is_print_to_console'} = 1;
+ close $self->{'file'};
+ $self->{'file'} = undef;
+ }
+
+ $self->{'filename'} = $filename;
+
+ if ($filename ne "")
+ {
+ open $self->{'file'}, ">", $self->{'filename'}
+ || Die "can not open log file ".$self->{'filename'}." for writing";
+ $self->{'is_print_to_console'} = 0;
+
+ # Make all writes synchronous so that we don't loose any messages on an
+ # 'abrupt' end.
+ my $handle = select $self->{'file'};
+ $| = 1;
+ select $handle;
+ }
+ }
+}
+
+
+
+
+=head2 set_filter ($self, $filter)
+
+ Sets $filter (a function reference) as line filter. It is applied to each line.
+ The filter can extract information from the given message and modify it before it is printed.
+
+=cut
+sub set_filter ($$)
+{
+ my ($self, $filter) = @_;
+ $self->{'filter'} = $filter;
+}
+
+
+
+
+=head2 add_timestamp ($self, $message)
+
+ Print the given message together with the current (absolute) time.
+
+=cut
+sub add_timestamp ($$)
+{
+ my ($self, $message) = @_;
+
+ my $timestring = get_time_string();
+ $self->printf("%s\t%s", $message, $timestring);
+}
+
+
+
+=head2 copy_lines_from ($self, $other)
+
+ Copy saved lines from another logger object.
+
+=cut
+sub copy_lines_from ($$)
+{
+ my ($self, $other) = @_;
+
+ my $is_print_to_console = $self->{'is_print_to_console'};
+ my $is_save_lines = $self->{'is_save_lines'};
+ my $fid = $self->{'file'};
+
+ foreach my $line (@{$other->{'lines'}})
+ {
+ $self->process_line(@$line);
+ }
+}
+
+
+
+
+=head2 set_forward ($self, $other)
+
+ Set a forwarding target. All future messages are forwarded (copied) to $other.
+ A typical use is to tie $Info to $Lang so that all messages sent to $Info are
+ printed to the console AND written to the log file.
+
+=cut
+sub set_forward ($$)
+{
+ my ($self, $other) = @_;
+
+ # At the moment at most one forward target is allowed.
+ if (defined $other)
+ {
+ $self->{'forward'} = [$other];
+ }
+ else
+ {
+ $self->{'forward'} = [];
+ }
+}
+
+
+
####################################################
# Including header files into the logfile
@@ -33,21 +365,12 @@ use installer::globals;
sub include_header_into_logfile
{
my ($message) = @_;
-
- my $infoline;
-
- $infoline = "\n" . get_time_string();
- push( @installer::globals::logfileinfo, $infoline);
- $infoline = "######################################################\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- $infoline = "$message\n";
- push( @installer::globals::logfileinfo, $infoline);
-
-
- $infoline = "######################################################\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $Lang->print("\n");
+ $Lang->print(get_time_string());
+ $Lang->print("######################################################\n");
+ $Lang->print($message."\n");
+ $Lang->print("######################################################\n");
}
####################################################
@@ -58,20 +381,11 @@ sub include_header_into_globallogfile
{
my ($message) = @_;
- my $infoline;
-
- $infoline = "\n" . get_time_string();
- push( @installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "######################################################\n";
- push( @installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "$message\n";
- push( @installer::globals::globallogfileinfo, $infoline);
-
-
- $infoline = "######################################################\n";
- push( @installer::globals::globallogfileinfo, $infoline);
+ $Global->print("\n");
+ $Global->print(get_time_string());
+ $Global->print("######################################################\n");
+ $Global->print($message."\n");
+ $Global->print("######################################################\n");
}
####################################################
@@ -80,12 +394,12 @@ sub include_header_into_globallogfile
sub include_timestamp_into_logfile
{
+ Die "deprected";
my ($message) = @_;
my $infoline;
my $timestring = get_time_string();
- $infoline = "$message\t$timestring";
- push( @installer::globals::logfileinfo, $infoline);
+ $Lang->printf("%s\t%s", $message, $timestring);
}
####################################################
@@ -96,8 +410,8 @@ sub log_hashref
{
my ($hashref) = @_;
- my $infoline = "\nLogging variable settings:\n";
- push(@installer::globals::globallogfileinfo, $infoline);
+ $Global->print("\n");
+ $Global->print("Logging variable settings:\n");
my $itemkey;
@@ -106,12 +420,10 @@ sub log_hashref
my $line = "";
my $itemvalue = "";
if ( $hashref->{$itemkey} ) { $itemvalue = $hashref->{$itemkey}; }
- $line = $itemkey . "=" . $itemvalue . "\n";
- push(@installer::globals::globallogfileinfo, $line);
+ $Global->printf("%s=%s\n", $itemkey, $itemvalue);
}
- $infoline = "\n";
- push(@installer::globals::globallogfileinfo, $infoline);
+ $Global->print("\n");
}
#########################################################
@@ -124,18 +436,11 @@ sub globallog
my $infoline;
- $infoline = "\n" . get_time_string();
- push( @installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "################################################################\n";
- push( @installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "$message\n";
- push( @installer::globals::globallogfileinfo, $infoline);
-
- $infoline = "################################################################\n";
- push( @installer::globals::globallogfileinfo, $infoline);
-
+ $Global->print("\n");
+ $Global->print(get_time_string());
+ $Global->print("################################################################\n");
+ $Global->print($message."\n");
+ $Global->print("################################################################\n");
}
###############################################################
@@ -183,6 +488,9 @@ sub savedebug
sub starttime
{
$installer::globals::starttime = time();
+ $StartTime = [gettimeofday()];
+
+ my $localtime = localtime();
}
###############################################################
@@ -258,8 +566,8 @@ sub get_file_age
sub stoptime
{
- my $infoline = get_time_string();
- print_message( "$infoline" );
+ my $localtime = localtime();
+ $Info->printf("stopping log at %s\n", $localtime);
}
###############################################################
@@ -291,6 +599,8 @@ sub set_installation_date
sub print_message
{
+ Die "print_message is deprecated";
+
my $message = shift;
chomp $message;
my $force = shift || 0;
@@ -326,10 +636,36 @@ sub print_error
{
my $message = shift;
chomp $message;
- print STDERR "\n**************************************************\n";
+ print STDERR "\n";
+ print STDERR "**************************************************\n";
print STDERR "ERROR: $message";
- print STDERR "\n**************************************************\n";
+ print STDERR "\n";
+ print STDERR "**************************************************\n";
return;
}
+
+=head2 PrintStackTrace()
+ This is for debugging the print and printf methods of the logger class and their use.
+ Therefore we use the Perl print/printf directly and not the logger methods to avoid loops in case of errors.
+=cut
+sub PrintStackTrace ()
+{
+ print "Stack Trace:\n";
+ my $i = 1;
+ while ((my @call_details = (caller($i++))))
+ {
+ printf("%s:%s in function %s\n", $call_details[1], $call_details[2], $call_details[3]);
+ }
+}
+
+sub Die ($)
+{
+ my ($message) = @_;
+ PrintStackTrace();
+ die $message;
+}
+
+
+
1;
Modified: openoffice/branches/ia2/main/solenv/bin/modules/installer/packagelist.pm
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/solenv/bin/modules/installer/packagelist.pm?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/solenv/bin/modules/installer/packagelist.pm (original)
+++ openoffice/branches/ia2/main/solenv/bin/modules/installer/packagelist.pm Mon Nov 4 05:32:01 2013
@@ -527,8 +527,7 @@ sub check_packagelist
if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find script file $scriptfile for module $gid!", "check_packagelist"); }
- my $infoline = "$gid: Using script file: \"$$fileref\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("%s: Using script file: \"%s\"!\n", $gid, $$fileref);
$onepackage->{'script'} = $$fileref;
}
@@ -679,8 +678,7 @@ sub collectpackages
if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $packinfofile for module $modulegid!", "collectpackages"); }
- my $infoline = "$modulegid: Using packinfo: \"$$fileref\"!\n";
- push( @installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("%s: Using packinfo: \"%s\"!\n", $modulegid, $$fileref);
get_packinfo($modulegid, $$fileref, \@packages, $onelanguage, $islanguagemodule);
}
@@ -709,8 +707,7 @@ sub log_packages_content
# checking all items that must be defined
- $infoline = "Package $onepackage->{'module'}\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Package %s\n", $onepackage->{'module'});
my $key;
foreach $key (sort keys %{$onepackage})
@@ -719,24 +716,20 @@ sub log_packages_content
if ( $key eq "allmodules" )
{
- $infoline = "\t$key:\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("\t%s:\n", $key);
my $onemodule;
foreach $onemodule ( @{$onepackage->{$key}} )
{
- $infoline = "\t\t$onemodule\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("\t\t%s\n", $onemodule);
}
}
else
{
- $infoline = "\t$key: $onepackage->{$key}\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("\t%s: %s\n", $key, $onepackage->{$key});
}
}
- $infoline = "\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("\n");
}
}
@@ -824,8 +817,7 @@ sub prepare_cabinet_files
# checking all items that must be defined
- $infoline = "Package $onepackage->{'module'}\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Package %s\n", $onepackage->{'module'});
# Assigning the cab file to the module and also to all corresponding sub modules
@@ -838,10 +830,12 @@ sub prepare_cabinet_files
}
else
{
- my $infoline = "Warning: Already existing assignment: $onemodule : $installer::globals::allcabinetassigns{$onemodule}\n";
- push(@installer::globals::logfileinfo, $infoline);
- $infoline = "Ignoring further assignment: $onemodule : $cabinetfile\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("Warning: Already existing assignment: %s : %s\n",
+ $onemodule,
+ $installer::globals::allcabinetassigns{$onemodule});
+ $installer::logger::Lang->printf("Ignoring further assignment: %s : %s\n",
+ $onemodule,
+ $cabinetfile);
}
}
}
@@ -855,16 +849,23 @@ sub log_cabinet_assignments
{
installer::logger::include_header_into_logfile("Logging cabinet files:");
- my $infoline = "List of cabinet files:\n";
- push(@installer::globals::logfileinfo, $infoline);
+ $installer::logger::Lang->printf("List of cabinet files:\n");
my $key;
- foreach $key ( sort keys %installer::globals::allcabinets ) { push(@installer::globals::logfileinfo, "\t$key\n"); }
-
- $infoline = "\nList of assignments from modules to cabinet files:\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- foreach $key ( sort keys %installer::globals::allcabinetassigns ) { push(@installer::globals::logfileinfo, "\t$key : $installer::globals::allcabinetassigns{$key}\n"); }
+ foreach $key ( sort keys %installer::globals::allcabinets )
+ {
+ $installer::logger::Lang->printf("\t%s\n", $key);
+ }
+
+ $installer::logger::Lang->printf("\n");
+ $installer::logger::Lang->printf("List of assignments from modules to cabinet files:\n");
+
+ foreach $key ( sort keys %installer::globals::allcabinetassigns )
+ {
+ $installer::logger::Lang->printf("\t%s : %s\n",
+ $key,
+ $installer::globals::allcabinetassigns{$key});
+ }
}
1;