[bacula/el5] Fix for rhbz#643932 and rhbz#718299

Simone Caronni slaanesh at fedoraproject.org
Thu Jul 19 13:00:23 UTC 2012


commit 968fb6d4fb8ef7438f2299553ca8b95b5ffa19f6
Author: Simone Caronni <negativo17 at gmail.com>
Date:   Thu Jul 19 14:59:43 2012 +0200

    Fix for rhbz#643932 and rhbz#718299

 bacula-2.4.4-fix-logwatch.patch |  206 +++++++++++++++++++++++++++++++++++++++
 bacula.spec                     |    9 +-
 2 files changed, 212 insertions(+), 3 deletions(-)
---
diff --git a/bacula-2.4.4-fix-logwatch.patch b/bacula-2.4.4-fix-logwatch.patch
new file mode 100644
index 0000000..be191d6
--- /dev/null
+++ b/bacula-2.4.4-fix-logwatch.patch
@@ -0,0 +1,206 @@
+diff -Naur bacula-2.4.4.old/null bacula-2.4.4/null
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ bacula-2.4.4/scripts/logwatch/applybaculadate	2012-07-19 14:50:03.298459699 +0200
+@@ -0,0 +1,92 @@
++#!/usr/bin/perl
++
++########################################################################
++## Copyright (c) 2009 Sigma Consulting Services Limited
++## v1.00 2009/06/21 16:54:23 Ian McMichael
++##
++## This program is free software: you can redistribute it and/or modify
++## it under the terms of the GNU General Public License as published by
++## the Free Software Foundation, either version 2 of the License, or
++## any later version.
++##
++## This program is distributed in the hope that it will be useful,
++## but WITHOUT ANY WARRANTY; without even the implied warranty of
++## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++## GNU General Public License for more details.
++##
++## You should have received a copy of the GNU General Public License
++## along with this program.  If not, see <http://www.gnu.org/licenses/>.
++########################################################################
++
++use Logwatch ':dates';
++
++my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
++
++$SearchDate = TimeFilter('%d-%b %H:%M');
++
++if ( $Debug > 5 ) {
++   print STDERR "DEBUG: Inside ApplyBaculaDate...\n";
++   print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
++}
++
++my $OutputLine = 0;
++
++while (defined($ThisLine = <STDIN>)) {
++   if ($ThisLine =~ m/^$SearchDate /o) {
++      $OutputLine = 1;
++   } elsif ($ThisLine !~ m/^\s+/o) {
++      $OutputLine = 0;
++   }
++
++   if ($OutputLine) {
++      print $ThisLine;
++   }
++}
++
++# vi: shiftwidth=3 syntax=perl tabstop=3 et
++#!/usr/bin/perl
++
++########################################################################
++## Copyright (c) 2009 Sigma Consulting Services Limited
++## v1.00 2009/06/21 16:54:23 Ian McMichael
++##
++## This program is free software: you can redistribute it and/or modify
++## it under the terms of the GNU General Public License as published by
++## the Free Software Foundation, either version 2 of the License, or
++## any later version.
++##
++## This program is distributed in the hope that it will be useful,
++## but WITHOUT ANY WARRANTY; without even the implied warranty of
++## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++## GNU General Public License for more details.
++##
++## You should have received a copy of the GNU General Public License
++## along with this program.  If not, see <http://www.gnu.org/licenses/>.
++########################################################################
++
++use Logwatch ':dates';
++
++my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
++
++$SearchDate = TimeFilter('%d-%b %H:%M');
++
++if ( $Debug > 5 ) {
++   print STDERR "DEBUG: Inside ApplyBaculaDate...\n";
++   print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
++}
++
++my $OutputLine = 0;
++
++while (defined($ThisLine = <STDIN>)) {
++   if ($ThisLine =~ m/^$SearchDate /o) {
++      $OutputLine = 1;
++   } elsif ($ThisLine !~ m/^\s+/o) {
++      $OutputLine = 0;
++   }
++
++   if ($OutputLine) {
++      print $ThisLine;
++   }
++}
++
++# vi: shiftwidth=3 syntax=perl tabstop=3 et
+diff -Naur bacula-2.4.4.old/scripts/logwatch/bacula bacula-2.4.4/scripts/logwatch/bacula
+--- bacula-2.4.4.old/scripts/logwatch/bacula	2012-07-19 14:48:12.725285088 +0200
++++ bacula-2.4.4/scripts/logwatch/bacula	2012-07-19 14:49:23.998686777 +0200
+@@ -11,18 +11,8 @@
+ use strict;
+ use POSIX qw(strftime);
+ 
+-my (@JobName,$JobStatus,$ThisName,$ThisStatus,$ThisDate,$SearchDate);
+-my ($Job,$JobId,$JobDate,$Debug,$DebugCounter,%data,$time);
+-
+-# set the logwatch search date we want
+-$time = time;
+-
+-if ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'yesterday') {
+-   $SearchDate = strftime("%Y-%m-%d", localtime($time-86400));
+-}
+-elsif ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'today') {
+-   $SearchDate = strftime("%Y-%m-%d", localtime($time));
+-}
++my (@JobName,$JobStatus,$ThisName,$ThisStatus,$ThisDate);
++my ($Job,$JobId,$JobDate,$Debug,$DebugCounter,%data);
+ 
+ # set debug level
+ $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
+@@ -41,22 +31,22 @@
+ 
+         # Test the line for a new entry, which is a jobid record
+         if (/^\s*JobId:\s+(\d+)/) {
+-                # A new entry.  Test, then save the previous stuff and 
+-                #  set up to grab more.
+-                if ($JobId and $Job and $JobStatus and $JobDate) {
+-                        $data{$JobId} = { 
+-                                "Job" => $Job, 
+-                                "JobStatus" => $JobStatus,
+-                                "JobDate" => $JobDate,
+-                        };
+-                        $Job = $JobStatus = $JobDate = "";
+-                }
+                 $JobId = $1;
+                 next;
+         }
++
+         (/^\s*Job:\s*(.*)/) and $Job = $1; 
+         (/^\s*Termination:\s*(.*)/) and $JobStatus = $1;
+         (/^\s*Job:.*(\d{4}-\d{2}-\d{2})/) and $JobDate = $1;
++
++        if ($JobId and $Job and $JobStatus and $JobDate) {
++                $data{$JobId} = { 
++                        "Job" => $Job, 
++                        "JobStatus" => $JobStatus,
++                        "JobDate" => $JobDate,
++                };
++                $JobId = $Job = $JobStatus = $JobDate = "";
++        }
+ }
+ 
+ # if we have data print it out, otherwise do nothing
+@@ -68,12 +58,7 @@
+                 $ThisDate = $data{$Id}{JobDate};
+                 $ThisName =~ s/\s//g;
+                 $ThisStatus =~ s/\s//g;
+-                if ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'all') {
+-                        $SearchDate = $ThisDate;
+-                }
+-                if ($ThisDate eq $SearchDate) {
+-                        print "$ThisDate $Id $ThisName\n     $ThisStatus\n\n";
+-                }
++                print "$ThisDate $Id $ThisName\n     $ThisStatus\n\n";
+         }
+ }
+ 
+diff -Naur bacula-2.4.4.old/scripts/logwatch/Makefile.in bacula-2.4.4/scripts/logwatch/Makefile.in
+--- bacula-2.4.4.old/scripts/logwatch/Makefile.in	2012-07-19 14:48:12.726285108 +0200
++++ bacula-2.4.4/scripts/logwatch/Makefile.in	2012-07-19 14:49:23.990686620 +0200
+@@ -9,10 +9,12 @@
+ install:
+ 
+ 	$(INSTALL) -m 755 bacula $(DESTDIR)$(SYSCONFDIR)/scripts/services/bacula
++	$(INSTALL) -m 755 applybaculadate $(DESTDIR)$(SYSCONFDIR)/scripts/shared/applybaculadate
+ 	$(INSTALL) -m 644 logfile.bacula.conf $(DESTDIR)$(SYSCONFDIR)/conf/logfiles/bacula.conf
+ 	$(INSTALL) -m 644 services.bacula.conf $(DESTDIR)$(SYSCONFDIR)/conf/services/bacula.conf
+ 
+ uninstall:
+ 	rm -f $(DESTDIR)$(SYSCONFDIR)/scripts/services/bacula
++	rm -f $(DESTDIR)$(SYSCONFDIR)/scripts/shared/applybaculadate
+ 	rm -f $(DESTDIR)$(SYSCONFDIR)/conf/logfiles/bacula.conf
+ 	rm -f $(DESTDIR)$(SYSCONFDIR)/conf/services/bacula.conf
+diff -Naur bacula-2.4.4.old/scripts/logwatch/README bacula-2.4.4/scripts/logwatch/README
+--- bacula-2.4.4.old/scripts/logwatch/README	2012-07-19 14:48:12.726285108 +0200
++++ bacula-2.4.4/scripts/logwatch/README	2012-07-19 14:49:23.991686637 +0200
+@@ -7,9 +7,11 @@
+ For manual install copy the files as indicated below:
+ 
+ cp -p scripts/logwatch/bacula /etc/log.d/scripts/services/bacula
++cp -p scripts/logwatch/bacula /etc/log.d/scripts/shared/applybaculadate
+ cp -p scripts/logwatch/logfile.bacula.conf /etc/log.d/conf/logfiles/bacula.conf
+ cp -p scripts/logwatch/services.bacula.conf /etc/log.d/conf/services/bacula.conf
+ chmod 755 /etc/log.d/scripts/services/bacula
++chmod 755 /etc/log.d/scripts/shared/applybaculadate
+ chmod 644 /etc/log.d/conf/logfiles/bacula.conf
+ chmod 644 /etc/log.d/conf/services/bacula.conf
+ 
+diff -Naur bacula-2.4.4.old/scripts/logwatch/services.bacula.conf bacula-2.4.4/scripts/logwatch/services.bacula.conf
+--- bacula-2.4.4.old/scripts/logwatch/services.bacula.conf	2012-07-19 14:48:12.725285088 +0200
++++ bacula-2.4.4/scripts/logwatch/services.bacula.conf	2012-07-19 14:49:23.998686777 +0200
+@@ -3,3 +3,4 @@
+ # Which logfile group...
+ LogFile = bacula
+ 
++*ApplyBaculaDate =
diff --git a/bacula.spec b/bacula.spec
index 31dd49e..782f4b6 100644
--- a/bacula.spec
+++ b/bacula.spec
@@ -1,10 +1,9 @@
-%global uid 133
 %global username bacula
 
 Summary:        Cross platform network backup for Linux, Unix, Mac and Windows
 Name:           bacula
 Version:        2.4.4
-Release:        4%{?dist}
+Release:        5%{?dist}
 License:        GPL
 Group:          System Environment/Daemons
 URL:            http://www.%{name}.org
@@ -21,6 +20,7 @@ Source9:        %{name}-sd.init
 
 Patch0:         %{name}-2.4.4-director-configuration.patch
 Patch1:         %{name}-2.4.4-config.patch
+Patch2:         %{name}-2.4.4-fix-logwatch.patch
 Patch3:         %{name}-2.4.4-pamd.patch
 
 BuildRequires:  atk-devel
@@ -819,7 +819,6 @@ fi
 %{_sbindir}/%{name}-fd
 %{_initrddir}/%{name}-fd
 %config(noreplace) %{_sysconfdir}/%{name}/%{name}-fd.conf
-%dir %{_localstatedir}/spool/%{name}
 %{_mandir}/man8/%{name}-fd.8*
 
 %files console
@@ -967,6 +966,10 @@ fi
 
 
 %changelog
+* Thu Jul 19 2012 Simone Caronni <negativo17 at gmail.com> 2.4.4-5
+- Spool directory owned only by common subpackage (rhbz#718299).
+- Backport patch from Bacula 3.0.2 to fix logwatch (rhbz#643932).
+
 * Wed Jul 18 2012 Simone Caronni <negativo17 at gmail.com> 2.4.4-4
 - Remove fedora-usermgmt entirely, see thread at:
   http://lists.fedoraproject.org/pipermail/packaging/2011-December/008034.html


More information about the scm-commits mailing list