From 88d64be07ce0458bb0a8cd4e40ae2c06fbe2c4bb Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Tue, 2 May 2017 00:59:53 +0200 Subject: community/pgbouncer: move from testing --- community/pgbouncer/APKBUILD | 60 ++++++++++++++++++++ community/pgbouncer/libressl-2.5.patch | 13 +++++ community/pgbouncer/pgbouncer-dirs.patch | 26 +++++++++ community/pgbouncer/pgbouncer.confd | 19 +++++++ community/pgbouncer/pgbouncer.initd | 92 +++++++++++++++++++++++++++++++ community/pgbouncer/pgbouncer.logrotate | 7 +++ community/pgbouncer/pgbouncer.pre-install | 3 + testing/pgbouncer/APKBUILD | 60 -------------------- testing/pgbouncer/libressl-2.5.patch | 13 ----- testing/pgbouncer/pgbouncer-dirs.patch | 26 --------- testing/pgbouncer/pgbouncer.confd | 19 ------- testing/pgbouncer/pgbouncer.initd | 92 ------------------------------- testing/pgbouncer/pgbouncer.logrotate | 7 --- testing/pgbouncer/pgbouncer.pre-install | 3 - 14 files changed, 220 insertions(+), 220 deletions(-) create mode 100644 community/pgbouncer/APKBUILD create mode 100644 community/pgbouncer/libressl-2.5.patch create mode 100644 community/pgbouncer/pgbouncer-dirs.patch create mode 100644 community/pgbouncer/pgbouncer.confd create mode 100644 community/pgbouncer/pgbouncer.initd create mode 100644 community/pgbouncer/pgbouncer.logrotate create mode 100644 community/pgbouncer/pgbouncer.pre-install delete mode 100644 testing/pgbouncer/APKBUILD delete mode 100644 testing/pgbouncer/libressl-2.5.patch delete mode 100644 testing/pgbouncer/pgbouncer-dirs.patch delete mode 100644 testing/pgbouncer/pgbouncer.confd delete mode 100644 testing/pgbouncer/pgbouncer.initd delete mode 100644 testing/pgbouncer/pgbouncer.logrotate delete mode 100644 testing/pgbouncer/pgbouncer.pre-install 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 +# Maintainer: Francesco Colista +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 diff --git a/testing/pgbouncer/APKBUILD b/testing/pgbouncer/APKBUILD deleted file mode 100644 index b1c81c182f..0000000000 --- a/testing/pgbouncer/APKBUILD +++ /dev/null @@ -1,60 +0,0 @@ -# Contributor: Francesco Colista -# Maintainer: Francesco Colista -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/testing/pgbouncer/libressl-2.5.patch b/testing/pgbouncer/libressl-2.5.patch deleted file mode 100644 index 8aaae74dbc..0000000000 --- a/testing/pgbouncer/libressl-2.5.patch +++ /dev/null @@ -1,13 +0,0 @@ -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/testing/pgbouncer/pgbouncer-dirs.patch b/testing/pgbouncer/pgbouncer-dirs.patch deleted file mode 100644 index 7945376d87..0000000000 --- a/testing/pgbouncer/pgbouncer-dirs.patch +++ /dev/null @@ -1,26 +0,0 @@ -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/testing/pgbouncer/pgbouncer.confd b/testing/pgbouncer/pgbouncer.confd deleted file mode 100644 index c5408bbe31..0000000000 --- a/testing/pgbouncer/pgbouncer.confd +++ /dev/null @@ -1,19 +0,0 @@ -# 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/testing/pgbouncer/pgbouncer.initd b/testing/pgbouncer/pgbouncer.initd deleted file mode 100644 index a44f6aeeb8..0000000000 --- a/testing/pgbouncer/pgbouncer.initd +++ /dev/null @@ -1,92 +0,0 @@ -#!/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/testing/pgbouncer/pgbouncer.logrotate b/testing/pgbouncer/pgbouncer.logrotate deleted file mode 100644 index 78b82510d3..0000000000 --- a/testing/pgbouncer/pgbouncer.logrotate +++ /dev/null @@ -1,7 +0,0 @@ -/var/log/pgbouncer/pgbouncer.log { - missingok - sharedscripts - postrotate - /etc/init.d/pgbouncer --quiet --ifstarted reload - endscript -} diff --git a/testing/pgbouncer/pgbouncer.pre-install b/testing/pgbouncer/pgbouncer.pre-install deleted file mode 100644 index 609b3a9272..0000000000 --- a/testing/pgbouncer/pgbouncer.pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -adduser -S -D -H -h /dev/null -s /sbin/nologin -G postgres -g pgbouncer pgbouncer 2>/dev/null -exit 0 -- cgit v1.2.3