From e322019d9fb820187263b242e10e750a46dd1bfd Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Mon, 29 Jun 2015 20:26:36 -0700 Subject: logrotate: 3.8.8 -> 3.9.1 Updated: - act-as-mv-when-rotate.patch - disable-check-different-filesystems.patch - update-the-manual.patch - base_contains -> bb.utils.contains [YOCTO #7346] Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- .../logrotate/act-as-mv-when-rotate.patch | 65 +++++++++++++--------- .../disable-check-different-filesystems.patch | 26 ++++----- .../logrotate/logrotate/update-the-manual.patch | 26 +++++---- meta/recipes-extended/logrotate/logrotate_3.8.8.bb | 65 ---------------------- meta/recipes-extended/logrotate/logrotate_3.9.1.bb | 63 +++++++++++++++++++++ 5 files changed, 130 insertions(+), 115 deletions(-) delete mode 100644 meta/recipes-extended/logrotate/logrotate_3.8.8.bb create mode 100644 meta/recipes-extended/logrotate/logrotate_3.9.1.bb diff --git a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch index ce64040d5f..2e931a2876 100644 --- a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch +++ b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch @@ -1,20 +1,23 @@ -Act as the "mv" command when rotate log +From 68f29ab490cf987aa34b5f4caf1784b58a021308 Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Tue, 17 Feb 2015 21:08:07 -0800 +Subject: [PATCH] Act as the "mv" command when rotate log Act as the "mv" command when rotate log, first rename, if failed, then read and write. -Upstream-Status: Submitted +Upstream-Status: Pending Signed-off-by: Robert Yang --- - logrotate.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 56 insertions(+), 9 deletions(-) + logrotate.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/logrotate.c b/logrotate.c -index 174a26b..b18b629 100644 +index d3deb6a..cf8bf2c 100644 --- a/logrotate.c +++ b/logrotate.c -@@ -906,6 +906,53 @@ int findNeedRotating(struct logInfo *log, int logNum, int force) +@@ -1157,6 +1157,53 @@ int findNeedRotating(struct logInfo *log, int logNum, int force) return 0; } @@ -68,7 +71,7 @@ index 174a26b..b18b629 100644 int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state, struct logNames *rotNames) { -@@ -1268,15 +1315,15 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state, +@@ -1523,15 +1570,15 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state, } message(MESS_DEBUG, @@ -87,22 +90,35 @@ index 174a26b..b18b629 100644 oldName, newName, strerror(errno)); hasErrors = 1; } -@@ -1408,11 +1455,11 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state, +@@ -1669,21 +1716,21 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state, + return 1; + } + +- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], ++ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], + tmpFilename); +- if (!debug && !hasErrors && rename(log->files[logNum], tmpFilename)) { +- message(MESS_ERROR, "failed to rename %s to %s: %s\n", ++ if (!debug && !hasErrors && mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { ++ message(MESS_ERROR, "failed to move %s to %s: %s\n", + log->files[logNum], tmpFilename, + strerror(errno)); + hasErrors = 1; } } - #endif /* WITH_ACL */ -- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], -+ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], - rotNames->finalName); - if (!debug && !hasErrors && -- rename(log->files[logNum], rotNames->finalName)) { -- message(MESS_ERROR, "failed to rename %s to %s: %s\n", -+ mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { -+ message(MESS_ERROR, "failed to move %s to %s: %s\n", - log->files[logNum], rotNames->finalName, - strerror(errno)); - hasErrors = 1; -@@ -1775,7 +1822,7 @@ int rotateLogSet(struct logInfo *log, int force) + else { +- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], ++ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], + rotNames->finalName); + if (!debug && !hasErrors && +- rename(log->files[logNum], rotNames->finalName)) { +- message(MESS_ERROR, "failed to rename %s to %s: %s\n", ++ mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { ++ message(MESS_ERROR, "failed to move %s to %s: %s\n", + log->files[logNum], tmpFilename, + strerror(errno)); + hasErrors = 1; +@@ -2063,7 +2110,7 @@ int rotateLogSet(struct logInfo *log, int force) return hasErrors; } @@ -111,7 +127,7 @@ index 174a26b..b18b629 100644 { struct logState *p; FILE *f; -@@ -1939,7 +1986,7 @@ static int writeState(char *stateFilename) +@@ -2227,7 +2274,7 @@ static int writeState(char *stateFilename) fclose(f); if (error == 0) { @@ -120,7 +136,7 @@ index 174a26b..b18b629 100644 unlink(tmpFilename); error = 1; message(MESS_ERROR, "error renaming temp state file %s\n", -@@ -2223,7 +2270,7 @@ int main(int argc, const char **argv) +@@ -2525,7 +2572,7 @@ int main(int argc, const char **argv) rc |= rotateLogSet(log, force); if (!debug) @@ -129,6 +145,3 @@ index 174a26b..b18b629 100644 return (rc != 0); } --- -1.7.10.4 - diff --git a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch b/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch index 43ebcffbae..793d702598 100644 --- a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch +++ b/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch @@ -3,7 +3,7 @@ Disable the check for different filesystems The logrotate supports rotate log across different filesystems now, so disable the check for different filesystems. -Upstream-Status: Submitted +Upstream-Status: Pending Signed-off-by: Robert Yang --- @@ -11,24 +11,22 @@ Signed-off-by: Robert Yang 1 file changed, 9 deletions(-) diff --git a/config.c b/config.c -index e0eadb7..c23092f 100644 +index dbbf563..64e66f6 100644 --- a/config.c +++ b/config.c -@@ -1515,15 +1515,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig) - dirName, strerror(errno)); - goto error; +@@ -1493,15 +1493,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig) + goto error; + } } - - if (sb.st_dev != sb2.st_dev -- && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY))) { -- message(MESS_ERROR, -- "%s:%d olddir %s and log file %s " -- "are on different devices\n", configFile, -- lineNum, newlog->oldDir, newlog->files[i]); -- goto error; +- && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY | LOG_FLAG_TMPFILENAME))) { +- message(MESS_ERROR, +- "%s:%d olddir %s and log file %s " +- "are on different devices\n", configFile, +- lineNum, newlog->oldDir, newlog->files[i]); +- goto error; - } } - } + } --- -1.7.9.5 diff --git a/meta/recipes-extended/logrotate/logrotate/update-the-manual.patch b/meta/recipes-extended/logrotate/logrotate/update-the-manual.patch index 517acdd27e..50d037d5a1 100644 --- a/meta/recipes-extended/logrotate/logrotate/update-the-manual.patch +++ b/meta/recipes-extended/logrotate/logrotate/update-the-manual.patch @@ -1,26 +1,32 @@ -Update the manual +From e0b0fe30e9c49234994a20a86aacfaf80e690087 Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Tue, 17 Feb 2015 21:14:37 -0800 +Subject: [PATCH] Update the manual Update the manual for rotating on different filesystems. -Upstream-Status: Submitted +Upstream-Status: Pending Signed-off-by: Robert Yang --- - logrotate.8 | 7 +++---- - 1 files changed, 3 insertions(+), 4 deletions(-) + logrotate.8 | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/logrotate.8 b/logrotate.8 -index 8b34167..5f15432 100644 +index e4e5f48..84407d0 100644 --- a/logrotate.8 +++ b/logrotate.8 -@@ -374,10 +374,9 @@ Do not rotate the log if it is empty (this overrides the \fBifempty\fR option). +@@ -405,12 +405,10 @@ Do not rotate the log if it is empty (this overrides the \fBifempty\fR option). + .TP \fBolddir \fIdirectory\fR - Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR --must be on the same physical device as the log file being rotated, --and is assumed to be relative to the directory holding the log file +-Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR must be +-on the same physical device as the log file being rotated, unless \fBcopy\fR, +-\fBcopytruncate\fR or \fBrenamecopy\fR option is used. The \fIdirectory\fR +-is assumed to be relative to the directory holding the log file -unless an absolute path name is specified. When this option is used all -old versions of the log end up in \fIdirectory\fR. This option may be ++Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR +is assumed to be relative to the directory holding the log file unless +an absolute path name is specified. When this option is used all old +versions of the log end up in \fIdirectory\fR. This option may be @@ -28,5 +34,5 @@ index 8b34167..5f15432 100644 .TP -- -1.7.4.1 +1.7.9.5 diff --git a/meta/recipes-extended/logrotate/logrotate_3.8.8.bb b/meta/recipes-extended/logrotate/logrotate_3.8.8.bb deleted file mode 100644 index e3cfa90ced..0000000000 --- a/meta/recipes-extended/logrotate/logrotate_3.8.8.bb +++ /dev/null @@ -1,65 +0,0 @@ -SUMMARY = "Rotates, compresses, removes and mails system log files" -SECTION = "console/utils" -HOMEPAGE = "https://fedorahosted.org/logrotate/" -LICENSE = "GPLv2" - -# TODO: logrotate 3.8.8 adds autotools/automake support, update recipe to use it. -# TODO: Document coreutils dependency. Why not RDEPENDS? Why not busybox? - -DEPENDS="coreutils popt" - -LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760" - -SRC_URI = "https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz \ - file://act-as-mv-when-rotate.patch \ - file://update-the-manual.patch \ - file://disable-check-different-filesystems.patch \ - " - -SRC_URI[md5sum] = "49846e873dddea15964cd0355b9943ca" -SRC_URI[sha256sum] = "46a1510ef4a1f4359edd5f361112cfd1523942e85ff28e6cbb0c81bad1829d0f" - -PACKAGECONFIG ?= "\ - ${@base_contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ - ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ -" - -PACKAGECONFIG[acl] = ",,acl" -PACKAGECONFIG[selinux] = ",,libselinux" - -CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \ - ${sysconfdir}/logrotate.conf" - -# If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our -# optimization variables, so use it rather than EXTRA_CFLAGS. -EXTRA_OEMAKE = "\ - LFS= \ - OS_NAME='${OS_NAME}' \ - \ - 'CC=${CC}' \ - 'RPM_OPT_FLAGS=${CFLAGS}' \ - 'EXTRA_LDFLAGS=${LDFLAGS}' \ - \ - ${@base_contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ - ${@base_contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ -" - -# OS_NAME in the makefile defaults to `uname -s`. The behavior for -# freebsd/netbsd is questionable, so leave it as Linux, which only sets -# INSTALL=install and BASEDIR=/usr. -OS_NAME = "Linux" - -do_compile_prepend() { - # Make sure the recompile is OK - rm -f ${B}/.depend -} - -do_install(){ - oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} BINDIR=${bindir} - mkdir -p ${D}${sysconfdir}/logrotate.d - mkdir -p ${D}${sysconfdir}/cron.daily - mkdir -p ${D}${localstatedir}/lib - install -p -m 644 examples/logrotate-default ${D}${sysconfdir}/logrotate.conf - install -p -m 755 examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate - touch ${D}${localstatedir}/lib/logrotate.status -} diff --git a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb new file mode 100644 index 0000000000..7d0a15961b --- /dev/null +++ b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb @@ -0,0 +1,63 @@ +SUMMARY = "Rotates, compresses, removes and mails system log files" +SECTION = "console/utils" +HOMEPAGE = "https://fedorahosted.org/logrotate/" +LICENSE = "GPLv2" + +# TODO: logrotate 3.8.8 adds autotools/automake support, update recipe to use it. +# TODO: Document coreutils dependency. Why not RDEPENDS? Why not busybox? + +DEPENDS="coreutils popt" + +LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760" + +SRC_URI = "https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz \ + file://act-as-mv-when-rotate.patch \ + file://update-the-manual.patch \ + file://disable-check-different-filesystems.patch \ + " + +SRC_URI[md5sum] = "4492b145b6d542e4a2f41e77fa199ab0" +SRC_URI[sha256sum] = "022769e3288c80981559a8421703c88e8438b447235e36dd3c8e97cd94c52545" + +PACKAGECONFIG ?= "\ + ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ +" + +PACKAGECONFIG[acl] = ",,acl" +PACKAGECONFIG[selinux] = ",,libselinux" + +CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \ + ${sysconfdir}/logrotate.conf" + +# If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our +# optimization variables, so use it rather than EXTRA_CFLAGS. +EXTRA_OEMAKE = "\ + LFS= \ + OS_NAME='${OS_NAME}' \ + 'CC=${CC}' \ + 'RPM_OPT_FLAGS=${CFLAGS}' \ + 'EXTRA_LDFLAGS=${LDFLAGS}' \ + ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ +" + +# OS_NAME in the makefile defaults to `uname -s`. The behavior for +# freebsd/netbsd is questionable, so leave it as Linux, which only sets +# INSTALL=install and BASEDIR=/usr. +OS_NAME = "Linux" + +do_compile_prepend() { + # Make sure the recompile is OK + rm -f ${B}/.depend +} + +do_install(){ + oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} BINDIR=${bindir} + mkdir -p ${D}${sysconfdir}/logrotate.d + mkdir -p ${D}${sysconfdir}/cron.daily + mkdir -p ${D}${localstatedir}/lib + install -p -m 644 examples/logrotate-default ${D}${sysconfdir}/logrotate.conf + install -p -m 755 examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate + touch ${D}${localstatedir}/lib/logrotate.status +} -- cgit 1.2.3-korg