rpms/swatch/FC-4 swatch-3.1.1.patch,NONE,1.1 swatch.spec,1.8,1.9

Jose Pedro Oliveira (jpo) fedora-extras-commits at redhat.com
Thu Jan 5 17:14:21 UTC 2006


Author: jpo

Update of /cvs/extras/rpms/swatch/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26643/FC-4

Modified Files:
	swatch.spec 
Added Files:
	swatch-3.1.1.patch 
Log Message:
Sync with devel

swatch-3.1.1.patch:

--- NEW FILE swatch-3.1.1.patch ---
diff -ruN swatch-3.1.1-orig/swatch swatch-3.1.1/swatch
--- swatch-3.1.1-orig/swatch	2004-07-19 21:14:54.000000000 +0100
+++ swatch-3.1.1/swatch	2005-08-29 20:52:13.000000000 +0100
@@ -32,7 +32,7 @@
 [ B<--input-record-separator> I<regex> ] 
 [ [ B<--examine> I<file_to_examine> ] 
 | [ B<--read-pipe> I<program_to_pipe_from> ] 
-| [ B<--tail> I<file_to_tail> ] ]
+| [ B<--tail-file> I<file_to_tail> ] ]
 [ B<--daemon> ] 
 [ B<--use-cpan-file-tail> ]
 [ B<--awk-field-syntax> ]
@@ -68,7 +68,7 @@
 
 Restart at the specified time where I<hh> is hours and I<mm> is minutes. 
 If the am/pm indicator is omitted, then a 24-hour clock is assumed. 
-If the time is preceeded by the "+" character, then the restart time 
+If the time is preceded by the "+" character, then the restart time 
 will be set to the current time plus the specified time and the am/pm
 indicator will be ignored.
 
@@ -124,18 +124,12 @@
 If swatch is called with no options, it is the same as typing the 
 command line
 
-=over 5
-
-=item
-
-C<swatch --config-file=~/.swatchrc --tail-file=/var/log/syslog>
+     swatch --config-file=~/.swatchrc --tail-file=/var/log/syslog
 
 or if /var/log/messages exists
 
-C<swatch --config-file=~/.swatchrc --tail-file=/var/log/messages>
-
+     swatch --config-file=~/.swatchrc --tail-file=/var/log/messages
 
-=back
 
 If the configuration file doesn't exist then the following configuration
 is used:
@@ -152,7 +146,7 @@
 
 Each line should contain a keyword and a, sometimes optional,
 value for that keyword. The keyword and value are separated by 
-space or an equal (=) sign.
+a space or an equal (=) sign.
 
 watchfor regex
 
@@ -162,7 +156,7 @@
 
 =item B<echo [modes]>
 
-.Echo the matched line. The text mode may be I<normal>,
+Echo the matched line. The text mode may be I<normal>,
 I<bold>, I<underscore>, I<blink>, I<inverse>, 
 I<black>, I<red>, I<green>, I<yellow>, I<blue>, I<magenta>, I<cyan>, I<white>,
 I<black_h>, I<red_h>, I<green_h>, I<yellow_h>, I<blue_h>, 
@@ -180,7 +174,7 @@
 Execute I<command>. The I<command> may contain variables which are 
 substituted with fields from the matched line. A I<$N> will be replaced
 by the I<Nth> field in the line. A I<$0> or I<$*> will be replaced by the
- entire line.
+entire line.
 
 =item B<mail [addresses=address:address:...][,subject=your_text_here]>
 
@@ -197,7 +191,7 @@
 
 Use B<write(1)> to send matched lines to I<user(s)>.
 
-=item B<throttle hours:minutes:seconds,[use=message|regex|<regex>]>
+=item B<throttle hours:minutes:seconds,[use=message|regex|<regexE<gt>]>
 
 Use this action to limit the number of times that the matched pattern 
 has actions performed on it.
@@ -205,7 +199,15 @@
 The B<use=regex> option will cause throttling to be based on the regular
 expression instead of the message.
 
-You can also specify a perl compliant regular expression as the value for B,use>. The default is use="^\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}\s+(.*)" causes the key to be the syslog message without the timestamp. This is most useful when throttling non-syslog created files.
+You can also specify a perl compliant regular expression as the value for B<use>. The default is
+
+=over 4
+
+use="^\w{3}\s+\d{1,2}\s\d{2}:\d{2}:\d{2}\s+(.*)"
+
+=back
+
+and causes the key to be the syslog message without the timestamp. This is most useful when throttling non-syslog created files.
 
 =item B<threshold events:seconds,[repeat=no|yes]>
 
@@ -223,7 +225,7 @@
  
 Note that this is similar to, but different from, the standard "throttle"
 command, since "throttle" shows the first line and ignores the rest, while
-"threshold" shows the last line and ignores the preceeding (and optionally
+"threshold" shows the last line and ignores the preceding (and optionally
 the following).  However, an action like "threshold 1:120" should perform
 similarly to "throttle 0:2:0,use=regex" and has the advantage of not relying
 on a particular timestamp format in the source log entry.
@@ -268,9 +270,13 @@
 conditional used by the current watchfor statement, and 3=inside the throttle
 block).
 
-Its intended use is to permit variable substitution through use like.
+Its intended use is to permit variable substitution. For example:
+
+=over 4
+
+perlcode $syslog="^\w{3}\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}.*";
 
-C<perlcode $syslog="^\w{3}\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}.*";>
+=back
  
 watchfor /$syslog hostname pppd/>
  
@@ -315,7 +321,7 @@
 
 =head1 NOTES
 
-Upon receiving a ALRM or HUP signal swatch will re-read the
+Upon receiving an ALRM or HUP signal swatch will re-read the
 configuration file and restart, except when used with the I<--daemon> 
 command line option where it will simply exit.
 Swatch will terminate gracefully
@@ -382,7 +388,8 @@
 my @Swatch_ARGV = join(' ', $0, @ARGV); # Save just in case we need to restart 
 (my $Me = $0) =~ s%.*/%%;	      # Strip the path off of the program name
 
-$SIG{'CHLD'} = 'IGNORE';
+#$SIG{'CHLD'} = 'IGNORE';
+$SIG{'CHLD'} = 'DEFAULT';
 
 my $DEF_CONFIG_FILE = "$ENV{'HOME'}/.swatchrc";
 my $DEF_INPUT;
@@ -406,13 +413,13 @@
     --config-file=FILENAME               Use FILENAME for configuration.
     --old-style-config                   Parse a pre-version 3 configuration.
     --restart-time=[+]HH:MM[AM|PM]       Send a HUP signal to swatch at the specified time.
-    --input-record-separator=REGEX       Specify an what should be used to separate "lines."
+    --input-record-separator=REGEX       Specify what should be used to separate "lines."
     --help                               Display this message.
     --version                            Display author and version information.
     --tail-file=FILENAME                 Watch a tail of FILENAME.
-    --read-pipe=COMMAND                  Watch a pipe from COMMAND
-    --examine=FILENAME                   Perform a single pass through FILENAME
-    --pid-file=FILENAME			 File to write pid of process to
+    --read-pipe=COMMAND                  Watch a pipe from COMMAND.
+    --examine=FILENAME                   Perform a single pass through FILENAME.
+    --pid-file=FILENAME			 File to write pid of process to.
     --use-cpan-file-tail                 Use the File::Tail CPAN module to read the log file.
 /;
 
@@ -566,8 +573,8 @@
     s/^\s+//; ## strip off leading blank space
     s/\s+$//; ## strip off trailing blank space
 
-    ### Skip comments blank lines ###
-    next if (/^\#/ or /^\s*$/);
+    ### Skip comments and blank lines ###
+    next if (/^\#/ or /^$/);
 
     s/\#.*$//; ## strip trailing comments
 
@@ -746,7 +753,8 @@
 /;
 
 \$SIG{'TERM'} = \$SIG{'HUP'} = 'goodbye';
-\$SIG{'CHLD'} = 'IGNORE';
+##\$SIG{'CHLD'} = 'IGNORE';
+\$SIG{'CHLD'} = 'DEFAULT';
 
 ## Constants
 (my \$Me = \$0) =~ s%.*/%%;
@@ -759,7 +767,7 @@
 my \$swatch_last_flush = time;
 
 use IO::Handle;
-STDOUT->autoflush(1);;
+STDOUT->autoflush(1);
 
 sub goodbye {
   \$| = 0;
@@ -959,8 +967,13 @@
     } else {
       my $opt = $v;
       $opt =~ s/@/\\@/g;
-      $opt =~ s/^['" ]*//;
-      $opt =~ s/['" ]*$//;
+#     $opt =~ s/^['" ]*//;
+#     $opt =~ s/['" ]*$//;
+      $opt =~ s/^\s+//o;
+      $opt =~ s/\s+$//o;
+      $opt = $1 if ($opt =~ /^['"]\s*(.*)\s*['"]$/o);
+      $opt =~ s/"/\\"/go;
+
       if ($actinfo->{$key}{'def_arg'} eq 'MODES') { 
         ## Modes are processed as an array ##
 	push(@{$options{$actinfo->{$key}{'def_arg'}}}, $opt);
@@ -1038,7 +1051,7 @@
   }
 #  $command =~ s/\$([0-9]+)/\$_[$1]/g;
 
-  return join(' ', @new_cmd);;
+  return join(' ', @new_cmd);
 }
 
  


Index: swatch.spec
===================================================================
RCS file: /cvs/extras/rpms/swatch/FC-4/swatch.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- swatch.spec	12 May 2005 23:27:11 -0000	1.8
+++ swatch.spec	5 Jan 2006 17:14:21 -0000	1.9
@@ -1,12 +1,13 @@
 Name:           swatch
 Version:        3.1.1
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Tool for actively monitoring log files
 
 Group:          Applications/File
 License:        GPL
 URL:            http://swatch.sourceforge.net/
 Source0:        http://dl.sf.net/swatch/swatch-3.1.1.tar.gz
+Patch0:         swatch-3.1.1.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
@@ -24,6 +25,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 chmod 644 tools/*
 
 %build
@@ -39,7 +41,7 @@
 chmod -R u+w $RPM_BUILD_ROOT/*
 
 
-%check ||:
+%check
 make test
 
 
@@ -58,6 +60,9 @@
 
 
 %changelog
+* Thu Jan  5 2006 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.1.1-4
+- Patch supplied by John Horne: doc updates and $0 handling (#160817).
+
 * Thu May 12 2005 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.1.1-3
 - Add dist tag.
 




More information about the fedora-extras-commits mailing list