--- pgbouncer-1.3.3.orig/debian/config.patch
+++ pgbouncer-1.3.3/debian/config.patch
@@ -0,0 +1,59 @@
+--- pgbouncer-1.3.orig/etc/pgbouncer.ini 2009-02-25 15:55:24.289557192 -0300
++++ pgbouncer-1.3/etc/pgbouncer.ini 2009-02-25 15:59:53.401611098 -0300
+@@ -5,12 +5,12 @@
+ foodb =
+
+ ; redirect bardb to bazdb on localhost
+-bardb = host=127.0.0.1 dbname=bazdb
++bardb =
+
+ ; acceess to dest database will go with single user
+-forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1'
++forcedb =
+
+-nondefaultdb = pool_size=50 reserve_pool=10
++nondefaultdb =
+
+ ; fallback connect string
+ ;* = host=testserver
+@@ -22,8 +22,8 @@
+ ;;; Administrative settings
+ ;;;
+
+-logfile = pgbouncer.log
+-pidfile = pgbouncer.pid
++logfile = /var/log/postgresql/pgbouncer.log
++pidfile = /var/run/postgresql/pgbouncer.pid
+
+ ;;;
+ ;;; Where to wait for clients
+@@ -32,7 +32,7 @@
+ ; ip address or * which means all ip-s
+ listen_addr = 127.0.0.1
+ listen_port = 6432
+-unix_socket_dir = /tmp
++unix_socket_dir = /var/run/postgresql
+
+ ;;;
+ ;;; Authentication settings
+@@ -41,17 +41,17 @@
+ ; any, trust, plain, crypt, md5
+ auth_type = trust
+ #auth_file = 8.0/main/global/pg_auth
+-auth_file = etc/userlist.txt
++auth_file = /etc/pgbouncer/userlist.txt
+
+ ;;;
+ ;;; Users allowed into database 'pgbouncer'
+ ;;;
+
+ ; comma-separated list of users, who are allowed to change settings
+-admin_users = user2, someadmin, otheradmin
++admin_users =
+
+ ; comma-separated list of users who are just allowed to use SHOW command
+-stats_users = stats, root
++stats_users =
+
+ ;;;
+ ;;; Pooler personality questions
--- pgbouncer-1.3.3.orig/debian/postinst
+++ pgbouncer-1.3.3/debian/postinst
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = configure ] && [ -z "$2" ]; then
+ chown postgres:postgres /etc/pgbouncer/pgbouncer.ini /etc/pgbouncer/userlist.txt
+ chmod u=rw,g=r,o= /etc/pgbouncer/pgbouncer.ini /etc/pgbouncer/userlist.txt
+fi
+
+#DEBHELPER#
--- pgbouncer-1.3.3.orig/debian/default
+++ pgbouncer-1.3.3/debian/default
@@ -0,0 +1,12 @@
+
+# Set to 1 after you've configured pgbouncer in
+# /etc/pgbouncer
+
+START=0
+
+# It is possible to change the options the daemon is started with.
+# The default setting is shown below, uncomment and apply your changes
+# if you need to modify it.
+
+#OPTS="-d /etc/pgbouncer/pgbouncer.ini"
+
--- pgbouncer-1.3.3.orig/debian/init
+++ pgbouncer-1.3.3/debian/init
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+### BEGIN INIT INFO
+# Provides: pgbouncer
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Should-Start: postgresql
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start pgbouncer
+# Description: pgbouncer is a connection pool server and replication
+# proxy for PostgreSQL.
+### END INIT INFO
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/pgbouncer
+PIDFILE=/var/run/postgresql/pgbouncer.pid
+OPTS="-d /etc/pgbouncer/pgbouncer.ini"
+
+test -x $DAEMON || exit 5
+
+# Include pgbouncer defaults if available
+if [ -f /etc/default/pgbouncer ] ; then
+ . /etc/default/pgbouncer
+fi
+
+
+. /lib/lsb/init-functions
+
+
+is_running() {
+ pidofproc -p $PIDFILE $DAEMON >/dev/null
+}
+
+
+d_start() {
+ if is_running; then
+ :
+ else
+ su -c "$DAEMON $OPTS 2> /dev/null &" - postgres
+ fi
+}
+
+d_reload() {
+ is_running || return 0
+
+ killproc -p $PIDFILE $DAEMON HUP
+}
+
+d_stop() {
+ SIGS='INT TERM KILL'
+
+ for sig in $SIGS
+ do
+ is_running || return 0
+
+ killproc -p $PIDFILE $DAEMON $sig
+ sleep 1
+ done
+}
+
+case "$1" in
+ start)
+ if [ ${START} -eq 1 ]; then
+ log_daemon_msg Starting pgbouncer
+ d_start
+ log_end_msg $?
+ else
+ log_warning_msg "pgbouncer daemon disabled in /etc/default/pgbouncer"
+ fi
+ ;;
+ stop)
+ log_daemon_msg Stopping pgbouncer
+ d_stop
+ log_end_msg $?
+ ;;
+ status)
+ is_running
+ status=$?
+ if [ $status -eq 0 ]; then
+ log_success_msg "pgbouncer is running"
+ else
+ log_failure_msg "pgbouncer is not running"
+ fi
+ exit $status
+ ;;
+ restart)
+ log_daemon_msg "Restarting pgbouncer" pgbouncer
+ d_stop
+ d_start
+ log_end_msg $?
+ ;;
+ try-restart)
+ if $0 status >/dev/null; then
+ $0 restart
+ else
+ exit 0
+ fi
+ ;;
+ reload|force-reload)
+ if is_running; then
+ log_daemon_msg "Reloading configuration" pgbouncer
+ d_reload
+ log_end_msg $?
+ else
+ log_failure_msg "pgbouncer is not running."
+ fi
+ ;;
+ *)
+ log_failure_msg "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
+ exit 2
+ ;;
+esac
--- pgbouncer-1.3.3.orig/debian/uscan-repack.sh
+++ pgbouncer-1.3.3/debian/uscan-repack.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+#command --upstream-version version filename
+
+[ $# -eq 3 ] || exit 255
+
+echo
+
+version="$2"
+filename="$3"
+
+tar xfz ${filename}
+
+dir=`tar tfz ${filename} | head -1 | sed 's,/.*,,g'`
+rm -f ${filename}
+
+rm -rf ${dir}/debian
+rm -rf ${dir}/win32
+mv ${dir} ${dir}+repack.orig
+
+tar cf - ${dir}+repack.orig | gzip -9 > ${filename}
+
+rm -rf ${dir}+repack.orig
+
+echo "${filename} created."
+
--- pgbouncer-1.3.3.orig/debian/README.source
+++ pgbouncer-1.3.3/debian/README.source
@@ -0,0 +1,15 @@
+pgbouncer source for Debian
+---------------------------------
+
+ * On Debian, dpatch is being used to manage patches at build time.
+ Please install the dpatch package and read
+ /usr/share/doc/dpatch/README.source.gz
+ if you'd like to know how to use it.
+
+ -- Bernd Zeimetz <bzed@debian.org> Fri, 26 Sep 2008 18:16:03 +0200
+
+ * Originally, source code had debian directory and win32 directory that
+ were removed. The debian directory was used to build packaging pgbouncer
+ with yada.
+
+ -- Fernando Ike de Oliveira <fike@midstorm.org> Wed, 25 Fev 2009 17:11:01 -0300
--- pgbouncer-1.3.3.orig/debian/docs
+++ pgbouncer-1.3.3/debian/docs
@@ -0,0 +1,2 @@
+NEWS
+README
--- pgbouncer-1.3.3.orig/debian/install
+++ pgbouncer-1.3.3/debian/install
@@ -0,0 +1 @@
+etc/pgbouncer.ini /etc/pgbouncer/
--- pgbouncer-1.3.3.orig/debian/changelog
+++ pgbouncer-1.3.3/debian/changelog
@@ -0,0 +1,175 @@
+pgbouncer (1.3.3-2) unstable; urgency=low
+
+ * Added myself to uploaders
+ * Fixed debian/copyright to match reality
+ * Updated standards version
+ * Install configuration files with more secure permissions (closes: #548887)
+
+ -- Peter Eisentraut <petere@debian.org> Thu, 05 Aug 2010 21:57:00 +0300
+
+pgbouncer (1.3.3-1) unstable; urgency=low
+
+ * New upstream version.
+ * Bumping Standards-Version to 3.8.4, no changes needed.
+ * Removing dpatch - no patches needed anymore since several releases.
+ * Use source format 1.0 for easy backporting.
+
+ -- Bernd Zeimetz <bzed@debian.org> Sun, 16 May 2010 03:15:41 +0200
+
+pgbouncer (1.3.2-1) unstable; urgency=low
+
+ * New upstream version.
+
+ -- Bernd Zeimetz <bzed@debian.org> Wed, 24 Mar 2010 23:10:02 +0100
+
+pgbouncer (1.3.1-3) unstable; urgency=low
+
+ * Really change the init script now - unfortunately the old one found
+ its way back into the package.
+
+ -- Bernd Zeimetz <bzed@debian.org> Sun, 24 Jan 2010 12:24:34 +0100
+
+pgbouncer (1.3.1-2) unstable; urgency=low
+
+ * Chaging Section to database, which is the new section for
+ database related tools.
+ * Require $remote_fs on start/stop in the init script. (Lintian:
+ init.d-script-missing-dependency-on-remote_fs)
+ * Use pgbouncer as the name the init script provides instead
+ of pgbouncer2. (Lintian: init.d-script-does-not-provide-itself)
+
+ -- Bernd Zeimetz <bzed@debian.org> Sun, 24 Jan 2010 00:55:35 +0100
+
+pgbouncer (1.3.1-1) unstable; urgency=low
+
+ * New upstream release.
+ * debian/init: Use reload instead of restart when force-reload
+ was called, thanks to Peter Eisentraut for the bug report.
+ Closes: #538006
+ * Ensure that pgbounce stops, even if clients are connected.
+ Thanks to Cyril Bouthors for the patch. Closes: #523066
+ * Bumping Standards-Version to 3.8.2, no changes needed.
+
+ -- Bernd Zeimetz <bzed@debian.org> Thu, 23 Jul 2009 16:23:52 +0200
+
+pgbouncer (1.3-1) unstable; urgency=low
+
+ [ Fernando Ike de Oliveira ]
+ * New upstream release.
+ * debian/init:
+ - pgbouncer.log and start script duplicated start message were removed.
+ - patch that change pgbouncer to port 6432 (default upstream) was removed
+ * debian/config.patch.
+ - pgbouncer.ini patch new version was fixed.
+ * win32 directory was removed from the original source code.
+
+ [ Bernd Zeimetz ]
+ * debian/watch, debian/uscan-repack.sh: Adding script to repackage upstream
+ source with uscan automatically. The included debian and win32 dir will
+ be removed.
+
+ -- Bernd Zeimetz <bzed@debian.org> Sun, 01 Mar 2009 03:48:18 +0100
+
+pgbouncer (1.2.3-2) unstable; urgency=low
+
+ * debian/control:
+ - pgbouncer needs a versioned dependency on libevent-dev (>= 1.3b).
+ * debian/init:
+ - Implementing reload by sending SIGHUP to the daemon.
+ - Better start/stop log messages.
+ * debian/default:
+ - Explain how to change the daemon options.
+
+ -- Bernd Zeimetz <bzed@debian.org> Tue, 30 Sep 2008 10:42:06 +0200
+
+pgbouncer (1.2.3-1) unstable; urgency=low
+
+ [ Fernando Ike de Oliveira ]
+ * New upstream Release.
+ * Change listen port to 5433.
+ * Added fields Enhances and Conflicts.
+
+ [ Bernd Zeimetz ]
+ * Changes done by Fernando Ike de Oliveira, but without a proper
+ changelog entry:
+ - The new upstream release closes: #499531
+ - debian/control: Depend on postgresql-common to make sure the postgres
+ user exists (Closes: #499521).
+ - Fixed init script, not using -n option anymore (Closes: #499522)
+ - Bumping Standards-Version to 3.8.0
+ * Adding myself to Uploaders.
+ * The following changes are a general cleanup of the package,
+ unfortunately these things were never detected by the former
+ sponsor. Sorry Fernando, but I also have to revert some of your
+ recent changes.
+ - debian/control:
+ * Fixing the long description, removing the copy of the short
+ description from it and switch to a better indenting.
+ * Adding python as Build-Dependency, upstream is using it to
+ fix the generated manpages.
+ * Removing extra blank lines.
+ * pgbouncer supports PostgreSQL versions 7.4 and higher, changing the
+ Enhances field accordingly.
+ * Dropping Conflicts field again. It's not a problem to install
+ pgpool/pgpool2 on the same machine with pgbouncer.
+ * Lowering the Dependency on lsb-base, 3.1 is enough to support
+ the new init script.
+ - debian/rules:
+ * Don't gzip examples manually, dh_compress will handle it according to
+ the policy.
+ * Dropping DEB_INSTALL_MANPAGES_pgbouncer definition, upstream installs
+ the manpages into the right place.
+ * Don't include /usr/share/cdbs/1/rules/utils.mk and
+ /usr/share/cdbs/1/rules/buildcore.mk, cdbs takes care of that.
+ * DEB_UPDATE_RCD_PARAMS: pgbouncer should start *after* PostgreSQL and
+ needs to stop before it. Changing to 'defaults 20 18' therefore.
+ * Don't install pgbouncer.ini.examples in the doc directory, use
+ dh_installexamples to install into the examples directory instead.
+ * Create an empty userlist.txt in /etc/pgbouncer
+ - debian/pgbouncer.8:
+ * Dropping file, upstream provides a manpage.
+ - debian/init:
+ * renaming debian/init.d to debian/init - that's the filename
+ dh_installinit takes care of.
+ * Respect the setting of 'START' in /etc/default/pgbouncer. The option
+ was ignored completely.
+ - debian/install:
+ * Renamed from pgbouncer.install.
+ * Don't install an example userlist to /etc. File will be touched in
+ debian/rules. Install it as example instead.
+ - debian/examples:
+ * Adding file, installing ini-file and userlist example.
+ - debian/config.patch, debian/patches/default-port.dpatch:
+ * Changing default port to 6432 as upstream's default conflicts with
+ X11. 5433 is also a bad choice as postgres instances may use
+ this port dynamically.
+ - debian/patches/01_configtxt:
+ * Dropping patch, not needed anymore.
+ - debian/patches/00list:
+ * Updated accordingly.
+ - debian/README.source:
+ * Adding file to make the package conform to Standards Version 3.8.0.
+ - debian/default:
+ * Adding short explanation.
+ - debian/README.Debian
+ * Several spelling fixes.
+
+ -- Bernd Zeimetz <bzed@debian.org> Fri, 26 Sep 2008 18:47:34 +0200
+
+pgbouncer (1.1.2.1-1) unstable; urgency=low
+
+ * Change section contrib to main and regenerate
+ .orig.tar.gz.(Closes: #474288)
+ * Fix error in script pgbouncer.prerm changed init.d to similar
+ pgpool2. (Closes: #471114)
+ * Change dependency to "$shlibs:Depends". (Closes: #461383)
+ * Build instead postgresql-8.3 (Closes: #474283)
+ * Added suggest dependency postgresql package.
+
+ -- Fernando Ike de Oliveira <fike@midstorm.org> Tue, 05 Aug 2008 14:31:58 -0300
+
+pgbouncer (1.1.2-1) unstable; urgency=low
+
+ * Initial Release. (Closes: #427238)
+
+ -- Fernando Ike de Oliveira <fike@midstorm.org> Wed, 12 Dec 2007 16:22:15 -0200
--- pgbouncer-1.3.3.orig/debian/rules
+++ pgbouncer-1.3.3/debian/rules
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+#DH_VERBOSE = 1
+
+DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin
+DEB_UPDATE_RCD_PARAMS := defaults 20 18
+
+clean::
+ find doc -name "pgbouncer.*" -exec rm {} \;
+
+
+install/pgbouncer::
+ rm -f $(CURDIR)/debian/pgbouncer/usr/share/doc/pgbouncer/pgbouncer.ini
+ mkdir -p $(CURDIR)/debian/pgbouncer/etc/pgbouncer
+ touch $(CURDIR)/debian/pgbouncer/etc/pgbouncer/userlist.txt
+
+binary-predeb/pgbouncer::
+ patch -p0 $(CURDIR)/debian/pgbouncer/etc/pgbouncer/pgbouncer.ini $(CURDIR)/debian/config.patch
--- pgbouncer-1.3.3.orig/debian/copyright
+++ pgbouncer-1.3.3/debian/copyright
@@ -0,0 +1,21 @@
+This package was debianized by Fernando Ike de Oliveira
+<fike@midstorm.org> on Mon, 18 Jun 2007 14:40:29 -0300.
+
+It was downloaded from <http://pgfoundry.org/projects/pgbouncer/>.
+
+Upstream Authors: Sven Suursoho <sven.suursoho@skype.net>,
+ Marko Kreen <marko.kreen@skype.net>
+
+Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- pgbouncer-1.3.3.orig/debian/compat
+++ pgbouncer-1.3.3/debian/compat
@@ -0,0 +1 @@
+5
--- pgbouncer-1.3.3.orig/debian/README.Debian
+++ pgbouncer-1.3.3/debian/README.Debian
@@ -0,0 +1,14 @@
+pgbouncer for Debian
+--------------------
+
+General usage information can be found at
+ https://developer.skype.com/SkypeGarage/DbProjects/PgBouncer/UsageInfo.
+
+Package-specific notes:
+
+- The default directory for the socket and PID file is
+ /var/run/postgresql, as known from the postgresql package.
+
+- The pgbouncer daemon is disabled by default, to enable it you need
+ to set START to 1 in /etc/default/pgbouncer.
+
--- pgbouncer-1.3.3.orig/debian/examples
+++ pgbouncer-1.3.3/debian/examples
@@ -0,0 +1,2 @@
+etc/pgbouncer.ini
+etc/userlist.txt
--- pgbouncer-1.3.3.orig/debian/control
+++ pgbouncer-1.3.3/debian/control
@@ -0,0 +1,24 @@
+Source: pgbouncer
+Maintainer: Fernando Ike de Oliveira <fike@midstorm.org>
+Uploaders: Bernd Zeimetz <bzed@debian.org>, Peter Eisentraut <petere@debian.org>
+Section: database
+Priority: optional
+Standards-Version: 3.9.1
+Build-Depends: cdbs, debhelper (>= 5), libevent-dev (>= 1.3b), asciidoc, xmlto, python
+Homepage: http://pgfoundry.org/projects/pgbouncer/
+Vcs-Svn: svn://svn.debian.org/pkg-postgresql/trunk/pgbouncer/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-postgresql/trunk/pgbouncer/
+
+Package: pgbouncer
+Architecture: any
+Depends: lsb-base (>= 3.1), postgresql-common (>= 26), ${misc:Depends}, ${shlibs:Depends}
+Enhances: postgresql (>= 7.4)
+Description: lightweight connection pooler for PostgreSQL
+ It provides the following features:
+ .
+ * Several levels of brutality when rotating connections.
+ * Low memory requirements.
+ * It is not tied to one backend server, the destination databases
+ can reside on different hosts.
+ * Supports online reconfiguration for most of the settings.
+ * Supports online restart/upgrade.
--- pgbouncer-1.3.3.orig/debian/watch
+++ pgbouncer-1.3.3/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://pgfoundry.org/frs/?group_id=1000258 /frs/download.php/[0-9]+/pgbouncer-([0-9.]+).tgz debian debian/uscan-repack.sh
--- pgbouncer-1.3.3.orig/debian/source/format
+++ pgbouncer-1.3.3/debian/source/format
@@ -0,0 +1 @@
+1.0
--- pgbouncer-1.3.3.orig/debian/source/options
+++ pgbouncer-1.3.3/debian/source/options
@@ -0,0 +1 @@
+extend-diff-ignore = svn-deblayout