From 539b284da55ee879989da19564e0f031609b4a40 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 23 Dec 2015 09:23:36 +0100 Subject: [PATCH] Build release packages properly --- build-aux/gen-version | 2 +- build-scripts/build-auth-rpm | 18 +++++++++++------- build-scripts/build-dnsdist-rpm | 16 ++++++++++------ build-scripts/build-recursor-rpm | 26 +++++++++++++++----------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/build-aux/gen-version b/build-aux/gen-version index cec0e7004..5994683fa 100755 --- a/build-aux/gen-version +++ b/build-aux/gen-version @@ -10,7 +10,7 @@ if [ "${IS_RELEASE}" = "YES" ]; then TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)" if [ -n "${TAG}" ]; then # We're on a tag - echo "${TAG}${DIRTY}" + echo "${TAG}${DIRTY}" | tee .version exit 0 fi echo 'This is not a tag, either tag this commit or do not set $IS_RELEASE' >&2 diff --git a/build-scripts/build-auth-rpm b/build-scripts/build-auth-rpm index d33ef89b9..55409ba99 100755 --- a/build-scripts/build-auth-rpm +++ b/build-scripts/build-auth-rpm @@ -10,6 +10,10 @@ if [ -z "$VERSION" ]; then exit 1 fi +if [ -z "$TARBALLVERSION" ]; then + TARBALLVERSION=$VERSION +fi + if [ -z "$RELEASE" ];then echo 'Please set $RELEASE' >&2 exit 1 @@ -22,10 +26,10 @@ set -x rpmdev-setuptree # This is somethat ugly... -if [ -f pdns-${VERSION}.tar.bz2 ]; then - mv pdns-${VERSION}.tar.bz2 $HOME/rpmbuild/SOURCES +if [ -f pdns-${TARBALLVERSION}.tar.bz2 ]; then + mv pdns-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES else - echo "pdns-${VERSION}.tar.bz2 not found" >&2 + echo "pdns-${TARBALLVERSION}.tar.bz2 not found" >&2 exit 1 fi @@ -49,7 +53,7 @@ Summary: A modern, advanced and high performance authoritative-only nameserver Group: System Environment/Daemons License: GPLv2 URL: http://powerdns.com -Source: ../%{name}-%{version}.tar.bz2 +Source: ../%{name}-${TARBALLVERSION}.tar.bz2 Requires(pre): shadow-utils Requires(post): /sbin/chkconfig @@ -144,7 +148,7 @@ BuildRequires: sqlite-devel This package contains the SQLite backend for %{name} %prep -%setup -q +%setup -q -n %{name}-${TARBALLVERSION} %build export CPPFLAGS="-DLDAP_DEPRECATED" @@ -287,7 +291,7 @@ Summary: A modern, advanced and high performance authoritative-only nameserver Group: System Environment/Daemons License: GPLv2 URL: http://powerdns.com -Source: ../pdns-%{version}.tar.bz2 +Source: ../pdns-${TARBALLVERSION}.tar.bz2 Requires(pre): shadow-utils Requires(post): systemd-sysv @@ -408,7 +412,7 @@ BuildRequires: sqlite-devel This package contains the SQLite backend for %{name} %prep -%setup -q +%setup -q -n %{name}-${TARBALLVERSION} %build export CPPFLAGS="-DLDAP_DEPRECATED" diff --git a/build-scripts/build-dnsdist-rpm b/build-scripts/build-dnsdist-rpm index aded5f533..843b0f37b 100755 --- a/build-scripts/build-dnsdist-rpm +++ b/build-scripts/build-dnsdist-rpm @@ -10,6 +10,10 @@ if [ -z "$VERSION" ]; then exit 1 fi +if [ -z "$TARBALLVERSION" ]; then + TARBALLVERSION=${VERSION} +fi + if [ -z "$RELEASE" ];then echo 'Please set $RELEASE' >&2 exit 1 @@ -22,10 +26,10 @@ set -x rpmdev-setuptree # This is somethat ugly... -if [ -f dnsdist-${VERSION}.tar.bz2 ]; then - mv dnsdist-${VERSION}.tar.bz2 $HOME/rpmbuild/SOURCES +if [ -f dnsdist-${TARBALLVERSION}.tar.bz2 ]; then + mv dnsdist-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES else - echo "dnsdist-${VERSION}.tar.bz2 not found" >&2 + echo "dnsdist-${TARBALLVERSION}.tar.bz2 not found" >&2 exit 1 fi @@ -44,7 +48,7 @@ DEFAULTS_INSTALL='' DEFAULTS_FILES='' # On some older distro's *cough* centos 6 *cough* autosetup fails -SETUP='%autosetup -n %{name}-%{version}' +SETUP="%autosetup -n %{name}-${TARBALLVERSION}" # Some setups need rpmbuild in a 'special' env RPMBUILD_COMMAND='rpmbuild -bb dnsdist.spec' @@ -60,7 +64,7 @@ if [ -f /etc/redhat-release ]; then INIT_BUILDREQUIRES='' INIT_INSTALL='install -d -m 755 %{buildroot}/%{_initrddir} && install -m 755 contrib/dnsdist.init.centos6 %{buildroot}/%{_initrddir}/dnsdist' INIT_FILES='%{_initrddir}/dnsdist' - SETUP='%setup -n %{name}-%{version}' + SETUP="%setup -n %{name}-${TARBALLVERSION}" RPMBUILD_COMMAND="scl enable devtoolset-2 -- ${RPMBUILD_COMMAND}" ;; CentOS\ Linux\ *\ 7*) @@ -81,7 +85,7 @@ Summary: Powerful and scriptable DNS loadbalancer License: GPLv2 Vendor: PowerDNS.COM BV Group: System/DNS -Source: dnsdist-${VERSION}.tar.bz2 +Source: dnsdist-${TARBALLVERSION}.tar.bz2 BuildRequires: readline-devel BuildRequires: boost-devel BuildRequires: lua-devel diff --git a/build-scripts/build-recursor-rpm b/build-scripts/build-recursor-rpm index 8d6c2dbbb..07dd7193d 100755 --- a/build-scripts/build-recursor-rpm +++ b/build-scripts/build-recursor-rpm @@ -10,6 +10,10 @@ if [ -z "$VERSION" ]; then exit 1 fi +if [ -z "$TARBALLVERSION" ]; then + TARBALLVERSION=${VERSION} +fi + if [ -z "$RELEASE" ];then echo 'Please set $RELEASE' >&2 exit 1 @@ -22,10 +26,10 @@ set -x rpmdev-setuptree # This is somethat ugly... -if [ -f pdns-recursor-${VERSION}.tar.bz2 ]; then - mv pdns-recursor-${VERSION}.tar.bz2 $HOME/rpmbuild/SOURCES +if [ -f pdns-recursor-${TARBALLVERSION}.tar.bz2 ]; then + mv pdns-recursor-${TARBALLVERSION}.tar.bz2 $HOME/rpmbuild/SOURCES else - echo "pdns-recursor-${VERSION}.tar.bz2 not found" >&2 + echo "pdns-recursor-${TARBALLVERSION}.tar.bz2 not found" >&2 exit 1 fi @@ -112,7 +116,7 @@ Summary: Modern, advanced and high performance recursing/non authoritative name Group: System Environment/Daemons License: GPLv2 URL: http://powerdns.com -Source0: ../%{name}-%{version}.tar.bz2 +Source0: ../%{name}-${TARBALLVERSION}.tar.bz2 Source1: pdns-recursor.init Provides: powerdns-recursor = %{version}-%{release} @@ -129,9 +133,9 @@ PowerDNS Recursor is a non authoritative/recursing DNS server. Use this package if you need a dns cache for your network. %prep -%setup -q -sed -i -e 's!SYSCONFDIR=/etc/powerdns!SYSCONFDIR=/etc/pdns-recursor!' -e 's!STRIP_BINARIES?=1!STRIP_BINARIES?=0!' $HOME/rpmbuild/BUILD/pdns-recursor-${VERSION}/Makefile.in -sed -i -e 's!OS_SPECIFIC_INSTALL=.*!OS_SPECIFIC_INSTALL=!' $HOME/rpmbuild/BUILD/pdns-recursor-${VERSION}/sysdeps/Linux.inc +%setup -q -n pdns-recursor-${TARBALLVERSION} +sed -i -e 's!SYSCONFDIR=/etc/powerdns!SYSCONFDIR=/etc/pdns-recursor!' -e 's!STRIP_BINARIES?=1!STRIP_BINARIES?=0!' $HOME/rpmbuild/BUILD/pdns-recursor-${TARBALLVERSION}/Makefile.in +sed -i -e 's!OS_SPECIFIC_INSTALL=.*!OS_SPECIFIC_INSTALL=!' $HOME/rpmbuild/BUILD/pdns-recursor-${TARBALLVERSION}/sysdeps/Linux.inc %build %configure @@ -197,7 +201,7 @@ Summary: Modern, advanced and high performance recursing/non authoritative name Group: System Environment/Daemons License: GPLv2 URL: http://powerdns.com -Source0: ../%{name}-%{version}.tar.bz2 +Source0: ../%{name}-${TARBALLVERSION}.tar.bz2 Provides: powerdns-recursor = %{version}-%{release} BuildRequires: boost-devel @@ -216,9 +220,9 @@ PowerDNS Recursor is a non authoritative/recursing DNS server. Use this package if you need a dns cache for your network. %prep -%setup -q -sed -i -e 's!SYSCONFDIR=/etc/powerdns!SYSCONFDIR=/etc/pdns-recursor!' -e 's!STRIP_BINARIES?=1!STRIP_BINARIES?=0!' $HOME/rpmbuild/BUILD/pdns-recursor-${VERSION}/Makefile.in -sed -i -e 's!OS_SPECIFIC_INSTALL=.*!OS_SPECIFIC_INSTALL=!' $HOME/rpmbuild/BUILD/pdns-recursor-${VERSION}/sysdeps/Linux.inc +%setup -q -n pdns-recursor-${TARBALLVERSION} +sed -i -e 's!SYSCONFDIR=/etc/powerdns!SYSCONFDIR=/etc/pdns-recursor!' -e 's!STRIP_BINARIES?=1!STRIP_BINARIES?=0!' $HOME/rpmbuild/BUILD/pdns-recursor-${TARBALLVERSION}/Makefile.in +sed -i -e 's!OS_SPECIFIC_INSTALL=.*!OS_SPECIFIC_INSTALL=!' $HOME/rpmbuild/BUILD/pdns-recursor-${TARBALLVERSION}/sysdeps/Linux.inc %build %configure -- 2.40.0