diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-02 00:59:53 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-02 01:01:45 +0200 |
commit | 88d64be07ce0458bb0a8cd4e40ae2c06fbe2c4bb (patch) | |
tree | 5a1db6dc08114d137ecd0feab6c6aa90917a1856 /community/pgbouncer | |
parent | 536fc9dbe00a90566b1d08a7252dbe9b098c3cba (diff) | |
download | aports-88d64be07ce0458bb0a8cd4e40ae2c06fbe2c4bb.tar.bz2 aports-88d64be07ce0458bb0a8cd4e40ae2c06fbe2c4bb.tar.xz |
community/pgbouncer: move from testing
Diffstat (limited to 'community/pgbouncer')
-rw-r--r-- | community/pgbouncer/APKBUILD | 60 | ||||
-rw-r--r-- | community/pgbouncer/libressl-2.5.patch | 13 | ||||
-rw-r--r-- | community/pgbouncer/pgbouncer-dirs.patch | 26 | ||||
-rw-r--r-- | community/pgbouncer/pgbouncer.confd | 19 | ||||
-rw-r--r-- | community/pgbouncer/pgbouncer.initd | 92 | ||||
-rw-r--r-- | community/pgbouncer/pgbouncer.logrotate | 7 | ||||
-rw-r--r-- | community/pgbouncer/pgbouncer.pre-install | 3 |
7 files changed, 220 insertions, 0 deletions
diff --git a/community/pgbouncer/APKBUILD b/community/pgbouncer/APKBUILD new file mode 100644 index 0000000000..b1c81c182f --- /dev/null +++ b/community/pgbouncer/APKBUILD @@ -0,0 +1,60 @@ +# Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=pgbouncer +pkgver=1.7.2 +pkgrel=2 +pkgdesc="A lightweight connection pooler for PostgreSQL" +url="https://wiki.postgresql.org/wiki/PgBouncer" +arch="all" +license="BSD" +pkgusers="pgbouncer" +pkggroups="postgres" +install="$pkgname.pre-install" +makedepends="c-ares-dev libevent-dev libressl-dev udns-dev" +subpackages="$pkgname-doc" +source="https://pgbouncer.github.io/downloads/files/$pkgver/$pkgname-$pkgver.tar.gz + $pkgname.initd + $pkgname.confd + $pkgname.logrotate + pgbouncer-dirs.patch + libressl-2.5.patch + " +builddir="$srcdir/$pkgname-$pkgver" + +build() { + cd "$builddir" + + ./configure \ + --prefix=/usr \ + --disable-debug + make +} + +check() { + cd "$builddir" + + ./pgbouncer --version + make -C test +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install + + cd "$pkgdir" + + install -m 755 -D "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname + install -m 644 -D "$srcdir"/$pkgname.confd ./etc/conf.d/$pkgname + install -m 644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname + install -m 644 -D "$builddir"/etc/$pkgname.ini ./etc/$pkgname/$pkgname.ini + + install -d -m 755 -o $pkgusers -g $pkggroups ./var/log/$pkgname +} + +sha512sums="11c89606599f424b34f39a4b072ec6293fea0b14ee52ae4fbc44775e6d83771a22d194f4e8eabe410e0d6a70657508cf1a3b1012543d91873c36f644afb5675d pgbouncer-1.7.2.tar.gz +a6dbfa477c2f0a405e4bf9ee0037165531802366565d0f192931ccd8a7cb3edf9e9b628655e4169592e9370cc71fb73d4424bfd3f20bb5a43eb26a52251e539d pgbouncer.initd +808621351b0f5973427fa22f63128432b00ac20fd25af437e8148dad9e55185775aba612b6ecdd58e4a6f2450b8c7838fcace288845b9b3cd0236bbe168aa574 pgbouncer.confd +83b869466b59c1b1d6e316a9368f725181128c1f5a7af230e3fa9c58ccda1bc097db182806c1c51a5121692791ec83d9eb0f5718fb3031f521bb537001153e2d pgbouncer.logrotate +fdee368ce422960ebc06547765a7e5eabc59d10ae8730948be1c5f9083adcac3aa373f41fd9972d1b9ef635a062f1e021d787085a5beb5d80edf4203f284c7c4 pgbouncer-dirs.patch +97caf142578f2f9d1500979ce88244554f316f999837707137dc4c3ec6ebc45bcef16678e61fdd1118bf4e26c7df733bd399f4a82b9b5a8e44c3497ab0922524 libressl-2.5.patch" diff --git a/community/pgbouncer/libressl-2.5.patch b/community/pgbouncer/libressl-2.5.patch new file mode 100644 index 0000000000..8aaae74dbc --- /dev/null +++ b/community/pgbouncer/libressl-2.5.patch @@ -0,0 +1,13 @@ +diff --git a/lib/usual/tls/tls.c b/lib/usual/tls/tls.c +index 9c6f6b9..a480fa4 100644 +--- a/lib/usual/tls/tls.c ++++ b/lib/usual/tls/tls.c +@@ -287,7 +287,7 @@ tls_info_callback(const SSL *ssl, int where, int rc) + { + struct tls *ctx = SSL_get_app_data(ssl); + +-#ifdef USE_LIBSSL_INTERNALS ++#if defined(USE_LIBSSL_INTERNALS) && LIBRESSL_VERSION_NUMBER < 0x2050100fL + if (!(ctx->state & TLS_HANDSHAKE_COMPLETE) && ssl->s3) { + /* steal info about used DH key */ + if (ssl->s3->tmp.dh && !ctx->used_dh_bits) { diff --git a/community/pgbouncer/pgbouncer-dirs.patch b/community/pgbouncer/pgbouncer-dirs.patch new file mode 100644 index 0000000000..7945376d87 --- /dev/null +++ b/community/pgbouncer/pgbouncer-dirs.patch @@ -0,0 +1,26 @@ +diff -Naruw a/etc/pgbouncer.ini b/etc/pgbouncer.ini +--- a/etc/pgbouncer.ini 2012-06-10 19:57:01.000000000 +0000 ++++ b/etc/pgbouncer.ini 2013-07-17 02:25:59.598888628 +0000 +@@ -29,7 +29,7 @@ + ;;; + + logfile = /var/log/pgbouncer/pgbouncer.log +-pidfile = /var/run/pgbouncer/pgbouncer.pid ++;pidfile = # do not set! + + ;;; + ;;; Where to wait for clients +@@ -40,10 +40,9 @@ + listen_port = 6432 + + ; unix socket is also used for -R. +-; On debian it should be /var/run/postgresql +-;unix_socket_dir = /tmp +-;unix_socket_mode = 0777 +-;unix_socket_group = ++unix_socket_dir = /run/postgresql ++unix_socket_mode = 0777 ++unix_socket_group = postgres + + ;;; + ;;; Authentication settings diff --git a/community/pgbouncer/pgbouncer.confd b/community/pgbouncer/pgbouncer.confd new file mode 100644 index 0000000000..c5408bbe31 --- /dev/null +++ b/community/pgbouncer/pgbouncer.confd @@ -0,0 +1,19 @@ +# Configuration file for /etc/init.d/pgbouncer + +# Location of configuration file for PgBouncer. +#cfgfile="/etc/pgbouncer/pgbouncer.ini" + +# The user to run PgBouncer as. +#user=pgbouncer + +# The group to run PgBouncer as. +#group=postgresql + +# How long to wait in seconds for a safe shutdown. Equivalent to +# issuing 'PAUSE;' and 'SHUTDOWN;' on psql console. See pgbouncer(1). +#nice_timeout=60 + +# Set to 'yes' to perform an immediate shutdown if the nice shutdown +# doesn't work. Same as issuing 'SHUTDOWN;' on console. See pgbouncer(1). +#force_quit=="no" +#force_quit_timeout=2 diff --git a/community/pgbouncer/pgbouncer.initd b/community/pgbouncer/pgbouncer.initd new file mode 100644 index 0000000000..a44f6aeeb8 --- /dev/null +++ b/community/pgbouncer/pgbouncer.initd @@ -0,0 +1,92 @@ +#!/sbin/openrc-run + +extra_started_commands="reload" + +: ${user:="pgbouncer"} +: ${group:="postgresql"} +: ${cfgfile:="/etc/pgbouncer/pgbouncer.ini"} +: ${nice_timeout:=60} +: ${force_quit:="no"} +: ${force_quit_timeout:=2} + +name="PgBouncer" +command="/usr/bin/pgbouncer" +command_args="-q $cfgfile" +command_background="yes" + +pidfile="/run/$RC_SVCNAME.pid" +start_stop_daemon_args=" + --user $user + --group $group" + +required_files="$cfgfile" + +depend() { + use net + after postgresql +} + +start_pre() { + local socket_dir=$(get_config unix_socket_dir) + if [ -n "$socket_dir" ]; then + checkpath -d -m 0755 -o postgres:postgres "$socket_dir" || return 1 + fi + + local logfile="$(get_config logfile)" + if [ -n "$logfile" ]; then + checkpath -f -m 0640 -o $user:$group "$logfile" || return 1 + fi +} + +stop() { + local retry="SIGINT/$nice_timeout" + yesno "$force_quit" \ + && retry="$retry/SIGTERM/$force_quit_timeout" \ + || force_quit_timeout=0 + + local seconds=$(( $nice_timeout + $force_quit_timeout )) + + ebegin "Stopping $seconds (this can take up to $seconds seconds)" + + start-stop-daemon --stop \ + --pidfile "$pidfile" \ + --retry "$retry" \ + --progress \ + --exec "$command" + eend $? +} + +restart() { + local socket_dir=$(get_config unix_socket_dir) + + if [ -n "$socket_dir" ]; then + ebegin "Performing online restart of $name" + "$command" -R "$command_args" + eend $? + else + stop && start + fi +} + +reload() { + ebegin "Reloading $name configuration" + start-stop-daemon --signal HUP --pidfile "$pidfile" + eend $? +} + +get_config() { + local name="$1" + local default="${2:-}" + + if [ ! -f "$conffile" ]; then + printf '%s\n' "$default" + return 1 + fi + sed -En "/^\s*${name}\b/{ # find line starting with the name + s/^\s*${name}\s*=?\s*([^#]+).*/\1/; # capture the value + s/\s*$//; # trim trailing whitespaces + s/^['\"](.*)['\"]$/\1/; # remove delimiting quotes + p + }" "$conffile" \ + | grep . || printf '%s\n' "$default" +} diff --git a/community/pgbouncer/pgbouncer.logrotate b/community/pgbouncer/pgbouncer.logrotate new file mode 100644 index 0000000000..78b82510d3 --- /dev/null +++ b/community/pgbouncer/pgbouncer.logrotate @@ -0,0 +1,7 @@ +/var/log/pgbouncer/pgbouncer.log { + missingok + sharedscripts + postrotate + /etc/init.d/pgbouncer --quiet --ifstarted reload + endscript +} diff --git a/community/pgbouncer/pgbouncer.pre-install b/community/pgbouncer/pgbouncer.pre-install new file mode 100644 index 0000000000..609b3a9272 --- /dev/null +++ b/community/pgbouncer/pgbouncer.pre-install @@ -0,0 +1,3 @@ +#!/bin/sh +adduser -S -D -H -h /dev/null -s /sbin/nologin -G postgres -g pgbouncer pgbouncer 2>/dev/null +exit 0 |