[Libreoffice-commits] .: 5 commits - solenv/bin

Michael Meeks michael at kemper.freedesktop.org
Fri Feb 17 06:28:56 PST 2012


 solenv/bin/modules/installer/globals.pm     |    2 
 solenv/bin/modules/installer/logger.pm      |  110 +++++++---------------------
 solenv/bin/modules/installer/setupscript.pm |    6 -
 3 files changed, 33 insertions(+), 85 deletions(-)

New commits:
commit 76ffd9e6bfc763f000045c12758f149b6dbbf299
Author: Tim Retout <tim at retout.co.uk>
Date:   Thu Feb 16 22:33:46 2012 +0000

    Replace installer::logger::include_header_into_globallogfile.

diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index f98d34c..dba0ea0 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -37,7 +37,6 @@ use installer::globals;
 
 our @EXPORT_OK = qw(
     include_header_into_logfile
-    include_header_into_globallogfile
     include_timestamp_into_logfile
     log_hashref
     globallog
@@ -78,30 +77,6 @@ sub include_header_into_logfile
 }
 
 ####################################################
-# Including header files into the logfile
-####################################################
-
-sub include_header_into_globallogfile
-{
-    my ($message) = @_;
-
-    my $infoline;
-
-    $infoline = "\n" . _get_time_string();
-    push( @installer::globals::globallogfileinfo, $infoline);
-
-    $infoline = "######################################################\n";
-    push( @installer::globals::globallogfileinfo, $infoline);
-
-    $infoline = "$message\n";
-    push( @installer::globals::globallogfileinfo, $infoline);
-
-
-    $infoline = "######################################################\n";
-    push( @installer::globals::globallogfileinfo, $infoline);
-}
-
-####################################################
 # Write timestamp into log file
 ####################################################
 
@@ -154,13 +129,13 @@ sub globallog
     $infoline = "\n" . _get_time_string();
     push( @installer::globals::globallogfileinfo, $infoline);
 
-    $infoline = "################################################################\n";
+    $infoline = "######################################################\n";
     push( @installer::globals::globallogfileinfo, $infoline);
 
     $infoline = "$message\n";
     push( @installer::globals::globallogfileinfo, $infoline);
 
-    $infoline = "################################################################\n";
+    $infoline = "######################################################\n";
     push( @installer::globals::globallogfileinfo, $infoline);
 
 }
diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm
index 3018bb3..7d590c5 100644
--- a/solenv/bin/modules/installer/setupscript.pm
+++ b/solenv/bin/modules/installer/setupscript.pm
@@ -30,7 +30,7 @@ package installer::setupscript;
 use installer::existence;
 use installer::exiter;
 use installer::globals;
-use installer::logger;
+use installer::logger qw(globallog);
 use installer::remover;
 use installer::scriptitems;
 use installer::ziplist;
@@ -241,7 +241,7 @@ sub replace_all_setupscriptvariables_in_script
 {
     my ( $scriptref, $variablesref ) = @_;
 
-    installer::logger::include_header_into_globallogfile("Replacing variables in setup script (start)");
+    globallog("Replacing variables in setup script (start)");
 
     # make hash of variables to be substituted if they appear in the script
     my %subs;
@@ -282,7 +282,7 @@ sub replace_all_setupscriptvariables_in_script
         }
     }
 
-    installer::logger::include_header_into_globallogfile("Replacing variables in setup script (end)");
+    globallog("Replacing variables in setup script (end)");
 
     return $scriptref;
 }
commit c2ece9e23d8dc792833506010c69e4ec1835b257
Author: Tim Retout <tim at retout.co.uk>
Date:   Thu Feb 16 20:54:19 2012 +0000

    Move global starttime into installer::logger

diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm
index 33d6e0a..f066c34 100644
--- a/solenv/bin/modules/installer/globals.pm
+++ b/solenv/bin/modules/installer/globals.pm
@@ -431,8 +431,6 @@ BEGIN
     $postprocess_standardepm = 0;
     $mergemodules_analyzed = 0;
 
-    $starttime = "";
-
     @solarispatchscripts = ("checkinstall", "copyright", "patch_checkinstall", "patch_postinstall", "postinstall", "preinstall", "i.none");
     @solarispatchscriptsforextensions = ("checkinstall", "copyright", "patch_checkinstall", "patch_postinstall_extensions", "postinstall_extensions", "preinstall", "i.none");
     @solarispatchfiles = (".diPatch", "patchinfo");
diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index 681c3d1..f98d34c 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -51,6 +51,8 @@ our @EXPORT_OK = qw(
     print_error
 );
 
+my $starttime;
+
 ####################################################
 # Including header files into the logfile
 ####################################################
@@ -207,7 +209,7 @@ sub savedebug
 
 sub starttime
 {
-    $installer::globals::starttime = time();
+    $starttime = time();
 }
 
 ###############################################################
@@ -258,7 +260,7 @@ sub _convert_timestring
 sub _get_time_string
 {
     my $currenttime = time();
-    $currenttime = $currenttime - $installer::globals::starttime;
+    $currenttime = $currenttime - $starttime;
     $currenttime = _convert_timestring($currenttime);
     $currenttime = localtime() . " \(" . $currenttime . "\)\n";
     return $currenttime;
commit f2808e15b44d8213b90c1b4ba08b5ce6dba01048
Author: Tim Retout <tim at retout.co.uk>
Date:   Thu Feb 16 20:52:10 2012 +0000

    installer::logger: Remove temporary variable.

diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index 2ec0360..681c3d1 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -270,8 +270,7 @@ sub _get_time_string
 
 sub stoptime
 {
-    my $infoline = _get_time_string();
-    print_message( "$infoline" );
+    print_message( _get_time_string() );
 }
 
 ###############################################################
commit 04134e94af8625b942e4cca544c305b232efb8ed
Author: Tim Retout <tim at retout.co.uk>
Date:   Thu Feb 16 20:22:42 2012 +0000

    Use Exporter in installer::logger.
    
    Also rename private subroutines to start with an underscore.

diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index f86c4df..2ec0360 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -30,9 +30,27 @@ package installer::logger;
 use strict;
 use warnings;
 
+use base 'Exporter';
+
 use installer::files;
 use installer::globals;
 
+our @EXPORT_OK = qw(
+    include_header_into_logfile
+    include_header_into_globallogfile
+    include_timestamp_into_logfile
+    log_hashref
+    globallog
+    copy_globalinfo_into_logfile
+    debuginfo
+    savedebug
+    starttime
+    stoptime
+    print_message
+    print_warning
+    print_error
+);
+
 ####################################################
 # Including header files into the logfile
 ####################################################
@@ -43,7 +61,7 @@ sub include_header_into_logfile
 
     my $infoline;
 
-    $infoline = "\n" . get_time_string();
+    $infoline = "\n" . _get_time_string();
     push( @installer::globals::logfileinfo, $infoline);
 
     $infoline = "######################################################\n";
@@ -67,7 +85,7 @@ sub include_header_into_globallogfile
 
     my $infoline;
 
-    $infoline = "\n" . get_time_string();
+    $infoline = "\n" . _get_time_string();
     push( @installer::globals::globallogfileinfo, $infoline);
 
     $infoline = "######################################################\n";
@@ -90,7 +108,7 @@ sub include_timestamp_into_logfile
     my ($message) = @_;
 
     my $infoline;
-    my $timestring = get_time_string();
+    my $timestring = _get_time_string();
     $infoline = "$message\t$timestring";
     push( @installer::globals::logfileinfo, $infoline);
 }
@@ -131,7 +149,7 @@ sub globallog
 
     my $infoline;
 
-    $infoline = "\n" . get_time_string();
+    $infoline = "\n" . _get_time_string();
     push( @installer::globals::globallogfileinfo, $infoline);
 
     $infoline = "################################################################\n";
@@ -196,7 +214,7 @@ sub starttime
 # Convert time string
 ###############################################################
 
-sub convert_timestring
+sub _convert_timestring
 {
     my ($secondstring) = @_;
 
@@ -237,11 +255,11 @@ sub convert_timestring
 # Returning time string for logging
 ###############################################################
 
-sub get_time_string
+sub _get_time_string
 {
     my $currenttime = time();
     $currenttime = $currenttime - $installer::globals::starttime;
-    $currenttime = convert_timestring($currenttime);
+    $currenttime = _convert_timestring($currenttime);
     $currenttime = localtime() . " \(" . $currenttime . "\)\n";
     return $currenttime;
 }
@@ -252,7 +270,7 @@ sub get_time_string
 
 sub stoptime
 {
-    my $infoline = get_time_string();
+    my $infoline = _get_time_string();
     print_message( "$infoline" );
 }
 
commit 094c3e91be4404010934350fd0e831ded98085a7
Author: Tim Retout <tim at retout.co.uk>
Date:   Thu Feb 16 19:46:12 2012 +0000

    Remove unreferenced subroutines from installer::logger

diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index 0130369..f86c4df 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -247,19 +247,6 @@ sub get_time_string
 }
 
 ###############################################################
-# Returning the age of a file (in seconds)
-###############################################################
-
-sub get_file_age
-{
-    my ( $filename ) = @_;
-
-    my $filetime = (stat($filename))[9];
-    my $timediff = time() - $filetime;
-    return $timediff;
-}
-
-###############################################################
 # Stopping the time
 ###############################################################
 
@@ -270,29 +257,6 @@ sub stoptime
 }
 
 ###############################################################
-# Set date string, format: yymmdd
-###############################################################
-
-sub set_installation_date
-{
-    my $datestring = "";
-
-    my @timearray = localtime(time);
-
-    my $day = $timearray[3];
-    my $month = $timearray[4] + 1;
-    my $year = $timearray[5] - 100;
-
-    if ( $year < 10 ) { $year = "0" . $year; }
-    if ( $month < 10 ) { $month = "0" . $month; }
-    if ( $day < 10 ) { $day = "0" . $day; }
-
-    $datestring = $year . $month . $day;
-
-    return $datestring;
-}
-
-###############################################################
 # Console output: messages
 ###############################################################
 
@@ -305,14 +269,6 @@ sub print_message
     return;
 }
 
-sub print_message_without_newline
-{
-    my $message = shift;
-    chomp $message;
-    print "$message" if ( ! $installer::globals::quiet );
-    return;
-}
-
 ###############################################################
 # Console output: warnings
 ###############################################################


More information about the Libreoffice-commits mailing list