logrotate stable port information

Package: logrotate
Version: 3.7.1
Revision: 1
Description: Rotates, compresses, removes and mails logs
License: GPL
DescDetail: <<
The logrotate utility is designed to simplify the administration of
log files on a system which generates a lot of log files. Logrotate
allows for the automatic rotation compression, removal and mailing of
log files. Logrotate can be set to handle a log file daily, weekly,
monthly or when the log file gets to a certain size. Normally,
logrotate would be run as a daily cron job.
<<
DescUsage: <<
Most of the log file rotation in Darwin / Mac OS X is already handled
by /etc/weekly etc. but /Library/Logs, ~/Library/Logs/CrashReporter
and httpd logs are not.

See the included examples to create new configuration files and setup CRON.

Known problems:

There appears to be a bug in Darwin's implementation of the glob(3)
routine, even as of Mac OS X 10.2.6 (Darwin 6.6):

error: error accessing /Users/Shared/Library/Logs/CrashReporter/: No such
file or directory
error: Users:16 glob failed for /Users/*/Library/Logs/CrashReporter/*.log

glibc2 in a similar situation would not return an error.

The only workaround for the present time is to make sure wildcard
expressions in logrotate.conf always have a positive match, by
creating any missing directories:

mkdir -p /Users/Shared/Library/Logs/CrashReporter

It is still not clear whether the problem really is in glob, however
anyone with technical insight into this problem should contact the
maintainer of this package and consider filing a bug report with
Apple at .
<<
Suggests: cron-service
Homepage: http://packages.debian.org/etch/logrotate.html
DocFiles: CHANGES COPYING logrotate.spec
BuildDepends: popt, fink (>= 0.24.12-1)
Depends: popt-shlibs
SourceDirectory: %n-%v
PatchFile: %n.patch
PatchFile-MD5: efbc448d89865aeacef8fa6cefc6200b
PatchScript: sed 's_@PREFIX@_%p_g' < %{PatchFile} | patch -p1
CompileScript: <<
make BASEDIR=%p MANDIR=%p/share/man STATEFILE=%p/var/run/logrotate.status
<<
ConfFiles: <<
%p/var/run/logrotate.status
%p/etc/logrotate.conf
%p/etc/logrotate.d/Fink
%p/etc/logrotate.d/httpd
%p/etc/logrotate.d/Library
%p/etc/logrotate.d/Users
<<
InstallScript: <<
make install PREFIX=%d BASEDIR=%p MANDIR=%p/share/man INSTALL=install
mkdir -p %i/share/doc/%n/test
mkdir -p %i/share/doc/%n/examples
install -m 644 test/* %i/share/doc/%n/test
install -m 644 examples/* %i/share/doc/%n/examples
mkdir -p %i/etc/logrotate.d
install -m 644 examples/logrotate-default %i/etc/logrotate.conf
install -m 644 examples/Fink %i/etc/logrotate.d/Fink
install -m 644 examples/Library %i/etc/logrotate.d/Library
install -m 664 examples/Users %i/etc/logrotate.d/Users
install -m 644 examples/httpd %i/etc/logrotate.d/httpd
mkdir -p %i/var/run/
touch %i/var/run/logrotate.status
<<
Source: mirror:debian:pool/main/l/%n/%n_%v.orig.tar.gz
Source-MD5: 552639142e163745f6bcd4f1f3816d8a
Maintainer: None
DescPort: <<
install some basic Darwin / OS X scripts in %p/etc/logrotate.d/
Changed paths in cron and man files appropriate to Darwin and Fink.
Added Darwin paths in config.h.
Patched to include for u_int32_t typedef.
Solution for a similar porting problem found at:
http://www.suares.com/pipermail/qmail-ldap-archive/1998-November/000075.html
<<
DescPackaging: <<
Original maintainer: Carsten Klapp

1. dmacks (3.7.1-1) make sure normal compiler flag vars are always used.
2. dmacks (3.7.1-1) cleaned up flag-propagation a bit.
3. 'PREFIX' is used instead of 'prefix' so InstallScript is needed to build
the deb file properly (another silly problem for which a fix eluded me
far far too long DOH).
4. Install examples and test dirs into docs dir.
5. dmacks (3.7.1-1) converted to use upstream platform token.
<<

logrotate stable port .patch

diff -Nurd -x'*~' logrotate-3.7.1.orig/Makefile logrotate-3.7.1/Makefile
--- logrotate-3.7.1.orig/Makefile 2003-10-09 16:05:07.000000000 -0400
+++ logrotate-3.7.1/Makefile 2008-09-06 16:10:11.000000000 -0400
@@ -69,7 +69,7 @@

ifeq ($(RPM_OPT_FLAGS),)
CFLAGS += -g
-LDFLAGS = -g
+LDFLAGS += -g
endif

ifeq (.depend,$(wildcard .depend))
@@ -88,7 +88,7 @@
rm -f $(OBJS) $(PROG) core* .depend

depend:
- $(CPP) $(CFLAGS) -M $(SOURCES) > .depend
+ $(CPP) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend

.PHONY : test
test: $(TARGET)
diff -Nurd -x'*~' logrotate-3.7.1.orig/config.c logrotate-3.7.1/config.c
--- logrotate-3.7.1.orig/config.c 2003-08-07 07:13:14.000000000 -0400
+++ logrotate-3.7.1/config.c 2008-09-06 16:00:32.000000000 -0400
@@ -1,4 +1,9 @@
-#include
+#ifndef Darwin
+ #include
+#else
+ #include
+#endif
+
#include
#include
#include
diff -Nurd -x'*~' logrotate-3.7.1.orig/config.h logrotate-3.7.1/config.h
--- logrotate-3.7.1.orig/config.h 2004-10-19 17:41:24.000000000 -0400
+++ logrotate-3.7.1/config.h 2008-09-06 16:00:32.000000000 -0400
@@ -9,6 +9,20 @@
#define STATEFILE "/var/run/logrotate.status"
#endif

+#ifdef Darwin
+ #ifndef DEFAULT_MAIL_COMMAND
+ #define DEFAULT_MAIL_COMMAND "mail -s"
+ #endif
+ #ifndef COMPRESS_COMMAND
+ #define COMPRESS_COMMAND "gzip"
+ #endif
+ #ifndef UNCOMPRESS_COMMAND
+ #define UNCOMPRESS_COMMAND "gunzip"
+ #endif
+ #ifndef STATEFILE
+ #define STATEFILE "@PREFIX@/var/run/logrotate.status"
+ #endif
+#endif
#ifdef SunOS
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/local/bin/gzip"
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/Fink logrotate-3.7.1/examples/Fink
--- logrotate-3.7.1.orig/examples/Fink 1969-12-31 19:00:00.000000000 -0500
+++ logrotate-3.7.1/examples/Fink 2008-09-06 16:00:32.000000000 -0400
@@ -0,0 +1,13 @@
+##
+# @PREFIX@/var/logs for software installed by fink
+##
+
+# rotate daily, keep 7 days worth, don't complain, don't recreate
+# empty logs
+
+@PREFIX@/var/log/*.log {
+ daily
+ missingok
+ nocreate
+ rotate 7
+}
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/Library logrotate-3.7.1/examples/Library
--- logrotate-3.7.1.orig/examples/Library 1969-12-31 19:00:00.000000000 -0500
+++ logrotate-3.7.1/examples/Library 2008-09-06 16:00:32.000000000 -0400
@@ -0,0 +1,13 @@
+##
+# /Library/Logs/CrashReporter Logs
+#
+
+# rotate daily, keep 7 days worth, don't complain, definitely don't
+# recreate empty logs
+
+/Library/Logs/CrashReporter/*.log {
+ daily
+ missingok
+ nocreate
+ rotate 7
+}
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/Users logrotate-3.7.1/examples/Users
--- logrotate-3.7.1.orig/examples/Users 1969-12-31 19:00:00.000000000 -0500
+++ logrotate-3.7.1/examples/Users 2008-09-06 16:00:32.000000000 -0400
@@ -0,0 +1,30 @@
+##
+# User's DiskCopy Logs ("DiskCopy.txt")
+#
+
+# rotate when log reaches 100k, keep 7 rotations worth
+# don't compress the log files
+
+/Users/*/Library/Logs/DiskCopy.txt {
+ size=100k
+ rotate 7
+ missingok
+ nocreate
+ nocompress
+}
+
+
+##
+# User's CrashReporter logs
+#
+
+# rotate daily, don't complain, definitely don't recreate empty logs,
+# keep 7 rotations worth, compress the log files
+
+/Users/*/Library/Logs/CrashReporter/*.log {
+ daily
+ missingok
+ nocreate
+ rotate 7
+ compress
+}
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/httpd logrotate-3.7.1/examples/httpd
--- logrotate-3.7.1.orig/examples/httpd 1969-12-31 19:00:00.000000000 -0500
+++ logrotate-3.7.1/examples/httpd 2008-09-06 16:00:32.000000000 -0400
@@ -0,0 +1,18 @@
+##
+# Apache WebServer Logs
+#
+
+# rotate when log reaches 100k, keep 30 rotations worth
+# sharedscripts: the postrotate script will only be run once,
+# not once for each log which is rotated
+# compress the log files with gzip -9
+
+"/var/log/httpd/access_log" "/var/log/httpd/error_log" {
+ size=100k
+ rotate 30
+ sharedscripts
+ postrotate
+ /usr/bin/killall -HUP httpd
+ endscript
+ compress
+}
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/logrotate-default logrotate-3.7.1/examples/logrotate-default
--- logrotate-3.7.1.orig/examples/logrotate-default 2001-11-28 16:13:07.000000000 -0500
+++ logrotate-3.7.1/examples/logrotate-default 2008-09-06 16:00:32.000000000 -0400
@@ -9,16 +9,18 @@
create

# uncomment this if you want your log files compressed
-#compress
+compress

-# RPM packages drop log rotation information into this directory
-include /etc/logrotate.d
+# packages drop log rotation information into this directory
+include @PREFIX@/etc/logrotate.d

+# Mac OS X handles wtmp with periodic scripts.
# no packages own wtmp -- we'll rotate them here
-/var/log/wtmp {
- monthly
- create 0664 root utmp
- rotate 1
-}
+#/var/log/wtmp {
+# monthly
+# create 0664 root utmp
+# rotate 1
+#}

# system-specific logs may be also be configured here.
+# Mac OS X handles other system logs with periodic scripts.
diff -Nurd -x'*~' logrotate-3.7.1.orig/examples/logrotate.cron logrotate-3.7.1/examples/logrotate.cron
--- logrotate-3.7.1.orig/examples/logrotate.cron 2003-07-09 15:36:35.000000000 -0400
+++ logrotate-3.7.1/examples/logrotate.cron 2008-09-06 16:00:32.000000000 -0400
@@ -1,6 +1,6 @@
#!/bin/sh

-/usr/sbin/logrotate /etc/logrotate.conf
+@PREFIX@/sbin/logrotate @PREFIX@/etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
diff -Nurd -x'*~' logrotate-3.7.1.orig/logrotate.8 logrotate-3.7.1/logrotate.8
--- logrotate-3.7.1.orig/logrotate.8 2003-08-07 07:13:14.000000000 -0400
+++ logrotate-3.7.1/logrotate.8 2008-09-06 16:00:32.000000000 -0400
@@ -54,7 +54,7 @@
\fB-s, -\-state \fR
Tells \fBlogrotate\fR to use an alternate state file. This is useful
if logrotate is being run as a different user for various sets of
-log files. The default state file is \fI/var/lib/logrotate/status\fR.
+log files. The default state file is \fI@PREFIX@/var/run/logrotate.status\fR.

.TP
\fB-\-usage\fR
@@ -77,17 +77,17 @@
rotate 5
weekly
postrotate
- /sbin/killall -HUP syslogd
+ /usr/bin/killall -HUP syslogd
endscript
}

-"/var/log/httpd/access.log" /var/log/httpd/error.log {
+"/var/log/httpd/access_log" /var/log/httpd/error_log {
rotate 5
mail www@my.org
size=100k
sharedscripts
postrotate
- /sbin/killall -HUP httpd
+ /usr/bin/killall -HUP httpd
endscript
}

@@ -116,7 +116,7 @@
\fI/sbin/killall -HUP syslogd\fR will be executed.

The next section defines the parameters for both
-\fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR.
+\fI/var/log/httpd/access_log\fR and \fI/var/log/httpd/error_log\fR.
They are rotated whenever is grows over 100k is size, and the old logs
files are mailed (uncompressed) to www@my.org after going through 5
rotations, rather then being removed. The \fBsharedscripts\fR means that
@@ -393,10 +393,10 @@
.SH FILES
.PD 0
.TP 27
-\fI/var/lib/logrotate/status\fR
+\fI@PREFIX@/var/run/logrotate.status\fR
Default state file.
.TP 27
-\fI/etc/logrotate.conf\fR
+\fI@PREFIX@/etc/logrotate.conf\fR
Configuration options.

.SH SEE ALSO
diff -Nurd -x'*~' logrotate-3.7.1.orig/logrotate.c logrotate-3.7.1/logrotate.c
--- logrotate-3.7.1.orig/logrotate.c 2004-10-19 17:41:24.000000000 -0400
+++ logrotate-3.7.1/logrotate.c 2008-09-06 16:00:32.000000000 -0400
@@ -1,4 +1,9 @@
-#include
+#ifndef Darwin
+ #include
+#else
+ #include
+#endif
+
#include
#include
#include

logrotate _unstable_ port .patch