diff options
author | Andre Fischer <af@apache.org> | 2013-10-31 10:37:56 +0000 |
---|---|---|
committer | Andre Fischer <af@apache.org> | 2013-10-31 10:37:56 +0000 |
commit | 97481ab1d4dc21f78cfcf503d4cfe1df1c8cf3cc (patch) | |
tree | 3a3664e243b2ed542c3c5a3e8d808f76811df70c /solenv/bin | |
parent | a8cc15c001ac76c0d320837cc4cdf65ecb7fc923 (diff) |
123595: Cleanup logging in make_installer.pl and its modules.
Notes
Notes:
ignore: obsolete
Diffstat (limited to 'solenv/bin')
59 files changed, 2183 insertions, 1922 deletions
diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index fe8c94496c7d..60f700688ed9 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -103,13 +103,18 @@ use installer::ziplist; ################################################# installer::logger::starttime(); +$installer::logger::Global->add_timestamp("starting logging"); + +# While there is no language set and logger::Lang is not yet tied to a log file, +# forward its output to logger::Global. +$installer::logger::Lang->set_forward($installer::logger::Global); ######################################### # Checking the environment and setting # most important variables ######################################### -installer::logger::print_message( "... checking environment variables ...\n" ); +$installer::logger::Info->print( "... checking environment variables ...\n" ); my $environmentvariableshashref = installer::control::check_system_environment(); installer::environment::set_global_environment_variables($environmentvariableshashref); @@ -153,7 +158,7 @@ my $current_install_number = ""; # Checking the system requirements ###################################### -installer::logger::print_message( "... checking required files ...\n" ); +$installer::logger::Info->print( "... checking required files ...\n" ); installer::control::check_system_path(); my $pathvariableshashref = installer::environment::create_pathvariables($environmentvariableshashref); @@ -172,7 +177,7 @@ installer::logger::globallog("zip list file: $installer::globals::ziplistname"); my $ziplistref = installer::files::read_file($installer::globals::ziplistname); -installer::logger::print_message( "... analyzing $installer::globals::ziplistname ... \n" ); +$installer::logger::Info->print( "... analyzing $installer::globals::ziplistname ... \n" ); my ($productblockref, $parent) = installer::ziplist::getproductblock($ziplistref, $installer::globals::product, 1); # product block from zip.lst if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "productblock.log" ,$productblockref); } @@ -361,7 +366,7 @@ if ($installer::globals::setupscript_defined_in_productlist) { installer::setups installer::logger::globallog("setup script file: $installer::globals::setupscriptname"); -installer::logger::print_message( "... analyzing script: $installer::globals::setupscriptname ... \n" ); +$installer::logger::Info->print( "... analyzing script: $installer::globals::setupscriptname ... \n" ); my $setupscriptref = installer::files::read_file($installer::globals::setupscriptname); # Reading the setup script file @@ -406,7 +411,7 @@ if ( $installer::globals::globallogging ) { installer::files::save_file($logging installer::logger::log_hashref($allvariableshashref); -installer::logger::print_message( "... analyzing directories ... \n" ); +$installer::logger::Info->print( "... analyzing directories ... \n" ); # Collect all directories in the script to get the destination dirs @@ -426,7 +431,7 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash installer::scriptitems::resolve_all_directory_names($dirsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productdirectories2.log", $dirsinproductarrayref); } -installer::logger::print_message( "... analyzing files ... \n" ); +$installer::logger::Info->print( "... analyzing files ... \n" ); my $filesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "File"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles1.log", $filesinproductarrayref); } @@ -470,7 +475,7 @@ if (( $installer::globals::packageformat ne "installed" ) && ( $installer::globa if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2cc.log", $filesinproductarrayref); } } -installer::logger::print_message( "... analyzing scpactions ... \n" ); +$installer::logger::Info->print( "... analyzing scpactions ... \n" ); my $scpactionsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ScpAction"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productscpactions1.log", $scpactionsinproductarrayref); } @@ -492,12 +497,12 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash installer::scriptitems::change_keys_of_scpactions($scpactionsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productscpactions2.log", $scpactionsinproductarrayref); } -installer::logger::print_message( "... analyzing shortcuts ... \n" ); +$installer::logger::Info->print( "... analyzing shortcuts ... \n" ); my $linksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Shortcut"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productlinks1.log", $linksinproductarrayref); } -installer::logger::print_message( "... analyzing unix links ... \n" ); +$installer::logger::Info->print( "... analyzing unix links ... \n" ); my $unixlinksinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Unixlink"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks1.log", $unixlinksinproductarrayref); } @@ -505,12 +510,12 @@ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hash # $unixlinksinproductarrayref = installer::scriptitems::filter_layerlinks_from_unixlinks($unixlinksinproductarrayref); # if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks1b.log", $unixlinksinproductarrayref); } -installer::logger::print_message( "... analyzing profile ... \n" ); +$installer::logger::Info->print( "... analyzing profile ... \n" ); my $profilesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Profile"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profiles1.log", $profilesinproductarrayref); } -installer::logger::print_message( "... analyzing profileitems ... \n" ); +$installer::logger::Info->print( "... analyzing profileitems ... \n" ); my $profileitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "ProfileItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profileitems1.log", $profileitemsinproductarrayref); } @@ -523,12 +528,12 @@ my $mergemodulesarrayref; if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, FolderItem, RegistryItem, WindowsCustomAction { - installer::logger::print_message( "... analyzing folders ... \n" ); + $installer::logger::Info->print( "... analyzing folders ... \n" ); $folderinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Folder"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folder1.log", $folderinproductarrayref); } - installer::logger::print_message( "... analyzing folderitems ... \n" ); + $installer::logger::Info->print( "... analyzing folderitems ... \n" ); $folderitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "FolderItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folderitems1.log", $folderitemsinproductarrayref); } @@ -539,7 +544,7 @@ if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, Fo installer::setupscript::prepare_non_advertised_files($folderitemsinproductarrayref, $filesinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2d.log", $filesinproductarrayref); } - installer::logger::print_message( "... analyzing registryitems ... \n" ); + $installer::logger::Info->print( "... analyzing registryitems ... \n" ); $registryitemsinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "RegistryItem"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems1.log", $registryitemsinproductarrayref); } @@ -547,12 +552,12 @@ if ( $installer::globals::iswindowsbuild ) # Windows specific items: Folder, Fo $registryitemsinproductarrayref = installer::scriptitems::remove_uninstall_regitems_from_script($registryitemsinproductarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems1b.log", $registryitemsinproductarrayref); } - installer::logger::print_message( "... analyzing Windows custom actions ... \n" ); + $installer::logger::Info->print( "... analyzing Windows custom actions ... \n" ); $windowscustomactionsarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "WindowsCustomAction"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "windowscustomactions1.log", $windowscustomactionsarrayref); } - installer::logger::print_message( "... analyzing Windows merge modules ... \n" ); + $installer::logger::Info->print( "... analyzing Windows merge modules ... \n" ); $mergemodulesarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "MergeModule"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "mergemodules1.log", $mergemodulesarrayref); } @@ -562,7 +567,7 @@ my $modulesinproductarrayref; if (!($installer::globals::is_copy_only_project)) { - installer::logger::print_message( "... analyzing modules ... \n" ); + $installer::logger::Info->print( "... analyzing modules ... \n" ); $modulesinproductarrayref = installer::setupscript::get_all_items_from_script($setupscriptref, "Module"); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "modules1.log", $modulesinproductarrayref); } @@ -616,6 +621,7 @@ if ( $installer::globals::debug ) { installer::logger::savedebug($installer::glo if ( $installer::globals::debug ) { installer::logger::debuginfo("\nPart 1b: The language dependent part\n"); } + for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { my $languagesarrayref = installer::languages::get_all_languages_for_one_product($installer::globals::languageproducts[$n], $allvariableshashref); @@ -623,8 +629,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) $installer::globals::alllanguagesinproductarrayref = $languagesarrayref; my $languagestringref = installer::languages::get_language_string($languagesarrayref); - installer::logger::print_message( "------------------------------------\n" ); - installer::logger::print_message( "... languages $$languagestringref ... \n" ); + $installer::logger::Info->print( "------------------------------------\n" ); + $installer::logger::Info->print( "... languages $$languagestringref ... \n" ); if ( $installer::globals::patch ) { @@ -649,7 +655,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Until now only global logging into default: logfile.txt ############################################################ - @installer::globals::logfileinfo = (); # new logfile array and new logfile name installer::logger::copy_globalinfo_into_logfile(); $installer::globals::globalinfo_copied = 1; @@ -667,13 +672,25 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) $loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id; } - $installer::globals::logfilename = "log_" . $installer::globals::build; - if ( $logminor ne "" ) { $installer::globals::logfilename .= "_" . $logminor; } - $installer::globals::logfilename .= "_" . $loglanguagestring; - $installer::globals::logfilename .= ".log"; + # Setup the directory where the language dependent log file will be stored. $loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator; installer::systemactions::create_directory($loggingdir); + # Set language dependent logging. + $installer::globals::logfilename = sprintf("log_%s%s_%s.log", + $installer::globals::build, + $logminor ne "" ? "_" . $logminor : "", + $loglanguagestring); + $installer::logger::Lang->set_filename($loggingdir . $installer::globals::logfilename); + $installer::logger::Lang->copy_lines_from($installer::logger::Global); + $installer::logger::Lang->set_filter(\&installer::control::filter_log_error); + installer::control::prepare_error_processing(); + # All logging to the console is also forwarded to the language dependen log. + $installer::logger::Lang->set_forward(undef); + $installer::logger::Info->set_forward($installer::logger::Lang); + # Scan all log lines for error messages. + $installer::logger::Lang->add_timestamp("starting log for language ".$loglanguagestring); + if ($loglanguagestring ne $loglanguagestring_orig) { (my $dir = $loggingdir) =~ s!/$!!; open(my $F1, "> $dir.dir"); @@ -714,7 +731,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { if ( $allvariableshashref->{'UPDATE_DATABASE'} ) { - installer::logger::print_message( "... analyzing update database ...\n" ); + $installer::logger::Info->print( "... analyzing update database ...\n" ); $refdatabase = installer::windows::update::readdatabase($allvariableshashref, $languagestringref, $includepatharrayref); if ( $installer::globals::updatedatabase ) @@ -776,7 +793,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # files part, language dependent ##################################### - installer::logger::print_message( "... analyzing files ...\n" ); + $installer::logger::Info->print( "... analyzing files ...\n" ); my $filesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($filesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles4.log", $filesinproductlanguageresolvedarrayref); } @@ -833,15 +850,11 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles10f.log", $filesinproductlanguageresolvedarrayref); } - # print "... calculating checksums ...\n"; - # my $checksumfile = installer::worker::make_checksum_file($filesinproductlanguageresolvedarrayref, $includepatharrayref); - # if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . $installer::globals::checksumfilename, $checksumfile); } - ###################################################################################### # Unzipping files with flag ARCHIVE and putting all included files into the file list ###################################################################################### - installer::logger::print_message( "... analyzing files with flag ARCHIVE ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag ARCHIVE ...\n" ); my @additional_paths_from_zipfiles = (); @@ -861,7 +874,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag SUBST_FILENAME ##################################### - installer::logger::print_message( "... analyzing files with flag SUBST_FILENAME ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag SUBST_FILENAME ...\n" ); installer::substfilenamefiles::resolving_subst_filename_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, $languagestringref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles12d.log", $filesinproductlanguageresolvedarrayref); } @@ -870,7 +883,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag SCPZIP_REPLACE ##################################### - installer::logger::print_message( "... analyzing files with flag SCPZIP_REPLACE ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag SCPZIP_REPLACE ...\n" ); # Editing files with flag SCPZIP_REPLACE. @@ -881,7 +894,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag PATCH_SO_NAME ##################################### - installer::logger::print_message( "... analyzing files with flag PATCH_SO_NAME ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag PATCH_SO_NAME ...\n" ); # Editing files with flag PATCH_SO_NAME. @@ -892,7 +905,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Files with flag HIDDEN ##################################### - installer::logger::print_message( "... analyzing files with flag HIDDEN ...\n" ); + $installer::logger::Info->print( "... analyzing files with flag HIDDEN ...\n" ); installer::worker::resolving_hidden_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles13c.log", $filesinproductlanguageresolvedarrayref); } @@ -901,7 +914,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Collecting directories for epm list file ############################################ - installer::logger::print_message( "... analyzing all directories for this product ...\n" ); + $installer::logger::Info->print( "... analyzing all directories for this product ...\n" ); # There are two ways for a directory to be included into the epm directory list: # 1. Looking for all destination paths in the files array @@ -944,7 +957,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent links part ######################################################### - installer::logger::print_message( "... analyzing links ...\n" ); + $installer::logger::Info->print( "... analyzing links ...\n" ); my $linksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($linksinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productlinks2.log", $linksinproductlanguageresolvedarrayref); } @@ -973,7 +986,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent unix links part ######################################################### - installer::logger::print_message( "... analyzing unix links ...\n" ); + $installer::logger::Info->print( "... analyzing unix links ...\n" ); my $unixlinksinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($unixlinksinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks3.log", $unixlinksinproductlanguageresolvedarrayref); } @@ -993,7 +1006,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack))) { - installer::logger::print_message( "... creating profiles ...\n" ); + $installer::logger::Info->print( "... creating profiles ...\n" ); $profilesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($profilesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "profiles2.log", $profilesinproductlanguageresolvedarrayref); } @@ -1035,7 +1048,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for folder ######################################################### - installer::logger::print_message( "... analyzing folder ...\n" ); + $installer::logger::Info->print( "... analyzing folder ...\n" ); $folderinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folder2.log", $folderinproductlanguageresolvedarrayref); } @@ -1047,7 +1060,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for folderitems ######################################################### - installer::logger::print_message( "... analyzing folderitems ...\n" ); + $installer::logger::Info->print( "... analyzing folderitems ...\n" ); $folderitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($folderitemsinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "folderitems2.log", $folderitemsinproductlanguageresolvedarrayref); } @@ -1059,7 +1072,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # language dependent part for registryitems ######################################################### - installer::logger::print_message( "... analyzing registryitems ...\n" ); + $installer::logger::Info->print( "... analyzing registryitems ...\n" ); $registryitemsinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($registryitemsinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems2.log", $registryitemsinproductlanguageresolvedarrayref); } @@ -1076,7 +1089,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (!($installer::globals::is_copy_only_project)) { - installer::logger::print_message( "... analyzing modules ...\n" ); + $installer::logger::Info->print( "... analyzing modules ...\n" ); $modulesinproductlanguageresolvedarrayref = installer::scriptitems::resolving_all_languages_in_productlists($modulesinproductarrayref, $languagesarrayref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes_modules($loggingdir . "modules2.log", $modulesinproductlanguageresolvedarrayref); } @@ -1170,7 +1183,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (( $installer::globals::iswindowsbuild ) && ( ! $installer::globals::patch )) # Windows specific items: Folder, FolderItem, RegistryItem { - installer::logger::print_message( "... creating inf files ...\n" ); + $installer::logger::Info->print( "... creating inf files ...\n" ); installer::worker::create_inf_file($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $modulesinproductlanguageresolvedarrayref, $languagesarrayref, $languagestringref, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles16c.log", $filesinproductlanguageresolvedarrayref); } } @@ -1203,7 +1216,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Analyzing the package structure ########################################################### - installer::logger::print_message( "... analyzing package list ...\n" ); + $installer::logger::Info->print( "... analyzing package list ...\n" ); my $packages = installer::packagelist::collectpackages($modulesinproductlanguageresolvedarrayref, $languagesarrayref); installer::packagelist::check_packagelist($packages); @@ -1240,13 +1253,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if (!( $installer::globals::iswindowsbuild )) { #################################################### - # Writing log file before packages are packed - #################################################### - - installer::logger::print_message( "... creating log file " . $loggingdir . $installer::globals::logfilename . "\n" ); - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); - - #################################################### # Creating directories #################################################### @@ -1254,8 +1260,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $listfiledir = installer::systemactions::create_directories("listfile", $languagestringref); my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); - # installer::packagelist::add_defaultpathes_into_filescollector($filesinproductlanguageresolvedarrayref); - # my $installchecksumdir = installer::systemactions::create_directory_next_to_directory($installdir, "checksum"); #################################################### # Reading for Solaris all package descriptions @@ -1362,9 +1366,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) push(@{$packages}, $onepackage); # ... and adding it to the end $installer::globals::poolshiftedpackages{$packagename} = 1; # only shifting each package once $k--; # decreasing the counter - my $localinfoline = "Pool: Package \"$packagename\" cannot be created at the moment. Trying again later (1).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename); + $installer::logger::Lang->printf("Pool: Package \"%s\" cannot be created at the moment. Trying again later (1).\n", $packagename); next; # repeating this iteration with new package } } @@ -1432,8 +1435,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( ! ( $#{$filesinpackage} > -1 )) { push(@installer::globals::emptypackages, $packagename); - $infoline = "\n\nNo file in package: $packagename \-\> Skipping\n\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n\n", $packagename); next; # next package, end of loop ! } @@ -1447,8 +1451,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $patchfiles = installer::worker::collect_all_items_with_special_flag($filesinpackage ,"PATCH"); if ( ! ( $#{$patchfiles} > -1 )) { - $infoline = "\n\nLinux Patch: No patch file in package: $packagename \-\> Skipping\n\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Linux Patch: No patch file in package: %s \-\> Skipping\n\n", + $packagename); next; } } @@ -1542,7 +1548,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $epmfilename = "epm_" . $onepackagename . $linkaddon . ".lst"; - installer::logger::print_message( "... creating epm list file $epmfilename ... \n" ); + $installer::logger::Info->print( "... creating epm list file $epmfilename ... \n" ); my $completeepmfilename = $listfiledir . $installer::globals::separator . $epmfilename; @@ -1559,8 +1565,8 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( ! ( $#{$filesinpackage} > -1 )) { push(@installer::globals::emptypackages, $packagename); - $infoline = "\nNo file in package: $packagename \-\> Skipping\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("No file in package: %s \-\> Skipping\n", $packagename); next; # next package, end of loop ! } } @@ -1612,9 +1618,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) push(@{$packages}, $onepackage); # ... and adding it to the end $installer::globals::poolshiftedpackages{$packagename} = 1; # only shifting each package once $k--; # decreasing the counter - my $localinfoline = "\nPool: Package \"$packagename\" cannot be created at the moment. Trying again later (2).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Package \"%s\" cannot be created at the moment. Trying again later (2).\n", $packagename); next; # repeating this iteration with new package } } @@ -1622,9 +1629,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $use_package_from_pool == 4 ) # There was a problem with pooling. Repeat this package immediately. { $k--; # decreasing the counter - my $localinfoline = "\nPool: Package \"$packagename\" had pooling problems. Repeating packaging immediately (3).\n"; - installer::logger::print_message($localinfoline); - push( @installer::globals::logfileinfo, $localinfoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Package \"%s\" had pooling problems. Repeating packaging immediately (3).\n", $packagename); next; # repeating this iteration } @@ -1654,7 +1662,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { # ... now epm can be started, to create the installation sets - installer::logger::print_message( "... starting patched epm ... \n" ); + $installer::logger::Info->print( "... starting patched epm ... \n" ); installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); @@ -1686,7 +1694,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) { # ... now epm can be started, to create the installation sets - installer::logger::print_message( "... starting unpatched epm ... \n" ); + $installer::logger::Info->print( "... starting unpatched epm ... \n" ); if ( $installer::globals::call_epm ) { installer::epmfile::call_epm($epmexecutable, $completeepmfilename, $packagename, $includepatharrayref); } @@ -1906,7 +1914,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Begin of functions that are used for the creation of idt files (Windows only) ################################################################################# - installer::logger::print_message( "... creating idt files ...\n" ); + $installer::logger::Info->print( "... creating idt files ...\n" ); installer::logger::include_header_into_logfile("Creating idt files:"); @@ -1998,8 +2006,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::assembly::add_assembly_condition_into_component_table($filesinproductlanguageresolvedarrayref, $newidtdir); } - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); # Localizing the language dependent idt files # For every language there will be a localized msi database @@ -2019,7 +2026,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Copy the template idt files and the new created idt files into this language directory - installer::logger::print_message( "... copying idt files ...\n" ); + $installer::logger::Info->print( "... copying idt files ...\n" ); installer::logger::include_header_into_logfile("Copying idt files to $languageidtdir:"); @@ -2035,14 +2042,14 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $controlidttable = installer::files::read_file($controlidttablename); installer::windows::idtglobal::add_language_checkboxes_to_database($controlidttable, $languagesarrayref); installer::files::save_file($controlidttablename, $controlidttable); - $infoline = "Added checkboxes for language selection dialog into table $controlidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Added checkboxes for language selection dialog into table %s\n", + $controlidttablename); } # Now all files are copied into a language specific directory # The template idt files can be translated - installer::logger::print_message( "... localizing idt files (language: $onelanguage) ...\n" ); + $installer::logger::Info->print( "... localizing idt files (language: $onelanguage) ...\n" ); installer::logger::include_header_into_logfile("Localizing idt files (Language: $onelanguage):"); @@ -2072,10 +2079,10 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::files::save_file($oneidtfilename, $oneidtfile); - $infoline = "Translated idt file: $oneidtfilename into language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Used languagefile: $languagefilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Translated idt file: %s into language %s\n", + $oneidtfilename, + $onelanguage); + $installer::logger::Lang->printf("Used languagefile: %s\n", $languagefilename); } # setting the encoding in every table (replacing WINDOWSENCODINGTEMPLATE) @@ -2101,8 +2108,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::idtglobal::add_licensefile_to_database($licensefile, $controltable); installer::files::save_file($controltablename, $controltable); - $infoline = "Added licensefile $licensefilesource into database $controltablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Added licensefile %s into database %s\n", + $licensefilesource, + $controltablename); } # include a component into environment table if required @@ -2160,7 +2168,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $msidatabasename = installer::windows::msiglobal::get_msidatabasename($allvariableshashref, $onelanguage); my $msifilename = $languageidtdir . $installer::globals::separator . $msidatabasename; - installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" ); + $installer::logger::Info->print( "... creating msi database (language $onelanguage) ... \n" ); installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes @@ -2202,7 +2210,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $allvariableshashref->{'ADDLANGUAGEINDATABASENAME'} ) { installer::windows::msiglobal::add_language_to_msi_database($defaultlanguage, $installdir, $allvariableshashref); } - installer::logger::print_message( "... generating setup.ini ...\n" ); + $installer::logger::Info->print( "... generating setup.ini ...\n" ); if ( ! $allvariableshashref->{'NOLOADERREQUIRED'} ) { installer::windows::msiglobal::create_setup_ini($languagesarrayref, $defaultlanguage, $installdir, $allvariableshashref); } } @@ -2210,7 +2218,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Analyzing the ScpActions and copying the files into the installation set # At least the loader.exe - installer::logger::print_message( "... copying files into installation set ...\n" ); + $installer::logger::Info->print( "... copying files into installation set ...\n" ); # installer::windows::msiglobal::copy_scpactions_into_installset($defaultlanguage, $installdir, $scpactionsinproductlanguageresolvedarrayref); installer::worker::put_scpactions_into_installset($installdir); @@ -2230,7 +2238,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::msiglobal::copy_child_projects_into_installset($installdir, $allvariableshashref); } - installer::logger::print_message( "... creating ddf files ...\n" ); + $installer::logger::Info->print( "... creating ddf files ...\n" ); # Creating all needed ddf files and generating a list # for the package process containing all system calls @@ -2242,17 +2250,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # Update and patch reasons the pack order needs to be saved installer::windows::msiglobal::save_packorder(); - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - - #################################### - # Writing log file - # before cab files are packed - #################################### - - installer::logger::print_message( "... creating log file $installer::globals::logfilename \n" ); - - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); + $installer::logger::Info->print("\n"); ####################################################### # Finally really create the installation packages, @@ -2261,17 +2259,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) if ( $installer::globals::iswin ) # only possible on a Windows platform { - installer::logger::print_message( "... packaging installation set ... \n" ); + $installer::logger::Info->print( "... packaging installation set ... \n" ); installer::windows::msiglobal::execute_packaging($installer::globals::packjobref, $loggingdir, $allvariableshashref); if ( $installer::globals::include_cab_in_msi ) { installer::windows::msiglobal::include_cabs_into_msi($installdir); } - - #################################### - # Writing log file - # after cab files are packed - #################################### - - installer::logger::print_message( "\n... creating log file $installer::globals::logfilename \n" ); - installer::files::save_file($loggingdir . $installer::globals::logfilename, \@installer::globals::logfileinfo); } ####################################################### diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm index 931c7eabd2a5..421c418c4afa 100644 --- a/solenv/bin/modules/installer/archivefiles.pm +++ b/solenv/bin/modules/installer/archivefiles.pm @@ -197,12 +197,10 @@ sub resolving_archive_flag { $select_files = 1; $selectlistfiles = get_patch_file_list( $onefile->{'Selectfiles'} ); - $infoline = "Selected file list defined at file: $onefile->{'Name'} :\n"; - push( @installer::globals::logfileinfo, $infoline); - for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ ) + $installer::logging::Lang->printf("Selected file list defined at file: %s :\n", $onefile->{'Name'}); + foreach my $line (@$selectlistfiles) { - $infoline = "\"${$selectlistfiles}[$k]\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logging::Lang->printf("\"%s\"\n", $line); } } @@ -216,12 +214,10 @@ sub resolving_archive_flag { $select_patch_files = 1; # special handling if a Patchlist is defined $patchlistfiles = get_patch_file_list( $onefile->{'Patchfiles'} ); - $infoline = "Patch file list defined at file: $onefile->{'Name'} :\n"; - push( @installer::globals::logfileinfo, $infoline); - for ( my $k = 0; $k <= $#{$patchlistfiles}; $k++ ) + $installer::logger::Lang->printf("Patch file list defined at file: %s :\n", $onefile->{'Name'}); + foreach my $line (@$patchlistfiles) { - $infoline = "\"${$patchlistfiles}[$k]\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\"%s\"\n", $line); } } @@ -254,8 +250,7 @@ sub resolving_archive_flag my $zip = Archive::Zip->new(); if ( $zip->read($sourcepath) != AZ_OK ) { - $infoline = "ERROR: Could not unzip $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not unzip %s\n", $sourcepath); } my $counter = 0; @@ -268,28 +263,27 @@ sub resolving_archive_flag if (! ( $counter > 0 )) # the zipfile is empty { - $infoline = "ERROR: Could not unzip $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("ERROR: Could not unzip %s\n", $sourcepath); } else { if ( $installer::globals::dounzip ) # really unpacking the files { - if ( $zip->extractTree("", $unzipdir) != AZ_OK ) { installer::exiter::exit_program("ERROR: $infoline", "resolving_archive_flag"); } + if ( $zip->extractTree("", $unzipdir) != AZ_OK ) + { + installer::exiter::exit_program("ERROR: can not unzip ".$sourcepath, "resolving_archive_flag"); + } if (( $^O =~ /cygwin/i ) && ( $contains_dll )) { # Make dll's executable $systemcall = "cd $unzipdir; find . -name \\*.dll -exec chmod 775 \{\} \\\;"; $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 \"\"!\n", $systemcall); } } @@ -299,13 +293,10 @@ sub resolving_archive_flag $systemcall = "cd $unzipdir; find . -type d -exec chmod 775 \{\} \\\;"; $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 \"\"!\n", $systemcall); } } @@ -363,8 +354,10 @@ sub resolving_archive_flag { my $value = sprintf("%o", (stat($newfile{'sourcepath'}))[2]); $newfile{'UnixRights'} = substr($value, 3); - $infoline = "Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Setting unix rights for \"%s\" to \"%s\"\n", + $newfile{'sourcepath'}, + $newfile{'UnixRights'}); } if ( $set_executable_privileges ) @@ -375,8 +368,10 @@ sub resolving_archive_flag if ( exists($executable_files_in_extensions{$compare_path}) ) { $newfile{'UnixRights'} = "775"; - $infoline = "Executable in Extension: Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Executable in Extension: Setting unix rights for \"%s\" to \"%s\"\n", + $newfile{'sourcepath'}, + $newfile{'UnixRights'}); } } @@ -384,14 +379,16 @@ sub resolving_archive_flag { if ( ! installer::existence::exists_in_array($zipname,$selectlistfiles) ) { - $infoline = "Removing from ARCHIVE file $onefilename: $zipname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Removing from ARCHIVE file %s: %s\n", + $onefilename, + $zipname); next; # ignoring files, that are not included in $selectlistfiles } else { - $infoline = "Keeping from ARCHIVE file $onefilename: $zipname\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Keeping from ARCHIVE file %s: \n", + $onefilename, + $zipname); push( @keptfiles, $zipname); # collecting all kept files } } @@ -407,13 +404,9 @@ sub resolving_archive_flag $newfile{'Styles'} =~ s/\,\s*\,/\,/; $newfile{'Styles'} =~ s/\(\s*\,/\(/; $newfile{'Styles'} =~ s/\,\s*\)/\)/; - # $infoline = "Removing PATCH flag from: $zipname\n"; - # push( @installer::globals::logfileinfo, $infoline); } else { - # $infoline = "Keeping PATCH flag at: $zipname\n"; - # push( @installer::globals::logfileinfo, $infoline); push( @keptpatchflags, $zipname); # collecting all PATCH flags } } @@ -430,15 +423,15 @@ sub resolving_archive_flag $newfile{'destination'} = $destination . $newzipname; $newfile{'sourcepath'} = $unzipdir . $newzipname; - $infoline = "RENAME_TO_LANGUAGE: Using $newzipname instead of $zipname!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("RENAME_TO_LANGUAGE: Using %s instead of %s!\n", + $newzipname, + $zipname); } my $sourcefiletest = $unzipdir . $zipname; if ( ! -f $sourcefiletest ) { - $infoline = "ATTENTION: Unzip failed for $sourcefiletest!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Unzip failed for %s!\n", $sourcefiletest); $unziperror = 1; } @@ -455,35 +448,25 @@ sub resolving_archive_flag if ( $select_files ) { - my $number = $#{$selectlistfiles} + 1; - $infoline = "SELECTLIST: Number of files in file selection list: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - $number = $#keptfiles + 1; - $infoline = "SELECTLIST: Number of kept files: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#keptfiles; $k++ ) + $installer::logger::Lang->printf("SELECTLIST: Number of files in file selection list: %d\n", + scalar @$selectlistfiles); + $installer::logger::Lang->printf("SELECTLIST: Number of kept files: %d\n", + scalar @keptfiles); + + foreach my $name (@keptfiles) { - $infoline = "KEPT FILES: $keptfiles[$k]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("KEPT FILES: %s\n", $name); } - my @warningfiles = (); - - for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ ) + foreach my $name (@$selectlistfiles) { - if ( ! installer::existence::exists_in_array(${$selectlistfiles}[$k],\@keptfiles) ) + if ( ! installer::existence::exists_in_array($name,\@keptfiles) ) { - push(@warningfiles, ${$selectlistfiles}[$k]); + $installer::logger::Lang->printf( + "WARNING: %s not included in install set (does not exist in zip file)!\n", + $name);; } } - - for ( my $k = 0; $k <= $#warningfiles; $k++ ) - { - $infoline = "WARNING: $warningfiles[$k] not included in install set (does not exist in zip file)!\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } # Comparing the content of @keptpatchflags and $patchlistfiles @@ -493,41 +476,32 @@ sub resolving_archive_flag if ( $select_patch_files ) { - my $number = $#{$patchlistfiles} + 1; - $infoline = "PATCHLIST: Number of files in patch list: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - $number = $#keptpatchflags + 1; - $infoline = "PATCHLIST: Number of kept PATCH flags: $number\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#keptpatchflags; $k++ ) + $installer::logger::Lang->printf("PATCHLIST: Number of files in patch list: %d\n", + scalar @$patchlistfiles); + $installer::logger::Lang->printf("PATCHLIST: Number of kept PATCH flags: %d\n", + scalar @keptpatchflags); + + foreach my $flag (@keptpatchflags) { - $infoline = "KEPT PATCH FLAGS: $keptpatchflags[$k]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("KEPT PATCH FLAGS: %s\n", + $flag); } - my @warningfiles = (); - - for ( my $k = 0; $k <= $#{$patchlistfiles}; $k++ ) + foreach my $name (@$patchlistfiles) { - if ( ! installer::existence::exists_in_array(${$patchlistfiles}[$k],\@keptpatchflags) ) + if ( ! installer::existence::exists_in_array($name,\@keptpatchflags) ) { - push(@warningfiles, ${$patchlistfiles}[$k]); + $installer::logger::Lang->printf( + "WARNING: %s did not keep PATCH flag (does not exist in zip file)!\n", + $name); } } - - for ( my $k = 0; $k <= $#warningfiles; $k++ ) - { - $infoline = "WARNING: $warningfiles[$k] did not keep PATCH flag (does not exist in zip file)!\n"; - push( @installer::globals::logfileinfo, $infoline); - } } if ( $unziperror ) { installer::logger::print_warning( "Repeating to unpack $sourcepath! \n" ); - $infoline = "ATTENTION: Repeating to unpack $sourcepath !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Repeating to unpack %s!\n", $sourcepath); $repeat_unzip = 1; $maxcounter++; @@ -538,8 +512,7 @@ sub resolving_archive_flag } else { - $infoline = "Info: $sourcepath unpacked without problems !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: %s unpacked without problems !\n", $sourcepath); $repeat_unzip = 0; $maxcounter = 0; } @@ -551,8 +524,7 @@ sub resolving_archive_flag } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); return \@newallfilesarray; } diff --git a/solenv/bin/modules/installer/configuration.pm b/solenv/bin/modules/installer/configuration.pm index 325e9fa96ce7..5444f946ff47 100644 --- a/solenv/bin/modules/installer/configuration.pm +++ b/solenv/bin/modules/installer/configuration.pm @@ -760,18 +760,16 @@ sub save_and_zip_configfile chdir($currentdir); - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); if ($returnvalue) { - $infoline = "ERROR: Could not zip $savefilename to $zipfilename\n"; + $installer::logger::Lang->printf("ERROR: Could not zip %s to %s\n", $savefilename, $zipfilename); } else { - $infoline = "SUCCESS: Zipped file $savefilename to $zipfilename\n"; + $installer::logger::Lang->printf("SUCCESS: Zipped file %s to %s\n", $savefilename, $zipfilename); } - push( @installer::globals::logfileinfo, $infoline); return $zipfilename; } @@ -889,9 +887,7 @@ sub create_configuration_files } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->print("\n"); } 1; diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index bad8c9835c0d..f48e6c166b0b 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -32,6 +32,8 @@ use installer::pathanalyzer; use installer::scriptitems; use installer::systemactions; +our @ErrorMessages = undef; + ######################################################### # Function that can be used for additional controls. # Search happens in $installer::globals::patharray. @@ -41,9 +43,10 @@ sub check_needed_files_in_path { my ( $filesref ) = @_; - foreach $onefile ( @{$filesref} ) + my $error = 0; + foreach my $onefile ( @{$filesref} ) { - installer::logger::print_message( "...... searching $onefile ..." ); + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $installer::globals::patharray , 0); @@ -54,7 +57,7 @@ sub check_needed_files_in_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->print( "\tFound: $$fileref\n" ); } } @@ -126,7 +129,7 @@ sub check_system_path foreach $onefile ( @needed_files_in_path ) { - installer::logger::print_message( "...... searching $onefile ..." ); + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $patharrayref , 0); @@ -137,7 +140,7 @@ sub check_system_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->print( "\tFound: $$fileref\n" ); # Saving the absolut path for msitran.exe. This is required for the determination of the checksum. if ( $onefile eq "msitran.exe" ) { $installer::globals::msitranpath = $$fileref; } } @@ -180,7 +183,7 @@ sub check_system_path { $installer::globals::upx_in_path = 1; $installer::globals::upxfile = $$upxfileref; - installer::logger::print_message( "\tFound: $$upxfileref\n" ); + $installer::logger::Info->print( "\tFound: $$upxfileref\n" ); } } @@ -204,13 +207,11 @@ sub get_makecab_version if ($returnvalue) { - $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("ERROR: Could not execute \"%s\"!\n", $systemcall); } else { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Success: Executed \"%s\" successfully!\n", $systemcall); my $versionline = ""; @@ -223,8 +224,7 @@ sub get_makecab_version } } - $infoline = $versionline; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("%s\n", $versionline); if ( $versionline =~ /\bVersion\b\s+(\d+[\d\.]+\d+)\s+/ ) { @@ -238,8 +238,7 @@ sub get_makecab_version $makecabversion = $1; } - $infoline = "Using version: " . $makecabversion . "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Using version: %s\n", $makecabversion); } return $makecabversion; @@ -258,8 +257,7 @@ sub check_makecab_version my $makecabversion = get_makecab_version(); - my $infoline = "Tested version: " . $installer::globals::controlledmakecabversion . "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Tested version: %s\n", $installer::globals::controlledmakecabversion); if ( $makecabversion < 0 ) { $do_check = 0; } # version could not be determined @@ -280,8 +278,7 @@ sub check_makecab_version } else { - $infoline = "Warning: No version check of makecab.exe\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Warning: No version check of makecab.exe\n"); } } @@ -317,113 +314,120 @@ sub check_system_environment return \%variables; } -############################################################# -# Controlling the log file at the end of the -# packaging process -############################################################# -sub check_logfile +sub prepare_error_processing () { - my ($logfile) = @_; + @ErrorMessages = (); +} - my @errors = (); - my @output = (); - my $contains_error = 0; +=item filter_log_error ($relative_time, $log_id, $process_id, $message) - my $ignore_error = 0; - my $make_error_to_warning = 0; + Process the given log message. Returns $message unaltered. - if (( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile )) { $ignore_error = 1; } +=cut +sub filter_log_error ($$$$) +{ + my ($relative_time, $log_id, $process_id, $message) = @_; - for ( my $i = 0; $i <= $#{$logfile}; $i++ ) + if ($message =~ /\berror\b/i) { - my $line = ${$logfile}[$i]; - - # Errors are all errors, but not the Windows installer table "Error.idt" + # Message contains the word "error". Now we have to find out if it is relevant. - my $compareline = $line; - $compareline =~ s/Error\.idt//g; # removing all occurences of "Error.idt" - $compareline =~ s/Error\.mlf//g; # removing all occurences of "Error.mlf" - $compareline =~ s/Error\.ulf//g; # removing all occurences of "Error.ulf" - $compareline =~ s/Error\.idl//g; # removing all occurences of "Error.idl" - $compareline =~ s/Error\.html//g; # removing all occurences of "Error.html" - # Ugly workaround for (boost) headers - $compareline =~ s/error\.hpp//g; # removing all occurences of "error.hpp" - $compareline =~ s/error\.ipp//g; # removing all occurences of "error.ipp" + # Remove all filenames that contain the word "Error". + my $work_string = $message; + $work_string =~ s/Error\.(idt|mlf|ulf|html|hpp|ipp)//g; - if ( $compareline =~ /\bError\b/i ) + if ($work_string =~ /\bError\b/i) { - $contains_error = 1; - push(@errors, $line); - - if ( $ignore_error ) - { - $contains_error = 0; - $make_error_to_warning = 1; - } + # This really is an error message. + push @ErrorMessages, {'relative_time' => $relative_time, + 'message' => $message}; } } - if ($contains_error) - { - my $line = "\n*********************************************************************\n"; - push(@output, $line); - $line = "ERROR: The following errors occured in packaging process:\n\n"; - push(@output, $line); + return $message; +} - for ( my $i = 0; $i <= $#errors; $i++ ) - { - $line = "$errors[$i]"; - push(@output, $line); - } - $line = "*********************************************************************\n"; - push(@output, $line); -# exit(-1); - } - else + + +sub printocessed_error_lines () +{ + my $lines = []; + + foreach my $line (@ErrorMessages) { - my $line = ""; + push @$lines, sprintf(" %12.6f : %s", $line->{'relative_time'}, $line->{'message'}); + } + + return $lines; +} - if ( $make_error_to_warning ) - { - $line = "\n*********************************************************************\n"; - push(@output, $line); - $line = "The following errors in the log file were ignored:\n\n"; - push(@output, $line); - for ( my $i = 0; $i <= $#errors; $i++ ) - { - $line = "$errors[$i]"; - push(@output, $line); - } - $line = "*********************************************************************\n"; - push(@output, $line); + +=item check_logfile() + + Print all error messages (typically at the end) on the console. + +=cut +sub check_logfile () +{ + my ($logfile) = @_; + + my @errors = (); + my @output = (); + + my $ignore_errors = ( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile ); + my $contains_errors = scalar @ErrorMessages > 0; + + # Format errors + if ($contains_errors) + { + push(@output, "\n"); + push(@output, "*********************************************************************\n"); + if ($ignore_errors) + { + push(@output, "The following errors in the log file were ignored:\n"); + } + else + { + push(@output, "ERROR: The following errors occured in packaging process:\n"); } + push(@output, "\n"); - $line = "\n***********************************************************\n"; - push(@output, $line); - $line = "Successful packaging process!\n"; - push(@output, $line); - $line = "***********************************************************\n"; - push(@output, $line); + foreach my $line (@ErrorMessages) + { + push @output, sprintf(" %12.6f : %s", $line->{'relative_time'}, $line->{'message'}); + } + + push(@output, "*********************************************************************\n"); } - # printing the output file and adding it to the logfile + # Claim success if there where no errors or if errors are treated as warnings. + if ( ! $contains_errors || $ignore_errors) + { + push(@output, "\n"); + push(@output, "***********************************************************\n"); + push(@output, "Successful packaging process!\n"); + push(@output, "***********************************************************\n"); + } + # Print the summary. installer::logger::include_header_into_logfile("Summary:"); - my $force = 1; # print this message even in 'quiet' mode - for ( my $i = 0; $i <= $#output; $i++ ) + foreach my $line (@output) { - my $line = "$output[$i]"; - installer::logger::print_message( "$line", $force ); - push( @installer::globals::logfileinfo, $line); - push( @installer::globals::errorlogfileinfo, $line); + $installer::logger::Info->print($line, $force); } - return $contains_error; + # Delete the accumulated error messages. The @ErrorMessages will now contain + # lines caused by printing those error messages. + @ErrorMessages = (); + + @installer::globals::errorlogfileinfo = @output; + + return $contains_error && ! $ignore_error; } ############################################################# @@ -471,8 +475,8 @@ sub determine_ship_directory $installer::globals::build . "_" . $installer::globals::lastminor . "_" . "native_inprogress-number_" . $languagestring . "\." . $installer::globals::buildid; - my $infoline = "\nSetting ship directory: $destdir\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Setting ship directory: %s\n", $destdir); return $destdir; } @@ -489,44 +493,40 @@ sub check_updatepack if ( $ENV{'UPDATER'} ) # the environment variable UPDATER has to be set { - $infoline = "\nEnvironment variable UPDATER set\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); + $installer::logger::Global->print("Environment variable UPDATER set\n"); if ( ! $ENV{'CWS_WORK_STAMP'} ) # the environment variable CWS_WORK_STAMP must not be set (set only in CWS) { - $infoline = "Environment variable CWS_WORK_STAMP not set\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable CWS_WORK_STAMP not set\n"); if ( $ENV{'SHIPDRIVE'} ) # the environment variable SHIPDRIVE must be set { $shipdrive = $ENV{'SHIPDRIVE'}; - $infoline = "Ship drive defined: $shipdrive\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Ship drive defined: %s\n", $shipdrive); if ( -d $shipdrive ) # SHIPDRIVE must be a directory { - $infoline = "Ship drive exists\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Ship drive exists\n"); # try to write into $shipdrive - $directory = $installer::globals::product . "_" . $installer::globals::compiler . "_" . $installer::globals::buildid . "_" . $installer::globals::languageproducts[0] . "_test_$$"; + my $directory = $installer::globals::product . "_" . $installer::globals::compiler . "_" . $installer::globals::buildid . "_" . $installer::globals::languageproducts[0] . "_test_$$"; $directory =~ s/\,/\_/g; # for the list of languages $directory =~ s/\-/\_/g; # for en-US, pt-BR, ... $directory = $shipdrive . $installer::globals::separator . $directory; - $infoline = "Try to create directory: $directory\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Try to create directory: %s\n", $directory); # saving this directory for later removal $installer::globals::shiptestdirectory = $directory; if ( installer::systemactions::try_to_create_directory($directory)) { - $infoline = "Write access on Ship drive\n"; - push(@installer::globals::globallogfileinfo, $infoline); - $infoline = "Ship test directory $installer::globals::shiptestdirectory was successfully created\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Write access on Ship drive\n"); + $installer::logger::Global->print( + "Ship test directory %s was successfully created\n", + $installer::globals::shiptestdirectory); my $systemcall = "rmdir $directory"; my $returnvalue = system($systemcall); @@ -537,8 +537,7 @@ sub check_updatepack my $sol_tmp; if ( $ENV{'SOLARENV'} ) { $solarenv = $ENV{'SOLARENV'}; } - $infoline = "Environment variable SOLARENV: $solarenv\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Environment variable SOLARENV: %s\n", $solarenv); if ( $ENV{'SOL_TMP'} ) { @@ -547,17 +546,15 @@ sub check_updatepack } else { $infoline = "Environment variable SOL_TMP not set\n"; } - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); if ( defined $sol_tmp && ( $solarenv =~ /^\s*\Q$sol_tmp\E/ )) { - $infoline = "Content of SOLARENV starts with the content of SOL_TMP\: Local environment -\> No Updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Content of SOLARENV starts with the content of SOL_TMP\: Local environment -\> No Updatepack\n"); } else { - $infoline = "Content of SOLARENV does not start with the content of SOL_TMP: No local environment\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Content of SOLARENV does not start with the content of SOL_TMP: No local environment\n"); $installer::globals::updatepack = 1; # That's it } @@ -566,48 +563,53 @@ sub check_updatepack if ( -d $installer::globals::shiptestdirectory ) { - $infoline = "Ship test directory $installer::globals::shiptestdirectory still exists. Trying removal later again.\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Ship test directory %s still exists. Trying removal later again.\n", + $installer::globals::shiptestdirectory); } else { - $infoline = "Ship test directory $installer::globals::shiptestdirectory was successfully removed.\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Ship test directory %s was successfully removed.\n", + $installer::globals::shiptestdirectory); } } else { - $infoline = "No write access on Ship drive\n"; - push(@installer::globals::globallogfileinfo, $infoline); - $infoline = "Failed to create directory $directory\n"; - push(@installer::globals::globallogfileinfo, $infoline); - if ( defined $ENV{'BSCLIENT'} && ( uc $ENV{'BSCLIENT'} eq 'TRUE' ) ) { + $installer::logger::Global->print("No write access on Ship drive\n"); + $installer::logger::Global->printf("Failed to create directory \n", $directory); + if ( defined $ENV{'BSCLIENT'} && ( uc $ENV{'BSCLIENT'} eq 'TRUE' ) ) + { installer::exiter::exit_program("ERROR: No write access to SHIPDRIVE allthough BSCLIENT is set.", "check_updatepack"); } } } else { - $infoline = "Ship drive not found: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Ship drive not found: No updatepack\n"); } } else { - $infoline = "Environment variable SHIPDRIVE not set: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable SHIPDRIVE not set: No updatepack\n"); } } else { - $infoline = "Environment variable CWS_WORK_STAMP defined: No updatepack\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("Environment variable CWS_WORK_STAMP defined: No updatepack\n"); } } - if ( $installer::globals::updatepack ) { $infoline = "Setting updatepack true\n\n"; } - else { $infoline = "\nNo updatepack\n"; } - push(@installer::globals::globallogfileinfo, $infoline); + if ( $installer::globals::updatepack ) + { + $installer::logger::Global->print("Setting updatepack true\n"); + $installer::logger::Global->print("\n"); + } + else + { + $installer::logger::Global->print("\n"); + $installer::logger::Global->print("No updatepack\n"); + } } @@ -623,8 +625,7 @@ sub read_encodinglist if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Did not find Windows encoding list $installer::globals::encodinglistname!", "read_encodinglist"); } - my $infoline = "Found encoding file: $$fileref\n"; - push(@installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Found encoding file: %s\n", $$fileref); my $encodinglist = installer::files::read_file($$fileref); @@ -720,8 +721,9 @@ sub set_addchildprojects $installer::globals::addchildprojects = 0; # no child projects for patches } - my $infoline = "Value of \$installer::globals::addchildprojects: $installer::globals::addchildprojects\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addchildprojects: %s\n", + $installer::globals::addchildprojects); } #################################################################### @@ -738,8 +740,9 @@ sub set_addjavainstaller if ( $installer::globals::languagepack ) { $installer::globals::addjavainstaller = 0; } if ( $allvariableshashref->{'XPDINSTALLER'} ) { $installer::globals::addjavainstaller = 0; } - my $infoline = "Value of \$installer::globals::addjavainstaller: $installer::globals::addjavainstaller\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addjavainstaller: %s\n", + $installer::globals::addjavainstaller); } ####################################################################### @@ -756,8 +759,9 @@ sub set_addsystemintegration if ( $installer::globals::languagepack ) { $installer::globals::addsystemintegration = 0; } if (( $installer::globals::packageformat eq "native" ) || ( $installer::globals::packageformat eq "portable" )) { $installer::globals::addsystemintegration = 0; } - my $infoline = "Value of \$installer::globals::addsystemintegration: $installer::globals::addsystemintegration\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Value of \$installer::globals::addsystemintegration: %s\n", + $installer::globals::addsystemintegration); } 1; diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm index f92843f00784..bc6a994885bd 100644 --- a/solenv/bin/modules/installer/download.pm +++ b/solenv/bin/modules/installer/download.pm @@ -52,8 +52,7 @@ sub put_productname_into_script $productname =~ s/\.//g; # openoffice.org -> openofficeorg $productname =~ s/\s*//g; - my $infoline = "Adding productname $productname into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding productname %s into download shell script\n", $productname); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -71,8 +70,7 @@ sub put_linenumber_into_script my $linenumber = $#{$scriptfile} + 2; - my $infoline = "Adding linenumber $linenumber into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Adding linenumber %d into download shell script\n", $linenumber); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -92,8 +90,7 @@ sub determine_scriptfile_name $filename = $filename . $installer::globals::downloadfileextension; $installer::globals::downloadfilename = $filename; - my $infoline = "Setting download shell script file name to $filename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting download shell script file name to %s\n", $filename); return $filename; } @@ -109,8 +106,7 @@ sub save_script_file $newscriptfilename = $directory . $installer::globals::separator . $newscriptfilename; installer::files::save_file($newscriptfilename, $scriptfile); - my $infoline = "Saving script file $newscriptfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Saving script file %s\n", $newscriptfilename); if ( ! $installer::globals::iswindowsbuild ) { @@ -142,8 +138,8 @@ sub put_checksum_and_size_into_script installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/sum: $sumout", "put_checksum_and_size_into_script"); } - my $infoline = "Adding checksum $checksum and size $size into download shell script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Adding checksum %s and size %s into download shell script\n", $checksum, $size); for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) { @@ -175,18 +171,15 @@ sub call_md5sum my $returnvalue = $?; # $? contains the return value of the 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->print("Success: Executed \"%s\" successfully!\n", $systemcall); } return $md5sumoutput; @@ -211,8 +204,7 @@ sub get_md5sum installer::exiter::exit_program("ERROR: Incorrect return value from /usr/bin/md5sum: $md5sumoutput", "get_md5sum"); } - my $infoline = "Setting md5sum: $md5sum\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting md5sum: %s\n", $md5sum); return $md5sum; } @@ -235,18 +227,15 @@ sub call_sum my $returnvalue = $?; # $? contains the return value of the 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); } $sumoutput =~ s/\s+$filename\s$//; @@ -290,18 +279,15 @@ sub include_tar_into_script my $systemcall = "cat $temporary_tarfile >> $scriptfile && rm $temporary_tarfile"; 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); } return $returnvalue; } @@ -321,18 +307,15 @@ sub tar_package 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 \"\" successfully!\n", $systemcall); } my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1"; @@ -349,7 +332,6 @@ sub create_tar_gz_file_from_package { my ($installdir, $getuidlibrary) = @_; - my $infoline = ""; my $alldirs = installer::systemactions::get_all_directories($installdir); my $onedir = ${$alldirs}[0]; $installdir = $onedir; @@ -362,18 +344,15 @@ sub create_tar_gz_file_from_package my $systemcall = "cd $installdir; rm $onefile"; my $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); } } @@ -394,18 +373,15 @@ sub create_tar_gz_file_from_package my $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); } } @@ -761,24 +737,20 @@ sub get_versionstring sub get_current_version { - my $infoline = ""; my $versionstring = ""; my $filename = "version.info"; # $filename = $installer::globals::ooouploaddir . $installer::globals::separator . $filename; if ( -f $filename ) { - $infoline = "File $filename exists. Trying to find current version.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("File %s exists. Trying to find current version.\n", $filename); my $versionfile = installer::files::read_file($filename); $versionstring = get_versionstring($versionfile); - $infoline = "Setting version string: $versionstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting version string: %s\n", $versionstring); } else { - $infoline = "File $filename does not exist. No version setting in download file name.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("File %s does not exist. No version setting in download file name.\n", $filename); } $installer::globals::oooversionstring = $versionstring; @@ -826,8 +798,6 @@ sub create_tar_gz_file_from_directory { my ($installdir, $getuidlibrary, $downloaddir, $downloadfilename) = @_; - my $infoline = ""; - my $packdir = $installdir; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$packdir); my $changedir = $installdir; @@ -844,18 +814,15 @@ sub create_tar_gz_file_from_directory my $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); } return $targzname; @@ -912,8 +879,7 @@ sub replace_one_variable { my ($templatefile, $placeholder, $value) = @_; - my $infoline = "Replacing $placeholder by $value in nsi file\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Replacing %s by %s in nsi file\n", $placeholder, $value); for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) { @@ -1309,11 +1275,10 @@ sub nsis_language_converter elsif ( $language eq "vi" ) { $nsislanguage = "Vietnamese"; } elsif ( $language eq "zh-CN" ) { $nsislanguage = "SimpChinese"; } elsif ( $language eq "zh-TW" ) { $nsislanguage = "TradChinese"; } - else { - my $infoline = "NSIS language_converter : Could not find nsis language for $language!\n"; - push( @installer::globals::logfileinfo, $infoline); + else + { + $installer::logger::Lang->printf("NSIS language_converter : Could not find nsis language for %s!\n", $language); $nsislanguage = "English"; - # installer::exiter::exit_program("ERROR: Could not find nsis language for $language!", "nsis_language_converter"); } return $nsislanguage; @@ -1472,8 +1437,11 @@ sub replace_identifier_in_nshfile { my $oldstring = $1; ${$nshfile}[$i] =~ s/\Q$oldstring\E/$newstring/; - my $infoline = "NSIS replacement in $nshfilename ($onelanguage): $oldstring \-\> $newstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("NSIS replacement in %s (%s): \-\> %s\n", + $nshfilename, + $onelanguage, + $oldstring, + $newstring); } } } @@ -1497,8 +1465,11 @@ sub replace_identifier_in_nlffile my $oldstring = ${$nlffile}[$next]; ${$nlffile}[$next] = $newstring . "\n"; $oldstring =~ s/\s*$//; - my $infoline = "NSIS replacement in $nlffilename ($onelanguage): $oldstring \-\> $newstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("NSIS replacement in %s (%s): %s \-\> %s\n", + $nlffilename, + $onelanguage, + $oldstring, + $newstring); } } } @@ -1620,8 +1591,6 @@ sub copy_and_translate_nsis_language_files my $nlffilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Language\ files" . $installer::globals::separator; my $nshfilepath = $nsispath . $installer::globals::separator . "Contrib" . $installer::globals::separator . "Modern\ UI" . $installer::globals::separator . "Language files" . $installer::globals::separator; - my $infoline = ""; - for ( my $i = 0; $i <= $#{$languagesarrayref}; $i++ ) { my $onelanguage = ${$languagesarrayref}[$i]; @@ -1656,8 +1625,7 @@ sub copy_and_translate_nsis_language_files if ( $installer::globals::unicodensis ) { - $infoline = "This is Unicode NSIS!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("This is Unicode NSIS!\n"); convert_utf16_to_utf8($nshfilename); convert_utf16_to_utf8($nlffilename); $nshfile = installer::files::read_file($nshfilename); # read nsh file again @@ -1776,8 +1744,9 @@ sub get_path_to_nsis_sdk if ( $nsispath eq "" ) { - installer::logger::print_message( "... no Environment variable \"SOLARROOT\", \"NSIS_PATH\" or \"NSISSDK_SOURCE\" found and NSIS not found in path!", "get_path_to_nsis_sdk"); - } elsif ( ! -d $nsispath ) + $installer::logger::Info->print("... no Environment variable \"SOLARROOT\", \"NSIS_PATH\" or \"NSISSDK_SOURCE\" found and NSIS not found in path!\n"); + } + elsif ( ! -d $nsispath ) { installer::exiter::exit_program("ERROR: NSIS path $nsispath does not exist!", "get_path_to_nsis_sdk"); } @@ -1795,14 +1764,13 @@ sub call_nsis my $makensisexe = $nsispath . $installer::globals::separator . "makensis.exe"; - installer::logger::print_message( "... starting $makensisexe ... \n" ); + $installer::logger::Info->printf("... starting %s ... \n", $makensisexe); if( $^O =~ /cygwin/i ) { $nsifile =~ s/\\/\//g; } my $systemcall = "$makensisexe $nsifile |"; - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); my @nsisoutput = (); @@ -1814,17 +1782,17 @@ sub call_nsis if ($returnvalue) { - $infoline = "ERROR: $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: %s !\n", $systemcall); } else { - $infoline = "Success: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: %s\n", $systemcall); } - for ( my $i = 0; $i <= $#nsisoutput; $i++ ) { push( @installer::globals::logfileinfo, "$nsisoutput[$i]"); } - + foreach my $line (@nsisoutput) + { + $installer::logger::Lang->print($line); + } } ################################################################################# @@ -1874,8 +1842,7 @@ sub get_translation_file my $translationfile = installer::files::read_file($translationfilename); replace_variables($translationfile, $allvariableshashref); - my $infoline = "Reading translation file: $translationfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Reading translation file: %s\n", $translationfilename); return $translationfile; } @@ -1904,8 +1871,7 @@ sub create_link_tree if ( ! $installer::globals::ooouploaddir ) { installer::exiter::exit_program("ERROR: Directory for AOO upload not defined!", "create_link_tree"); } my $versiondir = $installer::globals::ooouploaddir . $installer::globals::separator . $versionstring; - my $infoline = "Directory for the link: $versiondir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Directory for the link: %s\n", $versiondir); if ( ! -d $versiondir ) { installer::systemactions::create_directory_structure($versiondir); } @@ -1915,8 +1881,7 @@ sub create_link_tree # If there is an older version of this file (link), it has to be removed if ( -f $linkdestination ) { unlink($linkdestination); } - $infoline = "Creating hard link from $sourcedownloadfile to $linkdestination\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating hard link from %s to %s\n", $sourcedownloadfile, $linkdestination); installer::systemactions::hardlink_one_file($sourcedownloadfile, $linkdestination); } @@ -1948,12 +1913,10 @@ sub create_download_sets { my ($installationdir, $includepatharrayref, $allvariableshashref, $downloadname, $languagestringref, $languagesarrayref) = @_; - my $infoline = ""; - - my $force = 1; # print this message even in 'quiet' mode - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating download installation set ...\n", $force ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating download installation set ...\n", 1); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating download installation sets:"); @@ -2030,8 +1993,7 @@ sub create_download_sets if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "create_download_sets"); } my $scriptfile = installer::files::read_file($$scriptref); - $infoline = "Found script file $scriptfilename: $$scriptref \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Found script file %s: %s \n", $scriptfilename, $$scriptref); # add product name into script template put_productname_into_script($scriptfile, $allvariableshashref); @@ -2054,7 +2016,7 @@ sub create_download_sets my $newscriptfilename = determine_scriptfile_name($downloadname); $newscriptfilename = save_script_file($downloaddir, $newscriptfilename, $scriptfile); - installer::logger::print_message( "... including installation set into $newscriptfilename ... \n" ); + $installer::logger::Info->printf("... including installation set into %s ... \n", $newscriptfilename); # Append tar file to script include_tar_into_script($newscriptfilename, $temporary_tarfile_name); } @@ -2070,9 +2032,9 @@ sub create_download_sets if ( $nsispath eq "" ) { # If nsis is not found just skip the rest of this function # and do not create the NSIS file. - $infoline = "\nNo NSIS SDK found. Skipping the generation of NSIS file.\n"; - push(@installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... no NSIS SDK found. Skipping the generation of NSIS file ... \n" ); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("No NSIS SDK found. Skipping the generation of NSIS file.\n"); + $installer::logger::Info->print("... no NSIS SDK found. Skipping the generation of NSIS file ... \n"); return $downloaddir; } @@ -2115,7 +2077,7 @@ sub create_download_sets my $nsifilename = save_script_file($localnsisdir, $templatefilename, $templatefile); - installer::logger::print_message( "... created NSIS file $nsifilename ... \n" ); + $installer::logger::Info->printf("... created NSIS file %s ... \n", $nsifilename); # starting the NSIS SDK to create the download file call_nsis($nsispath, $nsifilename); @@ -2132,14 +2094,14 @@ sub create_download_link_tree { my ($downloaddir, $languagestringref, $allvariableshashref) = @_; - my $infoline; - - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating download hard link ...\n" ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); # + $installer::logger::Info->print("... creating download hard link ...\n"); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating download hard link:"); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Creating hard link, start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, start"); if ( is_supported_platform() ) { @@ -2151,8 +2113,7 @@ sub create_download_link_tree # Is $versionstring empty? If yes, there is nothing to do now. - $infoline = "Version string is set to: $versionstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Version string is set to: %s\n", $versionstring); if ( $versionstring ) { @@ -2165,13 +2126,11 @@ sub create_download_link_tree { $destdownloadfilename = $destdownloadfilename . $installer::globals::downloadfileextension; - $infoline = "Setting destination download file name: $destdownloadfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting destination download file name: %s\n", $destdownloadfilename); my $sourcedownloadfile = $downloaddir . $installer::globals::separator . $installer::globals::downloadfilename; - $infoline = "Setting source download file name: $sourcedownloadfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Setting source download file name: %s\n", $sourcedownloadfile); create_link_tree($sourcedownloadfile, $destdownloadfilename, $versionstring); # my $md5sumoutput = call_md5sum($downloadfile); @@ -2181,17 +2140,15 @@ sub create_download_link_tree } else { - $infoline = "Version string is empty. Nothing to do!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Version string is empty. Nothing to do!\n"); } } else { - $infoline = "Platform not used for hard linking. Nothing to do!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Platform not used for hard linking. Nothing to do!\n"); } - installer::logger::include_timestamp_into_logfile("Performance Info: Creating hard link, stop"); + $installer::logger::Lang->add_timestamp("Performance Info: Creating hard link, stop"); } 1; diff --git a/solenv/bin/modules/installer/downloadsigner.pm b/solenv/bin/modules/installer/downloadsigner.pm index 3ecc2f0749d0..0bdf49edb16b 100644 --- a/solenv/bin/modules/installer/downloadsigner.pm +++ b/solenv/bin/modules/installer/downloadsigner.pm @@ -87,8 +87,6 @@ Ende sub getparameter { - # installer::logger::print_message("Checking parameter"); - while ( $#ARGV >= 0 ) { my $param = shift(@ARGV); @@ -193,7 +191,8 @@ sub set_temp_path exit(-1); } - installer::logger::print_message( "\n... using output path: $temppath ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("\n... using output path: %s ...\n", $temppath); push(@installer::globals::removedirs, $temppath); @@ -227,7 +226,8 @@ sub set_minor_into_pathes { my ($followmeinfohash, $temppath) = @_; - installer::logger::print_message( "\n... forcing into minor: $installer::globals::lastminor ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... forcing into minor: %s ...\n", $installer::globals::lastminor); my @pathnames = ("bin", "doc", "inc", "lib", "pck", "res", "xml"); my $sourcename = "src"; @@ -235,7 +235,8 @@ sub set_minor_into_pathes if ( $installer::globals::minor ne "" ) { - installer::logger::print_message( "\n... already defined minor: $installer::globals::minor -> ignoring parameter \"-useminor\" ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... already defined minor: %s -> ignoring parameter \"-useminor\" ...\n" , $installer::globals::minor); return; } @@ -247,19 +248,16 @@ sub set_minor_into_pathes # $installer::globals::idtlanguagepath installer::logger::include_header_into_logfile("Changing saved pathes to add the minor"); - my $infoline = "Old pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Include pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); } + $installer::logger::Lang->print("Old pathes:\n"); + $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'}); + $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath); + $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath); + $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath); + $installer::logger::Lang->printf("Include pathes:\n"); + foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) + { + $installer::logger::Lang->print($path); + } foreach $onepath ( @pathnames ) { @@ -302,19 +300,17 @@ sub set_minor_into_pathes if ( $installer::globals::idtlanguagepath =~ /\Q$srcpath\E/ ) { $installer::globals::idtlanguagepath =~ s/\Q$srcpath\E/$newsrcpath/; } foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { if ( $path =~ /\Q$srcpath\E/ ) { $path =~ s/\Q$srcpath\E/$newsrcpath/; } } - $infoline = "\nNew pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Include pathes:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); } + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("New pathes:\n"); + $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'}); + $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath); + $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath); + $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath); + $installer::logger::Lang->printf("Include pathes:\n"); + foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) + { + $installer::logger::Lang->print($path); + } } ############################################# @@ -380,16 +376,17 @@ sub publishproductlist { my ($infofilelist) = @_; - installer::logger::print_message( "\n... found products: ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... found products: ...\n"); for ( my $i = 0; $i <= $#{$infofilelist}; $i++ ) { my $onefile = ${$infofilelist}[$i]; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$onefile); - installer::logger::print_message( "...... $onefile ...\n" ); + $installer::logger::Info->printf("...... $onefile ...\n"); } - installer::logger::print_message( "\n" ); + $installer::logger::Info->printf("\n"); } ######################################################### @@ -469,7 +466,8 @@ sub createproductlist } elsif ( -d $installer::globals::followmeinfofilename ) { - installer::logger::print_message( "\n... reading directory: $installer::globals::followmeinfofilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... reading directory: %s ...\n", $installer::globals::followmeinfofilename); $installer::globals::followmeinfofilename =~ s/$installer::globals::separator\s*$//; my $allfollowmefiles = installer::systemactions::find_file_with_file_extension("log", $installer::globals::followmeinfofilename); @@ -546,14 +544,26 @@ sub logfollowmeinfohash { my ( $followmehash ) = @_; - print "\n*****************************************\n"; - print "Content of follow-me info file:\n"; - print "finalinstalldir: $followmehash->{'finalinstalldir'}\n"; - print "downloadname: $followmehash->{'downloadname'}\n"; - print "languagestring: $followmehash->{'languagestring'}\n"; - foreach my $lang ( @{$followmehash->{'languagesarray'}} ) { print "languagesarray: $lang\n"; } - foreach my $path ( @{$followmehash->{'includepatharray'}} ) { print "includepatharray: $path"; } - foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} ) { print "allvariableshash: $key : $followmehash->{'allvariableshash'}->{$key}\n"; } + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("*****************************************\n"); + $installer::logger::Info->printf("Content of follow-me info file:\n"); + $installer::logger::Info->printf("finalinstalldir: %s\n", $followmehash->{'finalinstalldir'}); + $installer::logger::Info->printf("downloadname: %s\n", $followmehash->{'downloadname'}); + $installer::logger::Info->printf("languagestring: %s\n", $followmehash->{'languagestring'}); + foreach my $lang ( @{$followmehash->{'languagesarray'}} ) + { + $installer::logger::Info->printf("languagesarray: %s\n", $lang); + } + foreach my $path ( @{$followmehash->{'includepatharray'}} ) + { + $installer::logger::Info->printf("includepatharray: %s\n", $path); + } + foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} ) + { + $installer::logger::Info->printf("allvariableshash: %s : %s\n", + $key, + $followmehash->{'allvariableshash'}->{$key}); + } } ######################################################################## @@ -574,7 +584,11 @@ sub rename_followme_infofile if ( $filename ne $newfilename ) { my $returnvalue = rename($filename, $newfilename); - if ( $returnvalue ) { installer::logger::print_message( "\n... renamed file \"$filename\" to \"$newfilename\" ...\n" ); } + if ( $returnvalue ) + { + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... renamed file \"%s\" to \"%s\" ...\n", $filename, $newfilename); + } } } diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index cd370d998262..b6d6b96297c5 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -83,14 +83,12 @@ sub check_tilde_in_directory my $home = $ENV{'HOME'}; $home =~ s/\Q$installer::globals::separator\E\s*$//; $installer::globals::localinstalldir =~ s/~/$home/; - my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Info: Changing LOCALINSTALLDIR to %s\n", $installer::globals::localinstalldir); } else { # exit, because "~" is not allowed, if HOME is not set - my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n"); installer::exiter::exit_program("ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!", "check_tilde_in_directory"); } } diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index d0efdc0bbf40..64ac137e04b8 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -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 @@ -51,8 +51,9 @@ sub read_packagemap 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}) ) { @@ -127,9 +129,8 @@ 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_for_patch 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); } } } @@ -1595,14 +1590,14 @@ 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); + $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->printf($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); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Last try: Using %s directly (problem with LD_LIBARY_PATH)\n", + $rpmprog); - $infoline = "\nSystemcall: $helpersystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Systemcall: %s\n", $helpersystemcall); - for ( my $j = 0; $j <= $#helperrpmoutput; $j++ ) { push( @installer::globals::logfileinfo, "$helperrpmoutput[$j]"); } + foreach my $line (@helperrpmoutput) + { + $installer::logger::Lang->printf($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,8 +2660,7 @@ 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" @@ -2754,7 +2668,7 @@ sub remove_temporary_epm_files $systemcall = "rm -rf $removedir"; - installer::logger::print_message( "... $systemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $returnvalue = system($systemcall); @@ -2762,23 +2676,19 @@ sub remove_temporary_epm_files $systemcall = "rm -rf $removedir"; - installer::logger::print_message( "... $systemcall ...\n" ); + $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); + $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); } } } @@ -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_installset 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"); } @@ -3260,8 +3162,8 @@ sub put_installsetfiles_into_installset 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"; diff --git a/solenv/bin/modules/installer/exiter.pm b/solenv/bin/modules/installer/exiter.pm index 9e025152322c..e59caf2af68c 100644 --- a/solenv/bin/modules/installer/exiter.pm +++ b/solenv/bin/modules/installer/exiter.pm @@ -60,38 +60,26 @@ sub exit_program if ( $#installer::globals::logfileinfo > -1 ) { - $infoline = "\n***************************************************************\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"); - $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::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 diff --git a/solenv/bin/modules/installer/files.pm b/solenv/bin/modules/installer/files.pm index c2e2f6532295..907521c70173 100644 --- a/solenv/bin/modules/installer/files.pm +++ b/solenv/bin/modules/installer/files.pm @@ -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 } diff --git a/solenv/bin/modules/installer/followme.pm b/solenv/bin/modules/installer/followme.pm index 10d648bb02a9..975846cd5c11 100644 --- a/solenv/bin/modules/installer/followme.pm +++ b/solenv/bin/modules/installer/followme.pm @@ -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 = (); diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 513e1e45dbb3..f4dcd0ff382f 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -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 { diff --git a/solenv/bin/modules/installer/javainstaller.pm b/solenv/bin/modules/installer/javainstaller.pm index a7001c483ebe..31f3709fc1ab 100644 --- a/solenv/bin/modules/installer/javainstaller.pm +++ b/solenv/bin/modules/installer/javainstaller.pm @@ -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; diff --git a/solenv/bin/modules/installer/languagepack.pm b/solenv/bin/modules/installer/languagepack.pm index 461bbc9a33dd..2e5bea42b4cd 100644 --- a/solenv/bin/modules/installer/languagepack.pm +++ b/solenv/bin/modules/installer/languagepack.pm @@ -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 = ""; @@ -167,17 +167,17 @@ sub create_tar_gz_file 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); } } @@ -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); diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm index 9cf3299d4eee..d9aaac1f844b 100644 --- a/solenv/bin/modules/installer/logger.pm +++ b/solenv/bin/modules/installer/logger.pm @@ -25,53 +25,359 @@ package installer::logger; use installer::files; use installer::globals; +use Time::HiRes qw(gettimeofday tv_interval); +use English; +use IO::Handle; +use strict; -#################################################### -# Including header files into the logfile -#################################################### +my $StartTime = undef; -sub include_header_into_logfile +=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 ($message) = @_; + 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) = @_; + + $self->print(sprintf($format, @arguments), 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); +} + - my $infoline; - $infoline = "\n" . get_time_string(); - push( @installer::globals::logfileinfo, $infoline); +=head2 copy_lines_from ($self, $other) - $infoline = "######################################################\n"; - push( @installer::globals::logfileinfo, $infoline); + Copy saved lines from another logger object. - $infoline = "$message\n"; - push( @installer::globals::logfileinfo, $infoline); +=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'}; - $infoline = "######################################################\n"; - push( @installer::globals::logfileinfo, $infoline); + 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 #################################################### -sub include_header_into_globallogfile +sub include_header_into_logfile { my ($message) = @_; - my $infoline; - - $infoline = "\n" . get_time_string(); - push( @installer::globals::globallogfileinfo, $infoline); - - $infoline = "######################################################\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $Lang->print("\n"); + $Lang->print(get_time_string()); + $Lang->print("######################################################\n"); + $Lang->print($message."\n"); + $Lang->print("######################################################\n"); +} - $infoline = "$message\n"; - push( @installer::globals::globallogfileinfo, $infoline); +#################################################### +# Including header files into the logfile +#################################################### +sub include_header_into_globallogfile +{ + my ($message) = @_; - $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 +386,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 +402,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 +412,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 +428,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 +480,9 @@ sub savedebug sub starttime { $installer::globals::starttime = time(); + $StartTime = [gettimeofday()]; + + my $localtime = localtime(); } ############################################################### @@ -258,8 +558,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 +591,8 @@ sub set_installation_date sub print_message { + die "print_message is deprecated"; + my $message = shift; chomp $message; my $force = shift || 0; @@ -326,9 +628,11 @@ 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; } diff --git a/solenv/bin/modules/installer/packagelist.pm b/solenv/bin/modules/installer/packagelist.pm index a330ae3d0589..51706274beff 100644 --- a/solenv/bin/modules/installer/packagelist.pm +++ b/solenv/bin/modules/installer/packagelist.pm @@ -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"); } + foreach $key ( sort keys %installer::globals::allcabinets ) + { + $installer::logger::Lang->printf("\t%s\n", $key); + } - $infoline = "\nList of assignments from modules to cabinet files:\n"; - push(@installer::globals::logfileinfo, $infoline); + $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 ) { push(@installer::globals::logfileinfo, "\t$key : $installer::globals::allcabinetassigns{$key}\n"); } + foreach $key ( sort keys %installer::globals::allcabinetassigns ) + { + $installer::logger::Lang->printf("\t%s : %s\n", + $key, + $installer::globals::allcabinetassigns{$key}); + } } 1; diff --git a/solenv/bin/modules/installer/packagepool.pm b/solenv/bin/modules/installer/packagepool.pm index 2473ea9bec00..b6c25d4306f2 100644 --- a/solenv/bin/modules/installer/packagepool.pm +++ b/solenv/bin/modules/installer/packagepool.pm @@ -57,8 +57,8 @@ sub set_sessionid my $timer = time(); # time $installer::globals::sessionid = $pid . $timer; $installer::globals::sessionidset = 1; - my $infoline = "\nPool: Setting session id: $installer::globals::sessionid.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Pool: Setting session id: $installer::globals::sessionid.\n"); } #################################################### @@ -104,7 +104,8 @@ sub compare_epm_content if ( $oldmember != $newmember ) { $identical = 0; - installer::logger::print_message("\n...... changed length of EPM file\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("...... changed length of EPM file\n"); $diffinfo = "Pool: EPM, different line count: old epm file: $oldmember, new epm file: $newmember\n"; push(@installer::globals::epmdifflist, $diffinfo); } @@ -119,7 +120,8 @@ sub compare_epm_content { $identical = 0; my $line = $i + 1; - installer::logger::print_message("\n...... different content in EPM file\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("...... different content in EPM file\n"); $diffinfo = "Pool: EPM, line $line changed from \"${$oldcontent}[$i]\" to \"$newlocalcontent[$i]\".\n"; push(@installer::globals::epmdifflist, $diffinfo); last; @@ -150,7 +152,8 @@ sub compare_package_content { # Logging the difference $identical = 0; - installer::logger::print_message("\n...... different number of files in packages. New number: $newmember, old number: $oldmember\n"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("...... different number of files in packages. New number: %s, old number: %s\n", $newmember, $oldmember); $infoline = "Different number of files in packages. New number: $newmember, old number: $oldmember\n"; push(@installer::globals::pcfdiffcomment, $infoline); } @@ -166,7 +169,7 @@ sub compare_package_content if ( ! exists($oldcontent->{$dest}) ) { $identical = 0; - installer::logger::print_message("$start...... file only in one package (A): $dest\n"); + $installer::logger::Info->printf("%s...... file only in one package (A): %s\n", $start, $dest); $infoline = "File only in existing pool package: $dest\n"; push(@installer::globals::pcfdiffcomment, $infoline); if ( $first ) { $start = ""; } @@ -182,7 +185,7 @@ sub compare_package_content if ( ! exists($newcontent->{$dest}) ) { $identical = 0; - installer::logger::print_message("$start...... file only in one package (B): $dest\n"); + $installer::logger::Info->printf("%s...... file only in one package (B): %s\n", $start, $dest); $infoline = "File only in new package: $dest\n"; push(@installer::globals::pcfdiffcomment, $infoline); if ( $first ) { $start = ""; } @@ -205,11 +208,11 @@ sub compare_package_content $identical = 0; if ( $first == 1 ) { - installer::logger::print_message("\n"); + $installer::logger::Info->print("\n"); $first = 0; } $installer::globals::pcfdifflist{$dest} = 1; - installer::logger::print_message("...... different file: $dest\n"); + $installer::logger::Info->printf("...... different file: %s\n", $dest); # last; } @@ -219,7 +222,8 @@ sub compare_package_content { $identical = 0; $installer::globals::pcfdifflist{$dest} = 1; - installer::logger::print_message("\n...... different file: $dest"); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("...... different file: %s", $dest); # last; } } @@ -237,7 +241,8 @@ sub calculate_current_content { my ($filesarray, $packagename) = @_; - installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Calculating content for package content file ($packagename), start"); my %globalcontent = (); @@ -265,7 +270,8 @@ sub calculate_current_content $globalcontent{$destination} = \%onefilehash; } - installer::logger::include_timestamp_into_logfile("\nCalculating content for package content file ($packagename), start"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Calculating content for package content file ($packagename), start"); return \%globalcontent; } @@ -424,8 +430,10 @@ sub check_pool_exit { my $timestring = installer::logger::convert_timestring($timeage); my $infoline = "\nPool: Attention: \"$lockfilename\" is too old ($timestring). Removing file!\n"; - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print($infoline); unlink $lockfilename; # installer::exiter::exit_program("ERROR: Waiting too long for removal of lock file \"$lockfilename\"", "check_pool_exit (packagepool)"); } @@ -434,9 +442,11 @@ sub check_pool_exit my $filecontent = installer::files::read_file($lockfilename); my $waittime = $timecounter * 10; $waittime = installer::logger::convert_timestring($waittime); - my $infoline = "\nPool: Warning: \"$lockfilename\" blocks this process for $waittime. Lock content: \"${$filecontent}[0]\"\n"; - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); + my $infoline = "Pool: Warning: \"$lockfilename\" blocks this process for $waittime. Lock content: \"${$filecontent}[0]\"\n"; + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print($infoline); } } @@ -457,16 +467,24 @@ sub log_pool_info if ( $file_exists ) { - $infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" belongs to another process. This process has session id: $installer::globals::sessionid .\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Content of Lock file:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $line ( @{$installer::globals::savelockfilecontent} ) { push( @installer::globals::logfileinfo, $line); } + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Pool Problem: Lock file \"%s\" belongs to another process. This process has session id: %s.\n", + $installer::globals::savelockfilename, + $installer::globals::sessionid); + $installer::logger::Lang->print("Content of Lock file:\n"); + foreach my $line ( @{$installer::globals::savelockfilecontent} ) + { + $installer::logger::Lang->print($line); + } } else { - $infoline = "\nPool Problem: Lock file \"$installer::globals::savelockfilename\" does not exist anymore (this process has session id: $installer::globals::sessionid) .\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Pool Problem: Lock file \"%s\" does not exist anymore (this process has session id: %s).\n", + $installer::globals::savelockfilename, + $installer::globals::sessionid); } } @@ -499,8 +517,8 @@ sub remove_package_from_installset { my ($newpackagepath) = @_; - my $infoline = "Pool problem: Removing package \"$newpackagepath\" from installation set!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Pool problem: Removing package \"%s\" from installation set!\n", + $newpackagepath); if ( -f $newpackagepath ) { unlink $newpackagepath; } if ( -d $newpackagepath ) { installer::systemactions::remove_complete_directory($newpackagepath, 1); } @@ -518,7 +536,7 @@ sub package_is_up_to_date { my ($allvariables, $onepackage, $packagename, $newepmcontent, $filesinpackage, $installdir, $subdir, $languagestringref) = @_; - installer::logger::print_message_without_newline( "... checking pool package $packagename ..." ); + $installer::logger::Info->printf("... checking pool package ...\n", $packagename); installer::logger::include_header_into_logfile("Checking package in pool: $packagename"); @@ -563,10 +581,12 @@ sub package_is_up_to_date } $infoline = "Pool: $checkfilename exists. WAITING 10 seconds ($timecounter).\n"; - if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); } - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); - # if ( $timecounter % 50 == 0 ) { check_pool_exit($checkfilename, $timecounter); } + if ( $timecounter == 1 ) + { + $installer::logger::Info->print("\n"); + } + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print($infoline); if ( $timecounter % 100 == 0 ) { check_pool_exit($checkfilename, $timecounter); } sleep 10; # process sleeps 10 seconds $waited_for_check = 1; @@ -580,7 +600,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" could not be created successfully or was removed by another process (A)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -589,15 +609,18 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (A)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; } $infoline = "Pool: Created file: $checkfilename\n"; - push( @installer::globals::logfileinfo, $infoline); - if ( $waited_for_check ) { installer::logger::print_message( "... $infoline" ); } + $installer::logger::Lang->print($infoline); + if ( $waited_for_check ) + { + $installer::logger::Info->printf("... %s", $infoline); + } # Waiting, step 2 # Checking, if another process creates this package at the moment @@ -606,17 +629,22 @@ sub package_is_up_to_date { $timecounter++; $infoline = "Pool: $lockfilename exists. WAITING 10 seconds ($timecounter).\n"; - if ( $timecounter == 1 ) { installer::logger::print_message( "\n" ); } - installer::logger::print_message( "... $infoline" ); - push( @installer::globals::logfileinfo, $infoline); - # if ( $timecounter % 50 == 0 ) { check_pool_exit($lockfilename, $timecounter); } + if ( $timecounter == 1 ) + { + $installer::logger::Info->print("\n"); + } + $installer::logger::Info->printf("... %s", $infoline); + $installer::logger::Lang->print($infoline); if ( $timecounter % 100 == 0 ) { check_pool_exit($lockfilename, $timecounter); } sleep 10; # process sleeps 10 seconds $waited_for_lock = 1; } # No lock file exists, therefore no process creates this package at the moment. Check can be done now. - if ( $waited_for_lock ) { installer::logger::print_message( "... Pool: Proceeding, $lockfilename was removed.\n" ); } + if ( $waited_for_lock ) + { + $installer::logger::Info->printf("... Pool: Proceeding, %s was removed.\n", $lockfilename); + } my $package_already_exists = 0; @@ -651,26 +679,35 @@ sub package_is_up_to_date if ( $package_is_up_to_date ) { $infoline = "Pool: $packagename: No new content, using existing package\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... using package from pool\n" ); + $installer::logger::Lang->print($infoline); + $installer::logger::Info->printf("... using package from pool\n"); } else { if ( $package_already_exists ) { $infoline = "Pool: $packagename: Contains new content, creating new package. Differences:\n"; - push( @installer::globals::logfileinfo, $infoline); - foreach my $dest ( sort keys %installer::globals::pcfdifflist ) { push( @installer::globals::logfileinfo, "$dest\n"); } - foreach my $dest ( @installer::globals::pcfdiffcomment ) { push( @installer::globals::logfileinfo, "$dest"); } - foreach my $dest ( @installer::globals::epmdifflist ) { push( @installer::globals::logfileinfo, "$dest"); } + $installer::logger::Lang->print($infoline); + foreach my $dest ( sort keys %installer::globals::pcfdifflist ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } + foreach my $dest ( @installer::globals::pcfdiffcomment ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } + foreach my $dest ( @installer::globals::epmdifflist ) + { + $installer::logger::Lang->printf("%s\n", $dest); + } } else { $infoline = "Pool: $packagename: Does not exist in pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::print_message( "... packaging required\n" ); + $installer::logger::Info->printf("... packaging required\n"); %installer::globals::xpdpackageinfo = (); # reset the filled hash, because the package cannot be used. # Creating lock mechanism, so that other processes do not create this package, too. @@ -682,7 +719,7 @@ sub package_is_up_to_date if ( ! -f $lockfilename ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" could not be created successfully or was removed by another process (D)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -691,14 +728,14 @@ sub package_is_up_to_date if ( ! process_is_owner($lockfilename) ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (D)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; } $infoline = "Pool: Created file: $lockfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $newpackagepath = ""; @@ -711,7 +748,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (B)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -720,7 +757,7 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (B)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -735,7 +772,7 @@ sub package_is_up_to_date if ( ! -f $checkfilename ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" was removed by another process (C)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); # removing new package from installation set @@ -748,7 +785,7 @@ sub package_is_up_to_date if ( ! process_is_owner($checkfilename) ) { $infoline = "Pool problem: Pool lock file \"$checkfilename\" belongs to another process (C)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); # removing new package from installation set @@ -763,7 +800,7 @@ sub package_is_up_to_date unlink $checkfilename; $installer::globals::processhaspoolcheckfile = 0; $infoline = "Pool: Removing file: $checkfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Last chance before packaging starts, to check, if this process is really still owner # of the packaging lock file. If not, this packaging process can be repeated. @@ -772,7 +809,7 @@ sub package_is_up_to_date if ( ! -f $lockfilename ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" was removed by another process (E)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(0); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -781,7 +818,7 @@ sub package_is_up_to_date if ( ! process_is_owner($lockfilename) ) { $infoline = "Pool problem: Pool lock file \"$lockfilename\" belongs to another process (E)!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); log_pool_info(1); $package_is_up_to_date = 4; # repeat this package return $package_is_up_to_date; @@ -884,7 +921,7 @@ sub put_content_into_pool # Put package into pool $infoline = "Pool: Adding package \"$packagename\" into pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Copying with unique name, containing PID. Only renaming if everything was fine. my $realdestination = ""; @@ -929,7 +966,7 @@ sub put_content_into_pool rename($uniquedestination, $realdestination); $infoline = "Pool: Renamed file: \"$uniquedestination\" to \"$realdestination\".\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # 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. # Check, if lock file still exists and if this process is the owner. Otherwise a pool error occured. @@ -949,7 +986,7 @@ sub put_content_into_pool unlink $installer::globals::poollockfilename; $installer::globals::processhaspoollockfile = 0; $infoline = "Pool: Removing file: $installer::globals::poollockfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################### @@ -961,7 +998,7 @@ sub copy_package_from_pool my ($installdir, $subdir, $packagename) = @_; my $infoline = "Pool: Using package \"$packagename\" from pool.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $sourcefile = $installer::globals::poolpath . $installer::globals::separator . $packagename; if ( $installer::globals::issolarisbuild ) { $sourcefile = $sourcefile . ".tar"; } if ( ! -f $sourcefile ) { installer::exiter::exit_program("ERROR: Missing package in package pool: \"$sourcefile\"", "copy_package_from_pool"); } @@ -1016,27 +1053,26 @@ sub log_pool_statistics my $created_packages = get_count(\%installer::globals::createpackages); $infoline = "Number of packages from pool: $pool_packages\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $packagename ( sort keys(%installer::globals::poolpackages) ) { $infoline = "\t$packagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - $infoline = "\nNumber of packages that were created: $created_packages\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Number of packages that were created: %s\n", $created_packages); foreach my $packagename ( sort keys(%installer::globals::createpackages) ) { $infoline = "\t$packagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $reason = $installer::globals::createpackages{$packagename}; - for ( my $i = 0; $i <= $#{$reason}; $i++ ) + foreach my $line (@reason) { - $infoline = "${$reason}[$i]"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($line); } } } diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm index c44ba17e0ad2..faa3cc1fde2a 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -30,6 +30,7 @@ use installer::globals; use installer::logger; use installer::remover; use installer::systemactions; +use strict; ############################################ # Parameter Operations @@ -95,21 +96,16 @@ sub saveparameter { if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::saveparameter"); } - my $include = ""; + $installer::logger::Global->printf("Command line arguments:\n"); - installer::logger::globallog("Command line arguments:"); - - for ( my $i = 0; $i <= $#ARGV; $i++ ) + my $index = 0; + foreach my $argument (@ARGV) { - $include = $ARGV[$i] . "\n"; - push(@installer::globals::globallogfileinfo, $include); + $installer::logger::Global->printf(" %2d: %s\n", $index++, $argument); } # also saving global settings: - - $include = "Separator: $installer::globals::separator\n"; - push(@installer::globals::globallogfileinfo, $include); - + $installer::logger::Global->printf("Separator: %s\n", $installer::globals::separator); } ##################################### @@ -340,8 +336,8 @@ sub setglobalvariables $installer::globals::debian = 1; $installer::globals::packageformat = "deb"; my $message = "Creating Debian packages"; - installer::logger::print_message( $message ); - push(@installer::globals::globallogfileinfo, $message); + $installer::logger::Info->print($message); + $installer::logger::Global->print($message); $installer::globals::islinuxrpmbuild = 0; $installer::globals::islinuxdebbuild = 1; $installer::globals::epmoutpath = "DEBS"; @@ -573,15 +569,14 @@ sub control_required_parameter # Writing parameter to shell and into logfile ################################################ -sub outputparameter +sub outputparameter () { if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::parameter::outputparameter"); } - my $element; - my @output = (); - push(@output, "\n########################################################\n"); + push(@output, "\n"); + push(@output, "########################################################\n"); push(@output, "$installer::globals::prog, version 1.0\n"); push(@output, "Product list file: $installer::globals::ziplistname\n"); if (!($installer::globals::setupscript_defined_in_productlist)) @@ -624,7 +619,7 @@ sub outputparameter if (!($installer::globals::languages_defined_in_productlist)) { push(@output, "Languages:\n"); - foreach $element (@installer::globals::languageproducts) { push(@output, "\t$element\n"); } + foreach my $element (@installer::globals::languageproducts) { push(@output, "\t$element\n"); } } else { @@ -637,10 +632,10 @@ sub outputparameter # output into shell and into logfile - for ( my $i = 0; $i <= $#output; $i++ ) + foreach my $line (@output) { - installer::logger::print_message( $output[$i] ); - push(@installer::globals::globallogfileinfo, $output[$i]); + $installer::logger::Info->print($line); + $installer::logger::Global->print($line); } } diff --git a/solenv/bin/modules/installer/profiles.pm b/solenv/bin/modules/installer/profiles.pm index 6c5869c4e642..c31a54eb7601 100644 --- a/solenv/bin/modules/installer/profiles.pm +++ b/solenv/bin/modules/installer/profiles.pm @@ -215,12 +215,10 @@ sub create_profiles # Some data are set now, others are taken from the file "soffice.exe" ("soffice.bin") add_profile_into_filelist($filesarrayref, $oneprofile, $completeprofilename, $allvariables); - $infoline = "Created Profile: $completeprofilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created Profile: %s\n", $completeprofilename); } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } diff --git a/solenv/bin/modules/installer/scppatchsoname.pm b/solenv/bin/modules/installer/scppatchsoname.pm index a9bf09ae06eb..3adec119d608 100644 --- a/solenv/bin/modules/installer/scppatchsoname.pm +++ b/solenv/bin/modules/installer/scppatchsoname.pm @@ -183,13 +183,12 @@ sub resolving_patchsoname_flag if ($found == 0) { - my $infoline = "Did not patch the file $destinationpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Did not patch the file %s\n", $destinationpath); } else { - my $infoline = "Successfully patched $destinationpath, Count: $found\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully patched %s, Count: %s\n", + $destinationpath, $found); } } @@ -207,8 +206,7 @@ sub resolving_patchsoname_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); } 1; diff --git a/solenv/bin/modules/installer/scpzipfiles.pm b/solenv/bin/modules/installer/scpzipfiles.pm index b950baaea107..ecc1d3e76dd1 100644 --- a/solenv/bin/modules/installer/scpzipfiles.pm +++ b/solenv/bin/modules/installer/scpzipfiles.pm @@ -176,8 +176,7 @@ sub resolving_scpzip_replace_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } 1; diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index 50c96a75a3fb..d07498bdbafc 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -103,8 +103,8 @@ sub resolve_all_directory_names if ($parentvalue eq "") { $directoryhashref->{$key} = "FAILURE"; - my $infoline = "WARNING: No hostname for $parentid with \"$key\". Needed by child directory $gid !\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("WARNING: No hostname for %s with \"%s\". Needed by child directory %s !\n", + $parentid, $key, $gid); } else { @@ -206,8 +206,8 @@ sub remove_notinsuite_files_from_productlists } else { - my $infoline = "INFO: Flag NOT_IN_SUITE \-\> Removing $oneitem->{'gid'} from file list.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("INFO: Flag NOT_IN_SUITE \-\> Removing %s from file list.\n", + $oneitem->{'gid'}); } } @@ -240,8 +240,9 @@ sub remove_office_start_language_files } else { - my $infoline = "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing $oneitem->{'gid'} from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "INFO: Flag SET_OFFICE_LANGUAGE \-\> Removing %s from file list.\n", + $oneitem->{'gid'}); } } @@ -436,8 +437,7 @@ sub remove_not_required_spellcheckerlanguage_modules } else { - $infoline = "Spellchecker selection: Removing module $module->{'gid'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Spellchecker selection: Removing module %s\n", $module->{'gid'}); # Collecting all files at modules that are removed @@ -481,8 +481,8 @@ sub remove_not_required_spellcheckerlanguage_files my $onefile = ${$filesarrayref}[$i]; if ( exists($installer::globals::spellcheckerfilehash{$onefile->{'gid'}}) ) { - $infoline = "Spellchecker selection: Removing file $onefile->{'gid'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Spellchecker selection: Removing file %s\n", + $onefile->{'gid'}); next; } push(@filesarray, $onefile); @@ -541,13 +541,12 @@ sub add_bundled_extension_blobs # file:// extensions are added as pre-registered in add_bundled_prereg_extension(). } - installer::logger::print_message( - sprintf("preparing %d extension blob%s for language%s %s:\n", - $#bundle_files + 1, - $#bundle_files!=0 ? "s" : "", - $#installer::globals::languageproducts!=0 ? "s" : "", - join(" ", @installer::globals::languageproducts), - join("\n ", @bundle_files))); + $installer::logger::Info->printf( + "preparing %d extension blob%s for language%s %s:\n", + $#bundle_files + 1, + $#bundle_files!=0 ? "s" : "", + $#installer::globals::languageproducts!=0 ? "s" : "", + join(" ", @installer::globals::languageproducts)); foreach my $filename ( @bundle_files) { @@ -562,9 +561,9 @@ sub add_bundled_extension_blobs 'gid' => "gid_File_Extension_".$basename }; push( @filelist, $onefile); - push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n"); + $installer::logger::Lang->printf("\tbundling \"%s\" extension\n", $filename); - installer::logger::print_message(" " . $basename . "\n"); + $installer::logger::Info->printf(" %s\n", $basename); } return \@filelist; @@ -609,13 +608,16 @@ sub add_bundled_prereg_extensions } } - installer::logger::print_message( - sprintf("preparing %d bundled extension%s for language%s %s:\n %s\n", - $#bundle_files + 1, - $#bundle_files!=0 ? "s" : "", - $#installer::globals::languageproducts!=0 ? "s" : "", - join(" ", @installer::globals::languageproducts), - join("\n ", @bundle_files))); + $installer::logger::Info->printf( + "preparing %d bundled extension%s for language%s %s:\n", + $#bundle_files + 1, + $#bundle_files!=0 ? "s" : "", + $#installer::globals::languageproducts!=0 ? "s" : "", + join(" ", @installer::globals::languageproducts)); + foreach my $filename (@bundle_files) + { + $installer::logger::Info->printf(" %s\n", $filename); + } # Find the prereg directory entry so that we can create a new sub-directory. my $parentdir_gid = "gid_Brand_Dir_Share_Prereg_Bundled"; @@ -659,7 +661,7 @@ sub add_bundled_prereg_extensions 'gid' => "gid_File_Extension_".$basename }; push( @filelist, $onefile); - push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n"); + $installer::logger::Lang->printf("\tbundling \"%s\" extension\n", $filename); } return (\@filelist, $dirsref); @@ -1088,8 +1090,9 @@ sub remove_non_existent_languages_in_productlists if ($itemtoberemoved) { - $infoline = "WARNING: Language $$languagestringref: No $itemtype packed for $oneitem->{'gid'}!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("WARNING: Language %s: No $itemtype packed for %s!\n", + $$languagestringref, + $oneitem->{'gid'}); } else { @@ -1097,8 +1100,7 @@ sub remove_non_existent_languages_in_productlists } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); return \@allexistentitems; } @@ -1261,15 +1263,16 @@ sub get_sourcepath_from_filename_and_includepath_classic $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } else { if ( $write_logfile) { - $infoline = "SUCCESS: Source for $$searchfilenameref: $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("SUCCESS: Source for %s: %s\n", + $$searchfilenameref, + $onefile); } } @@ -1339,7 +1342,7 @@ sub get_sourcepath_from_filename_and_includepath $infoline = "ERROR: Source for $$searchfilenameref not found!\n"; # Important message in log file } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } else @@ -1354,7 +1357,7 @@ sub get_sourcepath_from_filename_and_includepath { $infoline = "SUCCESS/WARNING: Special handling for $$searchfilenameref: $onefile\n"; } - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf($infoline); } } @@ -1445,9 +1448,8 @@ sub get_Source_Directory_For_Files_From_Includepathlist if ($onefile->{'sourcepath'}) # defaulting to english was successful { - $infoline = "WARNING: Using $onefilename instead of $oldname\n"; - push( @installer::globals::logfileinfo, $infoline); - print " $infoline"; + $installer::logger::Lang->printf("WARNING: Using %s instead of %s\n", $onefilename, $oldname); + $installer::logger::Info->printf("WARNING: Using %s instead of %s\n", $onefilename, $oldname); # if ( $onefile->{'destination'} ) { $onefile->{'destination'} =~ s/\Q$oldname\E/$onefile->{'Name'}/; } # If the directory, in which the new file is installed, is not language dependent, @@ -1463,23 +1465,25 @@ sub get_Source_Directory_For_Files_From_Includepathlist if ( ! $islanguagedependent ) { $onefile->{'Styles'} =~ s/\bARCHIVE\b/ARCHIVE, RENAME_TO_LANGUAGE/; # Setting new flag RENAME_TO_LANGUAGE - $infoline = "Setting flag RENAME_TO_LANGUAGE: File $onefile->{'Name'} in directory: $directorygid\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Setting flag RENAME_TO_LANGUAGE: File %s in directory: %s\n", + $onefile->{'Name'}, + $directorygid); } } } else { - $infoline = "WARNING: Using $onefile->{'Name'} instead of $oldname was not successful\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("WARNING: Using %s instead of %s was not successful\n", + $onefile->{'Name'}, $oldname); $onefile->{'Name'} = $oldname; # Switching back to old file name } } } } - $infoline = "\n"; # empty line after listing of all files - push( @installer::globals::logfileinfo, $infoline); + # empty line after listing of all files + $installer::logger::Lang->printf("\n"); } ################################################################################# @@ -1507,8 +1511,8 @@ sub remove_Files_For_Languagepacks if (( $gid eq "gid_File_Extra_Fontunxpsprint" ) || ( $gid eq "gid_File_Extra_Migration_Lang" )) { - $infoline = "ATTENTION: Removing item $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Removing item %s from the installation set.\n", + $oneitem->{'gid'},); next; } @@ -1549,8 +1553,8 @@ sub remove_Files_Without_Sourcedirectory if ( ! $installer::globals::languagepack ) { - $infoline = "ERROR: No sourcepath -> Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: No sourcepath -> Removing file %s from file list.\n", + $filename); push(@missingfiles, "ERROR: File not found: $filename\n"); $error_occured = 1; @@ -1561,8 +1565,7 @@ sub remove_Files_Without_Sourcedirectory { if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Removing file %s from file list.\n", $filename); push(@missingfiles, "ERROR: File not found: $filename\n"); $error_occured = 1; @@ -1571,10 +1574,11 @@ sub remove_Files_Without_Sourcedirectory } else { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "INFO: Removing file %s from file list. It is not language dependent.\n", + $filename); + $installer::logger::Lang->printf( + "INFO: It is not language dependent and can be ignored in language packs.\n"); next; # removing this file from list, if sourcepath is empty } @@ -1584,8 +1588,7 @@ sub remove_Files_Without_Sourcedirectory push(@newfilesarray, $onefile); } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); if ( $error_occured ) { @@ -1717,20 +1720,24 @@ sub add_License_Files_into_Installdir push(@newfilesarray, $newfile); - $infoline = "New files: Adding file $newfilename for the installation root to the file list. Language: $defaultlanguage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Adding file %s for the installation root to the file list. Language: %s\n", + $newfilename, + $defaultlanguage); if ( defined $newfile->{'InstallName'} ) { - $infoline = "New files: Using installation name: $newfile->{'InstallName'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Using installation name: %s\n", $newfile->{'InstallName'}); } # Collecting license and readme file for the installation set push(@installer::globals::installsetfiles, $newfile); - $infoline = "New files: Adding file $newfilename to the file collector for the installation set. Language: $defaultlanguage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "New files: Adding file %s to the file collector for the installation set. Language: %s\n", + $newfilename, + $defaultlanguage); } push(@newfilesarray, $onefile); @@ -1760,13 +1767,12 @@ sub remove_onlyasialanguage_files_from_productlists my $containsasianlanguage = installer::languages::detect_asian_language($installer::globals::alllanguagesinproductarrayref); my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); - $infoline = "\nLanguages in complete product: $alllangstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Languages in complete product: %s\n", $alllangstring); if ( ! $containsasianlanguage ) { - $infoline = "Product does not contain asian language -> removing files\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Product does not contain asian language -> removing files\n"); for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) { @@ -1775,8 +1781,9 @@ sub remove_onlyasialanguage_files_from_productlists if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } if ( $styles =~ /\bONLY_ASIA_LANGUAGE\b/ ) { - $infoline = "Flag ONLY_ASIA_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Flag ONLY_ASIA_LANGUAGE: Removing file %s from files collector!\n", + $onefile->{'Name'}); next; } @@ -1789,9 +1796,7 @@ sub remove_onlyasialanguage_files_from_productlists { $returnfilesarrayref = $filesarrayref; - $infoline = "Product contains asian language -> Nothing to do\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Product contains asian language -> Nothing to do\n"); } return $returnfilesarrayref; @@ -1818,13 +1823,12 @@ sub remove_onlywesternlanguage_files_from_productlists my $containswesternlanguage = installer::languages::detect_western_language($installer::globals::alllanguagesinproductarrayref); my $alllangstring = installer::converter::convert_array_to_comma_separated_string($installer::globals::alllanguagesinproductarrayref); - $infoline = "\nLanguages in complete product: $alllangstring\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Languages in complete product: %s\n", $alllangstring); if ( ! $containswesternlanguage ) { - $infoline = "Product does not contain western language -> removing files\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Product does not contain western language -> removing files\n"); for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) { @@ -1833,8 +1837,9 @@ sub remove_onlywesternlanguage_files_from_productlists if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } if ( $styles =~ /\bONLY_WESTERN_LANGUAGE\b/ ) { - $infoline = "Flag ONLY_WESTERN_LANGUAGE: Removing file $onefile->{'Name'} from files collector!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Flag ONLY_WESTERN_LANGUAGE: Removing file %s from files collector!\n", + $onefile->{'Name'}); next; } @@ -1847,9 +1852,7 @@ sub remove_onlywesternlanguage_files_from_productlists { $returnfilesarrayref = $filesarrayref; - $infoline = "Product contains western language -> Nothing to do\n"; - push( @installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Product contains western language -> Nothing to do\n"); } return $returnfilesarrayref; @@ -1895,12 +1898,10 @@ sub make_filename_language_specific $onefile->{'destination'} =~ s/\Q$fileextension\E\s*$/_$language$fileextension/; } - $infoline = "Flag MAKE_LANG_SPECIFIC:\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Changing name from $oldname to $onefile->{'Name'} !\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "Changing destination from $olddestination to $onefile->{'destination'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Flag MAKE_LANG_SPECIFIC:\n"); + $installer::logger::Lang->printf("Changing name from %s to %s !\n", $oldname, $onefile->{'Name'}); + $installer::logger::Lang->printf("Changing destination from %s to %s !\n", + $olddestination, $onefile->{'destination'}); } } } @@ -1930,8 +1931,9 @@ sub remove_scpactions_without_name if ( $name eq "" ) { - $infoline = "ATTENTION: Removing scpaction $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "ATTENTION: Removing scpaction %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2009,8 +2011,9 @@ sub remove_Xpdonly_Items if ( $styles =~ /\bXPD_ONLY\b/ ) { - $infoline = "Removing \"xpd only\" item $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing \"xpd only\" item %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2018,8 +2021,7 @@ sub remove_Xpdonly_Items push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2047,8 +2049,9 @@ sub remove_Languagepacklibraries_from_Installset if ( $styles =~ /\bLANGUAGEPACK\b/ ) { - $infoline = "Removing language pack file $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing language pack file %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2056,8 +2059,7 @@ sub remove_Languagepacklibraries_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2085,8 +2087,9 @@ sub remove_patchonlyfiles_from_Installset if ( $styles =~ /\bPATCH_ONLY\b/ ) { - $infoline = "Removing file with flag PATCH_ONLY $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing file with flag PATCH_ONLY %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2094,8 +2097,7 @@ sub remove_patchonlyfiles_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2123,8 +2125,9 @@ sub remove_tabonlyfiles_from_Installset if ( $styles =~ /\bTAB_ONLY\b/ ) { - $infoline = "Removing tab only file $oneitem->{'gid'} from the installation set.\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing tab only file %s from the installation set.\n", + $oneitem->{'gid'}); next; } @@ -2132,8 +2135,7 @@ sub remove_tabonlyfiles_from_Installset push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2161,16 +2163,16 @@ sub remove_installedproductonlyfiles_from_Installset if ( $styles =~ /\bONLY_INSTALLED_PRODUCT\b/ ) { - $infoline = "Removing file $oneitem->{'gid'} from the installation set. This file is only required for PKGFORMAT archive or installed).\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Removing file from the installation set. This file is only required for PKGFORMAT archive or installed).\n", + $oneitem->{'gid'}); next; } push(@newitemsarray, $oneitem); } - $infoline = "\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print("\n"); return \@newitemsarray; } @@ -2202,16 +2204,15 @@ sub quoting_illegal_filenames # sourcepath and destination have to be quoted for epm list file - # $filename =~ s/\$/\$\$/g; $destpath =~ s/\$/\$\$/g; $sourcepath =~ s/\$/\$\$/g; - # my $infoline = "ATTENTION: Files: Renaming $onefile->{'Name'} to $filename\n"; - # push( @installer::globals::logfileinfo, $infoline); - my $infoline = "ATTENTION: Files: Quoting sourcepath $onefile->{'sourcepath'} to $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "ATTENTION: Files: Quoting destination path $onefile->{'destination'} to $destpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ATTENTION: Files: Quoting sourcepath %s to %s\n", + $onefile->{'sourcepath'}, + $sourcepath); + $installer::logger::Lang->printf("ATTENTION: Files: Quoting destination path %s to %s\n", + $onefile->{'destination'}, + $destpath); # $onefile->{'Name'} = $filename; $onefile->{'sourcepath'} = $sourcepath; @@ -2514,14 +2515,14 @@ sub get_destination_file_path_for_links if (!($foundfile)) { - $infoline = "Warning: FileID $fileid for Link $onelink->{'gid'} not found!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: FileID %s for Link %s not found!\n", + $fileid, + $onelink->{'gid'}); } } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } ################################################# @@ -2561,14 +2562,14 @@ sub get_destination_link_path_for_links if (!($foundlink)) { - $infoline = "Warning: ShortcutID $shortcutid for Link $onelink->{'gid'} not found!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: ShortcutID %s for Link %s not found!\n", + $shortcutid, + $onelink->{'gid'}); } } } - $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } ################################################################################### @@ -2786,14 +2787,14 @@ sub assigning_modules_to_items if (( $oneitem->{'ismultilingual'} ) && ( ! $oneitem->{'haslanguagemodule'} )) { $infoline = "Error: \"$oneitem->{'gid'}\" is multi lingual, but not in language pack (Assigned module: $modulegids)!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); push( @languageassignmenterrors, $infoline ); $languageassignmenterror = 1; } if (( $oneitem->{'haslanguagemodule'} ) && ( ! $oneitem->{'ismultilingual'} )) { $infoline = "Error: \"$oneitem->{'gid'}\" is in language pack, but not multi lingual (Assigned module: $modulegids)!\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->print($infoline); push( @languageassignmenterrors, $infoline ); $languageassignmenterror = 1; } @@ -2918,8 +2919,7 @@ sub collect_all_parent_feature if ( $found_root_module ) { installer::exiter::exit_program("ERROR: Only one module without ParentID or with empty ParentID allowed ($installer::globals::rootmodulegid, $onefeature->{'gid'}).", "collect_all_parent_feature"); } $installer::globals::rootmodulegid = $onefeature->{'gid'}; $found_root_module = 1; - $infoline = "Setting Root Module: $installer::globals::rootmodulegid\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Setting Root Module: %s\n", $installer::globals::rootmodulegid); } if ( ! $found_root_module ) { installer::exiter::exit_program("ERROR: Could not define root module. No module without ParentID or with empty ParentID exists.", "collect_all_parent_feature"); } diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index 4416a02754bd..2d4f6de6c9d4 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -285,10 +285,14 @@ sub replace_all_setupscriptvariables_in_script $num++; if ( $check =~ /^.*\%\w+.*$/ ) { - if (( $check =~ /%1/ ) || ( $check =~ /%2/ ) || ( $check =~ /%verify/ )) { next; } - my $infoline = "WARNING: mis-named or un-known '%' variable in setup script at line $num:\n$check\n"; - push( @installer::globals::globallogfileinfo, $infoline); - # print STDERR "Warning: mis-named or un-known '%' variable at line $num:\n$check\n"; + if (( $check =~ /%1/ ) || ( $check =~ /%2/ ) || ( $check =~ /%verify/ )) + { + next; + } + $installer::logger::Global->printf( + "WARNING: mis-named or un-known '%s' variable in setup script at line %s:\n", + "%", $num); + $installer::logger::Global->printf("%s\n", $check); } } diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index 4525a524bb64..28b1414de1ab 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -86,7 +86,7 @@ sub register_extensions if ( $preregdir eq "" ) { $infoline = "ERROR: Failed to determine directory \"prereg\" for extension registration! Please check your installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "register_extensions"); } @@ -104,31 +104,31 @@ sub register_extensions { $unopkgexists = 0; $infoline = "Language packs do not contain unopkg!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( ! -f $unopkgfile ) { $unopkgexists = 0; $infoline = "Info: File $unopkgfile does not exist! Extensions cannot be registered.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $unopkgexists ) { my $currentdir = cwd(); - print "... current dir: $currentdir ...\n"; + $installer::logger::Info->printf("... current dir: %s ...\n", $currentdir); $infoline = "Current dir: $currentdir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); } my $systemcall = $unopkgfile . " sync --verbose" . " -env:UNO_JAVA_JFW_ENV_JREHOME=true 2\>\&1 |"; - print "... $systemcall ...\n"; + $installer::logger::Info->printf("... %s ...\n", $systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my @unopkgoutput = (); @@ -147,16 +147,19 @@ sub register_extensions # Writing content of @unopkgoutput only in the error case into the log file. Sometimes it # contains strings like "Error" even in the case of success. This causes a packaging error # when the log file is analyzed at the end, even if there is no real error. - for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); } + foreach my $line (@unopkgoutput) + { + $installer::logger::Lang->printf($line); + } $infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions"); } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -177,7 +180,7 @@ sub get_mac_translation_file my $translationfile = installer::files::read_file($translationfilename); my $infoline = "Reading translation file: $translationfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $translationfile; } @@ -352,7 +355,7 @@ sub create_package { my ( $installdir, $archivedir, $packagename, $allvariables, $includepatharrayref, $languagestringref, $format ) = @_; - installer::logger::print_message( "... creating $installer::globals::packageformat file ...\n" ); + $installer::logger::Info->printf("... creating %s file ...\n", $installer::globals::packageformat); installer::logger::include_header_into_logfile("Creating $installer::globals::packageformat file:"); # moving dir into temporary directory @@ -448,20 +451,20 @@ sub create_package $systemcall = "tar -cjf $tarballname Contents/"; - print "... $systemcall ...\n"; + $installer::logger::Info->printf("... %s ...\n", $systemcall); my $localreturnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($localreturnvalue) { $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 $sourcefile = $appfolder . "/" . $tarballname; @@ -563,26 +566,26 @@ sub create_package if ( $makesystemcall ) { - print "... $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); } } if ( $return_to_start ) { chdir($from); } - print "... removing $tempdir ...\n"; + $installer::logger::Info->printf("... removing %s ...\n", $tempdir); installer::systemactions::remove_complete_directory($tempdir); } @@ -600,7 +603,7 @@ sub create_simple_package my $current_install_number = ""; my $infoline = ""; - installer::logger::print_message( "... creating installation directory ...\n" ); + $installer::logger::Info->print( "... creating installation directory ...\n" ); installer::logger::include_header_into_logfile("Creating installation directory"); $installer::globals::csp_installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); @@ -653,7 +656,7 @@ sub create_simple_package # Create directories, copy files and ScpActions - installer::logger::print_message( "... creating directories ...\n" ); + $installer::logger::Info->print("... creating directories ...\n"); installer::logger::include_header_into_logfile("Creating directories:"); for ( my $i = 0; $i <= $#{$dirsref}; $i++ ) @@ -668,8 +671,7 @@ sub create_simple_package { if ( $^O =~ /cygwin/i || $^O =~ /os2/i ) # Cygwin performance check { - $infoline = "Try to create directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Try to create directory %s\n", $destdir); # Directories in $dirsref are sorted and all parents were added -> "mkdir" works without parent creation! if ( ! ( -d $destdir )) { mkdir($destdir, 0775); } } @@ -685,7 +687,7 @@ sub create_simple_package if (( $installer::globals::strip ) && ( ! $installer::globals::iswindowsbuild ) && ( ! $installer::globals::isos2 )) { installer::strip::strip_libraries($filesref, $languagestringref); } # copy Files - installer::logger::print_message( "... copying files ...\n" ); + $installer::logger::Info->print("... copying files ...\n"); installer::logger::include_header_into_logfile("Copying files:"); for ( my $i = 0; $i <= $#{$filesref}; $i++ ) @@ -711,16 +713,14 @@ sub create_simple_package if ($copyreturn) { - $infoline = "Copy: $source to $destination\n"; + $installer::logger::Lang->printf("Copy: $source to %s\n", $destination); $returnvalue = 1; } else { - $infoline = "ERROR: Could not copy $source to $destination\n"; + $installer::logger::Lang->printf("ERROR: Could not copy %s to %s\n", $source, $destination); $returnvalue = 0; } - - push(@installer::globals::logfileinfo, $infoline); } else { @@ -743,7 +743,7 @@ sub create_simple_package # creating Links - installer::logger::print_message( "... creating links ...\n" ); + $installer::logger::Info->print("... creating links ...\n"); installer::logger::include_header_into_logfile("Creating links:"); for ( my $i = 0; $i <= $#{$linksref}; $i++ ) @@ -759,8 +759,9 @@ sub create_simple_package my $localcall = "ln -sf \'$destinationfile\' \'$destination\' \>\/dev\/null 2\>\&1"; system($localcall); - $infoline = "Creating link: \"ln -sf $destinationfile $destination\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating link: \"ln -sf %s %s\"\n", + $destinationfile, + $destination); } for ( my $i = 0; $i <= $#{$unixlinksref}; $i++ ) @@ -775,22 +776,23 @@ sub create_simple_package my $localcall = "ln -sf \'$target\' \'$destination\' \>\/dev\/null 2\>\&1"; system($localcall); - $infoline = "Creating Unix link: \"ln -sf $target $destination\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Creating Unix link: \"ln -sf %s %s\"\n", + $target, + $destination); } # Setting privileges for cygwin globally if ( $^O =~ /cygwin/i ) { - installer::logger::print_message( "... changing privileges in $subfolderdir ...\n" ); + $installer::logger::Lang->print( "... changing privileges in $subfolderdir ...\n" ); installer::logger::include_header_into_logfile("Changing privileges in $subfolderdir:"); my $localcall = "chmod -R 755 " . "\"" . $subfolderdir . "\""; system($localcall); } - installer::logger::print_message( "... removing superfluous directories ...\n" ); + $installer::logger::Lang->print( "... removing superfluous directories ...\n" ); installer::logger::include_header_into_logfile("Removing superfluous directories:"); my ( $extensionfolder, $preregdir ) = get_extensions_dir($subfolderdir); @@ -798,7 +800,7 @@ sub create_simple_package # Registering the extensions - installer::logger::print_message( "... registering extensions ...\n" ); + $installer::logger::Lang->print( "... registering extensions ...\n" ); installer::logger::include_header_into_logfile("Registering extensions:"); register_extensions($subfolderdir, $languagestringref, $preregdir); diff --git a/solenv/bin/modules/installer/strip.pm b/solenv/bin/modules/installer/strip.pm index 65e9badfe2b3..d821caa5e415 100644 --- a/solenv/bin/modules/installer/strip.pm +++ b/solenv/bin/modules/installer/strip.pm @@ -64,17 +64,17 @@ sub do_strip 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 strip $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "SUCCESS: Stripped library $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -105,7 +105,7 @@ sub strip_libraries installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); $infoline = "Strip: $shortfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # copy file into directory for stripped libraries diff --git a/solenv/bin/modules/installer/substfilenamefiles.pm b/solenv/bin/modules/installer/substfilenamefiles.pm index 4226303cef4e..0cb575020899 100644 --- a/solenv/bin/modules/installer/substfilenamefiles.pm +++ b/solenv/bin/modules/installer/substfilenamefiles.pm @@ -155,8 +155,7 @@ sub resolving_subst_filename_flag } } - my $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); } 1; diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index cd25ed17f5a4..76e4ace1f521 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -48,8 +48,8 @@ sub create_directory if ($returnvalue) { - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -64,8 +64,10 @@ sub create_directory # was not created in this process. There is only an important error, if the directory does not # exist now. - $infoline = "\nDid not succeed in creating directory: \"$directory\". Further attempts will follow.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Did not succeed in creating directory: \"%s\". Further attempts will follow.\n", + $directory); if (!(-d $directory)) { @@ -79,8 +81,10 @@ sub create_directory if ($returnvalue) { - $infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Successfully created parent directory (should already be created before): %s\n", + $parentdir); my $localcall = "chmod 775 $parentdir \>\/dev\/null 2\>\&1"; system($localcall); @@ -88,11 +92,13 @@ sub create_directory else { $infoline = "\Error: \"$directory\" could not be created. Even the parent directory \"$parentdir\" does not exist and could not be created.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -d $parentdir ) { - $infoline = "\nAttention: Finally the parent directory \"$parentdir\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the parent directory \"%s\" exists, but I could not create it.\n", + $parentdir); } else { @@ -109,8 +115,10 @@ sub create_directory if ($returnvalue) { - $infoline = "\nAttention: Created directory \"$directory\" in the second try.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Created directory \"\" in the second try.\n", + $directory);; my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -119,8 +127,10 @@ sub create_directory { if ( -d $directory ) { - $infoline = "\nAttention: Finally the directory \"$directory\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the directory \"%s\" exists, but I could not create it.\n", + $directory); } else { @@ -131,15 +141,16 @@ sub create_directory } else { - $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Another process created this directory in exactly this moment :-) : %s\n", + $directory);; } } } else { - $infoline = "\nAlready existing directory, did not create: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Already existing directory, did not create: %s\n", $directory); } } @@ -161,8 +172,8 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -173,8 +184,10 @@ sub create_directory_with_privileges # was not created in this process. There is only an important error, if the directory does not # exist now. - $infoline = "\nDid not succeed in creating directory: \"$directory\". Further attempts will follow.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Did not succeed in creating directory: \"%s\". Further attempts will follow.\n", + $directory); if (!(-d $directory)) { @@ -188,8 +201,10 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Successfully created parent directory (should already be created before): %s\n", + $parentdir); my $localcall = "chmod $privileges $parentdir \>\/dev\/null 2\>\&1"; system($localcall); @@ -197,11 +212,13 @@ sub create_directory_with_privileges else { $infoline = "\Error: \"$directory\" could not be created. Even the parent directory \"$parentdir\" does not exist and could not be created.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -d $parentdir ) { - $infoline = "\nAttention: Finally the parent directory \"$parentdir\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the parent directory \"%s\" exists, but I could not create it.\n", + $parentdir); } else { @@ -218,8 +235,9 @@ sub create_directory_with_privileges if ($returnvalue) { - $infoline = "\nAttention: Created directory \"$directory\" in the second try.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Attention: Created directory \"%s\" in the second try.\n", + $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -228,8 +246,10 @@ sub create_directory_with_privileges { if ( -d $directory ) { - $infoline = "\nAttention: Finally the directory \"$directory\" exists, but I could not create it.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Attention: Finally the directory \"\" exists, but I could not create it.\n", + $directory); } else { @@ -240,21 +260,54 @@ sub create_directory_with_privileges } else { - $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "Another process created this directory in exactly this moment :-) : %s\n", + $directory); } } } else { - $infoline = "\nAlready existing directory, did not create: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Already existing directory, did not create: %s\n", $directory); my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; system($localcall); } } + + + +=item is_directory_empty ($path) + Return + 1 if there are no files in the directory pointed to by $path + 0 if there are files + -1 if there is an error accessing the directory. +=cut +sub is_directory_empty ($) +{ + my ($path) = @_; + + opendir my $dir, $path or return -1; + + my $result = 1; + while (my $entry = readdir($dir)) + { + if ($entry !~ /^\.+$/) + { + $result = 0; + last; + } + } + + return $result; +} + + + + ###################################################### # Removing a new direcotory ###################################################### @@ -267,22 +320,27 @@ sub remove_empty_directory if (-d $directory) { - my $systemcall = "rmdir $directory"; - - $returnvalue = system($systemcall); - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - if ($returnvalue) + if ( ! is_directory_empty($directory)) { - $infoline = "ERROR: Could not remove \"$directory\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("directory '%s' is not empty and can not be removed\n", $directory); + return; } else { - $infoline = "Success: Removed \"$directory\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + my $systemcall = "rmdir $directory"; + + $returnvalue = system($systemcall); + + $installer::logger::Lang->printf("Systemcall: %s\n", $systemcall); + + if ($returnvalue) + { + $installer::logger::Lang->printf("ERROR: Could not remove \"%s\"!\n", $directory); + } + else + { + $installer::logger::Lang->printf("Success: Removed \"%s\"!\n", $directory); + } } } } @@ -348,7 +406,7 @@ sub create_directories } $infoline = "create_directories: Using $path for $newdirectory !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($newdirectory eq "unzip" ) # special handling for common directory { @@ -445,7 +503,7 @@ sub copy_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( !$returnvalue ) { return $returnvalue; @@ -467,7 +525,7 @@ sub copy_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $returnvalue; @@ -496,7 +554,7 @@ sub hardlink_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -524,7 +582,7 @@ sub softlink_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -552,7 +610,7 @@ sub rename_one_file $returnvalue = 0; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $returnvalue; } @@ -572,9 +630,9 @@ sub copy_directory $destdir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -644,9 +702,9 @@ sub hardlink_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Creating hard links for all files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -688,9 +746,9 @@ sub softlink_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Creating soft links for all files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -735,9 +793,9 @@ sub copy_complete_directory if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -782,9 +840,9 @@ sub copy_complete_directory_without_cvs if ( ! -d $destdir ) { create_directory($destdir); } my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files from directory $sourcedir to directory $destdir (without CVS)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -825,9 +883,9 @@ sub copy_directory_with_fileextension $destdir =~ s/\Q$installer::globals::separator\E\s*$//; $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files with extension $extension from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -867,9 +925,9 @@ sub copy_directory_except_fileextension $destdir =~ s/\Q$installer::globals::separator\E\s*$//; $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Copying files without extension $extension from directory $sourcedir to directory $destdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $sourcedir); @sourcefiles = readdir(DIR); @@ -909,9 +967,9 @@ sub rename_files_with_fileextension $dir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Renaming files with extension \"$extension\" in the directory $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $dir); @sourcefiles = readdir(DIR); @@ -951,9 +1009,9 @@ sub find_file_with_file_extension $dir =~ s/\Q$installer::globals::separator\E\s*$//; my $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Searching files with extension \"$extension\" in the directory $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); opendir(DIR, $dir); @sourcefiles = sort readdir(DIR); @@ -1010,14 +1068,16 @@ sub make_numbered_dir if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from %s to %s\n", $olddir, $newdir); $returndir = $newdir; } else { - $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"make_numbered_dir\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("ATTENTION: Could not move directory from %s to %s, \"make_numbered_dir\"\n", + $olddir, + $newdir); $returndir = $olddir; } @@ -1131,13 +1191,15 @@ sub rename_string_in_directory if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from $olddir to %s\n", $newdir); } else { - $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"rename_string_in_directory\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf( + "ATTENTION: Could not move directory from %s to %s, \"rename_string_in_directory\"\n", + $olddir, $newdir); } return $newdir; @@ -1194,14 +1256,12 @@ sub rename_directory sleep(2); if ( move($olddir, $newdir) ) { - $infoline = "\nMoved directory from $olddir to $newdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Moved directory from $olddir to %s\n", $newdir); } else { installer::exiter::exit_program("ERROR: Could not move directory from $olddir to $newdir", "rename_directory"); - # $infoline = "\nATTENTION: Could not move directory from $olddir to $newdir, \"rename_directory\"\n"; - # push(@installer::globals::logfileinfo, $infoline); } return $newdir; @@ -1435,8 +1495,8 @@ sub try_to_create_directory if ($returnvalue) { $created_directory = 1; - $infoline = "\nCreated directory: $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created directory: %s\n", $directory); my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; system($localcall); @@ -1471,10 +1531,8 @@ sub create_directory_structure my $parentdir = $directory; installer::pathanalyzer::get_path_from_fullqualifiedname(\$parentdir); - my $infoline = "INFO: Did not create directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Now trying to create parent directory $parentdir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("INFO: Did not create directory %s\n", $directory); + $installer::logger::Lang->printf("Now trying to create parent directory %s\n", $parentdir); create_directory_structure($parentdir); # recursive } @@ -1499,10 +1557,8 @@ sub remove_complete_directory { if ( $start ) { - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Removing directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Removing directory %s\n", $directory); } opendir(DIR, $directory); @@ -1531,12 +1587,15 @@ sub remove_complete_directory # try to remove empty directory + if ( ! -d $directory) + { + $installer::logger::Info->printf("trying to remove directory that doesn't exist: %s\n", $directory); + } my $returnvalue = rmdir $directory; if ( ! $returnvalue ) { - $infoline = "Warning: Problem with removing empty dir $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Warning: Problem with removing empty dir %s\n", $directory); } # try a little bit harder (sometimes there is a performance problem) @@ -1546,20 +1605,19 @@ sub remove_complete_directory { if ( -d $directory ) { - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); - $infoline = "Warning (Try $j): Problems with removing directory $directory\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Warning (Try %d): Problems with removing directory %s\n", + $j, $directory); $returnvalue = rmdir $directory; if ( $returnvalue ) { - $infoline = "Successfully removed empty dir $directory\n"; - push(@installer::globals::logfileinfo, $infoline); - } else { - $infoline = "Warning: rmdir $directory failed.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully removed empty dir %s\n", $directory); + } + else + { + $installer::logger::Lang->printf("Warning: rmdir %s failed.\n", $directory); } } } @@ -1728,12 +1786,12 @@ sub remove_empty_dirs_in_folder } # try to remove empty directory + $installer::logger::Info->printf("remove_empty_dirs_in_folder %s\n", $dir); my $returnvalue = rmdir $dir; if ( $returnvalue ) { - $infoline = "Successfully removed empty dir $dir\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Successfully removed empty dir %s\n", $dir); } } diff --git a/solenv/bin/modules/installer/upx.pm b/solenv/bin/modules/installer/upx.pm index b6bdc189b281..8eaa3ceb0422 100644 --- a/solenv/bin/modules/installer/upx.pm +++ b/solenv/bin/modules/installer/upx.pm @@ -68,17 +68,17 @@ sub do_upx my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "WARNING: Could not successfully upx $filename! Using original file.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "SUCCESS: upx $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $returnvalue; @@ -97,13 +97,15 @@ sub upx_on_libraries if ( ! $installer::globals::upx_in_path ) { - $infoline = "\n\nWarning: This is an UPX product, but upx was not found in PATH!\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Warning: This is an UPX product, but upx was not found in PATH!\n"); + $installer::logger::Lang->print("\n"); } else { $infoline = "Using upx: $installer::globals::upxfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $upxdirbase = installer::systemactions::create_directories("upx", $languagestringref); @@ -121,8 +123,8 @@ sub upx_on_libraries my $shortfilename = $sourcefilename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); - $infoline = "\nUpx: $shortfilename"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Upx: %s", $shortfilename); # copy file into directory for stripped libraries my $onelanguage = ${$filelist}[$i]->{'specificlanguage'}; diff --git a/solenv/bin/modules/installer/windows/admin.pm b/solenv/bin/modules/installer/windows/admin.pm index 13dbd4ebdd39..0bb4e2819033 100644 --- a/solenv/bin/modules/installer/windows/admin.pm +++ b/solenv/bin/modules/installer/windows/admin.pm @@ -41,7 +41,7 @@ sub unpack_cabinet_file my ($cabfilename, $unpackdir) = @_; my $infoline = "Unpacking cabinet file: $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $expandfile = "expand.exe"; # Has to be in the path @@ -84,18 +84,18 @@ sub unpack_cabinet_file my $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not extract cabinet file: $mergemodulehash->{'cabinetfile'} !", "change_file_table"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -139,18 +139,18 @@ sub include_tables_into_pcpfile $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not include tables into msi database: $fullmsidatabasepath !", "include_tables_into_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -197,18 +197,18 @@ sub extract_tables_from_pcpfile $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not exclude tables from pcp file: $localfullmsidatabasepath !", "extract_tables_from_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -480,7 +480,7 @@ sub copy_files_into_directory_structure { my $infoline = "ERROR: Could not copy $sourcefile to $destfile (insufficient disc space for $destfile ?)\n"; $returnvalue = 0; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "copy_files_into_directory_structure"); } @@ -540,7 +540,8 @@ sub remove_properties_from_registry_table { my ($registryhash, $componentkeypathhash, $registryfilecontent) = @_; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Start remove_properties_from_registry_table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Start remove_properties_from_registry_table"); my @registrytable = (); @@ -623,7 +624,7 @@ sub remove_properties_from_registry_table delete($registryhash->{$regitem}); $removecounter++; $infoline = "Removing registry item: $regitem : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { @@ -651,16 +652,16 @@ sub remove_properties_from_registry_table $infoline = "Changing registry item: $regitem\n"; $infoline = "Old: $oldkey : $oldname : $oldvalue\n"; $infoline = "New: $registryhash->{$regitem}->{'Key'} : $registryhash->{$regitem}->{'Name'} : $registryhash->{$regitem}->{'Value'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } } $infoline = "Number of removed registry items: $removecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Number of changed registry items: $renamecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Creating the new content of Registry table # First three lines from $registryfilecontent @@ -689,9 +690,10 @@ sub remove_properties_from_registry_table } $infoline = "Number of registry items: $newitemcounter. Old value: $olditemcounter.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: End remove_properties_from_registry_table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: End remove_properties_from_registry_table"); return (\@registrytable); } @@ -733,13 +735,13 @@ sub write_sis_info } $systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; - push(@installer::globals::logfileinfo, $systemcall); + $installer::logger::Lang->printf($systemcall); $returnvalue = system($systemcall); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "write_sis_info"); } } @@ -816,7 +818,9 @@ sub make_admin_install # Create helper directory - installer::logger::print_message( "... installing $databasepath in directory $targetdir ...\n" ); + $installer::logger::Info->printf("... installing %s in directory %s ...\n", + $databasepath, + $targetdir); my $helperdir = $targetdir . $installer::globals::separator . "installhelper"; installer::systemactions::create_directory($helperdir); diff --git a/solenv/bin/modules/installer/windows/assembly.pm b/solenv/bin/modules/installer/windows/assembly.pm index e7e63db55702..a053519168e2 100644 --- a/solenv/bin/modules/installer/windows/assembly.pm +++ b/solenv/bin/modules/installer/windows/assembly.pm @@ -217,7 +217,7 @@ sub create_msiassembly_table my $msiassemblytablename = $basedir . $installer::globals::separator . "MsiAssem.idt"; installer::files::save_file($msiassemblytablename ,\@msiassemblytable); my $infoline = "Created idt file: $msiassemblytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } #################################################################################### @@ -299,7 +299,7 @@ sub create_msiassemblyname_table my $msiassemblynametablename = $basedir . $installer::globals::separator . "MsiAsseN.idt"; installer::files::save_file($msiassemblynametablename ,\@msiassemblynametable); my $infoline = "Created idt file: $msiassemblynametablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -346,9 +346,9 @@ sub add_assembly_condition_into_component_table ${$componenttable}[$j] = $oneline; $changed = 1; $infoline = "Changing $componenttablename :\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = $oneline; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } } @@ -360,8 +360,8 @@ sub add_assembly_condition_into_component_table # Saving the file installer::files::save_file($componenttablename ,$componenttable); $infoline = "Saved idt file: $componenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/binary.pm b/solenv/bin/modules/installer/windows/binary.pm index ca979f65ae81..0f4d55852adf 100644 --- a/solenv/bin/modules/installer/windows/binary.pm +++ b/solenv/bin/modules/installer/windows/binary.pm @@ -66,8 +66,7 @@ sub update_binary_table # Saving the file installer::files::save_file($binaryidttablename ,$binaryidttable); - my $infoline = "Updated idt file: $binaryidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $binaryidttablename); } 1; diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index 436306c117e0..2804cb5a31a1 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -361,7 +361,7 @@ sub get_component_keypath { # Warning: This keypath was changed because of info from old database $infoline = "WARNING: The KeyPath for component \"$componentname\" was changed from \"$oneitem->{'uniquename'}\" to \"$keypath\" because of information from update database"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -438,7 +438,7 @@ sub create_component_table my $componenttablename = $basedir . $installer::globals::separator . "Componen.idt"; installer::files::save_file($componenttablename ,\@componenttable); $infoline = "Created idt file: $componenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } #################################################################################### @@ -501,14 +501,14 @@ sub set_component_in_environment_table if ( $componentname ) # only do something if a component could be found { $infoline = "Updated Environment table:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old line: ${$environmentfile}[$i]\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); ${$environmentfile}[$i] =~ s/$modulegid/$componentname/; $infoline = "New line: ${$environmentfile}[$i]\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -518,9 +518,9 @@ sub set_component_in_environment_table installer::files::save_file($environmentfilename ,$environmentfile); $infoline = "Updated idt file: $environmentfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/createfolder.pm b/solenv/bin/modules/installer/windows/createfolder.pm index 4f2de143892f..070d488a9044 100644 --- a/solenv/bin/modules/installer/windows/createfolder.pm +++ b/solenv/bin/modules/installer/windows/createfolder.pm @@ -141,9 +141,7 @@ sub create_createfolder_table my $createfoldertablename = $basedir . $installer::globals::separator . "CreateFo.idt"; installer::files::save_file($createfoldertablename ,\@createfoldertable); - $infoline = "Created idt file: $createfoldertablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $createfoldertablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 156aba0fc963..86be8a214d70 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -563,7 +563,7 @@ sub create_directory_table # Before ":" : [sourcedir]:[destdir] (not programmed yet) # After ":" : 8+3 and not 8+3 the destination directory name - installer::logger::include_timestamp_into_logfile("Performance Info: Directory Table start"); + $installer::logger::Lang->add_timestamp("Performance Info: Directory Table start"); my @directorytable = (); my $infoline; @@ -584,11 +584,9 @@ sub create_directory_table my $directorytablename = $basedir . $installer::globals::separator . "Director.idt"; installer::files::save_file($directorytablename ,\@directorytable); - $infoline = "Created idt file: $directorytablename\n"; - push(@installer::globals::logfileinfo, $infoline); - - installer::logger::include_timestamp_into_logfile("Performance Info: Directory Table end"); + $installer::logger::Lang->printf("Created idt file: %s\n", $directorytablename); + $installer::logger::Lang->add_timestamp("Performance Info: Directory Table end"); } 1; diff --git a/solenv/bin/modules/installer/windows/feature.pm b/solenv/bin/modules/installer/windows/feature.pm index 0e0ffa333748..20cba1422be4 100644 --- a/solenv/bin/modules/installer/windows/feature.pm +++ b/solenv/bin/modules/installer/windows/feature.pm @@ -329,8 +329,9 @@ sub sort_feature { if ( $sorted{$modulekey} == 0 ) { - my $infoline = "Warning: Module \"$modulekey\" could not be sorted. Added to the end of the module array.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf( + "Warning: Module \"%s\" could not be sorted. Added to the end of the module array.\n", + $modulekey); push(@feature, ${$modulesref}[$directaccess{$modulekey}]); } } @@ -432,10 +433,8 @@ sub create_feature_table my $featuretablename = $basedir . $installer::globals::separator . "Feature.idt" . "." . $onelanguage; installer::files::save_file($featuretablename ,\@featuretable); - $infoline = "Created idt file: $featuretablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $featuretablename); } - } 1; diff --git a/solenv/bin/modules/installer/windows/featurecomponent.pm b/solenv/bin/modules/installer/windows/featurecomponent.pm index 13eb7a24b080..4253746557cd 100644 --- a/solenv/bin/modules/installer/windows/featurecomponent.pm +++ b/solenv/bin/modules/installer/windows/featurecomponent.pm @@ -162,8 +162,8 @@ sub check_number_of_components_at_feature { my ($featurecomponenttable) = @_; - my $infoline = "\nChecking number of components at features. Maximum is 817 (for Win 98 and Win Me)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Checking number of components at features. Maximum is 817 (for Win 98 and Win Me)\n"); my $allfeature = collect_all_feature($featurecomponenttable); @@ -184,12 +184,10 @@ sub check_number_of_components_at_feature # Logging the result - $infoline = "Number of components at feature $onefeature : $featurecomponents\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Number of components at feature $onefeature : %s\n", $featurecomponents); } - $infoline = "\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); } ################################################################################# @@ -232,9 +230,7 @@ sub create_featurecomponent_table my $featurecomponenttablename = $basedir . $installer::globals::separator . "FeatureC.idt"; installer::files::save_file($featurecomponenttablename ,\@featurecomponenttable); - $infoline = "Created idt file: $featurecomponenttablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $featurecomponenttablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index 74d094c5b04a..00a23d12a2cd 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -70,13 +70,13 @@ sub assign_cab_to_files # logging the number of files in each cabinet file - $infoline = "\nCabinet file content:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file content:\n"); my $cabfile; foreach $cabfile ( sort keys %installer::globals::cabfilecounter ) { $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile} files\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # assigning startsequencenumbers for each cab file @@ -93,22 +93,22 @@ sub assign_cab_to_files # logging the start sequence numbers - $infoline = "\nCabinet file start sequences:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file start sequences:\n"); foreach $cabfile ( sort keys %installer::globals::cabfilecounter ) { $infoline = "$cabfile : $installer::globals::cabfilecounter{$cabfile}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # logging the last sequence numbers - $infoline = "\nCabinet file last sequences:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Cabinet file last sequences:\n"); foreach $cabfile ( sort keys %installer::globals::lastsequence ) { $infoline = "$cabfile : $installer::globals::lastsequence{$cabfile}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -594,7 +594,7 @@ sub get_sequence_for_file if ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) { $infoline = "Warning: Special handling for component \"$pffcomponentname\". This file was added after the final, but before this ServicePack.\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $onefile->{'componentname'} = $pffcomponentname; # pff for "post final file" $fileentry->{'Component_'} = $onefile->{'componentname'}; if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; } @@ -746,7 +746,7 @@ sub check_file_sequences } $infoline = "ERROR: Files are removed compared with update database.\nThe following files are missing:\n$errorstring"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "check_file_sequences"); } @@ -760,18 +760,20 @@ sub check_file_sequences $counter++; if ( $counter == 1 ) { - $infoline = "\nNew files compared to the update database:\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("New files compared to the update database:\n"); } - $infoline = "$onefile->{'Name'} ($onefile->{'gid'}) Sequence: $onefile->{'assignedsequencenumber'}\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("%s (%s) Sequence: %s\n", + $onefile->{'Name'}, + $onefile->{'gid'}, + $onefile->{'assignedsequencenumber'}); } if ( $counter == 0 ) { $infoline = "Info: No new file compared with update database!\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -844,7 +846,7 @@ sub create_files_table { my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_; - installer::logger::include_timestamp_into_logfile("Performance Info: File Table start"); + $installer::logger::Lang->add_timestamp("Performance Info: File Table start"); # Structure of the files table: # File Component_ FileName FileSize Version Language Attributes Sequence @@ -1040,15 +1042,15 @@ sub create_files_table my $filetablename = $basedir . $installer::globals::separator . "File.idt"; installer::files::save_file($filetablename ,\@filetable); - $infoline = "\nCreated idt file: $filetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created idt file: %s\n", $filetablename); - installer::logger::include_timestamp_into_logfile("Performance Info: File Table end"); + $installer::logger::Lang->add_timestamp("Performance Info: File Table end"); my $filehashtablename = $basedir . $installer::globals::separator . "MsiFileHash.idt"; installer::files::save_file($filehashtablename ,\@filehashtable); - $infoline = "\nCreated idt file: $filehashtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created idt file: %s\n", $filehashtablename); # Now the new files can be added to the files collector (only in update packaging processes) if ( $installer::globals::newfilesexist ) diff --git a/solenv/bin/modules/installer/windows/font.pm b/solenv/bin/modules/installer/windows/font.pm index 1996f51c2298..c82d5a082795 100644 --- a/solenv/bin/modules/installer/windows/font.pm +++ b/solenv/bin/modules/installer/windows/font.pm @@ -68,7 +68,7 @@ sub create_font_table my $fonttablename = $basedir . $installer::globals::separator . "Font.idt"; installer::files::save_file($fonttablename ,\@fonttable); my $infoline = "Created idt file: $fonttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -92,12 +92,12 @@ sub get_font_version { $fontversion = $1; $infoline = "FONT: Font \"$fontfile\" version: $fontversion\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "FONT: Could not determine font version: \"$fontfile\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $fontversion; diff --git a/solenv/bin/modules/installer/windows/icon.pm b/solenv/bin/modules/installer/windows/icon.pm index 32569e2ac487..c7ccf04bbc09 100644 --- a/solenv/bin/modules/installer/windows/icon.pm +++ b/solenv/bin/modules/installer/windows/icon.pm @@ -65,9 +65,7 @@ sub create_icon_table my $icontablename = $basedir . $installer::globals::separator . "Icon.idt"; installer::files::save_file($icontablename ,\@icontable); - my $infoline = "Created idt file: $icontablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $icontablename); } 1; diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm b/solenv/bin/modules/installer/windows/idtglobal.pm index 598ee64103e6..4edfe4ce6d4f 100644 --- a/solenv/bin/modules/installer/windows/idtglobal.pm +++ b/solenv/bin/modules/installer/windows/idtglobal.pm @@ -790,8 +790,12 @@ sub prepare_language_idt_directory if ( $allvariables->{'WINDOWSBITMAPDIRECTORY'} ) { $bitmapdir = $allvariables->{'WINDOWSBITMAPDIRECTORY'}; } my $newsourcedir = $installer::globals::unpackpath . $installer::globals::separator . $bitmapdir; # path setting in list file dependent from unpackpath !? - $infoline = "\nOverwriting files in directory \"" . $destinationdir . $installer::globals::separator . "Binary" . "\" with files from directory \"" . $newsourcedir . "\".\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf( + "Overwriting files in directory \"%s%sBinary\" with files from directory \"%s\".\n", + $destinationdir, + $installer::globals::separator, + $newsourcedir); if ( ! -d $newsourcedir ) { my $currentdir = cwd(); @@ -856,8 +860,7 @@ sub get_rtflicensefilesource if ($$sourcefileref eq "") { installer::exiter::exit_program("ERROR: Could not find $licensefilename!", "get_rtflicensefilesource"); } - my $infoline = "Using licensefile: $$sourcefileref\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Using licensefile: %s\n", $$sourcefileref); return $$sourcefileref; } @@ -1041,7 +1044,7 @@ sub add_officedir_to_database installer::files::save_file($customactionfilename ,$customacfile); my $infoline = "Updated idt file: $customactionfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -1282,7 +1285,7 @@ sub set_custom_action push(@{$customactionidttable}, $line); $infoline = "Added $actionname CustomAction into table $customactionidttablename (NO_FILE has been set)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $included_customaction = 1; return $included_customaction; @@ -1335,7 +1338,7 @@ sub set_custom_action if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $customactionidttablename\n"; } else { $infoline = "Did not add $actionname CustomAction into table $customactionidttablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $included_customaction; } @@ -1368,7 +1371,7 @@ sub add_custom_action_to_install_table push(@{$installtable}, $line); $infoline = "Added $actionname CustomAction into table $installtablename (NO_FILE has been set)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return; } @@ -1423,7 +1426,7 @@ sub add_custom_action_to_install_table if ( $included_customaction ) { $infoline = "Added $actionname CustomAction into table $installtablename\n"; } else { $infoline = "Did not add $actionname CustomAction into table $installtablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -1443,7 +1446,7 @@ sub connect_custom_action_to_control $line =~ s/\s*$//g; $infoline = "Added line \"$line\" into table $tablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################## @@ -1462,7 +1465,7 @@ sub connect_condition_to_control $line =~ s/\s*$//g; $infoline = "Added line \"$line\" into table $tablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################## @@ -1618,7 +1621,7 @@ sub include_subdirname_into_directory_table push(@{$directorytable}, $line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into directory table $directorytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $includedline = 1; last; @@ -1659,7 +1662,7 @@ sub include_subdir_into_componenttable installer::remover::remove_leading_and_ending_whitespaces(\$oldvalue); installer::remover::remove_leading_and_ending_whitespaces(\$newvalue); $infoline = "Change in Component table: From \"$oldvalue\" to \"$newvalue\"\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $changeddirectory = 1; last; @@ -1727,7 +1730,7 @@ sub add_childprojects $infoline = "SystemFolder already exists in table $directorytablename\n"; } - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Additional content for the directory table # subjava INSTALLLOCATION program:java @@ -1763,7 +1766,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1772,7 +1775,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1781,7 +1784,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1790,7 +1793,7 @@ sub add_childprojects push(@{$customactiontable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $customactiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Content for InstallUISequence table @@ -1808,7 +1811,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1820,7 +1823,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'ADAPRODUCT'} ) @@ -1831,7 +1834,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'JAVAPRODUCT'} ) @@ -1843,7 +1846,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1855,7 +1858,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $allvariables->{'UREPRODUCT'} ) @@ -1867,7 +1870,7 @@ sub add_childprojects push(@{$installuitable} ,$line); installer::remover::remove_leading_and_ending_whitespaces(\$line); $infoline = "Added $line into table $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Content for Feature table, better from scp (translation) @@ -2101,8 +2104,8 @@ sub set_positions_in_table { my ( $sequencetable, $tablename ) = @_; - my $infoline = "\nSetting positions in table \"$tablename\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Setting positions in table \"%s\".\n", $tablename); # Step 1: Resolving all occurences of "POSITIONTEMPLATE_end" @@ -2116,7 +2119,7 @@ sub set_positions_in_table $lastposition = $lastposition + 25; ${$sequencetable}[$i] =~ s/POSITIONTEMPLATE_end/$lastposition/; $infoline = "Setting position \"$lastposition\" for custom action \"$customaction\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -2166,12 +2169,12 @@ sub set_positions_in_table ${$sequencetable}[$i] =~ s/$templatename/$newposition/; $template_replaced = 1; $infoline = "Setting position \"$newposition\" for custom action \"$onename\" (scp: \"$positionname\" at position $position).\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Could not assign position for custom action \"$onename\" yet (scp: \"$positionname\").\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2207,13 +2210,13 @@ sub set_positions_in_table $lastposition = $lastposition + 25; ${$sequencetable}[$i] =~ s/$fulltemplate/$lastposition/; $infoline = "WARNING: Setting position \"$lastposition\" for custom action \"$customactionname\". Could not find CustomAction \"$template\".\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } # $templatestring =~ s/,\s*$//; # $infoline = "Error: Saving table \"$tablename\"\n"; - # push(@installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # print $infoline; # installer::files::save_file($tablename, $sequencetable); # installer::exiter::exit_program("ERROR: Unresolved positions in CustomActions in scp2: $templatestring", "set_positions_in_table"); @@ -2229,7 +2232,8 @@ sub addcustomactions { my ($languageidtdir, $customactions, $filesarray) = @_; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions start\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: addcustomactions start\n"); my $customactionidttablename = $languageidtdir . $installer::globals::separator . "CustomAc.idt"; my $customactionidttable = installer::files::read_file($customactionidttablename); @@ -2344,19 +2348,20 @@ sub addcustomactions installer::files::save_file($controlconditiontablename, $controlconditiontable); my $infoline = "Updated idt file: $customactionidttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $installexecutetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $adminexecutetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $installuitablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $controleventtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Updated idt file: $controlconditiontablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: addcustomactions end\n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: addcustomactions end\n"); } ########################################################################## @@ -2427,11 +2432,11 @@ sub setbidiattributes installer::files::save_file($dialogfilename, $dialogfile); $infoline = "Set bidi support in idt file \"$dialogfilename\" for language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($controlfilename, $controlfile); $infoline = "Set bidi support in idt file \"$controlfilename\" for language $onelanguage\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } 1; diff --git a/solenv/bin/modules/installer/windows/inifile.pm b/solenv/bin/modules/installer/windows/inifile.pm index 1e4c467ac796..b91f79deac53 100644 --- a/solenv/bin/modules/installer/windows/inifile.pm +++ b/solenv/bin/modules/installer/windows/inifile.pm @@ -134,9 +134,7 @@ sub create_inifile_table my $inifiletablename = $basedir . $installer::globals::separator . "IniFile.idt"; installer::files::save_file($inifiletablename ,\@inifiletable); - my $infoline = "Created idt file: $inifiletablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $inifiletablename); } 1; diff --git a/solenv/bin/modules/installer/windows/java.pm b/solenv/bin/modules/installer/windows/java.pm index 613c70ec875d..03ba1d3732d5 100644 --- a/solenv/bin/modules/installer/windows/java.pm +++ b/solenv/bin/modules/installer/windows/java.pm @@ -101,15 +101,15 @@ sub update_java_tables installer::files::save_file($reglocatfilename ,$reglocatfile); my $infoline = "Updated idt file for Java: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($appsearchfilename ,$appsearchfile); $infoline = "Updated idt file for Java: $appsearchfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::files::save_file($signaturefilename ,$signaturefile); $infoline = "Updated idt file: $signaturefilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } diff --git a/solenv/bin/modules/installer/windows/media.pm b/solenv/bin/modules/installer/windows/media.pm index effe3962c92a..0dc57b39485e 100644 --- a/solenv/bin/modules/installer/windows/media.pm +++ b/solenv/bin/modules/installer/windows/media.pm @@ -277,8 +277,9 @@ sub create_media_table } else { - my $localinfoline = "Warning: Could not find cabinet file \"$media{'Cabinet'}}\" in update database. This seems to be an new cabinet file!?\n"; - push(@installer::globals::logfileinfo, $localinfoline); + $installer::logger::Lang->printf( + "Warning: Could not find cabinet file \"%s}\" in update database. This seems to be an new cabinet file!?\n", + $media{'Cabinet'}); } } } @@ -447,8 +448,7 @@ sub create_media_table my $mediatablename = $basedir . $installer::globals::separator . "Media.idt"; installer::files::save_file($mediatablename ,\@mediatable); - my $infoline = "Created idt file: $mediatablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $mediatablename); } 1; diff --git a/solenv/bin/modules/installer/windows/mergemodule.pm b/solenv/bin/modules/installer/windows/mergemodule.pm index ce2cb8636240..2ed2781d9747 100644 --- a/solenv/bin/modules/installer/windows/mergemodule.pm +++ b/solenv/bin/modules/installer/windows/mergemodule.pm @@ -52,8 +52,9 @@ sub merge_mergemodules_into_msi_database if ( $domerge ) { installer::logger::include_header_into_logfile("Merging merge modules into msi database"); - installer::logger::print_message( "... merging msm files into msi database ... \n" ); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: MergeModule into msi database, start"); + $installer::logger::Info->printf("... merging msm files into msi database ... \n"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: MergeModule into msi database, start"); my $msidb = "msidb.exe"; # Has to be in the path my $cabinetfile = "MergeModule.CABinet"; # the name of each cabinet file in a merge file @@ -68,9 +69,10 @@ sub merge_mergemodules_into_msi_database if ( ! $installer::globals::mergemodules_analyzed ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Analyzing MergeModules, start"); - $infoline = "Analyzing all Merge Modules\n\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Analyzing MergeModules, start"); + $installer::logger::Lang->print("Analyzing all Merge Modules\n"); + $installer::logger::Lang->print("\n"); %installer::globals::mergemodules = (); @@ -91,7 +93,7 @@ sub merge_mergemodules_into_msi_database if ( ! -d $workdir ) { installer::systemactions::create_directory($workdir); } $infoline = "Analyzing Merge Module: $filename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # copy msm file into working directory my $completedest = $workdir . $installer::globals::separator . $filename; @@ -111,18 +113,18 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not extract cabinet file from merge file: $completedest !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # exclude tables from mergefile @@ -147,18 +149,18 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not exclude tables from merge file: $completedest !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Determining files @@ -320,13 +322,14 @@ sub merge_mergemodules_into_msi_database } $infoline = "All Merge Modules successfully analyzed\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $installer::globals::mergemodules_analyzed = 1; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Analyzing MergeModules, stop"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Analyzing MergeModules, stop"); $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # 2. Change msi database (has to be done for every msi database -> for every language) @@ -344,7 +347,7 @@ sub merge_mergemodules_into_msi_database $counter++; installer::logger::include_header_into_logfile("Merging Module: $mergemodulehash->{'name'}"); - installer::logger::print_message( "\t... $mergemodulehash->{'name'} ... \n" ); + $installer::logger::Info->printf("\t... %s ... \n", $mergemodulehash->{'name'}); $msifilename = installer::converter::make_path_conform($msifilename); my $workdir = $msifilename; @@ -360,7 +363,8 @@ sub merge_mergemodules_into_msi_database # Merging msm file, this is the "real" merge command - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before merging database"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before merging database"); if ( $^O =~ /cygwin/i ) { # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) @@ -377,21 +381,22 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall . Returnvalue: $returnvalue!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not merge msm file into database: $mergemodulehash->{'mergefilepath'} !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After merging database"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After merging database"); # Saving original idt files if ( -f "File.idt" ) { installer::systemactions::rename_one_file("File.idt", "File.idt.$counter"); } @@ -405,7 +410,8 @@ sub merge_mergemodules_into_msi_database # Extracting tables - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before extracting tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before extracting tables"); my $workingtables = "File Media Directory FeatureComponents"; # required tables # Optional tables can be added now @@ -427,21 +433,22 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not exclude tables from msi database: $msifilename !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After extracting tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After extracting tables"); # Using 8+3 table names, that are used, when tables are integrated into database. The export of tables # creates idt-files, that have long names. @@ -451,17 +458,22 @@ sub merge_mergemodules_into_msi_database if ( -f "MsiAssembly.idt" ) { installer::systemactions::rename_one_file("MsiAssembly.idt", "MsiAssem.idt"); } # Changing content of tables: File, Media, Directory, FeatureComponent, MsiAssembly - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing Media table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing Media table"); change_media_table($mergemodulehash, $workdir, $mergemodulegid, $allupdatelastsequences, $allupdatediskids); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing File table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing File table"); $filesref = change_file_table($mergemodulehash, $workdir, $allupdatesequences, $includepatharrayref, $filesref, $mergemodulegid); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing FeatureComponent table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing FeatureComponent table"); change_featurecomponent_table($mergemodulehash, $workdir); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing Directory table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing Directory table"); change_directory_table($mergemodulehash, $workdir); if ( $mergemodulehash->{'hasmsiassemblies'} ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing MsiAssembly table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing MsiAssembly table"); change_msiassembly_table($mergemodulehash, $workdir); } @@ -523,29 +535,35 @@ sub merge_mergemodules_into_msi_database # into tables InstallExecuteSequence, AdminExecuteSequence and AdvtExecuteSequence if ( -f "ModuleInstallExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing InstallExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing InstallExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "InstallE.idt", "ModuleInstallExecuteSequence.idt"); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing InstallUISequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing InstallUISequence table"); change_executesequence_table($mergemodulehash, $workdir, "InstallU.idt", "ModuleInstallExecuteSequence.idt"); } if ( -f "ModuleAdminExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing AdminExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing AdminExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "AdminExe.idt", "ModuleAdminExecuteSequence.idt"); } if ( -f "ModuleAdvtExecuteSequence.idt" ) { - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing AdvtExecuteSequence table"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Changing AdvtExecuteSequence table"); change_executesequence_table($mergemodulehash, $workdir, "AdvtExec.idt", "ModuleAdvtExecuteSequence.idt"); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: All tables edited"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: All tables edited"); # Including tables into msi database - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Before including tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Before including tables"); if ( $^O =~ /cygwin/i ) { # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) @@ -562,28 +580,30 @@ sub merge_mergemodules_into_msi_database $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not include tables into msi database: $msifilename !", "merge_mergemodules_into_msi_database"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - installer::logger::include_timestamp_into_logfile("\nPerformance Info: After including tables"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: After including tables"); chdir($from); } if ( ! $installer::globals::mergefiles_added_into_collector ) { $installer::globals::mergefiles_added_into_collector = 1; } # Now all mergemodules are merged for one language. - installer::logger::include_timestamp_into_logfile("\nPerformance Info: MergeModule into msi database, stop"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: MergeModule into msi database, stop"); } return $filesref; @@ -819,7 +839,7 @@ sub set_last_cabfile_name if ( $mediafile->{$line}->{'DiskId'} == $lastdiskid ) { $installer::globals::lastcabfilename = $mediafile->{$line}->{'Cabinet'}; } } my $infoline = "Setting last cabinet file: $installer::globals::lastcabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ######################################################################### @@ -832,7 +852,7 @@ sub change_media_table my ( $mergemodulehash, $workdir, $mergemodulegid, $allupdatelastsequences, $allupdatediskids ) = @_; my $infoline = "Changing content of table \"Media\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = "Media.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" in \"$workdir\" !", "change_media_table"); } @@ -857,11 +877,11 @@ sub change_media_table my $start = $1; my $final = $2; $infoline = "Merge: Old line in media table: ${$filecontent}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $newline = $start . $newmaxsequencenumber . $final . "\n"; ${$filecontent}[$i] = $newline; $infoline = "Merge: Changed line in media table: ${$filecontent}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -874,7 +894,7 @@ sub change_media_table } $infoline = "Adding line: $installer::globals::merge_media_line{$mergemodulegid}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # adding new line push(@{$filecontent}, $installer::globals::merge_media_line{$mergemodulegid}); @@ -1072,7 +1092,7 @@ sub change_file_table my ($mergemodulehash, $workdir, $allupdatesequenceshashref, $includepatharrayref, $filesref, $mergemodulegid) = @_; my $infoline = "Changing content of table \"File\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "File.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_file_table"); } @@ -1133,7 +1153,7 @@ sub change_file_table # should be available on every Windows system. $infoline = "Unpacking cabinet file: $mergemodulehash->{'cabinetfile'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Avoid the Cygwin expand command my $expandfile = "expand.exe"; # Has to be in the path @@ -1161,18 +1181,18 @@ sub change_file_table my $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not extract cabinet file: $mergemodulehash->{'cabinetfile'} !", "change_file_table"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } chdir($from); @@ -1216,11 +1236,11 @@ sub change_file_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Adding files to the files collector (but only once) if (( $installer::globals::fix_number_of_cab_files ) && ( ! $installer::globals::mergefiles_added_into_collector )) @@ -1343,7 +1363,7 @@ sub change_featurecomponent_table my ($mergemodulehash, $workdir) = @_; my $infoline = "Changing content of table \"FeatureComponents\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "FeatureC.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_featurecomponent_table"); } @@ -1370,7 +1390,7 @@ sub change_featurecomponent_table my $line = "$feature\t$component\n"; push(@{$filecontent}, $line); $infoline = "Adding line: $line\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # saving file @@ -1392,7 +1412,7 @@ sub change_directory_table if ( $scpdirectory ne "TARGETDIR" ) # TARGETDIR works fine, when using msidb.exe { my $infoline = "Changing content of table \"Directory\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "Director.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_directory_table"); } @@ -1432,11 +1452,11 @@ sub change_directory_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1454,7 +1474,7 @@ sub change_msiassembly_table my ($mergemodulehash, $workdir) = @_; my $infoline = "Changing content of table \"MsiAssembly\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $idtfilename = "MsiAssem.idt"; if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_msiassembly_table"); } @@ -1492,11 +1512,11 @@ sub change_msiassembly_table ${$filecontent}[$linenumber] = $newline; $infoline = "Merge, replacing line:\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Old: $oldline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New: $newline\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # saving file @@ -1581,7 +1601,7 @@ sub change_executesequence_table my ($mergemodulehash, $workdir, $idtfilename, $moduleidtfilename) = @_; my $infoline = "Changing content of table \"$idtfilename\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( ! -f $idtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$idtfilename\" in \"$workdir\" !", "change_executesequence_table"); } if ( ! -f $moduleidtfilename ) { installer::exiter::exit_program("ERROR: Could not find file \"$moduleidtfilename\" in \"$workdir\" !", "change_executesequence_table"); } diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 2c8c017a5ec1..24342935643f 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -101,7 +101,7 @@ sub check_ddf_file } my $infoline = "Check of ddf file \"$ddffilename\": Maximum length \"$maxlength\" in line \"$maxline\" (allowed line length: 256 characters)\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ########################################################################## @@ -162,7 +162,7 @@ sub generate_cab_file_list installer::logger::include_header_into_logfile("Generating ddf files"); - installer::logger::include_timestamp_into_logfile("Performance Info: ddf file generation start"); + $installer::logger::Lang->add_timestamp("Performance Info: ddf file generation start"); if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_pathes($filesref); } @@ -244,7 +244,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -337,7 +337,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -413,7 +413,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -476,7 +476,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -528,7 +528,7 @@ sub generate_cab_file_list installer::files::save_file($ddffilename ,\@ddffile); my $infoline = "Created ddf file: $ddffilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # lines in ddf files must not be longer than 256 characters check_ddf_file(\@ddffile, $ddffilename); @@ -547,7 +547,7 @@ sub generate_cab_file_list installer::exiter::exit_program("ERROR: No cab file specification in globals.pm !", "create_media_table"); } - installer::logger::include_timestamp_into_logfile("Performance Info: ddf file generation end"); + $installer::logger::Lang->add_timestamp("Performance Info: ddf file generation end"); return \@cabfilelist; # contains all system calls for packaging process } @@ -593,7 +593,7 @@ sub save_packorder { installer::logger::include_header_into_logfile("Saving pack order"); - installer::logger::include_timestamp_into_logfile("Performance Info: saving pack order start"); + $installer::logger::Lang->add_timestamp("Performance Info: saving pack order start"); my $packorderfilename = "packorder.txt"; $packorderfilename = $installer::globals::infodirectory . $installer::globals::separator . $packorderfilename; @@ -638,7 +638,7 @@ sub save_packorder installer::files::save_file($packorderfilename ,\@packorder); - installer::logger::include_timestamp_into_logfile("Performance Info: saving pack order end"); + $installer::logger::Lang->add_timestamp("Performance Info: saving pack order end"); } ################################################################# @@ -708,17 +708,17 @@ sub create_msi_database 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 $msidb!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msidb successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -812,7 +812,7 @@ sub get_packagecode_for_sis my $guid = "\{" . ${$guidref}[0] . "\}"; my $infoline = "PackageCode: $guid\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $guid; } @@ -949,17 +949,17 @@ sub write_summary_into_msi_database 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 $msiinfo!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msiinfo successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1004,7 +1004,7 @@ sub create_transforms my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Problem: msitran.exe in version 4.0 always returns "1", even if no failure occured. # Therefore it has to be checked, if this is version 4.0. If yes, if the mst file @@ -1015,7 +1015,7 @@ sub create_transforms if ($returnvalue) { $infoline = "WARNING: Returnvalue of $msitran is not 0. Checking version of $msitran!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); open(FILE, "<$installer::globals::msitranpath") or die "ERROR: Can't open $installer::globals::msitranpath for creating file hash"; binmode(FILE); @@ -1028,9 +1028,9 @@ sub create_transforms foreach my $problemchecksum ( @problemchecksums ) { $infoline = "Checksum of problematic MsiTran.exe: $problemchecksum\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Checksum of used MsiTran.exe: $digest\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $digest eq $problemchecksum ) { $isproblemchecksum = 1; } } @@ -1040,45 +1040,45 @@ sub create_transforms if ( -f $transformfile ) { $infoline = "File $transformfile exists.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filesize = ( -s $transformfile ); $infoline = "Size of $transformfile: $filesize\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $filesize > 0 ) { $infoline = "Info: Returnvalue $returnvalue of $msitran is no problem :-) .\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $returnvalue = 0; # reset the error } else { $infoline = "Filesize indicates that an error occured.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "File $transformfile does not exist -> An error occured.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "This is not a problematic version of msitran.exe. Therefore the error is not caused by problematic msitran.exe.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } if ($returnvalue) { $infoline = "ERROR: Could not execute $msitran!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Executed $msitran successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # The reference database can be deleted @@ -1089,7 +1089,7 @@ sub create_transforms if ( $result == 0 ) { $infoline = "ERROR: Could not remove file $$referencedbname !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program($infoline, "create_transforms"); } } @@ -1337,7 +1337,7 @@ sub create_setup_ini installer::files::save_file($setupinifilename, $setupinifile); $infoline = "Generated file $setupinifilename !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################# @@ -1479,19 +1479,19 @@ sub get_guid_list close (UUIDGEN); my $infoline = "Systemcall: $systemcall\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } my $comparenumber = $#uuidlist + 1; if ( $comparenumber == $number ) { $infoline = "Success: Executed $uuidgen successfully!\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } } else { $infoline = "ERROR: Could not execute $uuidgen successfully!\n"; - if ( $log ) { push( @installer::globals::logfileinfo, $infoline); } + if ( $log ) { $installer::logger::Lang->print($infoline); } } # uppercase, no longer "-c", because this is only supported in uuidgen.exe v.1.01 @@ -1678,12 +1678,12 @@ sub set_uuid_into_component_table # # installer::files::save_file($installer::globals::componentfilename, $componentfile); # version using new file in solver # # $infoline = "COMPONENTCODES: Created $counter new GUIDs for components ! \n"; -# push( @installer::globals::logfileinfo, $infoline); +# $installer::logger::Lang->print($infoline); # } # else # { # $infoline = "SUCCESS COMPONENTCODES: All component codes exist! \n"; -# push( @installer::globals::logfileinfo, $infoline); +# $installer::logger::Lang->print($infoline); # } } @@ -1745,7 +1745,7 @@ sub prepare_64bit_database # Saving the files installer::files::save_file($reglocatfilename ,$reglocatfile); $infoline = "Making idt file 64 bit conform: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -1778,7 +1778,7 @@ sub prepare_64bit_database # Saving the files installer::files::save_file($fullfilename ,$filecontent); $infoline = "Making idt file 64 bit conform: $fullfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -1803,7 +1803,7 @@ sub include_cabs_into_msi chdir($to); my $infoline = "Changing into directory: $to"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $msidb = "msidb.exe"; # Has to be in the path my $extraslash = ""; # Has to be set for non-ActiveState perl @@ -1825,17 +1825,17 @@ sub include_cabs_into_msi my $returnvalue = system($systemcall); $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); } # deleting the cab file @@ -1843,11 +1843,11 @@ sub include_cabs_into_msi unlink(${$allcabfiles}[$i]); $infoline = "Deleted cab file: ${$allcabfiles}[$i]\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } $infoline = "Changing back into directory: $from"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); chdir($from); } @@ -1863,7 +1863,7 @@ sub execute_packaging installer::logger::include_header_into_logfile("Packaging process"); - installer::logger::include_timestamp_into_logfile("Performance Info: Execute packaging start"); + $installer::logger::Lang->add_timestamp("Performance Info: Execute packaging start"); my $infoline = ""; my $from = cwd(); @@ -1871,7 +1871,7 @@ sub execute_packaging chdir($to); $infoline = "chdir: $to \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # if the ddf file contains relative pathes, it is necessary to change into the temp directory if ( $allvariables->{'RELATIVE_PATHES_IN_DDF'} ) @@ -1879,7 +1879,7 @@ sub execute_packaging $to = $installer::globals::temppath; chdir($to); $infoline = "chdir: $to \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # changing the tmp directory, because makecab.exe generates temporary cab files @@ -1896,7 +1896,7 @@ sub execute_packaging my $callscounter = $i + 1; - installer::logger::print_message( "... makecab.exe ($callscounter/$allmakecabcalls) ... \n" ); + $installer::logger::Info->printf("... makecab.exe (%s/%s) ... \n", $callscounter, $allmakecabcalls); # my $returnvalue = system($systemcall); @@ -1905,7 +1905,7 @@ sub execute_packaging my @ddfoutput = (); $infoline = "Systemcall: $systemcall"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); open (DDF, "$systemcall"); while (<DDF>) {push(@ddfoutput, $_); } @@ -1917,26 +1917,26 @@ sub execute_packaging { if ( $n < $maxmakecabcalls ) { - installer::logger::print_message( "makecab_error (Try $n): Trying again \n" ); - $infoline = "makecab_error (Try $n): $systemcall !"; + $installer::logger::Info->printf("makecab_error (Try %s): Trying again\n", $n); + $installer::logger::Lang->printf("makecab_error (Try %s): Trying again\n", $n); } else { - installer::logger::print_message( "ERROR (Try $n): Abort packing \n" ); - $infoline = "ERROR (Try $n): $systemcall !"; + $installer::logger::Info->printf("ERROR (Try %s): Abort packing \n", $n); + $installer::logger::Lang->printf("ERROR (Try %s): Abort packing \n", $n); } - push( @installer::globals::logfileinfo, $infoline); - # for ( my $j = 0; $j <= $#ddfoutput; $j++ ) { push( @installer::globals::logfileinfo, "$ddfoutput[$j]"); } - for ( my $m = 0; $m <= $#ddfoutput; $m++ ) { if ( $ddfoutput[$m] =~ /(ERROR\:.*?)\s*$/ ) { $infoline = $1 . "\n"; - if ( $n < $maxmakecabcalls ) { $infoline =~ s/ERROR\:/makecab_error\:/i; } - installer::logger::print_message( $infoline ); - push( @installer::globals::logfileinfo, $infoline); + if ( $n < $maxmakecabcalls ) + { + $infoline =~ s/ERROR\:/makecab_error\:/i; + } + $installer::logger::Info->print($infoline); + $installer::logger::Lang->print($infoline); } } @@ -1944,22 +1944,21 @@ sub execute_packaging } else { - # installer::logger::print_message( "Success (Try $n): \"$systemcall\"\n" ); $infoline = "Success (Try $n): $systemcall"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); last; } } } - installer::logger::include_timestamp_into_logfile("Performance Info: Execute packaging end"); + $installer::logger::Lang->add_timestamp("Performance Info: Execute packaging end"); # setting back to the original tmp directory $ENV{'TMP'} = $origtemppath; chdir($from); $infoline = "chdir: $from \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ############################################################### @@ -1982,7 +1981,7 @@ sub set_global_code_variables } my $infoline = "Using Codes file: $installer::globals::codefilename \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $codefile = installer::files::read_file($installer::globals::codefilename); @@ -2051,9 +2050,9 @@ sub set_global_code_variables if ( $installer::globals::upgradecode eq "" ) { installer::exiter::exit_program("ERROR: UpgradeCode not defined in $installer::globals::codefilename !", "set_global_code_variables"); } $infoline = "Setting ProductCode to: $installer::globals::productcode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Setting UpgradeCode to: $installer::globals::upgradecode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Adding both variables into the variables array @@ -2061,10 +2060,10 @@ sub set_global_code_variables $allvariableshashref->{'UPGRADECODE'} = $installer::globals::upgradecode; $infoline = "Defined variable PRODUCTCODE: $installer::globals::productcode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Defined variable UPGRADECODE: $installer::globals::upgradecode \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -2185,7 +2184,7 @@ sub update_reglocat_table # Saving the file installer::files::save_file($reglocatfilename ,$reglocatfile); my $infoline = "Updated idt file: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2220,7 +2219,7 @@ sub update_removere_table # Saving the file installer::files::save_file($removeregistryfilename ,$removeregistryfile); my $infoline = "Updated idt file: $removeregistryfilename \n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -2234,7 +2233,7 @@ sub read_saved_mappings { installer::logger::include_header_into_logfile("Reading saved mappings from older installation sets:"); - installer::logger::include_timestamp_into_logfile("Performance Info: Reading saved mappings start"); + $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings start"); if ( $installer::globals::previous_idt_dir ) { @@ -2250,8 +2249,12 @@ sub read_saved_mappings # Reading File.idt my $idtfile = $idtdir . $installer::globals::separator . "File.idt"; - push( @installer::globals::globallogfileinfo, "\nAnalyzing file: $idtfile\n" ); - if ( ! -f $idtfile ) { push( @installer::globals::globallogfileinfo, "Warning: File $idtfile does not exist!\n" ); } + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Analyzing file: %s\n", $idtfile); + if ( ! -f $idtfile ) + { + $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile); + } my $n = 0; open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings"); @@ -2319,13 +2322,18 @@ sub read_saved_mappings close (F); - push( @installer::globals::globallogfileinfo, "Read $n old file table key or 8.3 name mappings from $idtfile\n" ); + $installer::logger::Global->printf("Read %s old file table key or 8.3 name mappings from %s\n", + $n, $idtfile); # Reading Director.idt $idtfile = $idtdir . $installer::globals::separator . "Director.idt"; - push( @installer::globals::globallogfileinfo, "\nAnalyzing file $idtfile\n" ); - if ( ! -f $idtfile ) { push( @installer::globals::globallogfileinfo, "Warning: File $idtfile does not exist!\n" ); } + $installer::logger::Global->print("\n"); + $installer::logger::Global->printf("Analyzing file %s\n", $idtfile); + if ( ! -f $idtfile ) + { + $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile); + } $n = 0; open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings"); @@ -2356,25 +2364,25 @@ sub read_saved_mappings } close (F); - push( @installer::globals::globallogfileinfo, "Read $n old directory 8.3 name mappings from $idtfile\n" ); + $installer::logger::Global->printf("Read %s old directory 8.3 name mappings from %s\n", + $n, $idtfile); # Analyzing errors if ( $error_occured ) { - for ( my $i = 0; $i <= $#errorlines; $i++ ) + for my $line (@errorlines) { - print "$errorlines[$i]"; - push( @installer::globals::globallogfileinfo, "$errorlines[$i]"); + $installer::logger::Info->print($line); + $installer::logger::Global->print($line); } installer::exiter::exit_program("ERROR: Duplicate entries in saved mappings!", "read_saved_mappings"); } } else { - # push( @installer::globals::globallogfileinfo, "WARNING: Windows patch shall be prepared, but PREVIOUS_IDT_DIR is not set!\n" ); installer::exiter::exit_program("ERROR: Windows patch shall be prepared, but environment variable PREVIOUS_IDT_DIR is not set!", "read_saved_mappings"); } - installer::logger::include_timestamp_into_logfile("Performance Info: Reading saved mappings end"); + $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings end"); } 1; diff --git a/solenv/bin/modules/installer/windows/msp.pm b/solenv/bin/modules/installer/windows/msp.pm index 10dc7287f809..735377439fc5 100644 --- a/solenv/bin/modules/installer/windows/msp.pm +++ b/solenv/bin/modules/installer/windows/msp.pm @@ -186,7 +186,7 @@ sub prepare_path_in_nopatchfilehash if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not determine flexible destination path for msp patch creation!", "prepare_path_in_nopatchfilehash"); } $infoline = "Setting flexible path for msp creation: $flexiblepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $onedestination ( keys %{$nopatchfiledestinations} ) { @@ -206,25 +206,25 @@ sub synchronize_installation_sets { my ($olddatabase, $newdatabase, $filesarray) = @_; - my $infoline = "\nSynchronizing installed products because of PATCH flag\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->print("Synchronizing installed products because of PATCH flag\n"); $infoline = "Old product: $olddatabase\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "New product: $newdatabase\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my ( $patchfiledestinations, $nopatchfiledestinations, $patchfilecounter, $nopatchfilecounter ) = collect_patch_file_destinations($filesarray); $infoline = "Number of files with PATCH flag: $patchfilecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $infoline = "Number of files without PATCH flag: $nopatchfilecounter\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $localfile ( sort keys %{$patchfiledestinations} ) { $infoline = "\tPATCH file: $localfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $oldpath = $olddatabase; @@ -255,18 +255,18 @@ sub synchronize_installation_sets my $copyreturn = copy($source, $dest); # installer::systemactions::copy_one_file($source, $dest); # $infoline = "Synchronizing file: $source to $dest\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); } else { $infoline = "Not synchronizing. Destination file \"$dest\" does not exist.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Not synchronizing. Source file \"$source\" does not exist.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -301,18 +301,18 @@ sub extract_all_tables_from_pcpfile $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not exclude tables from pcp file: $fullpcpfilepath !", "extract_all_tables_from_msidatabase"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -363,18 +363,18 @@ sub include_tables_into_pcpfile $returnvalue = system($systemcall); $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); installer::exiter::exit_program("ERROR: Could not include tables into pcp file: $fullpcpfilepath !", "include_tables_into_pcpfile"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -424,23 +424,23 @@ sub execute_msimsp } $systemcall = $msimsp . " -s " . $localfullpcpfilename . " -p " . $localmspfilename . " -l " . $locallogfilename . " -f " . $localmsimsptemppath; - 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->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute $systemcall !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Could not execute $systemcall !", "execute_msimsp"); } else { $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $logfilename; @@ -544,7 +544,7 @@ sub change_properties_table my ($localmspdir, $mspfilename) = @_; my $infoline = "Changing content of table \"Properties\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "Properties.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_properties_table"); } @@ -602,7 +602,7 @@ sub change_targetimages_table my ($localmspdir, $olddatabase) = @_; my $infoline = "Changing content of table \"TargetImages\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "TargetImages.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_targetimages_table"); } @@ -630,7 +630,7 @@ sub change_upgradedimages_table my ($localmspdir, $newdatabase) = @_; my $infoline = "Changing content of table \"UpgradedImages\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "UpgradedImages.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_upgradedimages_table"); } @@ -679,7 +679,7 @@ sub change_imagefamilies_table my ($localmspdir) = @_; my $infoline = "Changing content of table \"ImageFamilies\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "ImageFamilies.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_imagefamilies_table"); } @@ -846,7 +846,7 @@ sub change_patchmetadata_table my ($localmspdir, $allvariables, $languagestringref) = @_; my $infoline = "Changing content of table \"PatchMetadata\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "PatchMetadata.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_patchmetadata_table"); } @@ -1054,7 +1054,7 @@ sub change_patchsequence_table my ($localmspdir, $allvariables) = @_; my $infoline = "Changing content of table \"PatchSequence\"\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $filename = $localmspdir . $installer::globals::separator . "PatchSequence.idt"; if ( ! -f $filename ) { installer::exiter::exit_program("ERROR: Could not find file \"$filename\" !", "change_patchsequence_table"); } @@ -1342,10 +1342,11 @@ sub create_msp_patch { my ($installationdir, $includepatharrayref, $allvariables, $languagestringref, $languagesarrayref, $filesarray) = @_; - my $force = 1; # print this message even in 'quiet' mode - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating msp installation set ...\n", $force ); - installer::logger::print_message( "******************************************\n" ); + # print this message even in 'quiet' mode + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating msp installation set ...\n", 1); + $installer::logger::Info->print("******************************************\n"); $installer::globals::creating_windows_installer_patch = 1; @@ -1381,22 +1382,25 @@ sub create_msp_patch $installer::globals::saveinstalldir = $mspdir; - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting product installation"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting product installation"); # Installing both installation sets - installer::logger::print_message( "... installing products ...\n" ); + $installer::logger::Info->printf("... installing products ...\n"); my ($olddatabase, $newdatabase) = install_installation_sets($installationdir); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting synchronization of installation sets"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting synchronization of installation sets"); # Synchronizing installed products, allowing only different files with PATCH flag - installer::logger::print_message( "... synchronizing installation sets ...\n" ); + $installer::logger::Info->printf("... synchronizing installation sets ...\n"); synchronize_installation_sets($olddatabase, $newdatabase, $filesarray); - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting pcp file creation"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting pcp file creation"); # Create pcp file - installer::logger::print_message( "... creating pcp file ...\n" ); + $installer::logger::Info->printf("... creating pcp file ...\n"); my $localmspdir = installer::systemactions::create_directories("msp", $languagestringref); @@ -1437,12 +1441,14 @@ sub create_msp_patch include_tables_into_pcpfile($fullpcpfilename, $localmspdir, $tablelist); # Start msimsp.exe - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting msimsp.exe"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Starting msimsp.exe"); my $msimsplogfile = execute_msimsp($fullpcpfilename, $mspfilename, $localmspdir); # Copy final installation set next to msp file - installer::logger::include_timestamp_into_logfile("\nPerformance Info: Copying installation set"); - installer::logger::print_message( "... copying installation set ...\n" ); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: Copying installation set"); + $installer::logger::Info->printf("... copying installation set ...\n"); my $oldinstallationsetpath = $installer::globals::updatedatabasepath; @@ -1470,7 +1476,7 @@ sub create_msp_patch # Copying patch file installer::systemactions::copy_one_file($requiredpatchfile, $mspdir); # my $infoline = "Copy $requiredpatchfile to $mspdir\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); } # Find all files included into the patch @@ -1478,7 +1484,8 @@ sub create_msp_patch analyze_msimsp_logfile($msimsplogfile, $filesarray); # Done - installer::logger::include_timestamp_into_logfile("\nPerformance Info: msp creation done"); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->add_timestamp("Performance Info: msp creation done"); return $mspdir; } diff --git a/solenv/bin/modules/installer/windows/patch.pm b/solenv/bin/modules/installer/windows/patch.pm index 5035339aaa6a..7d75481370df 100644 --- a/solenv/bin/modules/installer/windows/patch.pm +++ b/solenv/bin/modules/installer/windows/patch.pm @@ -135,17 +135,13 @@ sub update_patch_tables # Saving the files installer::files::save_file($reglocatfilename ,$reglocatfile); - my $infoline = "Updated idt file: $reglocatfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $reglocatfilename); installer::files::save_file($appsearchfilename ,$appsearchfile); - $infoline = "Updated idt file: $appsearchfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Updated idt file: %s\n", $appsearchfilename); installer::files::save_file($signaturefilename ,$signaturefile); - $infoline = "Updated idt file: $signaturefilename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Updated idt file: %s\n", $signaturefilename); } 1; diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 70e3d86bb849..eddce824633b 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -177,7 +177,7 @@ sub get_productname_for_property_table # Saving this name in hash $allvariables for further usage $allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname; my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $productname; } @@ -193,7 +193,7 @@ sub get_quickstarterlinkname_for_property_table my $quickstartername = $name . " " . $version; my $infoline = "Defined Quickstarter Link name: $quickstartername\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); return $quickstartername; } @@ -512,7 +512,7 @@ sub update_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Updated idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -559,7 +559,7 @@ sub set_languages_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -590,7 +590,7 @@ sub set_codes_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -619,7 +619,7 @@ sub set_regkeyprodpath_in_property_table installer::files::save_file($properyfilename ,$propertyfile); my $infoline = "Added language content into idt file: $properyfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } @@ -650,7 +650,7 @@ sub update_checkbox_table # Saving the property file installer::files::save_file($checkboxfilename ,$checkboxfile); my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm index 5cdc6a34cd0e..3e26b03810d6 100644 --- a/solenv/bin/modules/installer/windows/registry.pm +++ b/solenv/bin/modules/installer/windows/registry.pm @@ -445,13 +445,11 @@ sub create_registry_table my $registrytablename = $basedir . $installer::globals::separator . "Registry.idt" . "." . $onelanguage; installer::files::save_file($registrytablename ,\@registrytable); - my $infoline = "Created idt file: $registrytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $registrytablename); $registrytablename = $basedir . $installer::globals::separator . "Reg64.idt" . "." . $onelanguage; installer::files::save_file($registrytablename ,\@reg64table ); - $infoline = "Created idt file: $registrytablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $registrytablename); } } diff --git a/solenv/bin/modules/installer/windows/removefile.pm b/solenv/bin/modules/installer/windows/removefile.pm index ec6b17dbbfff..cdf0f5366ef0 100644 --- a/solenv/bin/modules/installer/windows/removefile.pm +++ b/solenv/bin/modules/installer/windows/removefile.pm @@ -140,9 +140,7 @@ sub create_removefile_table my $removefiletablename = $basedir . $installer::globals::separator . "RemoveFi.idt"; installer::files::save_file($removefiletablename ,\@removefiletable); - my $infoline = "Created idt file: $removefiletablename\n"; - push(@installer::globals::logfileinfo, $infoline); - + $installer::logger::Lang->printf("Created idt file: %s\n", $removefiletablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/selfreg.pm b/solenv/bin/modules/installer/windows/selfreg.pm index fa69439e4977..96029edd9326 100644 --- a/solenv/bin/modules/installer/windows/selfreg.pm +++ b/solenv/bin/modules/installer/windows/selfreg.pm @@ -77,8 +77,7 @@ sub create_selfreg_table my $selfregtablename = $basedir . $installer::globals::separator . "SelfReg.idt"; installer::files::save_file($selfregtablename ,\@selfregtable); - my $infoline = "Created idt file: $selfregtablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $selfregtablename); } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm index 134429888f98..3ba36a053dc6 100644 --- a/solenv/bin/modules/installer/windows/shortcut.pm +++ b/solenv/bin/modules/installer/windows/shortcut.pm @@ -677,17 +677,16 @@ sub create_shortcut_table $installer::globals::sofficeiconadded = 1; } - my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; - push(@installer::globals::logfileinfo, $localinfoline); + $installer::logger::Lang->printf( + "Added icon file %s for language pack into icon file collector.\n", $$sourcepathref); # Saving the file my $shortcuttablename = $basedir . $installer::globals::separator . "Shortcut.idt" . "." . $onelanguage; installer::files::save_file($shortcuttablename ,\@shortcuttable); - my $infoline = "Created idt file: $shortcuttablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $shortcuttablename); } } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/sign.pm b/solenv/bin/modules/installer/windows/sign.pm index b1ec229256c1..8ce4cc6e054c 100644 --- a/solenv/bin/modules/installer/windows/sign.pm +++ b/solenv/bin/modules/installer/windows/sign.pm @@ -63,7 +63,7 @@ sub copy_install_set if ( -d $removepath ) { installer::systemactions::remove_complete_directory($removepath, 1); } $infoline = "Copy installation set from $installsetpath to $newpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $installsetpath = installer::systemactions::copy_complete_directory($installsetpath, $newpath); @@ -141,7 +141,8 @@ sub check_system_path foreach my $onefile ( @needed_files_in_path ) { - installer::logger::print_message( "...... searching $onefile ..." ); + + $installer::logger::Info->printf("...... searching %s ...\n", $onefile); my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$onefile, $patharrayref , 0); @@ -152,7 +153,7 @@ sub check_system_path } else { - installer::logger::print_message( "\tFound: $$fileref\n" ); + $installer::logger::Info->printf("\tFound: %s\n", $$fileref); } } @@ -169,24 +170,24 @@ sub make_systemcall { my ($systemcall, $displaysystemcall) = @_; - installer::logger::print_message( "... $displaysystemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $displaysystemcall); my $success = 1; my $returnvalue = system($systemcall); my $infoline = "Systemcall: $displaysystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not execute \"$displaysystemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$displaysystemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $success; @@ -200,24 +201,24 @@ sub make_systemcall_with_warning { my ($systemcall, $displaysystemcall) = @_; - installer::logger::print_message( "... $displaysystemcall ...\n" ); + $installer::logger::Info->printf("... %s ...\n", $displaysystemcall); my $success = 1; my $returnvalue = system($systemcall); my $infoline = "Systemcall: $displaysystemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "WARNING: Could not execute \"$displaysystemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$displaysystemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $success; @@ -256,13 +257,13 @@ sub execute_open_system_call if ($returnvalue) { $infoline = "ERROR: Could not execute \"$systemcall\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = 0; } else { $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return ($success, \@openoutput); @@ -504,7 +505,7 @@ sub cabinet_cosistency_check my ( $onefile, $followmeinfohash, $filenamehash, $lastsequencehash, $temppath ) = @_; my $infoline = "Making consistency check of $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $expandfile = "expand.exe"; # Has to be in the path if ( $^O =~ /cygwin/i ) @@ -516,12 +517,12 @@ sub cabinet_cosistency_check if ( $filenamehash == 0 ) { $infoline = "Warning: Stopping consistency check: Important hash of filenames is empty!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( $lastsequencehash == 0 ) { $infoline = "Warning: Stopping consistency check; Important hash of last sequences is empty!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else # both hashes are available { @@ -529,7 +530,7 @@ sub cabinet_cosistency_check my $sequence = $lastsequencehash->{$onefile}; my $lastfile = $filenamehash->{$sequence}; $infoline = "Check of $onefile: Sequence: $sequence is file: $lastfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Therefore the file $lastfile need to be binary compared. # It has to be expanded from the cabinet file @@ -555,12 +556,12 @@ sub cabinet_cosistency_check if ( ! -f $sourcecabfile ) { $infoline = "WARNING: Check of cab file cannot happen, because source cabinet file was not found: $sourcecabfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( ! -f $destcabfile ) { $infoline = "WARNING: Check of cab file cannot happen, because destination cabinet file was not found: $sourcecabfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else # everything is okay for the check { @@ -574,14 +575,14 @@ sub cabinet_cosistency_check my $systemcall = "$expandfile $sourcecabfile $origdiffpath -f:$lastfile "; $infoline = $systemcall . "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $success = make_systemcall($systemcall, $systemcall); if ( ! $success ) { installer::exiter::exit_program("ERROR: Could not successfully execute: $systemcall !", "cabinet_cosistency_check"); } $systemcall = "$expandfile $destcabfile $newdiffpath -f:$lastfile "; $infoline = $systemcall . "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $success = make_systemcall($systemcall, $systemcall); if ( ! $success ) { installer::exiter::exit_program("ERROR: Could not successfully execute: $systemcall !", "cabinet_cosistency_check"); } @@ -599,13 +600,13 @@ sub cabinet_cosistency_check if ( $origsize != $newsize ) # This shows an error! { $infoline = "ERROR: Different filesize after signtool.exe was used. Original: $origsize Bytes, new: $newsize. File: $lastfile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: The cabinet file $destcabfile is broken after signtool.exe signed this file !", "cabinet_cosistency_check"); } else { $infoline = "Same size of last file in cabinet file after usage of signtool.exe: $newsize (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # Also making a binary diff? @@ -620,18 +621,18 @@ sub cabinet_cosistency_check if ( $success == 0 ) { $infoline = "Last files are identical after signing cabinet file (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } elsif ( $success == 1 ) { $infoline = "ERROR: Last files are different after signing cabinet file (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Last files are different after signing cabinet file (File: $lastfile)!", "cabinet_cosistency_check"); } else { $infoline = "ERROR: Problem occured calling diff.exe (File: $lastfile)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Problem occured calling diff.exe (File: $lastfile) !", "cabinet_cosistency_check"); } } @@ -671,7 +672,7 @@ sub sign_files if ( already_certified($onefile) ) { $infoline = "Already certified: Skipping file $onefile\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); next; } @@ -680,8 +681,16 @@ sub sign_files while (( $counter <= $maxcounter ) && ( ! $success )) { - if ( $counter > 1 ) { installer::logger::print_message( "\n\n... repeating file $onefile ...\n" ); } - if ( $cabinternal ) { installer::logger::print_message(" Signing: $onefile\n"); } + if ( $counter > 1 ) + { + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... repeating file %s ...\n", $onefile); + } + if ( $cabinternal ) + { + $installer::logger::Info->printf(" Signing: %s\n", $onefile); + } my $systemcall = "signtool.exe sign /f \"$pfxfilepath\" /p $pw $productname $url /t \"$timestampurl\" \"$onefile\""; my $displaysystemcall = "signtool.exe sign /f \"$pfxfilepath\" /p ***** $productname $url /t \"$timestampurl\" \"$onefile\""; $success = make_systemcall_with_warning($systemcall, $displaysystemcall); @@ -737,7 +746,7 @@ sub check_ddf_file } my $infoline = "Check of ddf file \"$ddffilename\": Maximum length \"$maxlength\" in line \"$maxline\" (allowed line length: 256 characters)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################################# @@ -838,9 +847,10 @@ sub read_cab_file { my ($cabfilename) = @_; - installer::logger::print_message( "\n... reading cabinet file $cabfilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... reading cabinet file %s ...\n", $cabfilename); my $infoline = "Reading cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $systemcall = "cabarc.exe" . " L " . $cabfilename; push(@logfile, "$systemcall\n"); @@ -870,9 +880,10 @@ sub unpack_cab_file { my ($cabfilename, $temppath) = @_; - installer::logger::print_message( "\n... unpacking cabinet file $cabfilename ...\n" ); + $installer::logger::Info->printf("\n"); + $installer::logger::Info->printf("... unpacking cabinet file %s ...\n", $cabfilename); my $infoline = "Unpacking cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $dirname = $cabfilename; $dirname =~ s/\.cab\s*$//; @@ -965,9 +976,10 @@ sub do_pack_cab_file { my ($cabfilename, $allfiles, $workingpath, $temppath) = @_; - installer::logger::print_message( "\n... packing cabinet file $cabfilename ...\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->printf("... packing cabinet file %s ...\n", $cabfilename); my $infoline = "Packing cabinet file $cabfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -f $cabfilename ) { unlink($cabfilename); } # removing cab file if ( -f $cabfilename ) { installer::exiter::exit_program("ERROR: Failed to remove file: $cabfilename!", "do_pack_cab_file"); } @@ -1049,7 +1061,7 @@ sub already_certified if ( $success ) { $is_certified = 1; - installer::logger::print_message( "... already certified -> skipping $filename ...\n" ); + $installer::logger::Info->printf("... already certified -> skipping %s ...\n", $filename); } return $is_certified; @@ -1116,7 +1128,7 @@ sub compare_directories $dir2 =~ s/\/\s*//; my $infoline = "Comparing directories: $dir1 and $dir2\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); foreach my $onefile ( @{$files} ) { @@ -1130,7 +1142,7 @@ sub compare_directories my $size2 = -s $file2; $infoline = "Comparing files: $file1 ($size1) and $file2 ($size2)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $size1 != $size2 ) { @@ -1155,7 +1167,7 @@ sub sign_install_set my $success = 1; my $infoline = "Signing installation set in $installsetpath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # check required files. if ( ! $installer::globals::signfiles_checked ) { check_system_path(); } diff --git a/solenv/bin/modules/installer/windows/strip.pm b/solenv/bin/modules/installer/windows/strip.pm index 375a792fc5d8..924cfb6b3fcc 100644 --- a/solenv/bin/modules/installer/windows/strip.pm +++ b/solenv/bin/modules/installer/windows/strip.pm @@ -66,18 +66,15 @@ sub do_strip 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 strip $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("ERROR: Could not strip %s!\n", $filename); } else { - $infoline = "SUCCESS: Stripped library $filename!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("SUCCESS: Stripped library %s!\n", $filename); } } @@ -124,8 +121,7 @@ sub strip_binaries my $shortfilename = $sourcefilename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); - $infoline = "Strip: $shortfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Strip: %s\n", $shortfilename); # copy file into directory for stripped libraries diff --git a/solenv/bin/modules/installer/windows/update.pm b/solenv/bin/modules/installer/windows/update.pm index fe668322c70b..974ac6b760f8 100644 --- a/solenv/bin/modules/installer/windows/update.pm +++ b/solenv/bin/modules/installer/windows/update.pm @@ -56,19 +56,16 @@ sub extract_all_tables_from_msidatabase $systemcall = $msidb . " -d " . $fulldatabasepath . " -f " . $workdir . " -e " . $extraslash . "*"; $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); installer::exiter::exit_program("ERROR: Could not exclude tables from msi database: $fulldatabasepath !", "extract_all_tables_from_msidatabase"); } else { - $infoline = "Success: Executed $systemcall successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Success: Executed %s successfully!\n", $systemcall); } } @@ -323,17 +320,19 @@ sub readdatabase if (( $databasename ) && ( $databasename ne "" )) # This is an update packaging process! { $installer::globals::updatedatabase = 1; - installer::logger::print_message( "... update process, using database $databasename ...\n" ); - $infoline = "\nDatabase found in $completelistname: \"$databasename\"\n\n"; + $installer::logger::Info->printf("... update process, using database %s ...\n", $databasename); + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("Database found in %s: \"%s\"\n", $completelistname, $databasename); + $installer::logger::Lang->printf("\n"); # Saving in global variable $installer::globals::updatedatabasepath = $databasename; } else { - # installer::logger::print_message( "... no update process, no database found ...\n" ); - $infoline = "\nNo database found in $completelistname. This is no update process!\n\n"; + $installer::logger::Lang->printf("\n"); + $installer::logger::Lang->printf("No database found in %s. This is no update process!\n", $completelistname); + $installer::logger::Lang->printf("\n"); } - push( @installer::globals::logfileinfo, $infoline); if ( $installer::globals::updatedatabase ) { @@ -342,7 +341,7 @@ sub readdatabase my $msifilename = $databasename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$msifilename); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase start"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase start"); # create directory for unpacking my $databasedir = installer::systemactions::create_directories("database", $languagestringref); @@ -351,12 +350,12 @@ sub readdatabase my $fulldatabasepath = $databasedir . $installer::globals::separator . $msifilename; installer::systemactions::copy_one_file($databasename, $fulldatabasepath); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase: before extracting tables"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase: before extracting tables"); # extract all tables from database extract_all_tables_from_msidatabase($fulldatabasepath, $databasedir); - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase: before reading tables"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase: before reading tables"); # read all tables $database = read_all_tables_from_msidatabase($databasedir); @@ -402,7 +401,7 @@ sub readdatabase # } # } - installer::logger::include_timestamp_into_logfile("Performance Info: readdatabase end"); + $installer::logger::Lang->add_timestamp("Performance Info: readdatabase end"); } return $database; @@ -416,7 +415,7 @@ sub readmergedatabase { my ( $mergemodules, $languagestringref, $includepatharrayref ) = @_; - installer::logger::include_timestamp_into_logfile("Performance Info: readmergedatabase start"); + $installer::logger::Lang->add_timestamp("Performance Info: readmergedatabase start"); my $mergemoduledir = installer::systemactions::create_directories("mergedatabase", $languagestringref); @@ -461,7 +460,7 @@ sub readmergedatabase } } - installer::logger::include_timestamp_into_logfile("Performance Info: readmergedatabase end"); + $installer::logger::Lang->add_timestamp("Performance Info: readmergedatabase end"); } ################################################################################# @@ -593,4 +592,4 @@ sub create_database_hashes } -1;
\ No newline at end of file +1; diff --git a/solenv/bin/modules/installer/windows/upgrade.pm b/solenv/bin/modules/installer/windows/upgrade.pm index 3f837dff8f31..9559c8e6c8ab 100644 --- a/solenv/bin/modules/installer/windows/upgrade.pm +++ b/solenv/bin/modules/installer/windows/upgrade.pm @@ -124,16 +124,14 @@ sub create_upgrade_table { @upgradetable = (); installer::windows::idtglobal::write_idt_header(\@upgradetable, "upgrade"); - my $infoline = "Beta product -> empty Upgrade table\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Beta product -> empty Upgrade table\n"); } # Saving the file my $upgradetablename = $basedir . $installer::globals::separator . "Upgrade.idt"; installer::files::save_file($upgradetablename ,\@upgradetable); - my $infoline = "Created idt file: $upgradetablename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->printf("Created idt file: %s\n", $upgradetablename); } ############################################################## diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 91da2ab0b39a..8ea19acda9da 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -52,7 +52,7 @@ sub unpack_all_targzfiles_in_directory installer::logger::include_header_into_logfile("Unpacking tar.gz files:"); - installer::logger::print_message( "... unpacking tar.gz files ... \n" ); + $installer::logger::Info->print( "... unpacking tar.gz files ... \n" ); my $localdirectory = $directory . $installer::globals::separator . "packages"; my $alltargzfiles = installer::systemactions::find_file_with_file_extension("tar.gz", $localdirectory); @@ -65,17 +65,17 @@ sub unpack_all_targzfiles_in_directory $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); } } } @@ -97,7 +97,7 @@ sub copy_install_sets_to_ship if ( ! -d $localshipinstalldir ) { installer::systemactions::create_directory_structure($localshipinstalldir); } # copy installation set to /ship ($localshipinstalldir) - installer::logger::print_message( "... copy installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); + $installer::logger::Info->print( "... copy installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); installer::systemactions::copy_complete_directory($destdir, $localshipinstalldir); if (( ! $installer::globals::iswindowsbuild ) && ( $installer::globals::addjavainstaller )) @@ -126,16 +126,16 @@ sub link_install_sets_to_ship installer::logger::include_header_into_logfile("Linking installation set to ship:"); my $infoline = "... destination directory: $shipinstalldir ...\n"; - installer::logger::print_message( $infoline ); - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Info->print( $infoline ); + $installer::logger::Lang->print($infoline); if ( ! -d $shipinstalldir) { $infoline = "Creating directory: $shipinstalldir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::systemactions::create_directory_structure($shipinstalldir); $infoline = "Created directory: $shipinstalldir\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } my $dirname = $destdir; @@ -144,24 +144,24 @@ sub link_install_sets_to_ship my $localshipinstalldir = $shipinstalldir . $installer::globals::separator . $dirname; # link installation set to /ship ($localshipinstalldir) - installer::logger::print_message( "... linking installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); + $installer::logger::Lang->print( "... linking installation set from " . $destdir . " to " . $localshipinstalldir . "\n" ); my $systemcall = "ln -s $destdir $localshipinstalldir"; $returnvalue = system($systemcall); $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: Could not create link \"$localshipinstalldir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: Created link \"$localshipinstalldir\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $localshipinstalldir; @@ -292,14 +292,14 @@ sub save_patchlist_file $patchlistfilename =~ s/log\_/patchfiles\_/; $patchlistfilename =~ s/\.log/\.txt/; installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, \@installer::globals::patchfilecollector); - installer::logger::print_message( "... creating patchlist file $patchlistfilename \n" ); + $installer::logger::Info->print( "... creating patchlist file $patchlistfilename \n" ); if (( $installer::globals::patch ) && ( ! $installer::globals::creating_windows_installer_patch )) # only for non-Windows patches { $patchlistfilename =~ s/patchfiles\_/nopatchfiles\_/; my $nopatchlist = create_nopatchlist(); installer::files::save_file($installpatchlistdir . $installer::globals::separator . $patchlistfilename, $nopatchlist); - installer::logger::print_message( "... creating patch exclusion file $patchlistfilename \n" ); + $installer::logger::Info->print( "... creating patch exclusion file $patchlistfilename \n" ); } } @@ -313,7 +313,7 @@ sub remove_old_installation_sets { my ($basedir) = @_; - installer::logger::print_message( "... removing old installation directories ...\n" ); + $installer::logger::Info->print( "... removing old installation directories ...\n" ); my $removedir = $basedir; @@ -342,7 +342,7 @@ sub remove_old_ship_installation_sets { my ($fulldir, $counter) = @_; - installer::logger::print_message( "... removing old installation directories ...\n" ); + $installer::logger::Info->print( "... removing old installation directories ...\n" ); my $basedir = $fulldir; installer::pathanalyzer::get_path_from_fullqualifiedname(\$basedir); @@ -398,7 +398,7 @@ sub create_installation_directory else { $installdir = installer::systemactions::create_directories("install", $languageref); - installer::logger::print_message( "... creating installation set in $installdir ...\n" ); + $installer::logger::Info->print( "... creating installation set in $installdir ...\n" ); remove_old_installation_sets($installdir); my $inprogressinstalldir = $installdir . "_inprogress"; installer::systemactions::rename_directory($installdir, $inprogressinstalldir); @@ -421,16 +421,19 @@ sub analyze_and_save_logfile my $is_success = 1; my $finalinstalldir = ""; - installer::logger::print_message( "... checking log file " . $loggingdir . $installer::globals::logfilename . "\n" ); + $installer::logger::Info->print( "... checking log file " . $loggingdir . $installer::globals::logfilename . "\n" ); - my $contains_error = installer::control::check_logfile(\@installer::globals::logfileinfo); + my $contains_error = installer::control::check_logfile(); # Dependent from the success, the installation directory can be renamed and mails can be send. - if ( $contains_error ) + if ($contains_error) { my $errordir = installer::systemactions::rename_string_in_directory($installdir, "_inprogress", "_witherror"); - if ( $installer::globals::updatepack ) { installer::mail::send_fail_mail($allsettingsarrayref, $languagestringref, $errordir); } + if ($installer::globals::updatepack) + { + installer::mail::send_fail_mail($allsettingsarrayref, $languagestringref, $errordir); + } # Error output to STDERR for ( my $j = 0; $j <= $#installer::globals::errorlogfileinfo; $j++ ) { @@ -469,13 +472,20 @@ sub analyze_and_save_logfile # Saving the logfile in the log file directory and additionally in a log directory in the install directory my $numberedlogfilename = $installer::globals::logfilename; - if ( $installer::globals::updatepack ) { $numberedlogfilename =~ s /log_/log_$current_install_number\_/; } - installer::logger::print_message( "... creating log file $numberedlogfilename \n" ); - installer::files::save_file($loggingdir . $numberedlogfilename, \@installer::globals::logfileinfo); - installer::files::save_file($installlogdir . $installer::globals::separator . $numberedlogfilename, \@installer::globals::logfileinfo); - - # Saving the checksumfile in a checksum directory in the install directory - # installer::worker::save_checksum_file($current_install_number, $installchecksumdir, $checksumfile); + if ( $installer::globals::updatepack ) + { + $numberedlogfilename =~ s /log_/log_$current_install_number\_/; + } + foreach my $log_file_name ( + $loggingdir . $numberedlogfilename, + $installlogdir . $installer::globals::separator . $numberedlogfilename) + { + if ($log_file_name ne $installer::logger::Lang->{'filename'}) + { + $installer::logger::Info->printf(" copying log file to %s\n", $log_file_name); + installer::systemactions::copy_one_file($installer::logger::Lang->{'filename'}, $log_file_name); + } + } # Saving the list of patchfiles in a patchlist directory in the install directory if (( $installer::globals::patch ) || ( $installer::globals::creating_windows_installer_patch )) { installer::worker::save_patchlist_file($installlogdir, $numberedlogfilename); } @@ -502,7 +512,7 @@ sub save_logfile_after_linking # Saving the logfile in the log file directory and additionally in a log directory in the install directory my $numberedlogfilename = $installer::globals::logfilename; if ( $installer::globals::updatepack ) { $numberedlogfilename =~ s /log_/log_$current_install_number\_/; } - installer::logger::print_message( "... creating log file $numberedlogfilename \n" ); + $installer::logger::Info->print( "... creating log file $numberedlogfilename \n" ); installer::files::save_file($loggingdir . $numberedlogfilename, \@installer::globals::logfileinfo); installer::files::save_file($installlogdir . $installer::globals::separator . $numberedlogfilename, \@installer::globals::logfileinfo); } @@ -514,13 +524,13 @@ sub save_logfile_after_linking sub clean_output_tree { - installer::logger::print_message( "... cleaning the output tree ...\n" ); + $installer::logger::Info->print( "... cleaning the output tree ...\n" ); for ( my $i = 0; $i <= $#installer::globals::removedirs; $i++ ) { if ( -d $installer::globals::removedirs[$i] ) { - installer::logger::print_message( "... removing directory $installer::globals::removedirs[$i] ...\n" ); + $installer::logger::Info->print( "... removing directory $installer::globals::removedirs[$i] ...\n" ); installer::systemactions::remove_complete_directory($installer::globals::removedirs[$i], 1); } } @@ -532,7 +542,7 @@ sub clean_output_tree if ( -d $installer::globals::shiptestdirectory ) { my $infoline = "Last try to remove $installer::globals::shiptestdirectory . \n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $systemcall = "rmdir $installer::globals::shiptestdirectory"; my $returnvalue = system($systemcall); } @@ -546,13 +556,13 @@ sub clean_output_tree sub clean_jds_temp_dirs { - installer::logger::print_message( "... cleaning jds directories ...\n" ); + $installer::logger::Info->print( "... cleaning jds directories ...\n" ); for ( my $i = 0; $i <= $#installer::globals::jdsremovedirs; $i++ ) { if ( -d $installer::globals::jdsremovedirs[$i] ) { - installer::logger::print_message( "... removing directory $installer::globals::jdsremovedirs[$i] ...\n" ); + $installer::logger::Info->print( "... removing directory $installer::globals::jdsremovedirs[$i] ...\n" ); installer::systemactions::remove_complete_directory($installer::globals::jdsremovedirs[$i], 1); } } @@ -724,7 +734,7 @@ sub remove_all_items_with_special_flag if ( $styles =~ /\b$flag\b/ ) { my $infoline = "Attention: Removing from collector: $oneitem->{'Name'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $flag eq "BINARYTABLE_ONLY" ) { push(@installer::globals::binarytableonlyfiles, $oneitem); } next; } @@ -748,13 +758,13 @@ sub install_simple ($$$$$$) my $copyopts = '-af'; $copyopts = '-PpRf' unless ( $ENV{'GNUCOPY'} ); # if not gnucopy, assume POSIX copy - installer::logger::print_message( "... installing module $packagename ...\n" ); + $installer::logger::Info->print( "... installing module $packagename ...\n" ); my $destdir = $installer::globals::destdir; my @lines = (); - installer::logger::print_message( "DestDir: $destdir \n" ); - installer::logger::print_message( "Rootpath: $installer::globals::rootpath \n" ); + $installer::logger::Info->print( "DestDir: $destdir \n" ); + $installer::logger::Info->print( "Rootpath: $installer::globals::rootpath \n" ); `mkdir -p $destdir` if $destdir ne ""; `mkdir -p $destdir$installer::globals::rootpath`; @@ -1092,7 +1102,7 @@ sub create_inf_file my $infdir = installer::systemactions::create_directories($infdirname, $languagestringref); my $infoline = "Number of inf files: $#{$inf_files} + 1 \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # there are inffiles for all modules @@ -1115,7 +1125,7 @@ sub create_inf_file my $onelanguage = ${$languagesarrayref}[$j]; $infoline = "Templatefile: $inf_file_name, Language: $onelanguage \n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $templatefile = installer::files::read_file($templatefilename); @@ -1124,7 +1134,7 @@ sub create_inf_file write_content_into_inf_file($templatefile, $filesref, $registryitemsref, $folderref, $folderitemsref, $modulesref, $onelanguage, $inffile, $firstlanguage, $allvariableshashref); $infoline = "Lines change: From $linesbefore to $#{$templatefile}.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # rename language specific inffile my $language_inf_file_name = $inf_file_name; @@ -1135,7 +1145,7 @@ sub create_inf_file installer::files::save_file($sourcepath, $templatefile); $infoline = "Saving file: $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # creating new file object @@ -1342,7 +1352,7 @@ sub prepare_linuxlinkfiles else { $onefile->{'destination'} = $onefile->{'destination'} . "\.$installer::globals::linuxlibrarybaselevel"; } my $infoline = "LINUXLINK: Changing file destination from $original_destination to $onefile->{'destination'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # all files without PATCH flag are included into the RPM if ( ! $ispatchfile ) { push( @filesarray, $onefile); } @@ -1357,7 +1367,7 @@ sub prepare_linuxlinkfiles push( @installer::globals::linuxlinks, $linkfile ); $infoline = "LINUXLINK: Created link: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return \@filesarray; @@ -1412,7 +1422,7 @@ sub prepare_forced_linuxlinkfiles $linkfile->{'destination'} = $localdestination . $installer::globals::separator . $onelink->{'Name'}; $infoline = "Forced link into update file: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # The file, defined by the link, has to be included into the # link array @installer::globals::linuxlinks @@ -1443,7 +1453,7 @@ sub prepare_forced_linuxlinkfiles $linkfile->{'destination'} = $localdestination . $installer::globals::separator . $onelink->{'Name'}; $infoline = "Forced link into update file: $linkfile->{'destination'} pointing to $linkfile->{'destinationfile'} !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # The file, defined by the link, has to be included into the # link array @installer::globals::linuxlinks @@ -1684,8 +1694,8 @@ sub prepare_windows_patchfiles $patchfilename = $winpatchdir . $installer::globals::separator . $patchfilename; installer::files::save_file($patchfilename, $patchfilelist); - my $infoline = "\nCreated list of patch files: $patchfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print("\n"); + $installer::logger::Lang->printf("Created list of patch files: %s\n", $patchfilename); # and assigning the new source $patchlistfile->{'sourcepath'} = $patchfilename; @@ -1695,8 +1705,8 @@ sub prepare_windows_patchfiles { my $filesize = ( -s $patchfilename ); $infoline = "Size of patch file list: $filesize\n\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::logger::print_message( "... size of patch list file: $filesize Byte ... \n" ); + $installer::logger::Lang->print($infoline); + $installer::logger::Info->print( "... size of patch list file: $filesize Byte ... \n" ); # Win 98: Maximum size of ini file is 65 kB # if ( $filesize > 64000 ) { installer::exiter::exit_program("ERROR: Maximum size of patch file list is 65 kB (Win98), now reached: $filesize Byte !", "prepare_windows_patchfiles"); } @@ -1948,13 +1958,13 @@ sub copy_all_packages else { $infoline = "Excluding package (matching): $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Excluding package (precise name): $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -1970,17 +1980,17 @@ sub make_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); } } @@ -1993,7 +2003,7 @@ sub copy_additional_packages my ($allcopypackages, $destdir, $includepatharrayref) = @_; my $infoline = "Copy additional packages into installation set.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $destdir =~ s/\/\s*$//; @@ -2001,7 +2011,7 @@ sub copy_additional_packages { my $onepackage = ${$allcopypackages}[$i]; $infoline = "Copy package: $onepackage\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # this package must be delivered into the solver @@ -2029,9 +2039,10 @@ sub create_jds_sets { my ($installationdir, $allvariableshashref, $languagestringref, $languagesarrayref, $includepatharrayref) = @_; - installer::logger::print_message( "\n******************************************\n" ); - installer::logger::print_message( "... creating jds installation set ...\n" ); - installer::logger::print_message( "******************************************\n" ); + $installer::logger::Info->print("\n"); + $installer::logger::Info->print("******************************************\n"); + $installer::logger::Info->print("... creating jds installation set ...\n"); + $installer::logger::Info->print("******************************************\n"); installer::logger::include_header_into_logfile("Creating jds installation sets:"); @@ -2072,7 +2083,7 @@ sub create_jds_sets my $listfile = installer::files::read_file($$filelistnameref); my $infoline = "Found jds list file: $$filelistnameref\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); # substituting the variables substitute_dollar_variables($listfile, $allvariableshashref); @@ -2301,8 +2312,7 @@ sub add_variables_from_inc_to_hashref $includefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$includefilename, $includepatharrayref, 1); if ( $$includefilenameref eq "" ) { installer::exiter::exit_program("Include file $includefilename not found!\nADD_INCLUDE_FILES = $allvariables->{'ADD_INCLUDE_FILES'}", "add_variables_from_inc_to_hashref"); } - $infoline = "Including inc file: $$includefilenameref \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Including inc file: %s\n", $$includefilenameref); my $includefile = installer::files::read_file($$includefilenameref); @@ -2316,8 +2326,8 @@ sub add_variables_from_inc_to_hashref my $key = $1; my $value = $2; $allvariables->{$key} = $value; - $infoline = "Setting of variable: $key = $value\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Setting of variable: %s = %s\n", + $key, $value); } } } @@ -2330,8 +2340,9 @@ sub add_variables_from_inc_to_hashref if (( exists($allvariables->{'WINDOWSJAVAVERSION'})) && ( $allvariables->{'WINDOWSJAVAVERSION'} ne "" )) { $allvariables->{'JAVAVERSION'} = $allvariables->{'WINDOWSJAVAVERSION'}; - $infoline = "Changing value of property \"JAVAVERSION\" to $allvariables->{'JAVAVERSION'} (property \"WINDOWSJAVAVERSION\").\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Changing value of property \"JAVAVERSION\" to %s (property \"WINDOWSJAVAVERSION\").\n", + $allvariables->{'JAVAVERSION'}); } } } @@ -2345,7 +2356,7 @@ sub collect_all_files_from_includepathes my ($patharrayref) = @_; installer::logger::globallog("Reading all directories: Start"); - installer::logger::print_message( "... reading include pathes ...\n" ); + $installer::logger::Info->print( "... reading include pathes ...\n" ); # empty the global @installer::globals::allincludepathes =(); @@ -2358,8 +2369,9 @@ sub collect_all_files_from_includepathes if ( ! -d $includepath ) { - $infoline = "$includepath does not exist. (Can be removed from include path list?)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "%s does not exist. (Can be removed from include path list?)\n", + $includepath); next; } @@ -2370,14 +2382,16 @@ sub collect_all_files_from_includepathes if ( ! ( $#sourcefiles > -1 )) { - $infoline = "$includepath is empty. (Can be removed from include path list?)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "%s is empty. (Can be removed from include path list?)\n", + $includepath); } else { my $number = $#sourcefiles + 1; - $infoline = "Directory $includepath contains $number files (including subdirs)\n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf( + "Directory %s contains $number files (including subdirs)\n", + $includepath); my %allfileshash = (); $allfileshash{'includepath'} = $includepath; @@ -2394,7 +2408,7 @@ sub collect_all_files_from_includepathes $installer::globals::include_pathes_read = 1; installer::logger::globallog("Reading all directories: End"); - push( @installer::globals::globallogfileinfo, "\n"); + $installer::logger::Global->print("\n"); } ############################################## @@ -2478,17 +2492,17 @@ sub call_sum 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 ($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 $sumoutput; @@ -2518,17 +2532,17 @@ sub call_wc 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 ($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 $wcoutput; @@ -2633,17 +2647,17 @@ sub set_time_stamp my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: \"$systemcall\" failed!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: \"$systemcall\" !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -2684,10 +2698,10 @@ sub generate_cygwin_pathes { my ($filesref) = @_; - installer::logger::include_timestamp_into_logfile("Starting generating cygwin pathes"); + $installer::logger::Lang->add_timestamp("Starting generating cygwin pathes"); my $infoline = "Generating cygwin pathes (generate_cygwin_pathes)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $max = 5000; # number of pathes in one file @@ -2708,7 +2722,7 @@ sub generate_cygwin_pathes $temppath =~ s/\Q$installer::globals::separator\E\s*$//; $tmpfilename = $temppath . $installer::globals::separator . $tmpfilename; $infoline = "Creating temporary file for cygwin conversion: $tmpfilename (contains $counter pathes)\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( -f $tmpfilename ) { unlink $tmpfilename; } installer::files::save_file($tmpfilename, \@pathcollector); @@ -2724,12 +2738,12 @@ sub generate_cygwin_pathes if ($success) { $infoline = "Success: Successfully converted to cygwin pathes!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "ERROR: Failed to convert to cygwin pathes!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: Failed to convert to cygwin pathes!", "generate_cygwin_pathes"); } @@ -2753,12 +2767,12 @@ sub generate_cygwin_pathes if (( ! exists(${$filesref}[$i]->{'cyg_sourcepath'}) ) || ( ${$filesref}[$i]->{'cyg_sourcepath'} eq "" )) { $infoline = "ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); installer::exiter::exit_program("ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}!", "generate_cygwin_pathes"); } } - installer::logger::include_timestamp_into_logfile("Ending generating cygwin pathes"); + $installer::logger::Lang->add_timestamp("Ending generating cygwin pathes"); } ############################################## @@ -2978,18 +2992,18 @@ sub resolving_hidden_flag else { $onefile->{'destination'} = $destination . $installer::globals::separator . $newfilename; } $infoline = "Success: Using file with flag HIDDEN from \"$onefile->{'sourcepath'}\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Error: Failed to copy HIDDEN file from \"$sourcefile\" to \"$destfile\"!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } $infoline = "\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################ @@ -3053,8 +3067,7 @@ sub set_spellcheckerlanguages if ($$spellcheckfileref eq "") { installer::exiter::exit_program("ERROR: Could not find $spellcheckfilename!", "set_spellcheckerlanguages"); } - my $infoline = "Using spellchecker file: $$spellcheckfileref \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Using spellchecker file: %s\n", $$spellcheckfileref); my $spellcheckfile = installer::files::read_file($$spellcheckfileref); my %spellcheckhash = (); @@ -3114,8 +3127,7 @@ sub set_spellcheckerlanguages foreach my $lang (sort keys %installer::globals::spellcheckerlanguagehash) { $langstring = $langstring . "," . $lang } $langstring =~ s/^\s*,//; - $infoline = "Collected spellchecker languages for spellchecker: $langstring \n"; - push( @installer::globals::globallogfileinfo, $infoline); + $installer::logger::Global->printf("Collected spellchecker languages for spellchecker: %s\n", $langstring); } ################################################ @@ -3142,7 +3154,7 @@ sub put_license_into_setup # Replacement my $infoline = "Adding licensefile into setup script\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $includestring = ""; for ( my $i = 0; $i <= $#{$licensefile}; $i++ ) { $includestring = $includestring . ${$licensefile}[$i]; } @@ -3185,17 +3197,17 @@ sub tar_package 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 $tarfilename \>\/dev\/null 2\>\&1"; @@ -3223,17 +3235,17 @@ sub untar_package 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 $tarfilename \>\/dev\/null 2\>\&1"; @@ -3250,12 +3262,12 @@ sub shuffle_array # my $counter = 0; # my $infoline = "Old package order: \n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # foreach my $onepackage ( @{$arrayref} ) # { # $counter++; # $infoline = "$counter: $onepackage->{'module'}\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # } my $i = @$arrayref; @@ -3267,12 +3279,12 @@ sub shuffle_array # $counter = 0; # $infoline = "New package order: \n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # foreach my $onepackage ( @{$arrayref} ) # { # $counter++; # $infoline = "$counter: $onepackage->{'module'}\n"; - # push( @installer::globals::logfileinfo, $infoline); + # $installer::logger::Lang->print($infoline); # } } @@ -3305,17 +3317,17 @@ sub set_time_stamp_for_file my $returnvalue = system($systemcall); my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ($returnvalue) { $infoline = "ERROR: \"$systemcall\" failed!\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Success: \"$systemcall\" !\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } diff --git a/solenv/bin/modules/installer/xpdinstaller.pm b/solenv/bin/modules/installer/xpdinstaller.pm index 0f8a4037e144..ee426f0e54e0 100644 --- a/solenv/bin/modules/installer/xpdinstaller.pm +++ b/solenv/bin/modules/installer/xpdinstaller.pm @@ -611,7 +611,7 @@ sub get_size_value my $rpmname = $packagename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "Filesize $rpmname : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } if ( $installer::globals::issolarispkgbuild ) @@ -671,7 +671,7 @@ sub get_md5_value my $rpmname = $packagename; installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "md5sum of $rpmname : $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } @@ -746,7 +746,7 @@ sub get_fullpkgname_value installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$rpmname); $infoline = "Full package name from $rpmname: $value\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } return $value; @@ -873,23 +873,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->print($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; @@ -914,11 +917,14 @@ sub make_systemcall_allowing_error 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->print($line); + } } if ($returnvalue) @@ -926,20 +932,20 @@ sub make_systemcall_allowing_error if ( $can_fail ) { $infoline = "WARNING: Failed system call: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $error_occured = 1; } else { $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, $returnvalue); @@ -1480,7 +1486,7 @@ sub create_emptyparents_xpd_file installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push(@installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # push(@installer::globals::emptyxpdparents, $parentgid); @@ -1595,7 +1601,7 @@ sub create_xpd_file installer::files::save_file($xpdfilename, $emptyfilecontent); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); $xpdfilename = $newxpdfilename; change_parent_in_xpdfile($xpdfile, $module->{'XpdPackageName'}); @@ -1605,7 +1611,7 @@ sub create_xpd_file push( @installer::globals::createdxpdfiles, $modulegid); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $grandpagid = "root"; if ( $parentgid ne "root" ) @@ -1663,7 +1669,7 @@ sub create_xpd_file_for_childproject push( @installer::globals::createdxpdfiles, $modulegid); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); if ( $parentgid ne "root" ) { @@ -1697,7 +1703,7 @@ sub create_xpd_file_for_systemintegration # installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$newpackagename); my $infoline = "Creating xpd file for package: $newpackagename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); my $childmodule = installer::worker::copy_hash_from_references($module); $childmodule->{'ParentID'} = $module->{'gid'}; # the module gid is the new parent @@ -1748,7 +1754,7 @@ sub create_xpd_file_for_systemintegration installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } # Creating the top level visible xpd file @@ -1804,7 +1810,7 @@ sub create_setup_xpd installer::files::save_file($xpdfilename, $xpdfile); push(@installer::globals::allxpdfiles, $xpdfilename); my $infoline = "Saving xpd file: $xpdfilename\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } ################################################### diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index af70557eac22..6673c3236feb 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -584,18 +584,18 @@ sub replace_languages_in_pathes { $installer::globals::refresh_includepathes = 1; $infoline = "Directory $newdir exists and is not empty. Refreshing global file array is required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } else { $infoline = "Directory $newdir is empty. No refresh of global file array required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } else { $infoline = "Directory $newdir does not exist. No refresh of global file array required.\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } } } @@ -623,10 +623,10 @@ sub list_all_files_from_include_path my $path = ${$patharrayref}[$i]; installer::remover::remove_leading_and_ending_whitespaces(\$path); my $infoline = "$path\n"; - push( @installer::globals::logfileinfo, $infoline); + $installer::logger::Lang->print($infoline); } - push( @installer::globals::logfileinfo, "\n"); + $installer::logger::Lang->print("\n"); return \@filesarray; } |