From a31a178a27f5f27afab54e6b5aad8ca04c140b55 Mon Sep 17 00:00:00 2001
From: Craig Treleaven <ctreleaven@macports.org>
Date: Tue, 18 Apr 2017 09:18:41 -0400
Subject: [PATCH] logrotate: update to 3.11.0, etc
Substantial re-write of port due to:
-project now hosted on GitHub
-build system now uses autotools
-add patch for build failure (reported upstream and fixed for next version)
-remove gzip variant as it is the default config
-redo patch because of build changes and to support additional default compressor variants
---
sysutils/logrotate/Portfile | 115 +++++++++------------
sysutils/logrotate/files/patch-Makefile.diff | 44 --------
sysutils/logrotate/files/patch-configs.diff | 15 +++
.../logrotate/files/patch-missing_include.diff | 10 ++
4 files changed, 73 insertions(+), 111 deletions(-)
delete mode 100644 sysutils/logrotate/files/patch-Makefile.diff
create mode 100644 sysutils/logrotate/files/patch-configs.diff
create mode 100644 sysutils/logrotate/files/patch-missing_include.diff
diff --git a/sysutils/logrotate/Portfile b/sysutils/logrotate/Portfile
index 990365f..96a34b5 100644
a
|
b
|
|
1 | 1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
2 | 2 | |
3 | 3 | PortSystem 1.0 |
| 4 | PortGroup github 1.0 |
4 | 5 | |
5 | | name logrotate |
6 | | version 3.8.6 |
7 | | revision 2 |
| 6 | github.setup logrotate logrotate 3.11.0 |
| 7 | |
| 8 | github.tarball_from releases |
| 9 | use_xz yes |
| 10 | checksums rmd160 507dc354394daead333744886c7038a2a8b85759 \ |
| 11 | sha256 18ae0f2ec1f14d9550c9f6bd9a2b6a18440e6a0fd7d5923a6e3fcb7d45946261 |
8 | 12 | categories sysutils |
9 | 13 | platforms darwin |
10 | 14 | license GPL-2 |
… |
… |
maintainers pixilla openmaintainer |
12 | 16 | |
13 | 17 | description Rotates, compresses, and mails system logs |
14 | 18 | |
15 | | long_description The logrotate utility is designed to simplify the administration of log files \ |
16 | | on a system which generates a lot of log files. Logrotate allows for the \ |
17 | | automatic rotation compression, removal and mailing of log files. Logrotate \ |
18 | | can be set to handle a log file \daily, weekly, monthly or when the log file \ |
19 | | gets to a certain size. |
20 | | |
21 | | homepage https://fedorahosted.org/logrotate/ |
22 | | master_sites https://fedorahosted.org/releases/l/o/logrotate/ |
| 19 | long_description The logrotate utility is designed to simplify the administration of logs \ |
| 20 | on a system which generates a lot of log files. Logrotate provides \ |
| 21 | automatic rotation, compression (gzip by default), removal and mailing \ |
| 22 | of log files. Logrotate can be set to handle a log file daily, weekly, \ |
| 23 | monthly or when the log file exceeds a certain size. |
23 | 24 | |
24 | | checksums rmd160 4cba4954c99896ea036d57190fc11a8307b2765e \ |
25 | | sha256 0e0ef0609afe9ef2a2ef6cae307b5ca618ddd349923ccce6e064513afd4e9d92 |
| 25 | homepage https://github.com/logrotate/logrotate |
26 | 26 | |
27 | 27 | depends_lib port:popt |
28 | 28 | |
29 | | depends_run port:gettext |
| 29 | depends_run port:gettext \ |
| 30 | port:gzip |
| 31 | |
| 32 | # See https://github.com/logrotate/logrotate/issues/117 |
| 33 | patchfiles-append patch-missing_include.diff |
| 34 | # set up so we can reinplace our desired compressor |
| 35 | patchfiles-append patch-configs.diff |
30 | 36 | |
31 | | patch.pre_args -p1 |
32 | | patchfiles patch-Makefile.diff |
| 37 | set compress ${prefix}/bin/gzip |
| 38 | set compress_ext .gz |
| 39 | set uncompress ${prefix}/bin/gunzip |
33 | 40 | |
34 | 41 | post-extract { |
35 | 42 | touch ${worksrcpath}/.depend |
… |
… |
post-patch { |
46 | 53 | ${worksrcpath}/logrotate.conf.example |
47 | 54 | reinplace "s|@PREFIX@|${prefix}|g" \ |
48 | 55 | ${worksrcpath}/org.macports.logrotate.plist.example |
| 56 | reinplace "s|@COMPRESS@|${compress}|g" \ |
| 57 | ${worksrcpath}/config.h |
| 58 | reinplace "s|@COMPRESS_EXT@|${compress_ext}|g" \ |
| 59 | ${worksrcpath}/config.h |
| 60 | reinplace "s|@UNCOMPRESS@|${uncompress}|g" \ |
| 61 | ${worksrcpath}/config.h |
49 | 62 | } |
50 | 63 | |
51 | | use_configure no |
| 64 | use_autoreconf yes |
| 65 | autoreconf.args-append \ |
| 66 | --force |
| 67 | configure.args-append \ |
| 68 | --disable-silent-rules\ |
| 69 | --with-state-file-path=${prefix}/var/run/logrotate/logrotate.status |
52 | 70 | |
53 | | variant universal {} |
| 71 | universal_variant no |
54 | 72 | |
55 | | build.env-append CC="${configure.cc} [get_canonical_archflags cc]" \ |
56 | | CXX="${configure.cxx} [get_canonical_archflags cxx]" \ |
57 | | CPP="${configure.cpp}" \ |
58 | | BASEDIR="${prefix}" \ |
59 | | POPT_DIR="${prefix}" \ |
60 | | STATEFILE="${prefix}/var/run/logrotate/logrotate.status" \ |
61 | | DEFAULT_MAIL_COMMAND="/usr/bin/mail" |
62 | | |
63 | | destroot.args INSTALL="install" \ |
64 | | BINDIR="${destroot}${prefix}/sbin" \ |
65 | | MANDIR="${destroot}${prefix}/share/man" |
66 | 73 | destroot.keepdirs ${destroot}${prefix}/etc/logrotate.d \ |
67 | 74 | ${destroot}${prefix}/var/run/logrotate |
68 | 75 | post-destroot { |
69 | 76 | xinstall -d ${destroot}${prefix}/share/${name} |
70 | | xinstall -m 644 -W ${worksrcpath} CHANGES COPYING \ |
| 77 | xinstall -m 644 -W ${worksrcpath} ChangeLog.md COPYING \ |
71 | 78 | logrotate.conf.example org.macports.logrotate.plist.example \ |
72 | 79 | ${destroot}${prefix}/share/${name} |
73 | 80 | |
74 | | # The startupitem.install keyword does not exist in MacPorts < 2.1. |
75 | | if {![info exists startupitem.install]} { |
76 | | |
77 | | set startupitem.install yes |
78 | | } |
79 | 81 | if {[variant_isset startupitem] |
80 | 82 | && ${startupitem.install} != "no" |
81 | 83 | && [getuid] == 0} { |
… |
… |
post-activate { |
96 | 98 | } |
97 | 99 | } |
98 | 100 | |
99 | | variant bzip2 conflicts gzip description {Use bzip2 compression by default} { |
100 | | build.env-append \ |
101 | | COMPRESS_COMMAND="${prefix}/bin/bzip2" \ |
102 | | COMPRESS_EXT=".bz2" \ |
103 | | UNCOMPRESS_COMMAND="${prefix}/bin/bunzip2" |
104 | | depends_run-append \ |
105 | | port:bzip2 |
106 | | } |
107 | | |
108 | | variant gzip conflicts bzip2 description {Use gzip compression by default} { |
109 | | build.pre_args-append \ |
110 | | COMPRESS_COMMAND="${prefix}/bin/gzip" \ |
111 | | COMPRESS_EXT=".gz" \ |
112 | | UNCOMPRESS_COMMAND="${prefix}/bin/gunzip" |
113 | | depends_run-append \ |
114 | | port:gzip |
115 | | } |
116 | | |
117 | | variant startupitem description {Install launchd plist} { |
| 101 | variant bzip2 description {Use bzip2 compression by default} { |
| 102 | set compress ${prefix}/bin/bzip2 |
| 103 | set compress_ext .bz2 |
| 104 | set uncompress ${prefix}/bin/bunzip2 |
| 105 | depends_run-replace \ |
| 106 | port:gzip port:bzip2 |
118 | 107 | } |
119 | 108 | |
120 | | if {![variant_isset bzip2]} { |
121 | | default_variants-append \ |
122 | | +gzip |
123 | | variant_set gzip |
| 109 | variant startupitem description {Run logrotate daily} { |
124 | 110 | } |
125 | 111 | |
126 | | livecheck.url $homepage |
| 112 | livecheck.url https://github.com/logrotate/logrotate/releases |
127 | 113 | livecheck.type regex |
128 | 114 | livecheck.regex "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}" |
129 | 115 | |
130 | | notes \ |
131 | | " |
132 | | |
| 116 | notes " |
133 | 117 | To use logrotate: |
134 | 118 | |
135 | | * If ${prefix}/etc/logrotate.conf does not exist copy the example into place. |
| 119 | * See 'man logrotate' for configuration options. |
136 | 120 | |
137 | | \$ sudo cp ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf |
138 | | |
139 | | * With the startupitem variant (+startupitem) you can activate a scheduled log |
| 121 | * The startupitem variant (+startupitem) provides for daily log |
140 | 122 | rotation with this command. |
141 | 123 | |
142 | 124 | \$ sudo port load logrotate |
… |
… |
To use logrotate: |
148 | 130 | \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist |
149 | 131 | |
150 | 132 | \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist |
151 | | |
152 | 133 | " |
diff --git a/sysutils/logrotate/files/patch-Makefile.diff b/sysutils/logrotate/files/patch-Makefile.diff
deleted file mode 100644
index 305d589..0000000
+
|
-
|
|
1 | | --- a/Makefile 2013-08-18 10:39:54.000000000 -0700 |
2 | | +++ b/Makefile 2013-08-18 10:40:08.000000000 -0700 |
3 | | @@ -82,14 +82,30 @@ |
4 | | endif |
5 | | |
6 | | ifneq ($(POPT_DIR),) |
7 | | - CFLAGS += -I$(POPT_DIR) |
8 | | - LOADLIBES += -L$(POPT_DIR) |
9 | | + CFLAGS += -I$(POPT_DIR)/include |
10 | | + LOADLIBES += -L$(POPT_DIR)/lib |
11 | | endif |
12 | | |
13 | | ifneq ($(STATEFILE),) |
14 | | CFLAGS += -DSTATEFILE=\"$(STATEFILE)\" |
15 | | endif |
16 | | |
17 | | +ifneq ($(COMPRESS_COMMAND),) |
18 | | + CFLAGS += -DCOMPRESS_COMMAND=\"$(COMPRESS_COMMAND)\" |
19 | | +endif |
20 | | + |
21 | | +ifneq ($(COMPRESS_EXT),) |
22 | | + CFLAGS += -DCOMPRESS_EXT=\"$(COMPRESS_EXT)\" |
23 | | +endif |
24 | | + |
25 | | +ifneq ($(UNCOMPRESS_COMMAND),) |
26 | | + CFLAGS += -DUNCOMPRESS_COMMAND=\"$(UNCOMPRESS_COMMAND)\" |
27 | | +endif |
28 | | + |
29 | | +ifneq ($(DEFAULT_MAIL_COMMAND),) |
30 | | + CFLAGS += -DDEFAULT_MAIL_COMMAND=\"$(DEFAULT_MAIL_COMMAND)\" |
31 | | +endif |
32 | | + |
33 | | BINDIR = $(BASEDIR)/sbin |
34 | | MANDIR ?= $(BASEDIR)/man |
35 | | |
36 | | @@ -133,7 +149,7 @@ |
37 | | echo "$(TEST_ACL)" > ./test/test.ACL ; |
38 | | echo "$(TEST_SELINUX)" > ./test/test.SELINUX ; |
39 | | |
40 | | -.PHONY : test |
41 | | +.PHONY: all clean depend pretest test install co svntag create-archive archive |
42 | | test: $(TARGET) |
43 | | (cd test; ./test) |
44 | | |
diff --git a/sysutils/logrotate/files/patch-configs.diff b/sysutils/logrotate/files/patch-configs.diff
new file mode 100644
index 0000000..a5a5db5
-
|
+
|
|
| 1 | --- config.h.orig 2017-04-17 18:24:58.000000000 -0400 |
| 2 | +++ config.h 2017-04-17 18:33:22.000000000 -0400 |
| 3 | @@ -24,8 +24,10 @@ |
| 4 | #endif |
| 5 | |
| 6 | #if defined(__APPLE__) && defined(__MACH__) |
| 7 | -#define COMPRESS_COMMAND "/usr/bin/gzip" |
| 8 | -#define UNCOMPRESS_COMMAND "/usr/bin/gunzip" |
| 9 | +#define DEFAULT_MAIL_COMMAND "/usr/bin/mail" |
| 10 | +#define COMPRESS_COMMAND "@COMPRESS@" |
| 11 | +#define COMPRESS_EXT "@COMPRESS_EXT@" |
| 12 | +#define UNCOMPRESS_COMMAND "@UNCOMPRESS@" |
| 13 | #endif |
| 14 | |
| 15 | /* |
diff --git a/sysutils/logrotate/files/patch-missing_include.diff b/sysutils/logrotate/files/patch-missing_include.diff
new file mode 100644
index 0000000..6f02b20
-
|
+
|
|
| 1 | --- config.c.orig 2017-04-17 16:25:49.000000000 -0400 |
| 2 | +++ config.c 2017-04-17 16:26:23.000000000 -0400 |
| 3 | @@ -24,6 +24,7 @@ |
| 4 | #include <fnmatch.h> |
| 5 | #include <sys/mman.h> |
| 6 | |
| 7 | +#include <libgen.h> |
| 8 | #include "basenames.h" |
| 9 | #include "log.h" |
| 10 | #include "logrotate.h" |