[pdns] New release candidate Add MongoDB backend Enable LUA support Convert to systemd

Ruben Kerkhof ruben at fedoraproject.org
Wed Jul 20 15:07:43 UTC 2011


commit 1e981e8fefdc339e31555bfaf74184932c3bdff0
Author: Ruben <ruben at rubenkerkhof.com>
Date:   Wed Jul 20 17:07:05 2011 +0200

    New release candidate
    Add MongoDB backend
    Enable LUA support
    Convert to systemd

 .gitignore                        |    2 +
 pdns-fix-lua-detection.patch      |   12 ++++
 pdns-fix-mongo-backend.patch      |   16 +++++
 pdns-fix-postgres-detection.patch |   22 -------
 pdns.service                      |   13 ++++
 pdns.spec                         |  124 +++++++++++++++++++++++++------------
 sources                           |    2 +-
 7 files changed, 129 insertions(+), 62 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9941fbd..0e40640 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
 pdns-2.9.22.tar.gz
 /pdns-3.0-pre.20110327.2103.tar.gz
+/pdns-3.0-rc2.tar.gz
+/pdns-3.0-rc3.tar.gz
diff --git a/pdns-fix-lua-detection.patch b/pdns-fix-lua-detection.patch
new file mode 100644
index 0000000..29b352a
--- /dev/null
+++ b/pdns-fix-lua-detection.patch
@@ -0,0 +1,12 @@
+diff -up pdns-3.0-rc3/configure.orig pdns-3.0-rc3/configure
+--- pdns-3.0-rc3/configure.orig	2011-07-20 14:09:39.960000514 +0200
++++ pdns-3.0-rc3/configure	2011-07-20 14:09:46.288007162 +0200
+@@ -16494,7 +16494,7 @@ $as_echo_n "checking if with lua... " >&
+ 
+ # Check whether --with-lua was given.
+ if test "${with_lua+set}" = set; then :
+-  withval=$with_lua; WITH_LUA=$withval]
++  withval=$with_lua; WITH_LUA=$withval
+ else
+   WITH_LUA=yes
+ fi
diff --git a/pdns-fix-mongo-backend.patch b/pdns-fix-mongo-backend.patch
new file mode 100644
index 0000000..31bb402
--- /dev/null
+++ b/pdns-fix-mongo-backend.patch
@@ -0,0 +1,16 @@
+diff -up pdns-3.0-rc3/modules/mongodbbackend/Makefile.in.orig pdns-3.0-rc3/modules/mongodbbackend/Makefile.in
+--- pdns-3.0-rc3/modules/mongodbbackend/Makefile.in.orig	2011-07-20 14:41:20.181000073 +0200
++++ pdns-3.0-rc3/modules/mongodbbackend/Makefile.in	2011-07-20 14:41:45.191996169 +0200
+@@ -256,10 +256,10 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = @THREADFLAGS@
+ EXTRA_DIST = OBJECTFILES OBJECTLIBS 
+-INCLUDES = -I/opt/mongo/include/mongo/
++INCLUDES = -I/usr/include/mongo/
+ lib_LTLIBRARIES = libmongodbbackend.la
+ libmongodbbackend_la_SOURCES = mongodbbackend.cc mongodbbackend.hh minimal.cc slave.cc master.cc reload.cc private.cc dnssec.cc supermaster.cc crc32.cc
+-libmongodbbackend_la_LDFLAGS = -module -avoid-version -L/opt/mongo/lib64 $(BOOST_THREAD_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS)  -lmongoclient $(BOOST_THREAD_LIBS) $(BOOST_FILESYSTEM_LIBS) $(BOOST_SYSTEM_LIBS) 
++libmongodbbackend_la_LDFLAGS = -module -avoid-version $(BOOST_THREAD_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS)  -lmongoclient $(BOOST_THREAD_LIBS) $(BOOST_FILESYSTEM_LIBS) $(BOOST_SYSTEM_LIBS) 
+ all: all-am
+ 
+ .SUFFIXES:
diff --git a/pdns.service b/pdns.service
new file mode 100644
index 0000000..d9877ad
--- /dev/null
+++ b/pdns.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=PDNS DNS Server
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/pdns_server --daemon --guardian=yes
+ExecReload=/usr/bin/pdns_control cycle
+ExecStop=/usr/bin/pdns_control quit
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/pdns.spec b/pdns.spec
index bf498a8..9b2f517 100644
--- a/pdns.spec
+++ b/pdns.spec
@@ -1,22 +1,24 @@
-%global alphatag pre.20110327.2103
+%global alphatag rc3
 
 Summary:	A modern, advanced and high performance authoritative-only nameserver
 Name:		pdns
 Version:	3.0
-Release:	4.%{alphatag}%{?dist}
+Release:	5.%{alphatag}%{?dist}
 
 Group:		System Environment/Daemons
 License:	GPLv2
 URL:		http://powerdns.com
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Source0:	http://downloads.powerdns.com/releases/%{name}-%{version}-%{alphatag}.tar.gz
-Patch0:		%{name}-fixinit.patch
-Patch1:		pdns-fix-postgres-detection.patch
+Source1:	pdns.service
+Patch0:		pdns-fix-mongo-backend.patch
+Patch1:		pdns-fix-lua-detection.patch
 
-Requires(post):	%{_sbindir}/useradd, /sbin/chkconfig
-Requires(preun):	/sbin/service, /sbin/chkconfig
+Requires(pre):	shadow-utils
+Requires(post):	systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
-BuildRequires:	boost-devel, chrpath, lua-devel
+BuildRequires:	boost-devel, chrpath, lua-devel, cryptopp-devel, systemd-units
 Provides:	powerdns = %{version}-%{release}
 
 %description
@@ -28,37 +30,43 @@ Furthermore, PowerDNS interfaces with almost any database.
 %package	backend-mysql
 Summary:	MySQL backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 BuildRequires:	mysql-devel
 
 %package	backend-postgresql
 Summary:	PostgreSQL backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 BuildRequires:	postgresql-devel
 
 %package	backend-pipe
 Summary:	Pipe backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 
 %package	backend-geo
 Summary:	Geo backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 
 %package	backend-ldap
 Summary:	LDAP backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 BuildRequires:	openldap-devel
 
 %package	backend-sqlite
 Summary:	SQLite backend for %{name}
 Group:		System Environment/Daemons
-Requires:	%{name} = %{version}-%{release}
+Requires:	%{name}%{?_isa} = %{version}-%{release}
 BuildRequires:	sqlite-devel
 
+%package	backend-mongodb
+Summary:	MongoDB backend for %{name}
+Group:		System Environment/Daemons
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+BuildRequires:	mongodb-devel
+
 %description	backend-mysql
 This package contains the gmysql backend for %{name}
 
@@ -79,11 +87,14 @@ This package contains the ldap backend for %{name}
 %description	backend-sqlite
 This package contains the SQLite backend for %{name}
 
+%description	backend-mongodb
+This package contains the MongoDB backend for %{name}
+
 
 %prep
 %setup -q -n %{name}-%{version}-%{alphatag}
-%patch0 -p1 -b .fixinit
-%patch1 -p1 -b .postgres
+%patch0 -p1 -b .fixmongo
+%patch1 -p1 -b .fixlua
 
 %build
 export CPPFLAGS="-DLDAP_DEPRECATED %{optflags}"
@@ -93,18 +104,19 @@ export CPPFLAGS="-DLDAP_DEPRECATED %{optflags}"
 	--libdir=%{_libdir}/%{name} \
 	--disable-static \
 	--with-modules='' \
-	--with-dynmodules='pipe gmysql gpgsql geo ldap gsqlite3' \
-	--with-mysql-lib=%{_libdir}/mysql \
-	--with-sqlite3-lib=%{_libdir}
+	--with-lua \
+	--with-dynmodules='pipe gmysql gpgsql geo ldap gsqlite3 mongodb' \
+	--enable-cryptopp
+
+sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
+sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
 
 make %{?_smp_mflags}
 
 %install
-%{__rm} -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 
 %{__rm} -f %{buildroot}%{_libdir}/%{name}/*.la
-%{__install} -p -D -m 0755 pdns/pdns %{buildroot}%{_initrddir}/pdns
 %{__mv} %{buildroot}%{_sysconfdir}/%{name}/pdns.conf{-dist,}
 
 # add the pdns user to the config file
@@ -118,26 +130,55 @@ chrpath --delete %{buildroot}%{_bindir}/zone2sql
 chrpath --delete %{buildroot}%{_sbindir}/pdns_server
 chrpath --delete %{buildroot}%{_libdir}/%{name}/*.so
 
+# Copy systemd service file
+install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/pdns.service
+
+
+%pre
+getent group pdns >/dev/null || groupadd -r pdns
+getent passwd pdns >/dev/null || \
+	useradd -r -g pdns -d / -s /sbin/nologin \
+	-c "PowerDNS user" pdns
+exit 0
+
+
 %post
 if [ $1 -eq 1 ]; then
-	/sbin/chkconfig --add pdns
-	userid=`id -u pdns 2>/dev/null`
-	if [ x"$userid" = x ]; then
-		%{_sbindir}/useradd -c "PowerDNS user" -s /sbin/nologin -r -d / pdns > /dev/null || :
-	fi
+	# Initial installation
+	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
+
+
 %preun
 if [ $1 -eq 0 ]; then
-	/sbin/service pdns stop >/dev/null 2>&1 || :
-	/sbin/chkconfig --del pdns
+	# Package removal; not upgrade
+	/bin/systemctl --no-reload disable pdns.service &>/dev/null || :
+	/bin/systemctl stop pdns.service &>/dev/null || :
 fi
 
-%clean
-%{__rm} -rf %{buildroot}
+
+%postun
+/bin/systemctl daemon-reload &>/dev/null || :
+if [ $1 -ge 1 ]; then
+	# Package upgrade; not install
+	/bin/systemctl try-restart pdns.service &>/dev/null || :
+fi
+
+
+%triggerun -- pdns < 3.0-rc3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply pdns
+# to migrate them to systemd targets
+%{_bindir}/systemd-sysv-convert --save pdns &>/dev/null ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del pdns &>/dev/null || :
+/bin/systemctl try-restart pdns.service &>/dev/null || :
+
 
 %files
 %defattr(-,root,root,-)
-%doc ChangeLog TODO pdns
+%doc COPYING README
 %{_bindir}/dnsreplay
 %{_bindir}/pdns_control
 %{_bindir}/pdnssec
@@ -147,44 +188,49 @@ fi
 %{_mandir}/man8/pdns_control.8.gz
 %{_mandir}/man8/pdns_server.8.gz
 %{_mandir}/man8/zone2sql.8.gz
-%{_initrddir}/pdns
+%{_unitdir}/pdns.service
 %dir %{_libdir}/%{name}/
 %dir %{_sysconfdir}/%{name}/
 %config(noreplace) %{_sysconfdir}/%{name}/pdns.conf
 
 %files backend-mysql
 %defattr(-,root,root,-)
-%doc COPYING
 %{_libdir}/%{name}/libgmysqlbackend.so
 
 %files backend-postgresql
 %defattr(-,root,root,-)
-%doc COPYING
 %{_libdir}/%{name}/libgpgsqlbackend.so
 
 %files backend-pipe
 %defattr(-,root,root,-)
-%doc COPYING
 %{_libdir}/%{name}/libpipebackend.so
 
 %files backend-geo
 %defattr(-,root,root,-)
-%doc COPYING modules/geobackend/README
+%doc modules/geobackend/README
 %{_libdir}/%{name}/libgeobackend.so
 
 %files backend-ldap
 %defattr(-,root,root,-)
-%doc COPYING
 %{_libdir}/%{name}/libldapbackend.so
 
 %files backend-sqlite
 %defattr(-,root,root,-)
-%doc COPYING
 %{_libdir}/%{name}/libgsqlite3backend.so
 
+%files backend-mongodb
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/libmongodbbackend.so
+
 
 %changelog
-* Sat Apr 09 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 3.0-4.
+* Wed Jul 20 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 3.0-5.rc3
+- New release candidate
+- Add MongoDB backend
+- Enable LUA support
+- Convert to systemd
+
+* Sat Apr 09 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 3.0-4.pre.20110327.2103.fc16
 - Rebuilt for new boost
 
 * Mon Mar 28 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 3.0-3.pre.20110327.2103
diff --git a/sources b/sources
index a015fa9..855f530 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b4ea207b6c43d0f39c96d3156f5fba95  pdns-3.0-pre.20110327.2103.tar.gz
+c77a88084c6d33c3b028482c511f80a4  pdns-3.0-rc3.tar.gz


More information about the scm-commits mailing list