]> git.pld-linux.org Git - packages/amavis-stats.git/commitdiff
- updated for 0.1.22, hope it will work :)
authorhawk <hawk@pld-linux.org>
Mon, 12 May 2008 13:00:26 +0000 (13:00 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    amavis-stats-gzip.patch -> 1.4

amavis-stats-gzip.patch

index 5fea35558ceb51ec5d24ae9d8fe2ae3e66463995..bb73dbf0c347fcffe39793e60cba49298c4dc477 100644 (file)
---- amavis-stats-0.1.13-rc6/amavis-stats.orig  2004-05-17 08:07:51.000000000 +0000
-+++ amavis-stats-0.1.13-rc6/amavis-stats       2004-08-06 07:27:08.849931336 +0000
-@@ -35,6 +35,7 @@
- use Fcntl ':flock';
- use POSIX qw(strftime);
- use POSIX qw(locale_h);
-+use Compress::Zlib;
+diff -urN amavis-stats-0.1.22.orig/configure.in amavis-stats-0.1.22/configure.in
+--- amavis-stats-0.1.22.orig/configure.in      2006-12-04 13:59:29.000000000 +0100
++++ amavis-stats-0.1.22/configure.in   2008-05-12 14:38:27.000000000 +0200
+@@ -66,7 +66,6 @@
+ AC_PATH_PROG(CP, cp, cp)
+ AC_PATH_PROG(CHMOD, chmod, chmod)
+ AC_PATH_PROG(CHOWN, chown, chown)
+-AC_PATH_PROGS(GZCAT, gzcat, no)
+ AC_PATH_PROGS(NROFF, gnroff nroff)
+ AC_PATH_PROGS(TROFF, groff troff)
+ AC_PROG_LIBTOOL
+@@ -101,14 +100,6 @@
  
+ PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
  
- # ########################################################################
-@@ -698,6 +699,59 @@
+-if test "$GZCAT" = no; then
+-  AC_MSG_ERROR([
+-
+-gzcat not found!!!
+-
+-])
+-fi
+-
+ if test "$PATCH" = no; then
+   AC_MSG_ERROR([
  
+diff -urN amavis-stats-0.1.22.orig/doc/Makefile.in amavis-stats-0.1.22/doc/Makefile.in
+--- amavis-stats-0.1.22.orig/doc/Makefile.in   2006-12-04 14:00:42.000000000 +0100
++++ amavis-stats-0.1.22/doc/Makefile.in        2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/etc/Makefile.in amavis-stats-0.1.22/etc/Makefile.in
+--- amavis-stats-0.1.22.orig/etc/Makefile.in   2006-12-04 14:00:44.000000000 +0100
++++ amavis-stats-0.1.22/etc/Makefile.in        2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/Makefile.in amavis-stats-0.1.22/Makefile.in
+--- amavis-stats-0.1.22.orig/Makefile.in       2006-12-04 13:59:40.000000000 +0100
++++ amavis-stats-0.1.22/Makefile.in    2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/php/Makefile.in amavis-stats-0.1.22/php/Makefile.in
+--- amavis-stats-0.1.22.orig/php/Makefile.in   2006-12-04 14:00:39.000000000 +0100
++++ amavis-stats-0.1.22/php/Makefile.in        2008-05-12 14:38:27.000000000 +0200
+@@ -124,7 +124,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/sbin/amavis-stats.in amavis-stats-0.1.22/sbin/amavis-stats.in
+--- amavis-stats-0.1.22.orig/sbin/amavis-stats.in      2006-01-21 02:25:01.000000000 +0100
++++ amavis-stats-0.1.22/sbin/amavis-stats.in   2008-05-12 14:38:57.000000000 +0200
+@@ -59,6 +59,7 @@
+               Exporter POSIX Fcntl Errno Carp Time::HiRes
+               Unix::Syslog RRDp RRDs IO::File
+               warnings Time::localtime Time::Local
++              Compress::Zlib
+       ));
+ }
  
- #
-+#
-+#
-+sub parseFilegz {
-+
-+    my ($fname, $start) = @_;
-+    dbg("parseFilegz ($fname, $start)");
-+
-+    #
-+    # Open up the file we need to parse
-+    #
-+    my $gz = gzopen ($fname, "rb");
-+    if (!defined($gz))
-+    {
-+      err("Couldn't open logfile $fname"); 
-+        exit 2; 
-+    }
-+
-+    #
-+    # Loop each line until the current end of file
-+    #
-+    $pos = 0;
-+    while ($pos < $start) {
-+      $pos += $gz->gzreadline($line);
-+    }
-+    my $lineid = 0;
-+    my $p = 0;
-+    do {
-+      $p = $gz->gzreadline($line);
-+      $pos += $p;
+@@ -843,6 +844,7 @@
+ use Unix::Syslog qw(:macros :subs);
+ use IO::File ();
+ use File::Basename;
++use Compress::Zlib;
+ BEGIN {
+       import AmavisStats::Conf qw(:platform $myversion $myhostname $daemon_user);
+@@ -1596,6 +1598,55 @@
+       }
++      sub parseFilegz {
 +
-+      if ($p > 0) {
-+              $lineid++;
-+              $lastepoch = $epoch;
++              my ($fname, $start) = @_;
++              do_log(2, "parseFilegz($fname, $start)");
 +
-+              if ($line =~ /amavis.*?\[\d+\]:/) {
-+                  classify();
++              #
++              # Open up the file we need to parse
++              #
++              unless (my $gz = gzopen ($fname, "rb") {
++                      do_log(1, "ERROR : Could not open file $fname: $!"); 
 +              }
++
 +              #
-+              # Save the current statistics every 1000 lines. This way
-+              # if the program dies we don't have to start again from the 
-+              # beginning each time. Also good for monitoring the graphs
-+              # to see where we are up to.
++              # Loop each line until the current end of file
 +              #
-+              if (!($lineid % 1000)) {
-+                  saveState();;
++              $pos = 0;
++              while ($pos < $start) {
++                      $pos += $gz->gzreadline($line);
 +              }
-+      }
-+    } while $p > 0;
-+    $gz->gzclose();
-+}
 +
++              my $lineid = 0;
++              my $p = 0;
++
++              do {
++                      $p = $gz->gzreadline($line);
++                      $pos += $p;
++
++                      if ($p > 0) {
++                              $lineid++;
++                              $lastepoch = $epoch;
 +
-+#
- # Find the previous (rotated) log file and parse that according to
- # our last position
- #
-@@ -720,18 +774,63 @@
++                              if ($line =~ /amavis.*?\[\d+\]:/) {
++                                      classify();
++                              }
++
++                              #
++                              # Save the current statistics every 1000 lines. This way
++                              # if the program dies we don't have to start again from the 
++                              # beginning each time. Also good for monitoring the graphs
++                              # to see where we are up to.
++                              #
++                              if (!($lineid % 1000)) {
++                                      saveState();;
++                              }
++                      }
++              } while $p > 0;
++              $gz->gzclose();
++      }
++
+       sub parseRotFile { 
+               do_log(5, "DEBUG : parseRotFile()");
+               my ($scan_logfile, $spos) = @_;
+@@ -1614,25 +1665,65 @@
  
-     if (-f "$logfile.0") {
-         $rotlogfile = $logfile . ".0";
-+    } elsif (-f "$logfile.0.gz") {
-+        $rotlogfile = $logfile . ".0.gz";
-     } elsif (-f "$logfile.1") {
-         $rotlogfile = $logfile . ".1";
-+    } elsif (-f "$logfile.1.gz") {
-+        $rotlogfile = $logfile . ".1.gz";
-     } elsif (-f "$logfile.01") {
-         $rotlogfile = $logfile . ".01";
-+    } elsif (-f "$logfile.01.gz") {
-+        $rotlogfile = $logfile . ".01.gz";
-     } elsif (-f "$logfile-$today") {
-         $rotlogfile = $logfile . "-$today";
-+    } elsif (-f "$logfile-$today.gz") {
-+        $rotlogfile = $logfile . "-$today.gz";
-     } elsif (-f "$logfile-$yesterday") {
-         $rotlogfile = $logfile . "-$yesterday";
-+    } elsif (-f "$logfile-$yesterday.gz") {
-+        $rotlogfile = $logfile . "-$yesterday.gz";
-+    } else {
-+           $rotlogfile = $logfile;
-+#          $rotlogfile =~ s/(.*)\/([a-z]*)/$1\/archiv\/$2/g;
-+           $rotlogfile =~ s/\/var\/log\/(.*)/\/var\/log\/archiv\/$1/g;
-+           if ($rotlogfile eq $logfile) {
-+                   $rotlogfile = "archiv/$logfile";
-+           }
-+           if (-f "$rotlogfile.0") {
-+                   $rotlogfile = $rotlogfile . ".0";
-+           } elsif (-f "$rotlogfile.0.gz") {
-+                   $rotlogfile = $rotlogfile . ".0.gz";
-+           } elsif (-f "$rotlogfile.1") {
-+                   $rotlogfile = $rotlogfile . ".1";
-+           } elsif (-f "$rotlogfile.1.gz") {
-+                   $rotlogfile = $rotlogfile . ".1.gz";
-+           } elsif (-f "$rotlogfile.01") {
-+                   $rotlogfile = $rotlogfile . ".01";
-+           } elsif (-f "$rotlogfile.01.gz") {
-+                   $rotlogfile = $rotlogfile . ".01.gz";
-+           } elsif (-f "$rotlogfile-$today") {
-+                   $rotlogfile = $rotlogfile . "-$today";
-+           } elsif (-f "$rotlogfile-$today.gz") {
-+                   $rotlogfile = $rotlogfile . "-$today.gz";
-+           } elsif (-f "$rotlogfile-$yesterday") {
-+                   $rotlogfile = $rotlogfile . "-$yesterday";
-+           } elsif (-f "$rotlogfile-$yesterday.gz") {
-+                   $rotlogfile = $rotlogfile . "-$yesterday.gz";
-+           }
-+           if (! -f $rotlogfile) {
-+                   $rotlogfile = undef;
-+           }
-     }
+               my $rotlogfile = undef;
  
-     if (defined $rotlogfile) {
--        parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
-+       if ( $rotlogfile =~ /\.gz$/ ) {
-+               parseFilegz ($rotlogfile, $spos);
-+       } else {
-+               parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
-+       }
-     } else {
-         err("Could not open rotated logfile.");
-         err("  Tried extentions .0, .1, .01, -$today, -$yesterday");
-@@ -854,7 +953,11 @@
-     $spos = 0; # reset to the start of the file
- }
+-              if (! -f "$scan_logfile.0" && -f "$scan_logfile.0.gz" ) {
+-                      do_log(2 , "copying $scan_logfile.0.gz -> $scan_logfile.0");
+-                      `gzcat "$scan_logfile.0.gz" > "$scan_logfile.0"`;
+-              }
+-              
+               if (-f "$scan_logfile.0") {
+                       $rotlogfile = $scan_logfile . ".0";
++              } elsif (-f "$scan_logfile.0.gz") {
++                      $rotlogfile = $scan_logfile . ".0.gz";
+               } elsif (-f "$scan_logfile.1") {
+                       $rotlogfile = $scan_logfile . ".1";
++              } elsif (-f "$scan_logfile.1.gz") {
++                      $rotlogfile = $scan_logfile . ".1.gz";
+               } elsif (-f "$scan_logfile.01") {
+                       $rotlogfile = $scan_logfile . ".01";
++              } elsif (-f "$scan_logfile.01.gz") {
++                      $rotlogfile = $scan_logfile . ".01.gz";
+               } elsif (-f "$scan_logfile-$today") {
+                       $rotlogfile = $scan_logfile . "-$today";
++              } elsif (-f "$scan_logfile-$today.gz") {
++                      $rotlogfile = $scan_logfile . "-$today.gz";
+               } elsif (-f "$scan_logfile-$yesterday") {
+                       $rotlogfile = $scan_logfile . "-$yesterday";
++              } elsif (-f "$scan_logfile-$yesterday.gz") {
++                      $rotlogfile = $scan_logfile . "-$yesterday.gz";
++              } else {
++                      $rotlogfile = $logfile;
++                      # $rotlogfile =~ s/(.*)\/([a-z]*)/$1\/archiv\/$2/g;
++                      $rotlogfile =~ s/\/var\/log\/(.*)/\/var\/log\/archive\/$1/g;
++                      if ($rotlogfile eq $logfile) {
++                              $rotlogfile = "archiv/$logfile";
++                      }
++                      if (-f "$rotlogfile.0") {
++                              $rotlogfile = $rotlogfile . ".0";
++                      } elsif (-f "$rotlogfile.0.gz") {
++                              $rotlogfile = $rotlogfile . ".0.gz";
++                      } elsif (-f "$rotlogfile.1") {
++                              $rotlogfile = $rotlogfile . ".1";
++                      } elsif (-f "$rotlogfile.1.gz") {
++                              $rotlogfile = $rotlogfile . ".1.gz";
++                      } elsif (-f "$rotlogfile.01") {
++                              $rotlogfile = $rotlogfile . ".01";
++                      } elsif (-f "$rotlogfile.01.gz") {
++                              $rotlogfile = $rotlogfile . ".01.gz";
++                      } elsif (-f "$rotlogfile-$today") {
++                              $rotlogfile = $rotlogfile . "-$today";
++                      } elsif (-f "$rotlogfile-$today.gz") {
++                              $rotlogfile = $rotlogfile . "-$today.gz";
++                      } elsif (-f "$rotlogfile-$yesterday") {
++                              $rotlogfile = $rotlogfile . "-$yesterday";
++                      } elsif (-f "$rotlogfile-$yesterday.gz") {
++                              $rotlogfile = $rotlogfile . "-$yesterday.gz";
++                      }
++                      if (! -f $rotlogfile) {
++                              $rotlogfile = undef;
++                      }
+               }
+               if (defined $rotlogfile) {
+-                      parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
++                      if ($rotlogfile =~ /\.gz$/) {
++                              parseFilegz ($rotlogfile, $spos);
++                      } else {
++                              parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]);
++                      }
+               } else {
+                       do_log(1, "ERROR : Could not open rotated logfile.");
+                       do_log(1, "ERROR :      Tried extentions .0.gz, .0, .1, .01, -$today, -$yesterday");
+@@ -1803,7 +1894,11 @@
+                       }
  
-+if ( $logfile =~ /\.gz$/ ) {
-+parseFilegz ($logfile, $spos);
-+} else {
- parseFile ($logfile, $spos, $eof);
-+}
- saveState();
- semunlock();
+                       do_log(5, "DEBUG : $scan_logfile, $spos, $eof");
+-                      parseFile ($scan_logfile, $spos, $eof);
++                      if ($scan_logfile =~ /\.gz$/) {
++                              parseFilegz ($scan_logfile, $spos);
++                      } else {
++                              parseFile ($scan_logfile, $spos, $eof);
++                      }
  
+                       saveState();
+                       do_log(1, sprintf("Finished -> %s", $scan_domains eq '.*' ? 'localhost' : $scan_domains));
+diff -urN amavis-stats-0.1.22.orig/sbin/Makefile.in amavis-stats-0.1.22/sbin/Makefile.in
+--- amavis-stats-0.1.22.orig/sbin/Makefile.in  2006-12-04 14:00:49.000000000 +0100
++++ amavis-stats-0.1.22/sbin/Makefile.in       2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/share/Makefile.in amavis-stats-0.1.22/share/Makefile.in
+--- amavis-stats-0.1.22.orig/share/Makefile.in 2006-12-04 14:00:47.000000000 +0100
++++ amavis-stats-0.1.22/share/Makefile.in      2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
+diff -urN amavis-stats-0.1.22.orig/startup/Makefile.in amavis-stats-0.1.22/startup/Makefile.in
+--- amavis-stats-0.1.22.orig/startup/Makefile.in       2006-12-04 14:02:26.000000000 +0100
++++ amavis-stats-0.1.22/startup/Makefile.in    2008-05-12 14:38:27.000000000 +0200
+@@ -108,7 +108,6 @@
+ GCJ = @GCJ@
+ GCJFLAGS = @GCJFLAGS@
+ GETENT = @GETENT@
+-GZCAT = @GZCAT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LIBTOOL = @LIBTOOL@
+ LINK_CMD = @LINK_CMD@
This page took 0.070068 seconds and 4 git commands to generate.