From 60968a297ad2deb56fb7f33f89152eb9ecf895d8 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 4 Jan 2013 10:34:54 +0200 Subject: [PATCH] deb cleanup * use installed pg_buildext * use installed pgxs_debian_control.mk * don't override 'clean' target in debian/rules * 'make deb' forces control file regeneration This reduces crap maintained locally. It also does mean that to build against server-dev-X.Y package that is not for Debians default Postgres version, following packages need to be installed from PGDG (wiki.postgresql.org/wiki/Apt) repo: postgresql-client-common postgresql-common postgresql-server-dev-all --- Makefile | 2 + debian/pg_buildext | 111 --------------------------------------------- debian/rules | 21 ++------- 3 files changed, 7 insertions(+), 127 deletions(-) delete mode 100755 debian/pg_buildext diff --git a/Makefile b/Makefile index 1dd7ce2..1110b49 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,8 @@ ack: cp results/*.out test/expected/ deb: + rm -f debian/control + make -f debian/rules debian/control debuild -uc -us -b debclean: diff --git a/debian/pg_buildext b/debian/pg_buildext deleted file mode 100755 index 4155e5e..0000000 --- a/debian/pg_buildext +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -# -# build a PostgreSQL module based on PGXS for give list of supported major -# versions -# -# Author: Dimitri Fontaine - -action="$1" -srcdir="$2" -target="$3" -opt="$4" - -prepare_env() { - if [ ! -d $srcdir ]; then - echo "Error: no such directory '$srcdir'" - exit 1 - fi - version=$1 - vtarget=`echo $target | sed -e "s:%v:$version:"` - pgc="/usr/lib/postgresql/$version/bin/pg_config" - cflags=`$pgc --cflags` -} - -build() { - prepare_env $1 - - mkdir -p $vtarget - cd $vtarget - make -f $srcdir/Makefile CFLAGS="$cflags $opt" PG_CONFIG="$pgc" VPATH="$srcdir" - cd - -} - -clean() { - prepare_env $1 - make clean PG_CONFIG="$pgc" - rm -rf $vtarget -} - -versions() { - #for v in `/usr/share/postgresql-common/supported-versions` - #grep -q "^$v" $srcdir/debian/pgversions && echo $v - for v in `cat $srcdir/debian/pgversions` - do - test -x /usr/lib/postgresql/$v/bin/pg_config && echo $v - done -} - -for v in `versions` -do - case "$action" in - "supported-versions") - echo $v - ;; - - build|clean) - # be verbose? - $action $v - ;; - - *) - echo "$0: unsupported $action." - ;; - esac -done - -exit 0 - -# POD follows here - -=head1 NAME - -pg_buildext - Build and install a PostgreSQL extension - -=head1 SYNOPSIS - -B I I I I - -=head1 DESCRIPTION - -B is a script that will build a PostgreSQL extension in a -C way. It only supports the B and B actions, and will -choose to build the versions known in C and in -C. - -=head1 OPTIONS - -=over 4 - -=item B - -Either I or I. - -=item B - -Where to find the extension sources, including the C subdirectory. - -=item B - -The target directory where to build the sources, it will get created for you -if it does not exist. If the B contains a C<%v> sign, it will get -replaced by the specific version of PostgreSQL being built against. - -=item B - -Custom C options to use for the build. - -=back - -=head1 AUTHOR - -Dimitri Fontaine Ldim@tapoueh.orgE> diff --git a/debian/rules b/debian/rules index c4ddd47..b7a407e 100755 --- a/debian/rules +++ b/debian/rules @@ -6,19 +6,11 @@ DEB_BUILD_OPTIONS := nostrip nocheck export DEB_BUILD_OPTIONS -PG_BUILDEXT = ./debian/pg_buildext +PG_BUILDEXT = pg_buildext -debian/control-stamp: debian/control.in debian/pgversions debian/rules - grep-dctrl -vP PGVERSION debian/control.in > debian/control - for v in $$($(PG_BUILDEXT) supported-versions . ); \ - do \ - grep -q "^$$v" debian/pgversions \ - && grep-dctrl -P PGVERSION debian/control.in \ - | sed -e "s:PGVERSION:$$v:" >> debian/control; \ - done - touch $@ +include /usr/share/postgresql-common/pgxs_debian_control.mk -clean: debian/control-stamp +override_dh_auto_clean: for v in $$($(PG_BUILDEXT) supported-versions . ) ; do \ rm -rf debian/postgresql-plproxy-$${v}; \ done @@ -34,13 +26,10 @@ override_dh_auto_install: || exit 1 ; \ done -build binary override_dh_auto_build: debian/control-stamp - -build binary binary-arch binary-indep: +%: dh $@ -.PHONY: build binary binary-arch binary-indep clean -.PHONY: orig override_dh_auto_install override_dh_auto_clean override_dh_auto_build +.PHONY: orig realclean PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }') srcpkg = plproxy2_$(PKGVERS)