rpms/logrotate/devel logrotate-3.7-yearly.patch, NONE, 1.1 logrotate.spec, 1.27, 1.28

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Aug 17 14:23:48 UTC 2005


Author: pvrabec

Update of /cvs/dist/rpms/logrotate/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19644

Modified Files:
	logrotate.spec 
Added Files:
	logrotate-3.7-yearly.patch 
Log Message:
allow yearly rotations(#134612)


logrotate-3.7-yearly.patch:
 config.c    |    4 ++++
 logrotate.8 |    4 ++++
 logrotate.c |    7 +++++++
 logrotate.h |    2 +-
 4 files changed, 16 insertions(+), 1 deletion(-)

--- NEW FILE logrotate-3.7-yearly.patch ---
--- logrotate-3.7.2/logrotate.8.yearly	2005-08-17 15:35:28.000000000 +0000
+++ logrotate-3.7.2/logrotate.8	2005-08-17 15:41:41.000000000 +0000
@@ -405,6 +405,10 @@
 of the week, but it works better if \fIlogrotate\fR is not run every
 night.
 
+.TP
+\fByearly\fR
+Log files are rotated if the current year is not the same as the last rotation.
+
 .SH FILES
 .PD 0
 .TP 27
--- logrotate-3.7.2/logrotate.c.yearly	2005-08-17 15:42:15.000000000 +0000
+++ logrotate-3.7.2/logrotate.c	2005-08-17 15:45:46.000000000 +0000
@@ -462,6 +462,10 @@
             /* FIXME: only days=1 is implemented!! */
 	      state->doRotate = 1;
 	      break;
+          case ROT_YEARLY:
+            /* rotate if the logs haven't been rotated this year */
+              state->doRotate = (now.tm_year != state->lastRotated.tm_year);
+              break;
 	default:
             /* ack! */
             state->doRotate = 0;
@@ -927,6 +931,9 @@
     case ROT_MONTHLY:
 	message(MESS_DEBUG, "monthly ");
 	break;
+    case ROT_YEARLY:
+	message(MESS_DEBUG, "yearly ");
+	break;
     case ROT_SIZE:
 	message(MESS_DEBUG, "%d bytes ", log->threshhold);
 	break;
--- logrotate-3.7.2/config.c.yearly	2005-08-17 15:33:25.000000000 +0000
+++ logrotate-3.7.2/config.c	2005-08-17 15:34:51.000000000 +0000
@@ -648,6 +648,10 @@
 		*endtag = oldchar, start = endtag;
 
 		newlog->criterium = ROT_WEEKLY;
+	    } else if (!strcmp(start, "yearly")) {
+                *endtag = oldchar, start = endtag;
+
+                newlog->criterium = ROT_YEARLY;
 	    } else if (!strcmp(start, "rotate")) {
 		*endtag = oldchar, start = endtag;
 
--- logrotate-3.7.2/logrotate.h.yearly	2005-08-17 15:46:32.000000000 +0000
+++ logrotate-3.7.2/logrotate.h	2005-08-17 15:50:03.000000000 +0000
@@ -32,7 +32,7 @@
     char ** files;
     int numFiles;
     char * oldDir;
-    enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium;
+    enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE, ROT_FORCE } criterium;
     unsigned int threshhold;
     int rotateCount;
     int rotateAge;


Index: logrotate.spec
===================================================================
RCS file: /cvs/dist/rpms/logrotate/devel/logrotate.spec,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- logrotate.spec	1 Aug 2005 12:22:18 -0000	1.27
+++ logrotate.spec	17 Aug 2005 14:23:45 -0000	1.28
@@ -5,11 +5,12 @@
 Summary: Rotates, compresses, removes and mails system log files.
 Name: logrotate
 Version: 3.7.2
-Release: 1
+Release: 2
 License: GPL
 Group: System Environment/Base
 Source: logrotate-%{PACKAGE_VERSION}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}.root
+Patch1: logrotate-3.7-yearly.patch
 
 %description
 The logrotate utility is designed to simplify the administration of
@@ -24,6 +25,7 @@
 
 %prep
 %setup
+%patch1 -p1 -b .yearly
 
 %build
 make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -g" \
@@ -56,6 +58,9 @@
 %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) /var/lib/logrotate.status
 
 %changelog
+* Wed Aug 17 2005 Peter Vrabec <pvrabec at redhat.com> 3.7.2-2
+- allow yearly rotations(#134612)
+
 * Mon Aug 01 2005 Peter Vrabec <pvrabec at redhat.com> 3.7.2-1
 - new upstream release
 




More information about the fedora-cvs-commits mailing list