From 4d007a6493feaf2825ac458336d036930fd93cb6 Mon Sep 17 00:00:00 2001 From: mjl Date: Sat, 3 Sep 2011 22:05:52 +0000 Subject: Initial import of pgbouncer-1.4.2 pgbouncer is a lightweight connection pooler for PostgreSQL that 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. --- DESCR | 9 ++++++ Makefile | 93 ++++++++++++++++++++---------------------------------- PLIST | 7 ++++ distinfo | 5 +++ files/pgbouncer.sh | 43 +++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 58 deletions(-) create mode 100644 DESCR create mode 100644 PLIST create mode 100644 distinfo create mode 100644 files/pgbouncer.sh diff --git a/DESCR b/DESCR new file mode 100644 index 00000000000..40d2383f066 --- /dev/null +++ b/DESCR @@ -0,0 +1,9 @@ +Lightweight connection pooler for PostgreSQL that 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. diff --git a/Makefile b/Makefile index 3324cb7f95c..fc46d83aff9 100644 --- a/Makefile +++ b/Makefile @@ -1,72 +1,49 @@ -# $NetBSD: Makefile,v 1.1.1.2 2005/04/01 13:34:51 abs Exp $ +# $NetBSD: Makefile,v 1.1.1.3 2011/09/03 22:05:52 mjl Exp $ +# -DISTNAME= jakarta-tomcat-${TOMCAT_VERSION} -CATEGORIES= www java -# The list of sites to download is generated by a jakarta website. -# The getsite.sh script parses the HTML and extracts the urls. -DYNAMIC_MASTER_SITES=1 +DISTNAME= pgbouncer-${VERSION} +CATEGORIES= databases +MASTER_SITES= http://pgfoundry.org/frs/download.php/3085/ +EXTRACT_SUFX= .tgz -MAINTAINER= abs@NetBSD.org -HOMEPAGE= http://jakarta.apache.org/tomcat/ -COMMENT= The Apache Project's Java Servlet 2.4 and JSP 2.0 server +MAINTAINER= pkgsrc@NetBSD.org +HOMEPAGE= http://wiki.postgresql.org/wiki/PgBouncer +COMMENT= Lightweight connection pooler for PostgreSQL +LICENSE= original-bsd -TOMCAT_VERSION= 5.5.7 +PKG_DESTDIR_SUPPORT= user-destdir -# This needs java 1.4 or higher. -USE_JAVA2= yes -USE_BUILDLINK3= yes +VERSION= 1.4.2 +USE_LANGUAGES= c +USE_TOOLS= gmake +GNU_CONFIGURE= yes -TOMCAT_LIB= ${PREFIX}/tomcat -CATALINA_DIR= Catalina/localhost +CONFIGURE_ARGS+= --with-libevent=${BUILDLINK_PREFIX.libevent} -EGDIR= ${TOMCAT_LIB}/share/examples/jakarta-tomcat -EGDIR2= ${EGDIR}/${CATALINA_DIR} +EGDIR= ${PREFIX}/share/examples/${PKGBASE} +CONF_FILES= ${EGDIR}/pgbouncer.ini ${PKG_SYSCONFDIR}/pgbouncer.ini \ + ${EGDIR}/pgbouncer.userlist ${PKG_SYSCONFDIR}/pgbouncer.userlist -# Work around a horrible interaction with the gzip in NetBSD 2.0 (at least RC4) -# If gzip is used in a pipeline the tarfile fails to extract. PR bin/27228 -EXTRACT_CMD= ${CP} ${DOWNLOADED_DISTFILE} ${WRKDIR}/tar.gz && ${GZIP_CMD} -d ${WRKDIR}/tar.gz && ${TAR} xf ${WRKDIR}/tar +RCD_SCRIPTS+= pgbouncer -PKG_SYSCONFDIR.jakarta-tomcat55= ${TOMCAT_LIB}/conf -MAKE_DIRS= ${PKG_SYSCONFDIR.jakarta-tomcat55}/${CATALINA_DIR} +INSTALLATION_DIRS= bin ${PKGMANDIR}/man1 ${PKGMANDIR}/man5 ${EGDIR} -USE_PKGINSTALL= yes -RCD_SCRIPTS= tomcat -CFILES= server.xml web.xml tomcat-users.xml -CFILES+= catalina.policy catalina.properties jk2.properties -CF2FILES= manager.xml +PGUSER?= pgsql +PGGROUP?= pgsql +PKG_GROUPS= ${PGGROUP} +PKG_USERS= ${PGUSER}:${PGGROUP} -CONF_FILES= # empty -.for f in ${CFILES} -CONF_FILES+= ${EGDIR}/${f} ${PKG_SYSCONFDIR}/${f} -.endfor -.undef f -.for f in ${CF2FILES} -CONF_FILES+= ${EGDIR2}/${f} ${PKG_SYSCONFDIR}/${CATALINA_DIR}/${f} -.endfor -.undef f +BUILD_DEFS+= PGUSER PGGROUP +FILES_SUBST+= PGUSER=${PGUSER} -FILES_SUBST+= JAVA_HOME=${PKG_JVM_HOME} TOMCAT_LIB=${TOMCAT_LIB} - -do-build: - @${MV} ${WRKSRC}/conf ${WRKDIR} do-install: - ${INSTALL_DATA_DIR} ${EGDIR2} -.for f in ${CFILES} - ${INSTALL_DATA} ${WRKDIR}/conf/${f} ${EGDIR} -.endfor -.undef f -.for f in ${CF2FILES} - ${INSTALL_DATA} ${WRKDIR}/conf/${CATALINA_DIR}/${f} ${EGDIR2} -.endfor -.undef f - ${INSTALL_DATA_DIR} ${TOMCAT_LIB} - @(cd ${WRKSRC} && ${PAX} -rw -pm . ${TOMCAT_LIB}; \ - ${FIND} ${TOMCAT_LIB} -type f -print | ${XARGS} ${CHMOD} a+r; \ - ${FIND} ${TOMCAT_LIB} \( -type f -o -perm -u+x \) -print \ - | ${XARGS} ${CHMOD} a+rx; \ - ${FIND} ${TOMCAT_LIB} -type d -print | ${XARGS} ${CHMOD} a+rx; \ - ${FIND} ${TOMCAT_LIB} -type f -name \*.bat -print | \ - ${XARGS} ${RM} -f) + ${INSTALL_PROGRAM} ${WRKSRC}/pgbouncer ${DESTDIR}${PREFIX}/bin/ + ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/ + ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5/ + ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini ${DESTDIR}${EGDIR} + ${INSTALL_DATA} ${WRKSRC}/etc/userlist.txt ${DESTDIR}${EGDIR}/pgbouncer.userlist + +BUILDLINK_API_DEPENDS.libevent+= libevent>=2.0 +.include "../../devel/libevent/buildlink3.mk" -.include "../../mk/java-vm.mk" .include "../../mk/bsd.pkg.mk" diff --git a/PLIST b/PLIST new file mode 100644 index 00000000000..72d0ddc1c41 --- /dev/null +++ b/PLIST @@ -0,0 +1,7 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2011/09/03 22:05:52 mjl Exp $ +bin/pgbouncer +man/man1/pgbouncer.1 +man/man5/pgbouncer.5 +share/examples/pgbouncer/pgbouncer.ini +share/examples/pgbouncer/pgbouncer.userlist +share/examples/rc.d/pgbouncer diff --git a/distinfo b/distinfo new file mode 100644 index 00000000000..1e4e1e61916 --- /dev/null +++ b/distinfo @@ -0,0 +1,5 @@ +$NetBSD: distinfo,v 1.1.1.1 2011/09/03 22:05:52 mjl Exp $ + +SHA1 (pgbouncer-1.4.2.tgz) = 610198c3f2186d70267275f554e23bd43598e4b5 +RMD160 (pgbouncer-1.4.2.tgz) = 055796e23dd7029d3f4a2c882cf24399a5481cb1 +Size (pgbouncer-1.4.2.tgz) = 283204 bytes diff --git a/files/pgbouncer.sh b/files/pgbouncer.sh new file mode 100644 index 00000000000..0d9d4f11ea4 --- /dev/null +++ b/files/pgbouncer.sh @@ -0,0 +1,43 @@ +#! @RCD_SCRIPTS_SHELL@ +# +# $NetBSD: pgbouncer.sh,v 1.1.1.1 2011/09/03 22:05:52 mjl Exp $ +# +# PROVIDE: pgbouncer +# REQUIRE: DAEMON +# + +if [ -r /etc/rc.subr ] +then + . /etc/rc.subr +fi + +name="pgbouncer" +rcvar=${name} +command="@PREFIX@/bin/${name}" +pgbouncer_conf="@PKG_SYSCONFDIR@/${name}.ini" +required_files="${pgbouncer_conf}" +command_args="-d ${pgbouncer_conf}" +extra_commands="reload" +pgsql_user="@PGUSER@" +start_cmd="pgbouncer_start" + +pidfile="@VARBASE@/run/${name}/${name}.pid" +if [ -r ${pgbouncer_conf} ] ; then + pidfile=`grep -i pidfile /usr/pkg/etc/pgbouncer.ini | cut -d= -f2` +fi + +pgbouncer_start() +{ + @ECHO@ "Starting ${name}." + piddir=`dirname ${pidfile}` + if [ ! -d ${piddir} ] ; then + @MKDIR@ -p ${piddir} + @CHOWN@ ${pgsql_user} ${piddir} + fi + + doit="@SU@ -m ${pgsql_user} -c '${command} ${command_args}'" + eval $doit +} + +load_rc_config $name +run_rc_command "$1" -- cgit v1.2.3