rpms/xpilot-ng/FC-6 logwatch.logconf.xpilot, NONE, 1.1 logwatch.script.xpilot, NONE, 1.1 logwatch.serviceconf.xpilot, NONE, 1.1 logwatch.shared.applyxpilotdate, NONE, 1.1 xpilot-ng-4.7.2-scoreassert.patch, NONE, 1.1 xpilot-ng.spec, 1.9, 1.10

Michael Thomas (wart) fedora-extras-commits at redhat.com
Fri Feb 23 07:07:24 UTC 2007


Author: wart

Update of /cvs/extras/rpms/xpilot-ng/FC-6
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19047

Modified Files:
	xpilot-ng.spec 
Added Files:
	logwatch.logconf.xpilot logwatch.script.xpilot 
	logwatch.serviceconf.xpilot logwatch.shared.applyxpilotdate 
	xpilot-ng-4.7.2-scoreassert.patch 
Log Message:
- Add patch to prevent crash when running with robots not in idle mode
- Added logwatch files
- Switch from fedora-usermgmt to vanilla useradd




--- NEW FILE logwatch.logconf.xpilot ---
##########################################################################
##########################################################################

# What actual file?  Defaults to LogPath if not absolute path....
LogFile = /var/log/xpilot.log

# Keep only the lines in the proper date range...
*ApplyXpilotDate

# Search the rotated log files
Archive = xpilot.log.*

# vi: shiftwidth=3 tabstop=3 et


--- NEW FILE logwatch.script.xpilot ---
##########################################################################
##########################################################################

use strict;

my ($pilot, $user, $ip, $version, $reason, $Msg, $total);
my %Start = ();
my %Login = ();
my %TakeChar = ();
my %Ping = ();
my %Logout = ();

my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

# Interesting events:
#19 Feb 17:11:10 Server runs at 50 frames per second
#21 Feb 05:54:27 Welcome Man=Tiago at UR| (217.129.39.100/3086) (version 4501)
#21 Feb 05:54:28 Man (6) starts at startpos 0.
#21 Feb 05:54:46 Checking Address:(217.129.39.100)
#21 Feb 05:54:47 Checking Address:(217.129.39.100)
#21 Feb 05:54:50 Checking Address:(217.129.39.100)
#21 Feb 05:54:50 Checking Address:(217.129.39.100)
#21 Feb 05:55:18 Goodbye Man=Tiago at UR| ("timeout 08")



while (defined(my $ThisLine = <STDIN>)) {
   chomp($ThisLine);
   if ( ($Msg) = ($ThisLine =~ /Server runs at .*$/)) {
      $Start{$Msg}++;
   } elsif ( ($pilot,$user,$ip,$version) = ($ThisLine =~ /Welcome ([^=]+)=([^|]+)\| \(([^\)]+)\) \(([^\)]+)\)$/)) {
      $Login{$pilot}{$user}{$ip}{$version}++;
   } elsif ( ($pilot) = ($ThisLine =~ /([^ ]+) \(\d+\) starts at startpos/)) {
      $TakeChar{$pilot}++;
   } elsif ( ($ip) = ($ThisLine =~ /Checking Address:\((.*)\)$/)) {
      $Ping{$ip}++;
   } elsif ( ($pilot,$user,$reason) = ($ThisLine =~ /Goodbye ([^=]+)=([^|]+)\| \((.*)\)$/)) {
      $Logout{$pilot}{$user}{$reason}++;
   }  
}

if (keys %Start) {
   if ($Detail >= 5) {
      foreach my $Msg (sort keys %Start) {
         if ($Start{$Msg} > 1) {
            print "Server started ($Start{$Msg} times)\n";
         } else {
            print "Server started once\n";
         }
      }
   } else {
      my $total;
      foreach my $Msg (keys %Start) {
         $total += $Start{$Msg};
      }
      print "Server started $total times\n";
   }
}

if (keys %Login) {
   print "\n";
   if ($Detail >= 5) {
      foreach my $pilot (sort keys %Login) {
         foreach my $user (sort keys %{ $Login{$pilot} }) {
            my $total=0;
            foreach my $ip (keys %{ $Login{$pilot}{$user} }) {
               foreach my $version (keys %{ $Login{$pilot}{$user}{$ip} }) {
                  $total += $Login{$pilot}{$user}{$ip}{$version};
               }
            }
            print "Pilot $pilot ($user) logged in $total times\n";
         }
      }
   } else {
      my $total;
      foreach my $pilot (keys %Login) {
         foreach my $user (keys %{ $Login{$pilot} }) {
            foreach my $ip (keys %{ $Login{$pilot}{$user} }) {
               foreach my $version (keys %{ $Login{$pilot}{$user}{$ip} }) {
                  $total += $Login{$pilot}{$user}{$ip}{$version};
               }
            }
         }
      }
      print "$total users logged in\n";
   }
}

if (keys %TakeChar) {
   print "\n";
   if ($Detail >= 5) {
      foreach my $pilot (sort keys %TakeChar) {
         if ($TakeChar{$pilot} > 1) {
            print "Player $pilot joined $TakeChar{$pilot} times\n"
         } else {
            print "Player $pilot joined once\n"
         }
      }
   } else {
      my $total=0;
      foreach my $pilot (keys %TakeChar) {
         $total += $TakeChar{$pilot};
      }
      print "$total players entered the world\n";
   }
}

if (keys %Logout) {
   print "\n";
   if ($Detail >= 5) {
      foreach my $pilot (sort keys %Logout) {
         foreach my $user (sort keys %{ $Logout{$pilot} }) {
            foreach my $reason (keys %{ $Logout{$pilot}{$user} }) {
               print "Pilot $pilot ($user) logged out $Logout{$pilot}{$user}{$reason} times ($reason)\n";
            }
         }
      }
   } else {
      my $total=0;
      foreach my $pilot (keys %Logout) {
         foreach my $user (keys %{ $Logout{$pilot} }) {
            foreach my $reason (keys %{ $Logout{$pilot}{$user} }) {
               $total += $Logout{$pilot}{$user}{$reason};
            }
         }
      }
      print "$total users logged out\n";
   }
}

if (keys %Ping) {
   print "\n";
   if ($Detail >= 5) {
      foreach my $ip (sort keys %Ping) {
         if ($Ping{$ip} > 1) {
            printf "Pinged %-16s %3d times\n", ($ip,$Ping{$ip})
         } else {
            printf "Pinged %-16s once\n", ($ip)
         }
      }
   } else {
      my $total=0;
      foreach my $ip (keys %Ping) {
         $total += $Ping{$ip};
      }
      print "Pinged " . keys(%Ping) . " hosts $total times\n";
   }
}


exit(0);

# vi: shiftwidth=3 tabstop=3 syntax=perl et



--- NEW FILE logwatch.serviceconf.xpilot ---
###########################################################################
###########################################################################

# You can put comments anywhere you want to.  They are effective for the
# rest of the line.

# this is in the format of <name> = <value>.  Whitespace at the beginning
# and end of the lines is removed.  Whitespace before and after the = sign
# is removed.  Everything is case *insensitive*.

# Yes = True  = On  = 1
# No  = False = Off = 0

Title = "Xpilot"

# Which logfile group...
LogFile = xpilot-ng

# vi: shiftwidth=3 tabstop=3 et


--- NEW FILE logwatch.shared.applyxpilotdate ---
##########################################################################
##########################################################################

use Logwatch ':dates';

my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;

$SearchDate = TimeFilter('%d %b %H:%M:%S');

if ( $Debug > 5 ) {
   print STDERR "DEBUG: Inside ApplyXpilotDate...\n";
   print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
}

while (defined($ThisLine = <STDIN>)) {
   if ($ThisLine =~ m/^$SearchDate /o) {
      print $ThisLine;
   }
}

# vi: shiftwidth=3 syntax=perl tabstop=3 et

xpilot-ng-4.7.2-scoreassert.patch:

--- NEW FILE xpilot-ng-4.7.2-scoreassert.patch ---
--- src/server/score.c.orig	2006-10-20 11:38:01.000000000 -0700
+++ src/server/score.c	2006-10-20 12:44:30.000000000 -0700
@@ -257,9 +257,13 @@
 		sc = Rate(cannon->score, Get_Score(victim))
 		    * options.cannonKillScoreMult;
 	    else {
-		assert(((object_t *) extra)->id == NO_ID);
-		sc = Rate(UNOWNED_SCORE, Get_Score(victim))
-		    * options.cannonKillScoreMult;
+		//assert(((object_t *) extra)->id == NO_ID);
+		if ( ((object_t *) extra)->id != NO_ID) {
+                    fprintf(stderr, "((object_t *) extra)->id == NO_ID assertion failed\n");
+                } else {
+                    sc = Rate(UNOWNED_SCORE, Get_Score(victim))
+                        * options.cannonKillScoreMult;
+                }
 	    }
 	} else if (((object_t *) extra)->id == NO_ID) {
 	    sc = Rate(0.0,


Index: xpilot-ng.spec
===================================================================
RCS file: /cvs/extras/rpms/xpilot-ng/FC-6/xpilot-ng.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- xpilot-ng.spec	30 Aug 2006 04:10:38 -0000	1.9
+++ xpilot-ng.spec	23 Feb 2007 07:06:52 -0000	1.10
@@ -1,9 +1,13 @@
 %define selinux_variants mls strict targeted
 %define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp)
 
+%define logwatch_root %{_datadir}/logwatch
+%define logwatch_conf %{logwatch_root}/dist.conf
+%define logwatch_scripts %{logwatch_root}/scripts
+
 Name:           xpilot-ng
 Version:        4.7.2
-Release:        10%{?dist}
+Release:        11%{?dist}
 Summary:        Multiplayer space arcade game
 
 Group:          Amusements/Games
@@ -19,15 +23,17 @@
 Source7:        xpilotd.te
 Source8:        xpilotd.fc
 Source9:        xpilotd.if
+Source10:       logwatch.logconf.xpilot
+Source11:       logwatch.script.xpilot
+Source12:       logwatch.serviceconf.xpilot
+Source13:       logwatch.shared.applyxpilotdate
+Patch0:         xpilot-ng-4.7.2-scoreassert.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  desktop-file-utils
 BuildRequires:  expat-devel SDL_ttf-devel SDL_image-devel zlib-devel
 BuildRequires:  libXt-devel libGLU-devel libXxf86misc-devel
 BuildRequires:  selinux-policy-devel hardlink checkpolicy
-%if "%{selinux_policyver}" != ""
-Requires:       selinux-policy >= %{selinux_policyver}
-%endif
 
 %description
 A highly addictive, infinitely configurable multiplayer space
@@ -43,8 +49,6 @@
 Requires(preun): /sbin/chkconfig
 Requires(preun): /sbin/service
 Requires(postun): /sbin/service
-Requires(pre):   fedora-usermgmt
-Requires(postun): fedora-usermgmt
 %description server
 The xpilot server.  This allows you to host xpilot games on your
 computer and develop new xpilot maps.  This is required if you
@@ -55,14 +59,25 @@
 Summary: SELinux policy files for the xpilot-ng game server
 Group: Amusements/Games
 Requires: %{name}-server = %{version}-%{release}
+%if "%{selinux_policyver}" != ""
+Requires:       selinux-policy >= %{selinux_policyver}
+%endif
 Requires(post):         /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles
 Requires(preun):        /sbin/service /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles /usr/sbin/setsebool
 Requires(postun):       /usr/sbin/semodule
 %description selinux
 SELinux policy files for the xpilot-ng game server
 
+%package logwatch
+Summary: logwatch scripts for the xpilot game server
+Group: Amusements/Games
+Requires: %{name}-server = %{version}-%{release} logwatch
+%description logwatch
+logwatch scripts for the Xpilot game server
+
 %prep
 %setup -q
+%patch0
 pushd doc/man
 iconv --from=ISO-8859-1 --to=UTF-8 xpilot-ng-server.man > xpilot-ng-server.man.new
 mv xpilot-ng-server.man.new xpilot-ng-server.man
@@ -117,17 +132,23 @@
 install -p -D -m 644 lib/defaults.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/defaults.txt
 install -p -D -m 600 lib/password.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/password.txt
 
+# Install logwatch files
+install -pD -m 0644 %{SOURCE10} $RPM_BUILD_ROOT%{logwatch_conf}/logfiles/%{name}.conf
+install -pD -m 0755 %{SOURCE11} $RPM_BUILD_ROOT%{logwatch_scripts}/services/%{name}
+install -pD -m 0644 %{SOURCE12} $RPM_BUILD_ROOT%{logwatch_conf}/services/%{name}.conf
+install -pD -m 0755 %{SOURCE13} $RPM_BUILD_ROOT%{logwatch_scripts}/shared/applyxpilotdate
+
 # Install selinux policies
 pushd SELinux
 for variant in %{selinux_variants}
 do
-    install -d %{buildroot}%{_datadir}/selinux/${variant}
+    install -d $RPM_BUILD_ROOT%{_datadir}/selinux/${variant}
     install -p -m 644 xpilotd.pp.${variant} \
-           %{buildroot}%{_datadir}/selinux/${variant}/xpilotd.pp
+           $RPM_BUILD_ROOT%{_datadir}/selinux/${variant}/xpilotd.pp
 done
 popd
 # Hardlink identical policy module packages together
-/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
+/usr/sbin/hardlink -cv $RPM_BUILD_ROOT%{_datadir}/selinux
 
 %post
 touch --no-create %{_datadir}/icons/hicolor || :
@@ -144,9 +165,9 @@
 %pre server
 user_uid=`id -u xpilot 2>/dev/null`
 if [ x"$user_uid" = x ] ; then
-    /usr/sbin/fedora-groupadd 25 -r xpilot &>/dev/null || :
-    /usr/sbin/fedora-useradd  25 -r -s /sbin/nologin -d /usr/share/xpilot-ng \
-                -M -c 'XPilot Server' -g xpilot xpilot >/dev/null || :
+    useradd -r -s /sbin/nologin -d %{_datadir}/%{name} -M \
+            -c 'XPilot Server' \
+            xpilot >/dev/null || :
 fi
 
 %post server
@@ -162,8 +183,6 @@
 if [ "$1" -ge "1" ]; then
     /sbin/service xpilot-ng-server condrestart > /dev/null 2>&1
 fi
-test "$1" != 0 || /usr/sbin/fedora-userdel  xpilot &>/dev/null || :
-test "$1" != 0 || /usr/sbin/fedora-groupdel xpilot &>/dev/null || :
 
 %post selinux
 # Install SELinux policy modules
@@ -229,7 +248,7 @@
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-server
 %{_datadir}/%{name}
 %dir %{_sysconfdir}/%{name}
-%config(noreplace) %attr(0600,xpilot,xpilot) %{_sysconfdir}/%{name}/password.txt
+%config(noreplace) %attr(0600,xpilot,root) %{_sysconfdir}/%{name}/password.txt
 %config(noreplace) %{_sysconfdir}/%{name}/defaults.txt
 %{_mandir}/man6/xpilot-ng-server.6.gz
 %{_mandir}/man6/xpilot-ng-xp-mapedit.6.gz
@@ -240,7 +259,19 @@
 %doc SELinux/*.??
 %{_datadir}/selinux/*/xpilotd.pp
 
+%files logwatch
+%defattr(-,root,root,-)
+%{logwatch_conf}/logfiles/%{name}.conf
+%{logwatch_conf}/services/%{name}.conf
+%{logwatch_scripts}/services/%{name}
+%{logwatch_scripts}/shared/applyxpilotdate
+
 %changelog
+* Thu Feb 22 2007 Wart <wart at kobold.org> 4.7.2-11
+- Add patch to prevent crash when running with robots not in idle mode
+- Added logwatch files
+- Switch from fedora-usermgmt to vanilla useradd
+
 * Tue Aug 29 2006 Wart <wart at kobold.org> 4.7.2-10
 - Added SELinux policies for the game server
 - Don't attempt to create the xpilot user if it already exists




More information about the fedora-extras-commits mailing list