From 6daa792eab1488d013fefc5eb7e4d01f40f38687 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 20:03:20 +0100 Subject: change defaults for CONFIG/BUILD/INSTALL styles All packages need an update, so here is a very huge commit. Most of the 460 source packages use automatic style for configuration, building and installing. Make these styles default to "auto". If you have a package, which does not conform to this, just use manual style and add a do-$task make target. I added a new style named AUTOTOOL style, which is needed for some broken packages, which needs to be updated via autoconf or automake. I renamed CONFIGURE_STYLE to CONFIG_STYLE. Updates for some packages, which have newer upstream versions. Renaming of all package/*/extra directories. Use the directory src/ to provide overwrites of source files or to add the code, when no upstream package is available or used. src directory will be automatically used. --- package/logrotate/Makefile | 22 +- package/logrotate/patches/patch-Makefile | 41 ++- package/logrotate/patches/patch-config_c | 59 ---- package/logrotate/patches/patch-logrotate_8 | 28 -- package/logrotate/patches/patch-logrotate_c | 429 ---------------------------- package/logrotate/patches/patch-logrotate_h | 19 -- 6 files changed, 38 insertions(+), 560 deletions(-) delete mode 100644 package/logrotate/patches/patch-config_c delete mode 100644 package/logrotate/patches/patch-logrotate_8 delete mode 100644 package/logrotate/patches/patch-logrotate_c delete mode 100644 package/logrotate/patches/patch-logrotate_h (limited to 'package/logrotate') diff --git a/package/logrotate/Makefile b/package/logrotate/Makefile index 36b667534..a49e1fe34 100644 --- a/package/logrotate/Makefile +++ b/package/logrotate/Makefile @@ -4,29 +4,27 @@ include ${TOPDIR}/rules.mk PKG_NAME:= logrotate -PKG_VERSION:= 3.7.1 +PKG_VERSION:= 3.7.8 PKG_RELEASE:= 1 -PKG_BUILDDEP+= popt -PKG_MD5SUM:= 552639142e163745f6bcd4f1f3816d8a +PKG_MD5SUM:= b3589bea6d8d5afc8a84134fddaae973 PKG_DESCR:= logfile rotation utility PKG_SECTION:= misc PKG_DEPENDS:= libpopt -PKG_SITES:= http://ftp.debian.org/debian/pool/main/l/logrotate/ - -DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.orig.tar.gz +PKG_BUILDDEP+= popt +PKG_SITES:= https://fedorahosted.org/releases/l/o/logrotate/ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LOGROTATE,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -TCFLAGS+= -D_GNU_SOURCE -DLinux -DVERSION=\"$(PKG_VERSION)\" -ALL_TARGET= logrotate -BUILD_STYLE= auto +CONFIG_STYLE:= manual + +TCFLAGS+= -D_GNU_SOURCE -DVERSION=\"$(PKG_VERSION)\" -do-install: +post-install: ${INSTALL_DIR} ${IDIR_LOGROTATE}/usr/sbin - ${CP} ${WRKBUILD}/logrotate ${IDIR_LOGROTATE}/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/logrotate ${IDIR_LOGROTATE}/usr/sbin ${INSTALL_DIR} ${IDIR_LOGROTATE}/etc/logrotate.d - ${CP} ./files/logrotate.conf ${IDIR_LOGROTATE}/etc + ${INSTALL_DATA} ./files/logrotate.conf ${IDIR_LOGROTATE}/etc include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/logrotate/patches/patch-Makefile b/package/logrotate/patches/patch-Makefile index 0ac175346..2b348b75f 100644 --- a/package/logrotate/patches/patch-Makefile +++ b/package/logrotate/patches/patch-Makefile @@ -1,21 +1,36 @@ -$Id$ ---- logrotate-3.7.1.orig/Makefile Thu Oct 9 22:05:07 2003 -+++ logrotate-3.7.1/Makefile Sat Jan 20 19:25:23 2007 -@@ -3,7 +3,7 @@ CVSROOT = $(shell cat CVS/Root) - CVSTAG = r$(subst .,-,$(VERSION)) - OS_NAME = $(shell uname -s) +--- logrotate-3.7.8.orig/Makefile 2008-05-19 12:25:54.000000000 +0200 ++++ logrotate-3.7.8/Makefile 2010-02-06 00:00:58.853084930 +0100 +@@ -1,7 +1,7 @@ + VERSION = $(shell awk '/Version:/ { print $$2 }' logrotate.spec) +-OS_NAME = $(shell uname -s) ++OS_NAME = Linux LFS = $(shell echo `getconf LFS_CFLAGS 2>/dev/null`) -CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS) +CFLAGS ?= -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS) PROG = logrotate MAN = logrotate.8 LOADLIBES = -lpopt -@@ -69,7 +69,7 @@ SOURCES = $(subst .o,.c,$(OBJS) $(LIBOBJ +@@ -96,16 +96,16 @@ test: $(TARGET) + (cd test; ./test) - ifeq ($(RPM_OPT_FLAGS),) - CFLAGS += -g --LDFLAGS = -g -+LDFLAGS ?= -g - endif + install: +- [ -d $(PREFIX)/$(BINDIR) ] || mkdir -p $(PREFIX)/$(BINDIR) +- [ -d $(PREFIX)/$(MANDIR) ] || mkdir -p $(PREFIX)/$(MANDIR) +- [ -d $(PREFIX)/$(MANDIR)/man8 ] || mkdir -p $(PREFIX)/$(MANDIR)/man8 ++ [ -d $(DESTDIR)/$(BINDIR) ] || mkdir -p $(DESTDIR)/$(BINDIR) ++ [ -d $(DESTDIR)/$(MANDIR) ] || mkdir -p $(DESTDIR)/$(MANDIR) ++ [ -d $(DESTDIR)/$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)/$(MANDIR)/man8 - ifeq (.depend,$(wildcard .depend)) + if [ "$(OS_NAME)" = HP-UX ]; then \ +- $(INSTALL) $(PROG) $(PREFIX)/$(BINDIR) 0755 bin bin; \ +- $(INSTALL) $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \ ++ $(INSTALL) $(PROG) $(DESTDIR)/$(BINDIR) 0755 bin bin; \ ++ $(INSTALL) $(MAN) $(DESTDIR)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \ + else \ +- $(INSTALL) -m 755 $(PROG) $(PREFIX)/$(BINDIR); \ +- $(INSTALL) -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \ ++ $(INSTALL) -m 755 $(PROG) $(DESTDIR)/$(BINDIR); \ ++ $(INSTALL) -m 644 $(MAN) $(DESTDIR)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \ + fi + + co: diff --git a/package/logrotate/patches/patch-config_c b/package/logrotate/patches/patch-config_c deleted file mode 100644 index deea32c0f..000000000 --- a/package/logrotate/patches/patch-config_c +++ /dev/null @@ -1,59 +0,0 @@ -$Id$ ---- logrotate-3.7.1.orig/config.c Thu Aug 7 13:13:14 2003 -+++ logrotate-3.7.1/config.c Sat Jan 20 18:54:35 2007 -@@ -142,12 +142,17 @@ static int checkFile(const char * fname) - (!fname[1] || (fname[1] == '.' && !fname[2]))) - return 0; - -+ /* Don't include 'hidden' files either; this breaks Gentoo -+ portage config file management http://bugs.gentoo.org/87683 */ -+ if (fname[0] == '.') -+ return 0; -+ - /* Check if fname is ending in a taboo-extension; if so, return - false */ - for (i = 0; i < tabooCount; i++) { - if (!strcmp(fname + strlen(fname) - strlen(tabooExts[i]), - tabooExts[i])) { -- message(MESS_ERROR, "Ignoring %s, because of %s " -+ message(MESS_DEBUG, "Ignoring %s, because of %s " - "ending\n", fname, tabooExts[i]); - - return 0; -@@ -511,6 +516,14 @@ static int readConfigFile(const char * c - newlog->flags &= ~LOG_FLAG_IFEMPTY; - - *endtag = oldchar, start = endtag; -+ } else if (!strcmp(start, "dateext")) { -+ newlog->flags |= LOG_FLAG_DATEEXT; -+ -+ *endtag = oldchar, start = endtag; -+ } else if (!strcmp(start, "nodateext")) { -+ newlog->flags &= ~LOG_FLAG_DATEEXT; -+ -+ *endtag = oldchar, start = endtag; - } else if (!strcmp(start, "noolddir")) { - newlog->oldDir = NULL; - -@@ -667,6 +680,21 @@ static int readConfigFile(const char * c - message(MESS_ERROR, "%s:%d bad start count '%s'\n", - configFile, lineNum, start); - return 1; -+ } -+ *endtag = oldchar, start = endtag; -+ } -+ } else if (!strcmp(start, "maxage")) { -+ *endtag = oldchar, start = endtag; -+ -+ if (!isolateValue(configFile, lineNum, "maxage count", &start, -+ &endtag)) { -+ oldchar = *endtag, *endtag = '\0'; -+ -+ newlog->rotateAge = strtoul(start, &chptr, 0); -+ if (*chptr || newlog->rotateAge < 0) { -+ message(MESS_ERROR, "%s:%d bad maximum age '%s'\n", -+ configFile, lineNum, start); -+ return 1; - } - *endtag = oldchar, start = endtag; - } diff --git a/package/logrotate/patches/patch-logrotate_8 b/package/logrotate/patches/patch-logrotate_8 deleted file mode 100644 index 0673a449c..000000000 --- a/package/logrotate/patches/patch-logrotate_8 +++ /dev/null @@ -1,28 +0,0 @@ -$Id$ ---- logrotate-3.7.1.orig/logrotate.8 Thu Aug 7 13:13:14 2003 -+++ logrotate-3.7.1/logrotate.8 Sat Jan 20 18:54:35 2007 -@@ -200,6 +200,11 @@ file for the omitted attributes. This op - Log files are rotated every day. - - .TP -+\fBdateext\fR -+Archive old versions of log files adding a daily extension like YYYYMMDD -+instead of simply adding a number. -+ -+.TP - \fBdelaycompress\fR - Postpone compression of the previous log file to the next rotation cycle. - This has only effect when used in combination with \fBcompress\fR. -@@ -244,6 +249,12 @@ instead of the about-to-expire file. - \fBmaillast\fR - When using the \fBmail\fR command, mail the about-to-expire file, - instead of the just-rotated file (this is the default). -+ -+.TP -+\fBmaxage\fR \fIcount\fR -+Remove rotated logs older than days. The age is only checked -+if the logfile is to be rotated. The files are mailed to the -+configured address if \fBmaillast\fR and \fBmail\fR are configured. - - .TP - \fBmissingok\fR diff --git a/package/logrotate/patches/patch-logrotate_c b/package/logrotate/patches/patch-logrotate_c deleted file mode 100644 index 0222b1e5c..000000000 --- a/package/logrotate/patches/patch-logrotate_c +++ /dev/null @@ -1,429 +0,0 @@ -$Id$ ---- logrotate-3.7.1.orig/logrotate.c Tue Oct 19 23:41:24 2004 -+++ logrotate-3.7.1/logrotate.c Sat Jan 20 18:56:30 2007 -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #ifdef WITH_SELINUX - #include -@@ -22,6 +23,10 @@ int selinux_enabled=0; - #include "log.h" - #include "logrotate.h" - -+#if !defined(GLOB_ABORTED) && defined(GLOB_ABEND) -+#define GLOB_ABORTED GLOB_ABEND -+#endif -+ - typedef struct { - char * fn; - struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */ -@@ -42,6 +47,14 @@ int debug = 0; - char * mailCommand = DEFAULT_MAIL_COMMAND; - time_t nowSecs = 0; - -+static int globerr(const char * pathname, int theerr) { -+ message(MESS_ERROR, "error accessing %s: %s\n", pathname, -+ strerror(theerr)); -+ -+ /* We want the glob operation to continue, so return 0 */ -+ return 1; -+} -+ - static logState * findState(const char * fn, struct stateSet * sip) { - int i; - logState * states = sip->states; -@@ -49,9 +62,11 @@ static logState * findState(const char * - struct tm now = *localtime(&nowSecs); - time_t lr_time; - -+ /* find the filename fn in the statesPtr list */ - for (i = 0; i < numStates; i++) - if (!strcmp(fn, states[i].fn)) break; - -+ /* not in statesPtr list, so add new entry */ - if (i == numStates) { - i = numStates++; - states = realloc(states, sizeof(*states) * numStates); -@@ -75,10 +90,7 @@ static logState * findState(const char * - } - - static int runScript(char * logfn, char * script) { -- int fd; -- char *filespec; - int rc; -- char buf[256]; - - if (debug) { - message(MESS_DEBUG, "running script with arg %s: \"%s\"\n", -@@ -86,39 +98,24 @@ static int runScript(char * logfn, char - return 0; - } - -- filespec = buf; -- snprintf(buf, sizeof(buf), "%s/logrotate.XXXXXX", getenv("TMPDIR") ?: "/tmp"); -- fd = -1; -- if (!filespec || (fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) { -- message(MESS_DEBUG, "error creating %s: %s\n", filespec, -- strerror(errno)); -- if (fd >= 0) { -- close(fd); -- unlink(filespec); -- } -- return -1; -- } -- -- if (write(fd, "#!/bin/sh\n\n", 11) != 11 || -- write(fd, script, strlen(script)) != strlen(script)) { -- message(MESS_DEBUG, "error writing %s\n", filespec); -- close(fd); -- unlink(filespec); -- return -1; -- } -- -- close(fd); -- - if (!fork()) { -- execlp(filespec, filespec, logfn, NULL); -+ execl("/bin/sh", "sh", "-c", script, NULL); - exit(1); - } - - wait(&rc); -+ return rc; -+} - -- unlink(filespec); -+static int removeLogFile(char * name) { -+ message(MESS_DEBUG, "removing old log %s\n", name); - -- return rc; -+ if (!debug && unlink(name)) { -+ message(MESS_ERROR, "Failed to remove old log %s: %s\n", -+ name, strerror(errno)); -+ return 1; -+ } -+ return 0; - } - - static int compressLogFile(char * name, logInfo * log, struct stat *sb) { -@@ -265,6 +262,25 @@ static int mailLog(char * logFile, char - return rc; - } - -+static int mailLogWrapper (char * mailFilename, char * mailCommand, int logNum, logInfo * log) { -+ /* if the log is compressed (and we're not mailing a -+ * file whose compression has been delayed), we need -+ * to uncompress it */ -+ if ((log->flags & LOG_FLAG_COMPRESS) && -+ !((log->flags & LOG_FLAG_DELAYCOMPRESS) && -+ (log->flags & LOG_FLAG_MAILFIRST))) { -+ if (mailLog(mailFilename, mailCommand, -+ log->uncompress_prog, log->logAddress, -+ log->files[logNum])) -+ return 1; -+ } else { -+ if (mailLog(mailFilename, mailCommand, NULL, -+ log->logAddress, mailFilename)) -+ return 1; -+ } -+ return 0; -+} -+ - static int copyTruncate(char * currLog, char * saveLog, struct stat * sb, int flags) { - char buf[BUFSIZ]; - int fdcurr = -1, fdsave = -1; -@@ -424,12 +440,15 @@ int findNeedRotating(logInfo * log, int - switch (log->criterium) { - case ROT_WEEKLY: - /* rotate if: -- 1) the current weekday is before the weekday of the -- last rotation -+ 1) the day of the week is the same as the day of the week of -+ the previous rotation but not the same day of the year -+ this will rotate it on the same day every week, but not -+ twice a day. - 2) more then a week has passed since the last - rotation */ -- state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) || -- ((mktime(&now) - mktime(&state->lastRotated)) > -+ state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday && -+ now.tm_yday != state->lastRotated.tm_yday) || -+ ((mktime(&now) - mktime(&state->lastRotated)) > - (7 * 24 * 3600))); - break; - case ROT_MONTHLY: -@@ -479,6 +498,9 @@ int rotateSingleLog(logInfo * log, int l - char * baseName; - char * dirName; - char * firstRotated; -+ char * glob_pattern; -+ glob_t globResult; -+ int rc; - size_t alloc_size; - int rotateCount = log->rotateCount ? log->rotateCount : 1; - int logStart = (log->logStart == -1) ? 1 : log->logStart; -@@ -509,7 +531,7 @@ int rotateSingleLog(logInfo * log, int l - - alloc_size = strlen(dirName) + strlen(baseName) + - strlen(log->files[logNum]) + strlen(fileext) + -- strlen(compext) + 10; -+ strlen(compext) + 18; - - oldName = alloca(alloc_size); - newName = alloca(alloc_size); -@@ -531,16 +553,116 @@ int rotateSingleLog(logInfo * log, int l - /* First compress the previous log when necessary */ - if (log->flags & LOG_FLAG_COMPRESS && - log->flags & LOG_FLAG_DELAYCOMPRESS) { -- struct stat sbprev; -- -- sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); -- if (stat(oldName, &sbprev)) { -- message(MESS_DEBUG, "previous log %s does not exist\n", -- oldName); -- } else { -- hasErrors = compressLogFile(oldName, log, &sbprev); -+ if (log->flags & LOG_FLAG_DATEEXT) { -+ /* glob for uncompressed files with our pattern */ -+ glob_pattern = malloc(strlen(dirName) + strlen(baseName) -+ + strlen(fileext) + 44 ); -+ sprintf(glob_pattern, -+ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s", -+ dirName, baseName, fileext); -+ rc = glob(glob_pattern, 0, globerr, &globResult); -+ if (!rc && globResult.gl_pathc > 0) { -+ for (i = 0; i < globResult.gl_pathc && !hasErrors; i++) { -+ struct stat sbprev; -+ sprintf(oldName,"%s",(globResult.gl_pathv)[i]); -+ if (stat(oldName, &sbprev)) { -+ message(MESS_DEBUG, "previous log %s does not exist\n", oldName); -+ } else { -+ hasErrors = compressLogFile(oldName, log, &sbprev); -+ } -+ } -+ } else { -+ message (MESS_DEBUG, "glob finding logs to compress failed\n"); -+ /* fallback to old behaviour */ -+ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); -+ } -+ globfree(&globResult); -+ free(glob_pattern); -+ } else { -+ struct stat sbprev; -+ -+ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); -+ if (stat(oldName, &sbprev)) { -+ message(MESS_DEBUG, "previous log %s does not exist\n", -+ oldName); -+ } else { -+ hasErrors = compressLogFile(oldName, log, &sbprev); -+ } - } - } -+ -+ firstRotated = alloca(strlen(dirName) + strlen(baseName) + -+ strlen(fileext) + strlen(compext) + 30); -+ -+ if(log->flags & LOG_FLAG_DATEEXT) { -+ /* glob for compressed files with our pattern -+ * and compress ext */ -+ glob_pattern = malloc(strlen(dirName)+strlen(baseName) -+ +strlen(fileext)+strlen(compext)+44); -+ sprintf(glob_pattern, -+ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s%s", -+ dirName, baseName, fileext, compext); -+ rc = glob(glob_pattern, 0, globerr, &globResult); -+ if (!rc) { -+ /* search for files to drop, if we find one remember it, -+ * if we find another one mail and remove the first and -+ * remember the second and so on */ -+ struct stat fst_buf; -+ int mail_out = -1; -+ /* remove the first (n - rotateCount) matches -+ * no real rotation needed, since the files have -+ * the date in their name */ -+ for (i = 0; i < globResult.gl_pathc; i++) { -+ if( !stat((globResult.gl_pathv)[i],&fst_buf) ) { -+ if ((i <= ((int)globResult.gl_pathc - rotateCount)) -+ || ((log->rotateAge > 0) -+ && (((nowSecs - fst_buf.st_mtime)/60/60/24) -+ > log->rotateAge))) { -+ if ( mail_out != -1 ) { -+ if (!hasErrors && log->logAddress) { -+ char * mailFilename = (globResult.gl_pathv)[mail_out]; -+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log); -+ if (!hasErrors) -+ hasErrors = removeLogFile(mailFilename); -+ } -+ } -+ mail_out = i; -+ } -+ } -+ } -+ if ( mail_out != -1 ) { -+ /* oldName is oldest Backup found (for unlink later) */ -+ sprintf(oldName, "%s", (globResult.gl_pathv)[mail_out]); -+ strcpy(disposeName, oldName); -+ } else -+ disposeName = NULL; -+ } else { -+ message (MESS_DEBUG, "glob finding old rotated logs failed\n"); -+ disposeName = NULL; -+ } -+ /* firstRotated is most recently created/compressed rotated log */ -+ sprintf(firstRotated, "%s/%s-%04d%02d%02d%s%s", -+ dirName, baseName, now.tm_year+1900, -+ now.tm_mon+1, now.tm_mday, fileext, compext); -+ globfree(&globResult); -+ free(glob_pattern); -+ } else { -+ if ( log->rotateAge ) { -+ struct stat fst_buf; -+ for (i=1; i <= rotateCount; i++) { -+ sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, -+ rotateCount + 1, fileext, compext); -+ if(!stat(oldName,&fst_buf) -+ && (((nowSecs - fst_buf.st_mtime)/60/60/24) -+ > log->rotateAge)) { -+ char * mailFilename = (globResult.gl_pathv)[i]; -+ if (!hasErrors && log->logAddress) -+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log); -+ if (!hasErrors) -+ hasErrors = removeLogFile(mailFilename); -+ } -+ } -+ } - - sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, - logStart + rotateCount, fileext, compext); -@@ -548,8 +670,6 @@ int rotateSingleLog(logInfo * log, int l - - strcpy(disposeName, oldName); - -- firstRotated = alloca(strlen(dirName) + strlen(baseName) + -- strlen(fileext) + strlen(compext) + 30); - sprintf(firstRotated, "%s/%s.%d%s%s", dirName, baseName, - logStart, fileext, - (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext); -@@ -600,12 +720,27 @@ int rotateSingleLog(logInfo * log, int l - } - } - } -- -+ } /* !LOG_FLAG_DATEEXT */ -+ - finalName = oldName; -- -- /* note: the gzip extension is *not* used here! */ -- sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); -- -+ -+ if(log->flags & LOG_FLAG_DATEEXT) { -+ char * destFile = alloca(strlen(dirName) + strlen(baseName) + -+ strlen(fileext) + strlen(compext) + 30); -+ struct stat fst_buf; -+ sprintf(finalName, "%s/%s-%04d%02d%02d%s", -+ dirName, baseName, now.tm_year+1900, -+ now.tm_mon+1, now.tm_mday, fileext); -+ sprintf(destFile, "%s%s", finalName, compext); -+ if(!stat(destFile,&fst_buf)) { -+ message (MESS_DEBUG, "destination %s already exists, skipping rotation\n", firstRotated); -+ hasErrors = 1; -+ } -+ } else { -+ /* note: the gzip extension is *not* used here! */ -+ sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); -+ } -+ - /* if the last rotation doesn't exist, that's okay */ - if (!debug && access(disposeName, F_OK)) { - message(MESS_DEBUG, "log %s doesn't exist -- won't try to " -@@ -613,9 +748,6 @@ int rotateSingleLog(logInfo * log, int l - disposeName = NULL; - } - -- free(dirName); -- free(baseName); -- - if (!hasErrors) { - if (log->pre && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) { - message(MESS_DEBUG, "running prerotate script\n"); -@@ -722,33 +854,12 @@ int rotateSingleLog(logInfo * log, int l - else - mailFilename = disposeName; - -- if (mailFilename) { -- /* if the log is compressed (and we're not mailing a -- file whose compression has been delayed), we need -- to uncompress it */ -- if ((log->flags & LOG_FLAG_COMPRESS) && -- !((log->flags & LOG_FLAG_DELAYCOMPRESS) && -- (log->flags & LOG_FLAG_MAILFIRST))) { -- if (mailLog(mailFilename, mailCommand, -- log->uncompress_prog, log->logAddress, -- log->files[logNum])) -- hasErrors = 1; -- } else { -- if (mailLog(mailFilename, mailCommand, NULL, -- log->logAddress, mailFilename)) -- hasErrors = 1; -- } -- } -+ if (mailFilename) -+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log); - } - - if (!hasErrors && disposeName) { -- message(MESS_DEBUG, "removing old log %s\n", disposeName); -- -- if (!debug && unlink(disposeName)) { -- message(MESS_ERROR, "Failed to remove old log %s: %s\n", -- disposeName, strerror(errno)); -- hasErrors = 1; -- } -+ hasErrors = removeLogFile(disposeName); - } - } - -@@ -761,6 +872,8 @@ int rotateSingleLog(logInfo * log, int l - } - } - #endif -+ free(dirName); -+ free(baseName); - return hasErrors; - } - -@@ -1002,7 +1115,7 @@ static int readState(char * stateFilenam - } - - /* Hack to hide earlier bug */ -- if ((year != 1900) && (year < 1996 || year > 2100)) { -+ if ((year != 1900) && (year < 1970 || year > 2100)) { - message(MESS_ERROR, "bad year %d for file %s in state file %s\n", - year, argv[0], stateFilename); - fclose(f); -@@ -1047,7 +1160,9 @@ static int readState(char * stateFilenam - - int main(int argc, const char ** argv) { - logInfo defConfig = { NULL, NULL, 0, NULL, ROT_SIZE, -- /* threshHold */ 1024 * 1024, 0, -+ /* threshHold */ 1024 * 1024, -+ /* rotateCount */ 0, -+ /* rotateAge */ 0, - /* log start */ -1, - /* pre, post */ NULL, NULL, - /* first, last */ NULL, NULL, -@@ -1108,8 +1223,7 @@ int main(int argc, const char ** argv) { - - files = poptGetArgs((poptContext) optCon); - if (!files) { -- fprintf(stderr, "logrotate " VERSION -- " - Copyright (C) 1995-2001 Red Hat, Inc.\n"); -+ fprintf(stderr, "logrotate - Copyright (C) 1995-2001 Red Hat, Inc.\n"); - fprintf(stderr, "This may be freely redistributed under the terms of " - "the GNU Public License\n\n"); - poptPrintUsage(optCon, stderr, 0); diff --git a/package/logrotate/patches/patch-logrotate_h b/package/logrotate/patches/patch-logrotate_h deleted file mode 100644 index 9a3adefc5..000000000 --- a/package/logrotate/patches/patch-logrotate_h +++ /dev/null @@ -1,19 +0,0 @@ -$Id$ ---- logrotate-3.7.1.orig/logrotate.h Thu Aug 7 13:13:14 2003 -+++ logrotate-3.7.1/logrotate.h Sat Jan 20 18:54:35 2007 -@@ -15,6 +15,7 @@ - #define LOG_FLAG_MAILFIRST (1 << 6) - #define LOG_FLAG_SHAREDSCRIPTS (1 << 7) - #define LOG_FLAG_COPY (1 << 8) -+#define LOG_FLAG_DATEEXT (1 << 9) - - #define NO_FORCE_ROTATE 0 - #define FORCE_ROTATE 1 -@@ -34,6 +35,7 @@ typedef struct { - enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium; - unsigned int threshhold; - int rotateCount; -+ int rotateAge; - int logStart; - char * pre, * post, * first, * last; - char * logAddress; -- cgit v1.2.3