[82267] users/pixilla/dports/sysutils/logrotate

pixilla at macports.org pixilla at macports.org
Thu Aug 11 14:04:46 PDT 2011


Revision: 82267
          http://trac.macports.org/changeset/82267
Author:   pixilla at macports.org
Date:     2011-08-11 14:04:45 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
sysutils/logrotate:
- Fix up variants.
- Remove unused patches
- OSX does not hae strndup function so add it to config.c

Modified Paths:
--------------
    users/pixilla/dports/sysutils/logrotate/Portfile

Added Paths:
-----------
    users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff

Removed Paths:
-------------
    users/pixilla/dports/sysutils/logrotate/files/patch-Makefile.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-config.h.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-examples-logrotate-default.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-logrotate.c.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-strndup.c.diff
    users/pixilla/dports/sysutils/logrotate/files/patch-strndup.h.diff

Modified: users/pixilla/dports/sysutils/logrotate/Portfile
===================================================================
--- users/pixilla/dports/sysutils/logrotate/Portfile	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/Portfile	2011-08-11 21:04:45 UTC (rev 82267)
@@ -6,7 +6,7 @@
 name                logrotate
 version             3.8.0
 categories          sysutils
-maintainers         markd pixilla.com:brad
+maintainers         markd openmaintainer
 platforms           darwin
 
 description         Rotates, compresses, and mails system logs
@@ -18,60 +18,52 @@
                     gets to a certain size.
 
 homepage            https://fedorahosted.org/logrotate/
-master_sites        https://fedorahosted.org/releases/l/o/logrotate
+master_sites        gentoo
 checksums           sha1    a79c500c4ce45177b47bb473a6bff4021af7121e \
                     rmd160  7e1e24f53db5230eee2e1db8d90fe3a33692ca01
 
-livecheck.type      regex
-livecheck.url       ${master_sites}
-livecheck.regex     ${name}-(\\d+\\.\\d+(\\.\\d+)?)${extract.suffix}
-
-patchfiles          patch-Makefile.diff \
-                    patch-examples-logrotate-default.diff \
-                    patch-config.c.diff \
-                    patch-config.h.diff \
-                    patch-logrotate.c.diff \
-                    patch-strndup.c.diff \
-                    patch-strndup.h.diff
 patch.pre_args      -p1
+patchfiles          patch-config.c.diff
 
 depends_run         port:popt port:gettext port:gzip
 
-use_configure       no
+post-extract {
+    touch ${worksrcpath}/.depend
+}
 
-set prefix_hack     [string trimleft ${destroot}${prefix} /]
+post-patch {
+    reinplace "s|@@PREFIX@@|${prefix}|g" \
+        ${worksrcpath}/examples/logrotate-default
+}
 
-destroot.env-append BASEDIR="${prefix_hack}"
+use_configure       no
 
-build.env           BASEDIR="${prefix}" \
+build.env-append \
+                    CC="${configure.cc} [get_canonical_archflags]" \
+                    CXX="${configure.cxx} [get_canonical_archflags]" \
+                    CPP="${configure.cpp} [get_canonical_archflags]" \
+                    BASEDIR="${prefix}" \
                     POPT_DIR="${prefix}/include" \
                     STATEFILE="${prefix}/var/run/logrotate/logrotate.status" \
                     DEFAULT_MAIL_COMMAND="/usr/sbin/mail" \
                     USEINSTALL="install"
 
-#build.args-append   LDFLAGS="-L${prefix}/lib"
-                    
-post-patch {
-	reinplace "s|@@PREFIX@@|${prefix}|g" \
-		${worksrcpath}/examples/logrotate-default
-}
-
+destroot.env-append BASEDIR=[string trimleft ${destroot}${prefix} /]
 destroot.keepdirs   ${destroot}${prefix}/etc/logrotate.d \
                     ${destroot}${prefix}/var/run/logrotate
-
 post-destroot {
-		xinstall -m 755 ${worksrcpath}/examples/logrotate-default \
-			${destroot}${prefix}/etc/logrotate.conf.sample
+        xinstall -m 755 ${worksrcpath}/examples/logrotate-default \
+    ${destroot}${prefix}/etc/logrotate.conf.sample
     xinstall -d ${destroot}${prefix}/etc/logrotate.d
     xinstall -d ${destroot}${prefix}/var/run/logrotate
 }
 
 post-activate {
-    delete  ${prefix}/etc/logrotate.d/.turd_${name} \
-            ${prefix}/var/run/logrotate/.turd_${name}
+#    delete  ${prefix}/etc/logrotate.d/.turd_${name} \
+#            ${prefix}/var/run/logrotate/.turd_${name}
 }
 
-variant bzip2 description {change default compression to bzip} {
+variant bzip2 conflicts gzip description {Use bzip2 compression by default} {
     build.env-append    COMPRESS_COMMAND="${prefix}/bin/bzip2" \
                         COMPRESS_EXT=".bz2" \
                         UNCOMPRESS_COMMAND="${prefix}/bin/bunzip2"
@@ -79,10 +71,22 @@
     depends_run-append  port:bzip2
 }
 
-default_variants    bzip2
+variant gzip conflicts bzip2 description {Use gzip compression by default} {
+    depends_run-append  port:gzip
+}
 
+if {![variant_isset gzip]} {
+    default_variants +bzip2
+    variant_set bzip2
+}
+
+livecheck.type      regex
+livecheck.url       ${master_sites}
+livecheck.regex     ${name}-(\\d+\\.\\d+(\\.\\d+)?)${extract.suffix}
+
 notes \
-"Copy ${prefix}/etc/logrotate.conf.sample to ${prefix}/etc/logrotate.conf for a start.
+"Copy ${prefix}/etc/logrotate.conf.sample to ${prefix}/etc/logrotate.conf for a start:
+\$ cp ${prefix}/etc/logrotate.conf.sample ${prefix}/etc/logrotate.conf
 Afterwards putting logrotate scripts in ${prefix}/etc/logrotate.d will cause them to 
 be executed with the following command:
 \$ ${prefix}/bin/${name} ${prefix}/etc/logrotate.conf"

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-Makefile.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-Makefile.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-Makefile.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,42 +0,0 @@
---- a/Makefile	2011-08-10 22:30:09.000000000 -0700
-+++ b/Makefile	2011-08-10 22:40:02.000000000 -0700
-@@ -82,8 +82,29 @@
-     CFLAGS += -DSTATEFILE=\"$(STATEFILE)\"
- endif
- 
-+ifneq ($(DEFAULT_MAIL_COMMAND),)
-+    CFLAGS += -DDEFAULT_MAIL_COMMAND=\"$(DEFAULT_MAIL_COMMAND)\"
-+endif
-+
-+ifneq ($(COMPRESS_COMMAND),)
-+    CFLAGS += -DCOMPRESS_COMMAND=\"$(COMPRESS_COMMAND)\"
-+endif
-+
-+ifneq ($(COMPRESS_EXT),)
-+    CFLAGS += -DCOMPRESS_EXT=\"$(COMPRESS_EXT)\"
-+endif
-+
-+ifneq ($(UNCOMPRESS_COMMAND),)
-+    CFLAGS += -DUNCOMPRESS_COMMAND=\"$(UNCOMPRESS_COMMAND)\"
-+endif
-+
-+ifeq ($(OS_NAME),Darwin)
-+    INSTALL = install
-+    LDFLAGS += -undefined dynamic_lookup
-+endif
-+
- BINDIR = $(BASEDIR)/sbin
--MANDIR = $(BASEDIR)/man
-+MANDIR = $(BASEDIR)/share/man
- 
- #--------------------------------------------------------------------------
- 
-@@ -92,7 +113,7 @@
- 
- ifeq ($(RPM_OPT_FLAGS),)
- CFLAGS += -g
--LDFLAGS = -g
-+LDFLAGS += -g
- endif
- 
- ifeq (.depend,$(wildcard .depend))

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,56 +0,0 @@
---- a/config.c	2011-08-10 16:54:18.000000000 -0700
-+++ b/config.c	2011-08-10 17:08:36.000000000 -0700
-@@ -163,34 +163,25 @@
-     size_t len;
- 
-     if ((start = isolateValue(configFile, lineNum, key, startPtr, buf, length)) != NULL) {
--
--	chptr = start;
--
--	while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) {
--		if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || iswblank(pwc) ) {
--		    message(MESS_ERROR, "%s:%d bad %s path %s\n",
--			    configFile, lineNum, key, start);
--		    return NULL;
--		}
--		chptr += len;
--	}
--
--/*
--	while (*chptr && isprint(*chptr) && *chptr != ' ')
--	    chptr++;
--	if (*chptr) {
--	    message(MESS_ERROR, "%s:%d bad %s path %s\n",
--		    configFile, lineNum, key, start);
--	    return NULL;
--	}
--*/
--
--	path = strdup(start);
--	free(start);
--
--	return path;
--    } else
--	return NULL;
-+    
-+      chptr = start;
-+    
-+      while (*chptr && isprint(*chptr) && *chptr != ' ') {
-+        chptr++;
-+      }
-+      if (*chptr) {
-+        message(MESS_ERROR, "%s:%d bad %s path %s\n",
-+          configFile, lineNum, key, start);
-+        return NULL;
-+      }
-+    
-+      path = strdup(start);
-+      free(start);
-+    
-+      return path;
-+		} else {
-+    	return NULL;
-+    }
- }
- 
- static char *readAddress(const char *configFile, int lineNum, char *key,

Added: users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff	                        (rev 0)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-config.c.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -0,0 +1,32 @@
+--- a/config.c	2011-08-11 13:50:02.000000000 -0700
++++ b/config.c	2011-08-11 13:13:41.000000000 -0700
+@@ -74,6 +74,29 @@
+ 
+ #endif
+ 
++#if !defined(strndup)
++char *strndup(const char *s, size_t n)
++{
++       size_t nAvail;
++       char *p;
++
++       if(!s)
++               return NULL;
++
++       /* min() */
++       nAvail = strlen(s) + 1;
++       if ( (n + 1) < nAvail)
++               nAvail = n + 1;
++
++       p = malloc(nAvail);
++       if (!p)
++               return NULL;
++       memcpy(p, s, nAvail);
++       p[nAvail - 1] = 0;
++       return p;
++}
++#endif
++
+ enum {
+ 	STATE_DEFAULT = 2,
+ 	STATE_SKIP_LINE = 4,

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-config.h.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-config.h.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-config.h.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,10 +0,0 @@
---- a/config.h	2011-08-10 22:30:09.000000000 -0700
-+++ b/config.h	2011-08-10 22:34:07.000000000 -0700
-@@ -47,3 +47,7 @@
- #ifndef STATEFILE
- #define STATEFILE "/var/lib/logrotate.status"
- #endif
-+
-+#ifdef Darwin
-+#include "strndup.h"
-+#endif

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-examples-logrotate-default.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-examples-logrotate-default.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-examples-logrotate-default.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,38 +0,0 @@
---- a/examples/logrotate-default	2011-08-10 16:54:18.000000000 -0700
-+++ b/examples/logrotate-default	2011-08-10 17:08:36.000000000 -0700
-@@ -15,21 +15,21 @@
- #compress
- 
- # RPM packages drop log rotation information into this directory
--include /etc/logrotate.d
-+include @@PREFIX@@/etc/logrotate.d
- 
- # no packages own wtmp and btmp -- we'll rotate them here
--/var/log/wtmp {
--    monthly
--    create 0664 root utmp
--	minsize 1M
--    rotate 1
--}
--
--/var/log/btmp {
--    missingok
--    monthly
--    create 0600 root utmp
--    rotate 1
--}
-+#/var/log/wtmp {
-+#    monthly
-+#    create 0664 root utmp
-+#	minsize 1M
-+#    rotate 1
-+#}
-+#
-+#/var/log/btmp {
-+#    missingok
-+#    monthly
-+#    create 0600 root utmp
-+#    rotate 1
-+#}
- 
- # system-specific logs may be also be configured here.

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-logrotate.c.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-logrotate.c.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-logrotate.c.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,13 +0,0 @@
---- a/logrotate.c	2011-08-10 16:54:18.000000000 -0700
-+++ b/logrotate.c	2011-08-10 17:24:49.000000000 -0700
-@@ -21,6 +21,10 @@
- #include <sys/types.h>
- #include <utime.h>
- 
-+#if defined(Darwin) 
-+#include <limits.h>
-+#endif
-+
- #if defined(SunOS)
- #include <limits.h>
- #endif

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-strndup.c.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-strndup.c.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-strndup.c.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,41 +0,0 @@
---- /dev/null	2011-08-10 22:37:48.000000000 -0700
-+++ b/strndup.c	2011-08-10 22:25:13.000000000 -0700
-@@ -0,0 +1,37 @@
-+/* A replacement function, for systems that lack strndup.
-+
-+   Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007
-+   Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify it
-+   under the terms of the GNU General Public License as published by the
-+   Free Software Foundation; either version 2, or (at your option) any
-+   later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software Foundation,
-+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-+
-+#include <config.h>
-+
-+#include <string.h>
-+
-+#include <stdlib.h>
-+
-+char *
-+strndup (char const *s, size_t n)
-+{
-+  size_t len = strnlen (s, n);
-+  char *new = malloc (len + 1);
-+
-+  if (new == NULL)
-+    return NULL;
-+
-+  new[len] = '\0';
-+  return memcpy (new, s, len);
-+}
-\ No newline at end of file

Deleted: users/pixilla/dports/sysutils/logrotate/files/patch-strndup.h.diff
===================================================================
--- users/pixilla/dports/sysutils/logrotate/files/patch-strndup.h.diff	2011-08-11 20:58:09 UTC (rev 82266)
+++ users/pixilla/dports/sysutils/logrotate/files/patch-strndup.h.diff	2011-08-11 21:04:45 UTC (rev 82267)
@@ -1,4 +0,0 @@
---- /dev/null	2011-08-10 22:37:48.000000000 -0700
-+++ b/strndup.h	2011-08-10 22:26:21.000000000 -0700
-@@ -0,0 +1 @@
-+char *strndup (char const *s, size_t n);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110811/31f01d7c/attachment.html>


More information about the macports-changes mailing list