Subject: [alpine-aports] [PATCH 1/2] testing/pdns: Upgrade and cleanup

From: Olivier Mauras <[email-masked]>
Date: Tue, 16 Aug 2016 19:27:21 +0200

- Upgrade to latest version - 4.0.1 
- Removed unused patches
- Set config file in /etc/pdns instead of /etc to have a cleaner setup with pdns-recursor 
- Remove geo backend that doesn't exist anymore - geoip backend can be reintroduced later but has other dependancies
---
 testing/pdns/0010-disable-execinfo.patch           | 25 ------------
 testing/pdns/APKBUILD                              | 24 +++++------
 testing/pdns/allocate-tcp-buffer-dynamically.patch | 46 ----------------------
 3 files changed, 12 insertions(+), 83 deletions(-)
 delete mode 100644 testing/pdns/0010-disable-execinfo.patch
 delete mode 100644 testing/pdns/allocate-tcp-buffer-dynamically.patch

diff --git a/testing/pdns/0010-disable-execinfo.patch b/testing/pdns/0010-disable-execinfo.patch
deleted file mode 100644
index 23747b3..0000000
--- a/testing/pdns/0010-disable-execinfo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- ./pdns/receiver.cc.orig
-+++ ./pdns/receiver.cc
-@@ -375,10 +375,11 @@
- 
- 
- #ifdef __linux__
--#include <execinfo.h>
-+//#include <execinfo.h>
- static void tbhandler(int num)
- {
--  L<<Logger::Critical<<"Got a signal "<<num<<", attempting to print trace: "<<endl;
-+  L<<Logger::Critical<<"Got a signal "<<num<<" (trace printing hard-disabled)"<<endl;
-+/*
-   void *array[20]; //only care about last 17 functions (3 taken with tracing support)
-   size_t size;
-   char **strings;
-@@ -389,7 +390,7 @@
-   
-   for (i = 0; i < size; i++) //skip useless functions
-     L<<Logger::Error<<strings[i]<<endl;
--  
-+*/
-   
-   signal(SIGABRT, SIG_DFL);
-   abort();//hopefully will give core
diff --git a/testing/pdns/APKBUILD b/testing/pdns/APKBUILD
index c60320e..5d6fd99 100644
--- a/testing/pdns/APKBUILD
+++ b/testing/pdns/APKBUILD
@@ -1,9 +1,10 @@
 # Contributor: *ukasz Jendrysik <[email-masked]>
 # Contributor: Matt Smith <[email-masked]>
+# Contributor: Olivier Mauras <[email-masked]>
 # Maintainer:  Matt Smith <[email-masked]>
 pkgname=pdns
-pkgver=3.4.8
-pkgrel=3
+pkgver=4.0.1
+pkgrel=0
 pkgdesc="PowerDNS Authoritative Server"
 url="http://www.powerdns.com/"
 arch="all"
@@ -15,7 +16,6 @@ makedepends="$depends_dev boost-dev lua-dev openldap-dev mariadb-dev
 install="$pkgname.pre-install $pkgname.post-deinstall"
 subpackages="$pkgname-doc
 	$pkgname-backend-bind:backend_bind
-	$pkgname-backend-geo:backend_geo
 	$pkgname-backend-ldap:backend_ldap
 	$pkgname-backend-mysql:backend_mysql
 	$pkgname-backend-pgsql:backend_pgsql
@@ -44,13 +44,13 @@ prepare() {
 build() {
 	cd "$_builddir"
 	./configure --prefix=/usr \
-		--sysconfdir=/etc \
+		--sysconfdir=/etc/$pkgname \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
 		--localstatedir=/var \
 		--libdir=/usr/lib/pdns \
 		--with-modules="" \
-		--with-dynmodules="bind geo ldap gmysql gpgsql pipe gsqlite3" \
+		--with-dynmodules="bind ldap gmysql gpgsql pipe gsqlite3" \
 		--disable-static \
 		|| return 1
 	make || return 1
@@ -62,14 +62,13 @@ package() {
 
 	install -m755 -D "$srcdir"/$pkgname.initd \
 		"$pkgdir"/etc/init.d/$pkgname || return 1
-	rm "$pkgdir"/etc/pdns.conf-dist
+	rm "$pkgdir"/etc/$pkgname/$pkgname.conf-dist
 	install -m600 -D "$srcdir"/$pkgname.conf \
-		"$pkgdir"/etc/$pkgname.conf || return 1
-	chown pdns:pdns "$pkgdir"/etc/$pkgname.conf || return 1
+		"$pkgdir"/etc/$pkgname/$pkgname.conf || return 1
+	chown pdns:pdns "$pkgdir"/etc/$pkgname/$pkgname.conf || return 1
 }
 
 backend_bind()		{ _mv_backend bind; }
-backend_geo()		{ _mv_backend geo; }
 backend_ldap()		{ _mv_backend ldap openldap; }
 backend_mysql()		{ _mv_backend gmysql mysql; }
 backend_pgsql()		{ _mv_backend gpgsql postgresql; }
@@ -79,6 +78,7 @@ backend_sqlite3()	{ _mv_backend gsqlite3 sqlite; }
 _mv_backend() {
 	local backend=$1
 	pkgdesc="${backend} backend module for PowerDNS"
+	depends="$pkgname"
 
 	# backend dependencies
 	if [ -n "${2-}" ]; then
@@ -91,12 +91,12 @@ _mv_backend() {
 		"$subpkgdir"/usr/lib/pdns/pdns/ || return 1
 }
 
-md5sums="7d7c7de2b8b0343c64f85edab8e8074e  pdns-3.4.8.tar.bz2
+md5sums="d34a390672aa043f8a287e5bb2284f4a  pdns-4.0.1.tar.bz2
 db11dfe72474858f706155c817f2ded5  pdns.initd
 351bac7f784a1a40e768466d9e6f1a79  pdns.conf"
-sha256sums="4f818fd09bff89625b4317cc7c05445f6e7bd9ea8d21e7eefeaaca07b8b0cd9f  pdns-3.4.8.tar.bz2
+sha256sums="d191eed4a6664430e85969f49835c59e810ecbb7b3eb506e64c6b2734091edd7  pdns-4.0.1.tar.bz2
 081835f812e419b153a9cc716ad55b9cb22c6c185b748e0aafc40430fa5e8b5e  pdns.initd
 5fdf423f829dca0b50bc81bab773d7ec4ee6627e35f861124d8c2ccd79a2f50c  pdns.conf"
-sha512sums="8d0f7bbbe21559ecf0d9f323a2f4226b2c2d5542261e0ad44e6ac17f13bbe087b52efe1b74ca756cf9b92f6cb333829c42b55c245543fa3dea4a4f62be8cdf6e  pdns-3.4.8.tar.bz2
+sha512sums="77fce9963a05198afeb569f92fbb0f6a1cb3426c28dd77b0921128189c80d9a72ebdbfc249dfc0b5b89cc7a65a83887a0388d6cc3461453b1e3096e563afdd1e  pdns-4.0.1.tar.bz2
 71257be925fe57b15ebf29a7810cd70581cb867416ab9562300a1bbc3eb94fcb92ea2eb95f15e3ee3bd409468911077c50f90a2501801b0c8c49ed979f41f3a4  pdns.initd
 9913551bb4d685aaced806134b1037d85ce759e7d9e780e256e67651d9d346aad5e608b4a45a4933f0ba879605b69d06e579c38b7f917f7a9be37c7797c5953b  pdns.conf"
diff --git a/testing/pdns/allocate-tcp-buffer-dynamically.patch b/testing/pdns/allocate-tcp-buffer-dynamically.patch
deleted file mode 100644
index b346a2e..0000000
--- a/testing/pdns/allocate-tcp-buffer-dynamically.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From c2b4ccc0d125a30a1970f555f572bf74de27a3d5 Mon Sep 17 00:00:00 2001
-From: bert hubert <[email-masked]>
-Date: Sat, 10 Jan 2015 23:06:38 +0100
-Subject: [PATCH] allocate TCP buffer dynamically, decreasing our stack usage
-
----
- pdns/tcpreceiver.cc | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc
-index f90bf90..6356d34 100644
---- a/pdns/tcpreceiver.cc
-+++ b/pdns/tcpreceiver.cc
-@@ -253,7 +253,8 @@ void *TCPNameserver::doConnection(void *data)
-   pthread_detach(pthread_self());
-   Utility::setNonBlocking(fd);
-   try {
--    char mesg[65535];
-+    int mesgsize=65535;
-+    scoped_array<char> mesg(new char[mesgsize]);
-     
-     DLOG(L<<"TCP Connection accepted on fd "<<fd<<endl);
-     bool logDNSQueries= ::arg().mustDo("log-dns-queries");
-@@ -278,19 +279,19 @@ void *TCPNameserver::doConnection(void *data)
- 
-       // do not remove this check as it will catch if someone
-       // decreases the mesg buffer size for some reason. 
--      if(pktlen>sizeof(mesg)) {
-+      if(pktlen > mesgsize) {
-         L<<Logger::Error<<"Received an overly large question from "<<remote.toString()<<", dropping"<<endl;
-         break;
-       }
-       
--      getQuestion(fd, mesg, pktlen, remote);
-+      getQuestion(fd, mesg.get(), pktlen, remote);
-       S.inc("tcp-queries");      
- 
-       packet=shared_ptr<DNSPacket>(new DNSPacket);
-       packet->setRemote(&remote);
-       packet->d_tcp=true;
-       packet->setSocket(fd);
--      if(packet->parse(mesg, pktlen)<0)
-+      if(packet->parse(mesg.get(), pktlen)<0)
-         break;
-       
-       if(packet->qtype.getCode()==QType::AXFR) {
-- 
2.8.3