All `build-*` must be run from the root folder of the pdns repository to ensure
their correct functionality.
+## How do I build a package
+
+Before a package can be built, the distribution tarball has to exist in the root
+directory. For auth:
+
+ * `autoreconf -i`
+ * `./configure --without-modules --without-dynmodules --disable-depedency-tracking`
+ * `make dist`
+
+For the recursor:
+
+ * `cd pdns/recursordist`
+ * `autoreconf -i`
+ * `./configure --disable-depedency-tracking`
+ * `make dist`
+ * `mv pdns-recursor*.tar.bz2 ../../`
+ * `cd -`
+
+And dnsdist:
+
+ * `cd pdns/dnsdistdist`
+ * `autoreconf -i`
+ * `./configure --disable-depedency-tracking`
+ * `make dist`
+ * `mv dnsdist*.tar.bz2 ../../`
+ * `cd -`
+
+Now two environment variables need to be set, `$VERSION` and `$RELEASE`.
+
+`$VERSION` must be set to the to the version in the tarball to build a package for.
+If the version of the package has to be different (e.g. '4.1.0~beta1'), set
+`$VERSION` to *that* number and set `$TARBALLVERSION` to the tarball's version.
+
+`$RELEASE` is the 'release' version number for the package (e.g. '1.pdns' or
+'0.beta1').
+
+So, to create a package for 0.0.1 for debian version '0.0.1-1pdns0':
+
+ * VERSION=0.0.1
+ * RELEASE=1pdns0
+
+0.0.1-beta2 for EL7 (0.0.1-0.beta.2.pdns):
+
+ * VERSION=0.0.1
+ * TARBALLVERSION=0.0.1-beta2
+ * RELEASE=0.beta.2.pdns
+
+0.0.1-rc1 for debian (0.0.1~rc1-1pdns0):
+
+ * VERSION=0.0.1~rc1
+ * TARBALLVERSION=0.0.1-rc1
+ * RELEASE=1pdns0
+
+And run the proper script:
+
## `build-auth-*`
These scripts build (based on the suffix) a package of the authoritative
-server. Either RPM's (for several different RHEL-based distro's), .deb's
-(for Debian Jessie only at the moment) or statically compiled RPM's and deb's.
+server. Either RPM's (for several different RHEL-based distro's), .deb's.
## `build-recursor-*`
-Based on suffix, hese scripts build a deb/RPM package for the Recursor. There is
+Based on suffix, these scripts build a deb/RPM package for the Recursor. There is
also a semi-static build script.
## `build-dnsdist-*`
#!/bin/sh
-export DEBFULLNAME="PowerDNS.COM BV AutoBuilder"
-export DEBEMAIL="noreply@powerdns.com"
-
if [ "$0" != "./build-scripts/build-auth-debian" ]; then
echo "Please run me from the root checkout dir"
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=pdns
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
-
-DISTDIR=${DISTDIR:=.}
+startup
set -e
set -x
-rm -rf $DISTDIR/debian/
-cp -r build-scripts/debian-authoritative $DISTDIR/debian
+cp_tarball_to_tmp
-cd $DISTDIR
+cd ${SRCDIR}
cat > debian/changelog << EOF
pdns (${VERSION}-${RELEASE}) unstable; urgency=medium
fi
DH_OPTIONS=--parallel fakeroot debian/rules binary
+
+mv_debs_to_pwd
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=pdns
-if [ -z "$TARBALLVERSION" ]; then
- TARBALLVERSION=$VERSION
-fi
-
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
+startup
set -e
set -x
-# Prepare the build environment
-rpmdev-setuptree
-
-# This is somethat ugly...
-if [ -f pdns-${TARBALLVERSION}.tar.bz2 ]; then
- mv pdns-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES
-else
- echo "pdns-${TARBALLVERSION}.tar.bz2 not found" >&2
- exit 1
-fi
+cp_tarball_to_rpm_sources
# Some setups need rpmbuild in a 'special' env
RPMBUILD_COMMAND='rpmbuild -bb pdns.spec'
if [ -r /etc/os-release ]; then
OLDVERSION=$VERSION
- source /etc/os-release
+ . /etc/os-release
OS="${NAME} ${VERSION}"
VERSION=$OLDVERSION
fi
fi
case "$OS" in
-# Fedora\ *\ 21*)
-# ;;
CentOS\ *\ 6*)
RPMBUILD_COMMAND="scl enable devtoolset-3 -- ${RPMBUILD_COMMAND}"
cat > $HOME/rpmbuild/SOURCES/pdns.init <<EOF
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=dnsdist
-if [ -z "$DISTDIR" ]; then
- DISTDIR='pdns/dnsdistdist'
-fi
-
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
+startup
set -e
set -x
-rm -rf $DISTDIR/debian/
-cp -r build-scripts/debian-dnsdist $DISTDIR/debian
+cp_tarball_to_tmp
-cd $DISTDIR
+cd ${SRCDIR}
cat > debian/changelog << EOF
dnsdist (${VERSION}-${RELEASE}) unstable; urgency=medium
fakeroot debian/rules debian/control
fakeroot debian/rules binary
+
+mv_debs_to_pwd
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=dnsdist
-if [ -z "$TARBALLVERSION" ]; then
- TARBALLVERSION=${VERSION}
-fi
-
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
+startup
set -e
set -x
-# Prepare the build environment
-rpmdev-setuptree
-
-# This is somethat ugly...
-if [ -f dnsdist-${TARBALLVERSION}.tar.bz2 ]; then
- mv dnsdist-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES
-else
- echo "dnsdist-${TARBALLVERSION}.tar.bz2 not found" >&2
- exit 1
-fi
-
+cp_tarball_to_rpm_sources
# Some RPM platforms use systemd, others sysv, we default to systemd here
INIT_BUILDREQUIRES='BuildRequires: systemd-devel'
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=pdns-recursor
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
-
-if [ -z "$DISTDIR" ]; then
- echo 'Please set $DISTDIR to the directory where pdns-recursor.tar.gz was unpacked' >&2
- exit 1
-fi
+startup
set -e
set -x
-rm -rf $DISTDIR/debian
-cp -r build-scripts/debian-recursor $DISTDIR/debian
+cp_tarball_to_tmp
-cd $DISTDIR
+cd ${SRCDIR}
cat > debian/changelog << EOF
pdns-recursor (${VERSION}-${RELEASE}) unstable; urgency=medium
fi
fakeroot debian/rules debian/control
-
fakeroot debian/rules binary
+
+mv_debs_to_pwd
exit 1
fi
-if [ -z "$VERSION" ]; then
- echo 'Please set $VERSION' >&2
- exit 1
-fi
+. build-scripts/functions.sh
+TARBALLPREFIX=pdns-recursor
-if [ -z "$TARBALLVERSION" ]; then
- TARBALLVERSION=${VERSION}
-fi
-
-if [ -z "$RELEASE" ];then
- echo 'Please set $RELEASE' >&2
- exit 1
-fi
+startup
set -e
set -x
-# Prepare the build environment
-rpmdev-setuptree
-
-# This is somethat ugly...
-if [ -f pdns-recursor-${TARBALLVERSION}.tar.bz2 ]; then
- mv pdns-recursor-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES
-else
- echo "pdns-recursor-${TARBALLVERSION}.tar.bz2 not found" >&2
- exit 1
-fi
+cp_tarball_to_rpm_sources
# Some setups need rpmbuild in a 'special' env
RPMBUILD_COMMAND='rpmbuild -bb pdns-recursor.spec'
# pidfile: /var/run/pdns_recursor.pid
#
-# source function library
+# . function library
. /etc/rc.d/init.d/functions
RETVAL=0
--- /dev/null
+startup() {
+ export DEBFULLNAME="PowerDNS.COM BV AutoBuilder"
+ export DEBEMAIL="noreply@powerdns.com"
+
+ if [ -z "$VERSION" ]; then
+ echo 'Please set $VERSION' >&2
+ exit 1
+ fi
+
+ if [ -z "$RELEASE" ];then
+ echo 'Please set $RELEASE' >&2
+ exit 1
+ fi
+
+ TARBALLVERSION=${TARBALLVERSION:-$VERSION}
+
+ TARBALLFILE=${TARBALLPREFIX}-${TARBALLVERSION}.tar.bz2
+
+ if [ ! -f ${TARBALLFILE} ]; then
+ echo "${TARBALLFILE} not found" >&2
+ exit 1
+ fi
+}
+
+cp_tarball_to_tmp() {
+ DIR=$(mktemp -d)
+
+ tar -xf ${TARBALLFILE} -C ${DIR}
+
+ SRCDIR=${DIR}/${TARBALLPREFIX}-${TARBALLVERSION}
+ if [ "${TARBALLPREFIX}" = "pdns" ]; then
+ cp -r build-scripts/debian-authoritative ${SRCDIR}/debian
+ elif [ "${TARBALLPREFIX}" = "pdns-recursor" ]; then
+ cp -r build-scripts/debian-recursor ${SRCDIR}/debian
+ else
+ cp -r build-scripts/debian-${TARBALLPREFIX} ${SRCDIR}/debian
+ fi
+}
+
+cp_tarball_to_rpm_sources() {
+ rpmdev-setuptree
+ cp ${TARBALLFILE} ${HOME}/rpmbuild/SOURCES
+}
+
+mv_debs_to_pwd() {
+ mv ${DIR}/*.deb .
+}