From 2f0ac7ac1bc83936a3094463ed4ae899f43b578d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 12:33:45 -0500
Subject: logrotate 3.8.1

---
 abs/core/logrotate/PKGBUILD                        | 54 +++++++++++++---------
 .../logrotate/logrotate-3.8.1-noasprintf.patch     | 53 +++++++++++++++++++++
 abs/core/logrotate/logrotate.cron.daily            | 23 ++++++++-
 3 files changed, 106 insertions(+), 24 deletions(-)
 create mode 100644 abs/core/logrotate/logrotate-3.8.1-noasprintf.patch

diff --git a/abs/core/logrotate/PKGBUILD b/abs/core/logrotate/PKGBUILD
index 1cb10e4..2e38d80 100644
--- a/abs/core/logrotate/PKGBUILD
+++ b/abs/core/logrotate/PKGBUILD
@@ -1,39 +1,47 @@
-# $Id: PKGBUILD 92736 2010-09-30 15:38:29Z allan $
-# Maintainer: Aaron Griffin <aaron@archlinux.org>
-# Contributor: Judd Vinet <jvinet@zeroflux.org>
+# $Id: PKGBUILD 162089 2012-06-19 15:44:03Z allan $
+# Maintainer: Pierre Schmitz <pierre@archlinux.de>
 
 pkgname=logrotate
-pkgver=3.7.9
-pkgrel=1
+pkgver=3.8.1
+pkgrel=2
 pkgdesc="Rotates system logs automatically"
-url='https://fedorahosted.org/logrotate/'
 arch=('i686' 'x86_64')
+url="https://fedorahosted.org/logrotate/"
 license=('GPL')
 groups=('base')
 depends=('popt' 'cron' 'gzip')
 backup=('etc/logrotate.conf')
-source=(https://fedorahosted.org/releases/l/o/logrotate/logrotate-${pkgver}.tar.gz
-        logrotate.conf
-        logrotate.cron.daily)
-md5sums=('eeba9dbca62a9210236f4b83195e4ea5'
+source=("https://fedorahosted.org/releases/l/o/logrotate/logrotate-${pkgver}.tar.gz"
+        'logrotate-3.8.1-noasprintf.patch'
+        'logrotate.conf'
+        'logrotate.cron.daily')
+md5sums=('bd2e20d8dc644291b08f9215397d28a5'
+         'fc8e4e15211d8aefd431d0e2e96223c4'
          '462a5f364717461537eb2ae6394ad23e'
-         '8e23d5d4cc29b1e055b24df87e355cdc')
+         'aa8ac8283908b6114483a293adcb650f')
 
 build() {
-  cd $srcdir/${pkgname}-${pkgver}
-  
-  sed -i 's|#define DEFAULT_MAIL_COMMAND .*|#define DEFAULT_MAIL_COMMAND "/usr/bin/mail"|'\
-    config.h
-  sed -i "s|CFLAGS = -Wall|CFLAGS = -Wall $CFLAGS|" Makefile
-  sed -i 's|$(BASEDIR)/man|$(BASEDIR)/share/man|' Makefile
-  
-  make
+  cd "$srcdir/${pkgname}-${pkgver}"
+
+  patch -p1 -i "$srcdir"/logrotate-3.8.1-noasprintf.patch
+
+  sed -e 's|#define DEFAULT_MAIL_COMMAND .*|#define DEFAULT_MAIL_COMMAND "/usr/bin/mail"|'\
+      -e 's|#define COMPRESS_COMMAND .*|#define COMPRESS_COMMAND "/usr/bin/gzip"|'\
+      -e 's|#define UNCOMPRESS_COMMAND .*|#define UNCOMPRESS_COMMAND "/usr/bin/gunzip"|'\
+      -i config.h
+
+  make RPM_OPT_FLAGS="$CFLAGS" EXTRA_LDFLAGS="$LDFLAGS"
+}
+
+check() {
+  cd "$srcdir/${pkgname}-${pkgver}"
+  make test
 }
 
 package() {
-  cd $srcdir/${pkgname}-${pkgver}
-  make PREFIX=$pkgdir install
+  cd "$srcdir/${pkgname}-${pkgver}"
+  make PREFIX="$pkgdir" MANDIR="usr/share/man" install
 
-  install -Dm644 $srcdir/logrotate.conf $pkgdir/etc/logrotate.conf
-  install -Dm744 $srcdir/logrotate.cron.daily $pkgdir/etc/cron.daily/logrotate
+  install -Dm644 "$srcdir/logrotate.conf" "$pkgdir/etc/logrotate.conf"
+  install -Dm744 "$srcdir/logrotate.cron.daily" "$pkgdir/etc/cron.daily/logrotate"
 }
diff --git a/abs/core/logrotate/logrotate-3.8.1-noasprintf.patch b/abs/core/logrotate/logrotate-3.8.1-noasprintf.patch
new file mode 100644
index 0000000..be0c080
--- /dev/null
+++ b/abs/core/logrotate/logrotate-3.8.1-noasprintf.patch
@@ -0,0 +1,53 @@
+--- logrotate-3.8.0.orig/config.c	2011-06-21 04:12:02.000000000 -0400
++++ logrotate-3.8.0/config.c	2011-07-12 13:47:36.274319050 -0400
+@@ -41,39 +41,6 @@
+ #include "asprintf.c"
+ #endif
+ 
+-#if !defined(asprintf)
+-#include <stdarg.h>
+-
+-int asprintf(char **string_ptr, const char *format, ...)
+-{
+-	va_list arg;
+-	char *str;
+-	int size;
+-	int rv;
+-
+-	va_start(arg, format);
+-	size = vsnprintf(NULL, 0, format, arg);
+-	size++;
+-	va_start(arg, format);
+-	str = malloc(size);
+-	if (str == NULL) {
+-		va_end(arg);
+-		/*
+-		 * Strictly speaking, GNU asprintf doesn't do this,
+-		 * but the caller isn't checking the return value.
+-		 */
+-		fprintf(stderr, "failed to allocate memory\\n");
+-		exit(1);
+-	}
+-	rv = vsnprintf(str, size, format, arg);
+-	va_end(arg);
+-
+-	*string_ptr = str;
+-	return (rv);
+-}
+-
+-#endif
+-
+ #if !defined(strndup)
+ char *strndup(const char *s, size_t n)
+ {
+--- logrotate-3.8.0.orig/logrotate.h	2011-06-21 04:12:02.000000000 -0400
++++ logrotate-3.8.0/logrotate.h	2011-07-12 13:47:38.949285608 -0400
+@@ -66,8 +66,5 @@ extern int numLogs;
+ extern int debug;
+ 
+ int readAllConfigPaths(const char **paths);
+-#if !defined(asprintf)
+-int asprintf(char **string_ptr, const char *format, ...);
+-#endif
+ 
+ #endif
diff --git a/abs/core/logrotate/logrotate.cron.daily b/abs/core/logrotate/logrotate.cron.daily
index e8ab921..ee0eeeb 100755
--- a/abs/core/logrotate/logrotate.cron.daily
+++ b/abs/core/logrotate/logrotate.cron.daily
@@ -1,3 +1,24 @@
 #!/bin/sh
 
-/usr/sbin/logrotate /etc/logrotate.conf
+# nicenesses range from -20 (most favorable scheduling) to 19 (least favorable)
+NICE=19
+
+# 0 for none, 1 for real time, 2 for best-effort, 3 for idle
+IONICE_CLASS=2
+
+# 0-7 (for IONICE_CLASS 1 and 2 only), 0=highest, 7=lowest
+IONICE_PRIORITY=7
+
+CMD_LOGROTATE="/usr/sbin/logrotate /etc/logrotate.conf"
+ 
+if [ -x /usr/bin/nice ]; then
+  CMD_LOGROTATE="/usr/bin/nice -n ${NICE:-19} ${CMD_LOGROTATE}"
+fi
+ 
+if [ -x /usr/bin/ionice ]; then
+  CMD_LOGROTATE="/usr/bin/ionice -c ${IONICE_CLASS:-2} -n ${IONICE_PRIORITY:-7} ${CMD_LOGROTATE}"
+fi
+ 
+${CMD_LOGROTATE}
+ 
+exit 0
-- 
cgit v0.12

