Ticket #53930: 0001-logrotate-update-to-3.11.0-etc.patch

File 0001-logrotate-update-to-3.11.0-etc.patch, 10.3 KB (added by ctreleaven (Craig Treleaven), 8 years ago)
  • sysutils/logrotate/Portfile

    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  
    11# -*- 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
    22
    33PortSystem          1.0
     4PortGroup           github 1.0
    45
    5 name                logrotate
    6 version             3.8.6
    7 revision            2
     6github.setup        logrotate logrotate 3.11.0
     7
     8github.tarball_from releases
     9use_xz              yes
     10checksums           rmd160  507dc354394daead333744886c7038a2a8b85759 \
     11                    sha256  18ae0f2ec1f14d9550c9f6bd9a2b6a18440e6a0fd7d5923a6e3fcb7d45946261
    812categories          sysutils
    913platforms           darwin
    1014license             GPL-2
    maintainers pixilla openmaintainer 
    1216
    1317description         Rotates, compresses, and mails system logs
    1418
    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/
     19long_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.
    2324
    24 checksums           rmd160  4cba4954c99896ea036d57190fc11a8307b2765e \
    25                     sha256  0e0ef0609afe9ef2a2ef6cae307b5ca618ddd349923ccce6e064513afd4e9d92
     25homepage            https://github.com/logrotate/logrotate
    2626
    2727depends_lib         port:popt
    2828
    29 depends_run         port:gettext
     29depends_run         port:gettext \
     30                    port:gzip
     31
     32# See https://github.com/logrotate/logrotate/issues/117
     33patchfiles-append   patch-missing_include.diff
     34# set up so we can reinplace our desired compressor
     35patchfiles-append   patch-configs.diff
    3036
    31 patch.pre_args      -p1
    32 patchfiles          patch-Makefile.diff
     37set compress        ${prefix}/bin/gzip
     38set compress_ext    .gz
     39set uncompress      ${prefix}/bin/gunzip
    3340
    3441post-extract {
    3542    touch ${worksrcpath}/.depend
    post-patch { 
    4653        ${worksrcpath}/logrotate.conf.example
    4754    reinplace "s|@PREFIX@|${prefix}|g" \
    4855        ${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
    4962}
    5063
    51 use_configure       no
     64use_autoreconf      yes
     65autoreconf.args-append \
     66                    --force
     67configure.args-append \
     68                    --disable-silent-rules\
     69                    --with-state-file-path=${prefix}/var/run/logrotate/logrotate.status
    5270
    53 variant universal {}
     71universal_variant   no
    5472
    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"
    6673destroot.keepdirs   ${destroot}${prefix}/etc/logrotate.d \
    6774                    ${destroot}${prefix}/var/run/logrotate
    6875post-destroot {
    6976    xinstall -d ${destroot}${prefix}/share/${name}
    70         xinstall -m 644 -W ${worksrcpath} CHANGES COPYING \
     77        xinstall -m 644 -W ${worksrcpath} ChangeLog.md COPYING \
    7178            logrotate.conf.example org.macports.logrotate.plist.example \
    7279                ${destroot}${prefix}/share/${name}
    7380
    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     }
    7981    if {[variant_isset startupitem]
    8082    && ${startupitem.install} != "no"
    8183    && [getuid] == 0} {
    post-activate { 
    9698    }
    9799}
    98100
    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} {
     101variant 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
    118107}
    119108
    120 if {![variant_isset bzip2]} {
    121     default_variants-append \
    122                     +gzip
    123     variant_set     gzip
     109variant startupitem description {Run logrotate daily} {
    124110}
    125111
    126 livecheck.url       $homepage
     112livecheck.url       https://github.com/logrotate/logrotate/releases
    127113livecheck.type      regex
    128114livecheck.regex     "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}"
    129115
    130 notes \
    131 "
    132 
     116notes "
    133117To use logrotate:
    134118
    135   * If ${prefix}/etc/logrotate.conf does not exist copy the example into place.
     119  * See 'man logrotate' for configuration options.
    136120
    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
    140122    rotation with this command.
    141123
    142124    \$ sudo port load logrotate
    To use logrotate: 
    148130    \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist
    149131
    150132    \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist
    151    
    152133"
  • deleted file sysutils/logrotate/files/patch-Makefile.diff

    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  
  • new file sysutils/logrotate/files/patch-configs.diff

    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 /*
  • new file sysutils/logrotate/files/patch-missing_include.diff

    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"