summaryrefslogtreecommitdiff
path: root/dev-db
diff options
context:
space:
mode:
authorAaron Swenson <titanofold@gentoo.org>2011-05-20 09:54:56 +0000
committerAaron Swenson <titanofold@gentoo.org>2011-05-20 09:54:56 +0000
commit91d670918d7db4edb15d61eee0186e11d357ecd4 (patch)
tree10abdd098cfb93890daf539d842b5663ac01611f /dev-db
parentFix underlink. Bug #367485 (diff)
downloadhistorical-91d670918d7db4edb15d61eee0186e11d357ecd4.tar.gz
historical-91d670918d7db4edb15d61eee0186e11d357ecd4.tar.bz2
historical-91d670918d7db4edb15d61eee0186e11d357ecd4.zip
Fixes bugs 366713 and 355245. Added "en" to LINGUAS so those who have specified "en" will not build all languages. Removed inexplicable dependency on dev-python/egenix-mx-base.
Package-Manager: portage-2.1.9.42/cvs/Linux i686
Diffstat (limited to 'dev-db')
-rw-r--r--dev-db/postgresql-server/ChangeLog16
-rw-r--r--dev-db/postgresql-server/Manifest15
-rw-r--r--dev-db/postgresql-server/postgresql-server-8.2.21-r1.ebuild317
-rw-r--r--dev-db/postgresql-server/postgresql-server-8.3.15-r1.ebuild320
-rw-r--r--dev-db/postgresql-server/postgresql-server-8.4.8-r1.ebuild324
-rw-r--r--dev-db/postgresql-server/postgresql-server-9.0.4-r1.ebuild328
-rw-r--r--dev-db/postgresql-server/postgresql-server-9.1_beta1-r1.ebuild318
7 files changed, 1632 insertions, 6 deletions
diff --git a/dev-db/postgresql-server/ChangeLog b/dev-db/postgresql-server/ChangeLog
index d48116d6c420..c54d488bb709 100644
--- a/dev-db/postgresql-server/ChangeLog
+++ b/dev-db/postgresql-server/ChangeLog
@@ -1,6 +1,20 @@
# ChangeLog for dev-db/postgresql-server
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.124 2011/05/19 16:05:01 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.125 2011/05/20 09:54:56 titanofold Exp $
+
+*postgresql-server-9.1_beta1-r1 (20 May 2011)
+*postgresql-server-9.0.4-r1 (20 May 2011)
+*postgresql-server-8.4.8-r1 (20 May 2011)
+*postgresql-server-8.3.15-r1 (20 May 2011)
+*postgresql-server-8.2.21-r1 (20 May 2011)
+
+ 20 May 2011; Aaron W. Swenson <titanofold@gentoo.org>
+ +postgresql-server-8.2.21-r1.ebuild, +postgresql-server-8.3.15-r1.ebuild,
+ +postgresql-server-8.4.8-r1.ebuild, +postgresql-server-9.0.4-r1.ebuild,
+ +postgresql-server-9.1_beta1-r1.ebuild:
+ Fixes bugs 366713 and 355245. Added "en" to LINGUAS so those who have
+ specified "en" will not build all languages. Removed inexplicable dependency
+ on dev-python/egenix-mx-base.
19 May 2011; Tomáš Chvátal <scarabeus@gentoo.org>
-files/postgresql.conf-8.2, -files/postgresql.init-8.2,
diff --git a/dev-db/postgresql-server/Manifest b/dev-db/postgresql-server/Manifest
index ebcc1be3000c..57b728ea0a12 100644
--- a/dev-db/postgresql-server/Manifest
+++ b/dev-db/postgresql-server/Manifest
@@ -1,5 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
+Hash: SHA256
AUX postgresql-8.2-common.patch 2640 RMD160 b25ba915d5d6ad9c12c1d51426363c196b830923 SHA1 7b946d57bfed34e2e7e1338c3ab3004341d7ab12 SHA256 36ca9cb4f26424c302fdd704b7c1a268e87612afa3006bf008d4594dabe080f8
AUX postgresql-8.2-server.patch 5319 RMD160 9aae5832defd2e43879246e773fd1aada0680716 SHA1 ea726704fc85118c27f511bfd9324b136ced3eb1 SHA256 2687fa5159a34da59e36af4c894f43b2136e8e88c965a682607cb48acb61d8ee
@@ -40,20 +40,25 @@ DIST postgresql-patches-8.4.tbz2 4615 RMD160 ce13939969e19125099afcf8629b5f0955d
DIST postgresql-patches-9.0-r1.tbz2 4305 RMD160 858525038e409bc351efd178cfa9886aa98e0944 SHA1 d1e8cdf56900ad1426f9b17fe0d45ec2beb39c49 SHA256 0f6684fec778208a8527f9bdd7eb498e0b25af6f3e01439c9774311fc541e107
DIST postgresql-patches-9.1beta1.tbz2 4343 RMD160 a5e714733131afa3361c57cac5595482a9cc0778 SHA1 1c694f50db382c90a3fdd8548322ddf31b1b355d SHA256 216448c1810ef5de4ced5e52277fde2a8edc7979bda74bd8cd78b436dd83c509
EBUILD postgresql-server-8.2.20.ebuild 10148 RMD160 9e3da620143070e62daf7c475bc9246e93313e35 SHA1 26a8b7e21a435c8d8b2ba75e1b266d9fabc90e77 SHA256 2750bb3f2cfbd29db54565f82a022b606de6f2f0d3e92b7e15d2aca34337595b
+EBUILD postgresql-server-8.2.21-r1.ebuild 10848 RMD160 5b6d9d7a89c0666864752698e2e8c3982f2bc438 SHA1 e35f7d666dd03e3fad12e25b4e1d9ebfdde44bc5 SHA256 f274d96e016eaaf93179373ff1c9d01af1c63be4730ef1e4c1d249bd56b22711
EBUILD postgresql-server-8.2.21.ebuild 10864 RMD160 4344bf2ada0bb2fbf07bb3a6184373543b054973 SHA1 b1ffc311b0cb1dd95da035b98fba544b6f41ef0d SHA256 e687e3d93da61525945be31df0837f075afdbcf68106f13faed8ad58f275c8df
EBUILD postgresql-server-8.3.14.ebuild 10276 RMD160 970bd57f2f49a6d6e54470aade654013a0dc76e5 SHA1 3a255eee8c1137e8a22c0489d9a50070e6f7f29a SHA256 84199b817928d5a13e5d7ccc25b533eb1d29a7533f9baae6406b9b7fd38aa155
+EBUILD postgresql-server-8.3.15-r1.ebuild 11043 RMD160 00f65c5ef4a3c3742adcfd93938d8bc5b77243b3 SHA1 c182ad38614b3587acd521b7d589fc6228747d26 SHA256 5a40b584783b0efd19be642273b5af54a4ede25702980782bb27f693ff5ad8cf
EBUILD postgresql-server-8.3.15.ebuild 11073 RMD160 51cc902210197c7589f17b69b42e9cc67e07c47a SHA1 c4f26448d5f1f38c6b247730315e6aa449cc5281 SHA256 971e0783e2f8b2a51477ed26cd537f4c9a3b334da0266ec3fced1fb6486d9dc9
EBUILD postgresql-server-8.4.7.ebuild 10344 RMD160 c885044bc7798ef4ff9be452f8a7efd627996306 SHA1 57c543f2be626f3728f7bc481e058908ca9e2f29 SHA256 5118b76613653f2037845b8f3f840af1e32ce4cbc721fbcd90f8e9406eb54bbd
+EBUILD postgresql-server-8.4.8-r1.ebuild 11332 RMD160 f2eccfa7a2012c5475f6dad98f32ba4b0893ee4a SHA1 99a85d56e5dc4c76a508a6ef50dc1de785a1e07d SHA256 894b68ed4bc3aef995837a5daee0901168c15953e4288feb2823c21f31c3d936
EBUILD postgresql-server-8.4.8.ebuild 11391 RMD160 51b8024d3cc7ed279cc30ed802c70998d675a2e2 SHA1 2e6b9e46fdf3d8745cc8e858f9e39391a891fe39 SHA256 a9bcefc60d95a8971782a543fecf4b9065c70d7dc96f7b3a6ce03a7ec9a0bc79
EBUILD postgresql-server-9.0.3.ebuild 10178 RMD160 65da0866e062f1254e5e082aa3d6e5460035c972 SHA1 629aba6be85464b7e32548e05accc1cb86eeada9 SHA256 5f931b0c7a5ba5265cc1e3386243e18bba02fa1ff415b79d9f78ecbb5d3734de
+EBUILD postgresql-server-9.0.4-r1.ebuild 11281 RMD160 0b8b225efbf7b8a4d79b785e1ad67a62160e4563 SHA1 2d867625ee82f5e069782ad3223fbaa764946c74 SHA256 89e493adf4c11b811934941cbe67d34266b3499756ecb4e7baabd9ae1a5b7174
EBUILD postgresql-server-9.0.4.ebuild 11020 RMD160 4ed520c4c824e7fc6e55a781e49c090e2b0f7d57 SHA1 e3c8cfc898250252355361c8a4611575987012ec SHA256 b8a74faaf643f826ebd91c84863eeef7c95e9824017249d314c866b2b85efc17
+EBUILD postgresql-server-9.1_beta1-r1.ebuild 10803 RMD160 98b0630335d0239c385d3aae9cefd45f38f7ba8c SHA1 ce01de1d3814095a432fd5bfe0829c27a330d443 SHA256 360755f56791f401a9a77a102e87915ebe07036cfd8118c74a7eae641cc66a64
EBUILD postgresql-server-9.1_beta1.ebuild 10847 RMD160 a05affff4c133e3a303c33ff64723515cbd370ef SHA1 0e0b58306d49a18577958a5cf0116cd1aa8852e8 SHA256 4c5f328efaf0fd154763fc8ede474a6c4d86172583e45454ff17266689fca8a4
-MISC ChangeLog 40710 RMD160 8165ae1b4f01fb8f8446876bf0c6307f7e98070b SHA1 4c557bffc77307cc5ba4d79d52addb5844f147af SHA256 f33cecf33ca336633e0348d0d2b3f9e767b6c9b74fe47694daab5fe591b0dd26
+MISC ChangeLog 41360 RMD160 dd8e8adbb5ba75916b0f3518bc4628fafdcdd32b SHA1 534199cc9bb8e1325759a9a87ef2927f47eddd12 SHA256 e3b86adf54e10fe1edb51c1a24774f9181e6f5b88ce40cd75908b701b10d55ac
MISC metadata.xml 420 RMD160 789f5a0ce45d05125098fd7e74a816cf08f4c39b SHA1 d308d7434a37f12cd320f74ed85e1d3ca7dabc75 SHA256 ac37a5084450a782d02510149d030bd0d4a63164f2ffb7bdda3ddf344606ca62
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEARECAAYFAk3VP7QACgkQHB6c3gNBRYcwlwCcCDsuBWHKuHHxdI5lJPpsWWOb
-pYEAn3sgSmhGY9hGV/UdRC5IxK+/X5+7
-=28J+
+iF4EAREIAAYFAk3WOnkACgkQCOhwUhu5AEnihAD+IhJfnsGuq/UaBIgdxLAyEXyR
+eayeRbtB0OKDF2irCsEBAJJ162l2z6FHZH2x0RlU+e16UONQDZOfuA3GWD3pl08r
+=azsA
-----END PGP SIGNATURE-----
diff --git a/dev-db/postgresql-server/postgresql-server-8.2.21-r1.ebuild b/dev-db/postgresql-server/postgresql-server-8.2.21-r1.ebuild
new file mode 100644
index 000000000000..63d4bcbc9b15
--- /dev/null
+++ b/dev-db/postgresql-server/postgresql-server-8.2.21-r1.ebuild
@@ -0,0 +1,317 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.21-r1.ebuild,v 1.1 2011/05/20 09:54:56 titanofold Exp $
+
+EAPI="4"
+
+WANT_AUTOMAKE="none"
+inherit autotools eutils multilib pam prefix versionator
+
+SLOT="$(get_version_component_range 1-2)"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~s390 ~sh ~sparc ~x86"
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
+ http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}.tbz2
+ http://dev.gentoo.org/~titanofold/postgresql-initscript-1.0.1.tbz2"
+LICENSE="POSTGRESQL"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
+IUSE="doc kernel_linux nls pam perl python selinux tcl xml"
+
+for lingua in ${LINGUAS} ; do
+ IUSE+=" linguas_${lingua}"
+done
+
+wanted_languages() {
+ local enable_langs
+
+ for lingua in ${LINGUAS} ; do
+ use linguas_${lingua} && enable_langs+="${lingua} "
+ done
+
+ echo -n ${enable_langs}
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=]
+ perl? ( >=dev-lang/perl-5.8 )
+ selinux? ( sec-policy/selinux-postgresql )
+ tcl? ( >=dev-lang/tcl-8 )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ xml? ( dev-util/pkgconfig )"
+
+PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
+
+pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/autoconf.patch" \
+ "${WORKDIR}/server.patch" \
+ "${WORKDIR}/darwin.patch" \
+ "${WORKDIR}/SuperH.patch"
+
+ eprefixify src/include/pg_config_manual.h
+
+ if use test ; then
+ epatch "${WORKDIR}/regress.patch"
+ sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress.c
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
+ -i src/test/regress/{input,output}/tablespace.source
+ else
+ echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+ fi
+
+ eautoconf
+}
+
+src_configure() {
+ # eval is needed to get along with pg_config quotation of space-rich entities.
+ eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+ --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
+ $(use_with perl) \
+ $(use_with python) \
+ $(use_with tcl) \
+ "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
+}
+
+src_compile() {
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2); do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake -C $bd -j1 \
+ PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+ NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
+ done
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake install -C $bd -j1 DESTDIR="${D}" \
+ PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+ PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
+ done
+
+ rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/${PF}/html"
+ rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
+ docompress /usr/share/postgresql-${SLOT}/man/man1
+
+ dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+ dodir /etc/eselect/postgresql/slots/${SLOT}
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
+ > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
+
+ newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
+ newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
+
+ use pam && pamd_mimic system-auth postgresql auth account session
+
+ keepdir /var/run/postgresql
+ fperms 0770 /var/run/postgresql
+ use prefix || fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+ postgresql-config update
+
+ elog "The Unix-domain socket is located in:"
+ elog " ${EROOT%/}/var/run/postgresql/"
+ elog
+ elog "If you have users and/or services that you would like to utilize the socket,"
+ elog "you must add them to the 'postgres' system group:"
+ elog " usermod -a -G postgres <user>"
+ elog
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
+ elog "it contains your preferred locale in:"
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ elog
+ elog "Then, execute the following command to setup the initial database"
+ elog "environment:"
+ elog " emerge --config =${CATEGORY}/${PF}"
+}
+
+pkg_postrm() {
+ postgresql-config update
+}
+
+pkg_config() {
+ [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source ${EROOT%/}/etc/conf.d/postgresql-${SLOT}
+ [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
+ [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
+
+ # environment.bz2 may not contain the same locale as the current system
+ # locale. Unset and source from the current system locale.
+ if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
+ unset LANG
+ unset LC_CTYPE
+ unset LC_NUMERIC
+ unset LC_TIME
+ unset LC_COLLATE
+ unset LC_MONETARY
+ unset LC_MESSAGES
+ unset LC_ALL
+ source ${EROOT%/}/etc/env.d/02locale
+ [[ -n ${LANG} ]] && export LANG
+ [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
+ [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
+ [[ -n ${LC_TIME} ]] && export LC_TIME
+ [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
+ [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
+ [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
+ [[ -n ${LC_ALL} ]] && export LC_ALL
+ fi
+
+ einfo "You can modify the paths and options passed to initdb by editing:"
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ einfo
+ einfo "Information on options that can be passed to initdb are found at:"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then
+ einfo " (none)"
+ else
+ einfo " ${PG_INITDB_OPTS}"
+ fi
+ einfo
+ einfo "Configuration files will be installed to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "The database cluster will be created in:"
+ einfo " ${DATA_DIR}"
+ einfo
+ while [[ $correct != "true" ]] ; do
+ einfo "Are you ready to continue? (y/n)"
+ read answer
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+ correct="true"
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+ die "Aborting initialization."
+ else
+ echo "Answer not recognized"
+ fi
+ done
+
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
+ eerror "The given directory, '${DATA_DIR}', is not empty."
+ eerror "Modify DATA_DIR to point to an empty directory."
+ die "${DATA_DIR} is not empty."
+ fi
+
+ [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
+ einfo "Checking system parameters..."
+
+ if ! use kernel_linux ; then
+ einfo "Skipped."
+ einfo "Tests not supported on this OS (yet)"
+ else
+ if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+ local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+ local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+ local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+ local SHMMAX=$(sysctl -n kernel.shmmax)
+
+ local SEMMSL_MIN=17
+ local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+ local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+ local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+ for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+ if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
+ eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+ eerror "You have now several options:"
+ eerror " - Change the mentioned system parameter"
+ eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
+ eerror " value lower than ${PG_MAX_CONNECTIONS}"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+ eerror "More information can be found here:"
+ eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+ die "System test failed."
+ fi
+ done
+ einfo "Passed."
+ else
+ ewarn "SKIP_SYSTEM_TESTS set, so skipping."
+ fi
+ fi
+
+ if [[ ${EUID} == 0 ]] ; then
+ einfo "Creating the data directory ..."
+ mkdir -p "${DATA_DIR}"
+ chown -Rf postgres:postgres "${DATA_DIR}"
+ chmod 0700 "${DATA_DIR}"
+ fi
+
+ einfo "Initializing the database ..."
+ if [[ ${EUID} == 0 ]] ; then
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
+ else
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
+ fi
+ mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
+
+ einfo "The autovacuum function, which was in contrib, has been moved to the main"
+ einfo "PostgreSQL functions starting with 8.1."
+ einfo "You can enable it in the cluster's:"
+ einfo " ${PGDATA%/}/postgresql.conf"
+ einfo
+ einfo "The PostgreSQL server, by default, will log events to:"
+ einfo " ${DATA_DIR%/}/postmaster.log"
+ einfo
+ if use prefix ; then
+ einfo "The location of the configuration files have moved to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "To start the server:"
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
+ einfo
+ einfo "To stop:"
+ einfo " pg_ctl stop -D ${DATA_DIR}"
+ einfo
+ einfo "Or move the configuration files back:"
+ einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
+ else
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
+ einfo "instead of 'pg_ctl'."
+ fi
+}
+
+src_test() {
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+
+ if [[ ${UID} != 0 ]] ; then
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \
+ emake check \
+ PGXS=$("${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ NO_PGXS=0 USE_PGXS=1 SLOT="${SLOT}"
+
+ einfo "If you think other tests besides the regression tests are necessary, please"
+ einfo "submit a bug including a patch for this ebuild to enable them."
+ else
+ ewarn "Tests cannot be run as root. Skipping."
+ ewarn "HINT: FEATURES=\"userpriv\""
+ fi
+}
diff --git a/dev-db/postgresql-server/postgresql-server-8.3.15-r1.ebuild b/dev-db/postgresql-server/postgresql-server-8.3.15-r1.ebuild
new file mode 100644
index 000000000000..05fdea3db83a
--- /dev/null
+++ b/dev-db/postgresql-server/postgresql-server-8.3.15-r1.ebuild
@@ -0,0 +1,320 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.15-r1.ebuild,v 1.1 2011/05/20 09:54:56 titanofold Exp $
+
+EAPI="4"
+
+WANT_AUTOMAKE="none"
+inherit autotools eutils multilib pam prefix versionator
+
+SLOT="$(get_version_component_range 1-2)"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
+ http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}.tbz2
+ http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
+LICENSE="POSTGRESQL"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
+IUSE="doc kernel_linux nls pam perl python selinux tcl uuid xml"
+
+for lingua in ${LINGUAS} ; do
+ IUSE+=" linguas_${lingua}"
+done
+
+wanted_languages() {
+ local enable_langs
+
+ for lingua in ${LINGUAS} ; do
+ use linguas_${lingua} && enable_langs+="${lingua} "
+ done
+
+ echo -n ${enable_langs}
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=]
+ perl? ( >=dev-lang/perl-5.8 )
+ selinux? ( sec-policy/selinux-postgresql )
+ tcl? ( >=dev-lang/tcl-8 )
+ uuid? ( dev-libs/ossp-uuid )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ xml? ( dev-util/pkgconfig )"
+
+PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
+
+pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/autoconf.patch" \
+ "${WORKDIR}/server.patch" \
+ "${WORKDIR}/SuperH.patch" \
+ "${WORKDIR}/darwin.patch"
+
+ eprefixify src/include/pg_config_manual.h
+
+ if use test ; then
+ epatch "${WORKDIR}/regress.patch"
+ sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
+ -i src/test/regress/{input,output}/tablespace.source
+ else
+ echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+ fi
+
+ eautoconf
+}
+
+src_configure() {
+ # eval is needed to get along with pg_config quotation of space-rich entities.
+ eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+ --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
+ --with-system-tzdata="${EROOT%/}/usr/share/zoneinfo" \
+ $(use_with perl) \
+ $(use_with python) \
+ $(use_with tcl) \
+ $(use_with xml libxml) \
+ $(use_with xml libxslt) \
+ $(use_with uuid ossp-uuid) \
+ "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
+}
+
+src_compile() {
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2); do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake -C $bd -j1 \
+ PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+ NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
+ done
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake install -C $bd -j1 DESTDIR="${D}" \
+ PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
+ PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
+ done
+
+ rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/${PF}/html"
+ rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
+ docompress /usr/share/postgresql-${SLOT}/man/man1
+
+ dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+ dodir /etc/eselect/postgresql/slots/${SLOT}
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
+ > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
+
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
+ newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
+ newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
+
+ use pam && pamd_mimic system-auth postgresql auth account session
+
+ keepdir /var/run/postgresql
+ fperms 0770 /var/run/postgresql
+ use prefix || fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+ postgresql-config update
+
+ elog "The Unix-domain socket is located in:"
+ elog " ${EROOT%/}/var/run/postgresql/"
+ elog
+ elog "If you have users and/or services that you would like to utilize the socket,"
+ elog "you must add them to the 'postgres' system group:"
+ elog " usermod -a -G postgres <user>"
+ elog
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
+ elog "it contains your preferred locale in:"
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ elog
+ elog "Execute the following command to setup the initial database"
+ elog "environment:"
+ elog " emerge --config =${CATEGORY}/${PF}"
+}
+
+pkg_postrm() {
+ postgresql-config update
+}
+
+pkg_config() {
+ [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
+ [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
+
+ # environment.bz2 may not contain the same locale as the current system
+ # locale. Unset and source from the current system locale.
+ if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
+ unset LANG
+ unset LC_CTYPE
+ unset LC_NUMERIC
+ unset LC_TIME
+ unset LC_COLLATE
+ unset LC_MONETARY
+ unset LC_MESSAGES
+ unset LC_ALL
+ source ${EROOT%/}/etc/env.d/02locale
+ [[ -n ${LANG} ]] && export LANG
+ [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
+ [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
+ [[ -n ${LC_TIME} ]] && export LC_TIME
+ [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
+ [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
+ [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
+ [[ -n ${LC_ALL} ]] && export LC_ALL
+ fi
+
+ einfo "You can modify the paths and options passed to initdb by editing:"
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ einfo
+ einfo "Information on options that can be passed to initdb are found at:"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ if [[ -z ${PG_INITDB_OPTS} ]] ; then
+ einfo " (none)"
+ else
+ einfo " ${PG_INITDB_OPTS}"
+ fi
+ einfo
+ einfo "Configuration files will be installed to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "The database cluster will be created in:"
+ einfo " ${DATA_DIR}"
+ einfo
+ while [[ $correct != "true" ]] ; do
+ einfo "Are you ready to continue? (y/n)"
+ read answer
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+ correct="true"
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+ die "Aborting initialization."
+ else
+ echo "Answer not recognized."
+ fi
+ done
+
+ if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
+ eerror "The given directory, '${DATA_DIR}', is not empty."
+ eerror "Modify DATA_DIR to point to an empty directory."
+ die "${DATA_DIR} is not empty."
+ fi
+
+ [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
+ einfo "Checking system parameters..."
+
+ if ! use kernel_linux ; then
+ einfo "Skipped."
+ einfo "Tests not supported on this OS (yet)."
+ else
+ if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+ local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+ local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+ local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+ local SHMMAX=$(sysctl -n kernel.shmmax)
+
+ local SEMMSL_MIN=17
+ local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+ local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+ local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+ for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+ if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
+ eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+ eerror "You have now several options:"
+ eerror " - Change the mentioned system parameter"
+ eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a"
+ eerror " value lower than ${PG_MAX_CONNECTIONS}"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+ eerror "More information can be found here:"
+ eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+ die "System test failed."
+ fi
+ done
+ einfo "Passed."
+ else
+ ewarn "SKIP_SYSTEM_TESTS is set, so skipping."
+ fi
+ fi
+
+ if [[ ${EUID} == 0 ]] ; then
+ einfo "Creating the data directory ..."
+ mkdir -p "${DATA_DIR}"
+ chown -Rf postgres:postgres "${DATA_DIR}"
+ chmod 0700 "${DATA_DIR}"
+ fi
+
+ einfo "Initializing the database ..."
+ if [[ ${EUID} == 0 ]] ; then
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
+ else
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
+ fi
+ mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
+
+ einfo "The autovacuum function, which was in contrib, has been moved to the main"
+ einfo "PostgreSQL functions starting with 8.1. You can enable it in the clusters"
+ einfo "postgresql.conf."
+ einfo
+ if use prefix ; then
+ einfo "The location of the configuration files have moved to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "To start the server:"
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
+ einfo
+ einfo "To stop:"
+ einfo " pg_ctl stop -D ${DATA_DIR}"
+ einfo
+ einfo "Or move the configuration files back:"
+ einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
+ else
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
+ einfo "instead of 'pg_ctl'."
+ fi
+}
+
+src_test() {
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+
+ if [[ ${UID} != 0 ]] ; then
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \
+ emake check \
+ PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
+ NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT}
+
+ einfo "If you think other tests besides the regression tests are necessary, please"
+ einfo "submit a bug including a patch for this ebuild to enable them."
+ else
+ ewarn "Tests cannot be run as root. Skipping."
+ ewarn "HINT: FEATURES=\"userpriv\""
+ fi
+}
diff --git a/dev-db/postgresql-server/postgresql-server-8.4.8-r1.ebuild b/dev-db/postgresql-server/postgresql-server-8.4.8-r1.ebuild
new file mode 100644
index 000000000000..b449f813b7c0
--- /dev/null
+++ b/dev-db/postgresql-server/postgresql-server-8.4.8-r1.ebuild
@@ -0,0 +1,324 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.8-r1.ebuild,v 1.1 2011/05/20 09:54:56 titanofold Exp $
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+
+WANT_AUTOMAKE="none"
+inherit autotools eutils multilib pam prefix python versionator
+
+SLOT="$(get_version_component_range 1-2)"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
+ http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}.tbz2
+ http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
+LICENSE="POSTGRESQL"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
+IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
+
+for lingua in ${LINGUAS} ; do
+ IUSE+=" linguas_${lingua}"
+done
+
+wanted_languages() {
+ local enable_langs
+
+ for lingua in ${LINGUAS} ; do
+ use linguas_${lingua} && enable_langs+="${lingua} "
+ done
+
+ echo -n ${enable_langs}
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
+ perl? ( >=dev-lang/perl-5.8 )
+ selinux? ( sec-policy/selinux-postgresql )
+ tcl? ( >=dev-lang/tcl-8 )
+ uuid? ( dev-libs/ossp-uuid )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ xml? ( dev-util/pkgconfig )"
+
+PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
+
+pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+
+ use python && python_set_active_version 2
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/autoconf.patch" \
+ "${WORKDIR}/server.patch" \
+ "${WORKDIR}/ldflags.patch" \
+ "${WORKDIR}/SuperH.patch" \
+ "${WORKDIR}/darwin.patch"
+
+ eprefixify src/include/pg_config_manual.h
+
+ if use test ; then
+ epatch "${WORKDIR}/regress.patch"
+ sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
+ -i src/test/regress/{input,output}/tablespace.source
+ else
+ echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+ fi
+
+ eautoconf
+}
+
+src_configure() {
+ # eval is needed to get along with pg_config quotation of space-rich entities.
+ eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+ --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
+ --with-libraries="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
+ --with-system-tzdata="${EROOT%/}/usr/share/zoneinfo" \
+ $(use_with perl) \
+ $(use_with python) \
+ $(use_with tcl) \
+ $(use_with xml libxml) \
+ $(use_with xml libxslt) \
+ $(use_with uuid ossp-uuid) \
+ "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
+}
+
+src_compile() {
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake -C $bd -j1 || die "emake in $bd failed"
+ done
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
+ done
+
+ rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/postgresql-${SLOT}/html"
+ rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
+
+ dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+ dodir /etc/eselect/postgresql/slots/${SLOT}
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
+ > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
+
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
+ newconfd "${WORKDIR}"/postgresql.confd postgresql-${SLOT} || die "Inserting conf.d file failed"
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
+ newinitd "${WORKDIR}"/postgresql.init postgresql-${SLOT} || die "Inserting init.d file failed"
+
+ use pam && pamd_mimic system-auth postgresql auth account session
+
+ keepdir /var/run/postgresql
+ fperms 0770 /var/run/postgresql
+ use prefix || fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+ postgresql-config update
+
+ elog "The time stamp format is 64 bit integers now. If you upgrade from older"
+ elog "databases, this may force you to either do a dump and reload of enable"
+ elog "pg_legacytimestamp until you find time to do so. If the database can't start"
+ elog "please try enabling pg_legacytimestamp and rebuild."
+ elog
+ elog "The Unix-domain socket is located in:"
+ elog " ${EROOT%/}/var/run/postgresql/"
+ elog
+ elog "If you have users and/or services that you would like to utilize the socket,"
+ elog "you must add them to the 'postgres' system group:"
+ elog " usermod -a -G postgres <user>"
+ elog
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
+ elog "it contains your preferred locale and character encoding in:"
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ elog
+ elog "Then, execute the following command to setup the initial database"
+ elog "environment:"
+ elog " emerge --config =${CATEGORY}/${PF}"
+}
+
+pkg_postrm() {
+ postgresql-config update
+}
+
+pkg_config() {
+ [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
+ [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
+
+ # environment.bz2 may not contain the same locale as the current system
+ # locale. Unset and source from the current system locale.
+ if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
+ unset LANG
+ unset LC_CTYPE
+ unset LC_NUMERIC
+ unset LC_TIME
+ unset LC_COLLATE
+ unset LC_MONETARY
+ unset LC_MESSAGES
+ unset LC_ALL
+ source "${EROOT%/}/etc/env.d/02locale"
+ [[ -n ${LANG} ]] && export LANG
+ [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
+ [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
+ [[ -n ${LC_TIME} ]] && export LC_TIME
+ [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
+ [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
+ [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
+ [[ -n ${LC_ALL} ]] && export LC_ALL
+ fi
+
+ einfo "You can modify the paths and options passed to initdb by editing:"
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ einfo
+ einfo "Information on options that can be passed to initdb are found at:"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ if [[ -z ${PG_INITDB_OPTS} ]] ; then
+ einfo " (none)"
+ else
+ einfo " ${PG_INITDB_OPTS}"
+ fi
+ einfo
+ einfo "Configuration files will be installed to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "The database cluster will be created in:"
+ einfo " ${DATA_DIR}"
+ einfo
+ while [[ $correct != "true" ]] ; do
+ einfo "Are you ready to continue? (y/n)"
+ read answer
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+ correct="true"
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+ die "Aborting initialization."
+ else
+ echo "Answer not recognized"
+ fi
+ done
+
+ if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
+ eerror "The given directory, '${DATA_DIR}', is not empty."
+ eerror "Modify DATA_DIR to point to an empty directory."
+ die "${DATA_DIR} is not empty."
+ fi
+
+ [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
+ einfo "Checking system parameters..."
+
+ if ! use kernel_linux ; then
+ einfo "Skipped."
+ einfo " Tests not supported on this OS (yet)"
+ else
+ if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+ local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+ local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+ local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+ local SHMMAX=$(sysctl -n kernel.shmmax)
+
+ local SEMMSL_MIN=17
+ local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+ local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+ local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+ for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+ if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
+ eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+ eerror "You have now several options:"
+ eerror " - Change the mentioned system parameter"
+ eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
+ eerror " value lower than ${PG_MAX_CONNECTIONS}"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+ eerror "More information can be found here:"
+ eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+ die "System test failed."
+ fi
+ done
+ einfo "Passed."
+ else
+ ewarn "SKIP_SYSTEM_TESTS set, so skipping."
+ fi
+ fi
+
+ if [[ ${EUID} == 0 ]] ; then
+ einfo "Creating the data directory ..."
+ mkdir -p "${DATA_DIR}"
+ chown -Rf postgres:postgres "${DATA_DIR}"
+ chmod 0700 "${DATA_DIR}"
+ fi
+
+ einfo "Initializing the database ..."
+ if [[ ${EUID} == 0 ]] ; then
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
+ else
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
+ fi
+ mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
+
+ einfo "The autovacuum function, which was in contrib, has been moved to the main"
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
+ einfo "default. You can disable it in the cluster's:"
+ einfo " ${PGDATA%/}/postgresql.conf"
+ einfo
+ einfo "The PostgreSQL server, by default, will log events to:"
+ einfo " ${DATA_DIR%/}/postmaster.log"
+ einfo
+ if use prefix ; then
+ einfo "The location of the configuration files have moved to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "To start the server:"
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
+ einfo
+ einfo "To stop:"
+ einfo " pg_ctl stop -D ${DATA_DIR}"
+ einfo
+ einfo "Or move the configuration files back:"
+ einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
+ else
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
+ einfo "instead of 'pg_ctl'."
+ fi
+}
+
+src_test() {
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+
+ if [[ ${UID} != 0 ]] ; then
+ emake check || die "Make check failed. See above for details."
+
+ einfo "If you think other tests besides the regression tests are necessary, please"
+ einfo "submit a bug including a patch for this ebuild to enable them."
+ else
+ ewarn "Tests cannot be run as root. Skipping."
+ ewarn "HINT: FEATURES=\"userpriv\""
+ fi
+}
diff --git a/dev-db/postgresql-server/postgresql-server-9.0.4-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.0.4-r1.ebuild
new file mode 100644
index 000000000000..9bcd6aaeb184
--- /dev/null
+++ b/dev-db/postgresql-server/postgresql-server-9.0.4-r1.ebuild
@@ -0,0 +1,328 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.4-r1.ebuild,v 1.1 2011/05/20 09:54:56 titanofold Exp $
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+
+WANT_AUTOMAKE="none"
+inherit autotools eutils multilib pam prefix python versionator
+
+SLOT="$(get_version_component_range 1-2)"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris"
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
+ http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r1.tbz2
+ http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
+LICENSE="POSTGRESQL"
+
+S="${WORKDIR}/postgresql-${PV}"
+
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
+IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
+
+for lingua in ${LINGUAS}; do
+ IUSE+=" linguas_${lingua}"
+done
+
+wanted_languages() {
+ local enable_langs
+
+ for lingua in ${LINGUAS} ; do
+ use linguas_${lingua} && enable_langs+="${lingua} "
+ done
+
+ echo -n ${enable_langs}
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
+ perl? ( >=dev-lang/perl-5.8 )
+ selinux? ( sec-policy/selinux-postgresql )
+ tcl? ( >=dev-lang/tcl-8 )
+ uuid? ( dev-libs/ossp-uuid )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ xml? ( dev-util/pkgconfig )"
+
+PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
+
+pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+
+ use python && python_set_active_version 2
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/autoconf.patch" \
+ "${WORKDIR}/server.patch"
+ epatch "${FILESDIR}"/${P}-bool.patch
+
+ eprefixify src/include/pg_config_manual.h
+
+ if use test ; then
+ epatch "${WORKDIR}/regress.patch"
+ sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
+ -i src/test/regress/{input,output}/tablespace.source
+ else
+ echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+ fi
+
+ eautoconf
+}
+
+src_configure() {
+ # eval is needed to get along with pg_config quotation of space-rich entities.
+ eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+ --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
+ --with-libraries="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
+ --with-system-tzdata="${EROOT%/}/usr/share/zoneinfo" \
+ $(use_with perl) \
+ $(use_with python) \
+ $(use_with tcl) \
+ $(use_with xml libxml) \
+ $(use_with xml libxslt) \
+ $(use_with uuid ossp-uuid) \
+ "$(use_enable nls nls "$(wanted_languages)")"
+}
+
+src_compile() {
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2); do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake -C $bd -j1 || die "emake in $bd failed"
+ done
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
+ done
+
+ dodir /usr/share/postgresql-${SLOT}/man/man1/
+ cp "${S}"/doc/src/sgml/man1/{initdb,pg_controldata,pg_ctl,pg_resetxlog,post{gres,master}}.1 \
+ "${ED}"/usr/share/postgresql-${SLOT}/man/man1/ || die
+
+ dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+ dodir /etc/eselect/postgresql/slots/${SLOT}
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
+ > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
+
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}/postgresql.confd"
+ newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || die "Inserting conf.d file failed"
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}/postgresql.init"
+ newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || die "Inserting init.d file failed"
+
+ use pam && pamd_mimic system-auth postgresql auth account session
+
+ keepdir /var/run/postgresql
+ fperms 0770 /var/run/postgresql
+ use prefix || fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+ postgresql-config update
+
+ elog "The time stamp format is 64 bit integers now. If you upgrade from older"
+ elog "databases, this may force you to either do a dump and reload or enable"
+ elog "pg_legacytimestamp until you find time to do so. If the database cannot start"
+ elog "please try enabling pg_legacytimestamp and rebuild."
+ elog
+ elog "The Unix-domain socket is located in:"
+ elog " ${EROOT%/}/var/run/postgresql/"
+ elog
+ elog "If you have users and/or services that you would like to utilize the socket,"
+ elog "you must add them to the 'postgres' system group:"
+ elog " usermod -a -G postgres <user>"
+ elog
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
+ elog "it contains your preferred locale in:"
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ elog
+ elog "Then, execute the following command to setup the initial database"
+ elog "environment:"
+ elog " emerge --config =${CATEGORY}/${PF}"
+}
+
+pkg_postrm() {
+ postgresql-config update
+}
+
+pkg_config() {
+ [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
+ [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
+
+ # environment.bz2 may not contain the same locale as the current system
+ # locale. Unset and source from the current system locale.
+ if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
+ unset LANG
+ unset LC_CTYPE
+ unset LC_NUMERIC
+ unset LC_TIME
+ unset LC_COLLATE
+ unset LC_MONETARY
+ unset LC_MESSAGES
+ unset LC_ALL
+ source "${EROOT%/}/etc/env.d/02locale"
+ [[ -n ${LANG} ]] && export LANG
+ [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
+ [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
+ [[ -n ${LC_TIME} ]] && export LC_TIME
+ [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
+ [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
+ [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
+ [[ -n ${LC_ALL} ]] && export LC_ALL
+ fi
+
+ einfo "You can modify the paths and options passed to initdb by editing:"
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ einfo
+ einfo "Information on options that can be passed to initdb are found at:"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then
+ einfo " (none)"
+ else
+ einfo " ${PG_INITDB_OPTS}"
+ fi
+ einfo
+ einfo "Configuration files will be installed to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "The database cluster will be created in:"
+ einfo " ${DATA_DIR}"
+ einfo
+ while [[ $correct != "true" ]] ; do
+ einfo "Are you ready to continue? (y/n)"
+ read answer
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+ correct="true"
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+ die "Aborting initialization."
+ else
+ echo "Answer not recognized"
+ fi
+ done
+
+ if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
+ eerror "The given directory, '${DATA_DIR}', is not empty."
+ eerror "Modify DATA_DIR to point to an empty directory."
+ die "${DATA_DIR} is not empty."
+ fi
+
+ [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
+ einfo "Checking system parameters..."
+
+ if ! use kernel_linux ; then
+ einfo "Skipped."
+ einfo " Tests not supported on this OS (yet)"
+ else
+ if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+ local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+ local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+ local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+ local SHMMAX=$(sysctl -n kernel.shmmax)
+
+ local SEMMSL_MIN=17
+ local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+ local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+ local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+ for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+ if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
+ eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+ eerror "You have now several options:"
+ eerror " - Change the mentioned system parameter"
+ eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a"
+ eerror " value lower than ${PG_MAX_CONNECTIONS}"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+ eerror "More information can be found here:"
+ eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+ die "System test failed."
+ fi
+ done
+ einfo "Passed."
+ else
+ ewarn "SKIP_SYSTEM_TESTS set, so skipping."
+ fi
+ fi
+
+ if [[ ${EUID} == 0 ]] ; then
+ einfo "Creating the data directory ..."
+ mkdir -p "${DATA_DIR}"
+ chown -Rf postgres:postgres "${DATA_DIR}"
+ chmod 0700 "${DATA_DIR}"
+ fi
+
+ einfo "Initializing the database ..."
+
+ if [[ ${EUID} == 0 ]] ; then
+ su postgres \
+ -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D '${DATA_DIR}' -L '${EROOT%/}/usr/share/postgresql-${SLOT}/' ${PG_INITDB_OPTS}"
+ else
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb \
+ -U postgres -D "${DATA_DIR}" \
+ -L "${EROOT%/}/usr/share/postgresql-${SLOT}/" ${PG_INITDB_OPTS}
+ fi
+
+ mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
+
+ einfo "The autovacuum function, which was in contrib, has been moved to the main"
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
+ einfo "by default. You can disable it in the cluster's:"
+ einfo " ${PGDATA%/}/postgresql.conf"
+ einfo
+ einfo "The PostgreSQL server, by default, will log events to:"
+ einfo " ${DATA_DIR%/}/postmaster.log"
+ einfo
+ if use prefix ; then
+ einfo "The location of the configuration files have moved to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "To start the server:"
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
+ einfo
+ einfo "To stop:"
+ einfo " pg_ctl stop -D ${DATA_DIR}"
+ einfo
+ einfo "Or move the configuration files back:"
+ einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
+ else
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
+ einfo "instead of 'pg_ctl'."
+ fi
+}
+
+src_test() {
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+
+ if [[ ${UID} != 0 ]] ; then
+ emake check || die "Make check failed. See above for details."
+
+ einfo "If you think other tests besides the regression tests are necessary, please"
+ einfo "submit a bug including a patch for this ebuild to enable them."
+ else
+ ewarn "Tests cannot be run as root. Skipping."
+ ewarn "HINT: FEATURES=\"userpriv\""
+ fi
+}
diff --git a/dev-db/postgresql-server/postgresql-server-9.1_beta1-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.1_beta1-r1.ebuild
new file mode 100644
index 000000000000..c2fcf0fe720c
--- /dev/null
+++ b/dev-db/postgresql-server/postgresql-server-9.1_beta1-r1.ebuild
@@ -0,0 +1,318 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1_beta1-r1.ebuild,v 1.1 2011/05/20 09:54:56 titanofold Exp $
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+
+WANT_AUTOMAKE="none"
+inherit autotools eutils flag-o-matic multilib pam prefix python versionator
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris"
+
+# Upstream doesn't have an underscore in the file name
+MY_PV=${PV/_/}
+
+DESCRIPTION="PostgreSQL server"
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2
+ http://dev.gentoo.org/~titanofold/postgresql-patches-${MY_PV}.tbz2
+ http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
+LICENSE="POSTGRESQL"
+
+S="${WORKDIR}/postgresql-${MY_PV}"
+SLOT="$(get_version_component_range 1-2)"
+
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
+IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
+
+for lingua in ${LINGUAS}; do
+ IUSE+=" linguas_${lingua}"
+done
+
+wanted_languages() {
+ local enable_langs
+
+ for lingua in ${LINGUAS} ; do
+ use linguas_${lingua} && enable_langs+="${lingua} "
+ done
+
+ echo -n ${enable_langs}
+}
+
+RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
+ perl? ( >=dev-lang/perl-5.8 )
+ selinux? ( sec-policy/selinux-postgresql )
+ tcl? ( >=dev-lang/tcl-8 )
+ uuid? ( dev-libs/ossp-uuid )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ xml? ( dev-util/pkgconfig )"
+PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
+
+pkg_setup() {
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
+
+ use python && python_set_active_version 2
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/autoconf.patch" \
+ "${WORKDIR}/server.patch"
+ epatch "${FILESDIR}"/${PN}-9.0.4-bool.patch
+
+ eprefixify src/include/pg_config_manual.h
+
+ if use test ; then
+ epatch "${WORKDIR}/regress.patch"
+ sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
+ else
+ echo "all install:" > "${S}/src/test/regress/GNUmakefile"
+ fi
+
+ eautoconf
+}
+
+src_configure() {
+ case ${CHOST} in
+ *-darwin*|*-solaris*)
+ use nls && append-libs intl
+ ;;
+ esac
+ # eval is needed to get along with pg_config quotation of space-rich entities.
+ eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
+ $(use_with perl) \
+ $(use_with python) \
+ $(use_with tcl) \
+ $(use_with xml libxml) \
+ $(use_with xml libxslt) \
+ $(use_with uuid ossp-uuid) \
+ --with-system-tzdata="${EROOT%/}/usr/share/zoneinfo" \
+ --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
+ --with-libraries="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
+ "$(use_enable nls nls "$(wanted_languages)")"
+}
+
+src_compile() {
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2); do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake -C $bd -j1 || die "emake in $bd failed"
+ done
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ local bd
+ for bd in . contrib $(use xml && echo contrib/xml2) ; do
+ PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
+ emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
+ done
+
+ dodoc README HISTORY doc/{README.*,TODO,bug.template}
+
+ dodir /etc/eselect/postgresql/slots/${SLOT}
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
+
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
+ newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || die "Inserting conf failed"
+ sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
+ newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || die "Inserting conf failed"
+
+ use pam && pamd_mimic system-auth postgresql auth account session
+
+ keepdir /var/run/postgresql
+ fperms 0770 /var/run/postgresql
+ use prefix || fowners postgres:postgres /var/run/postgresql
+}
+
+pkg_postinst() {
+ postgresql-config update
+
+ elog "The Unix-domain socket is located in:"
+ elog " ${EROOT%/}/var/run/postgresql/"
+ elog
+ elog "If you have users and/or services that you would like to utilize the socket,"
+ elog "you must add them to the 'postgres' system group:"
+ elog " usermod -a -G postgres <user>"
+ elog
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
+ elog "it contains your preferred locale in:"
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ elog
+ elog "Then, execute the following command to setup the initial database"
+ elog "environment:"
+ elog " emerge --config =${CATEGORY}/${PF}"
+}
+
+pkg_postrm() {
+ postgresql-config update
+}
+
+pkg_config() {
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
+ [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
+
+ # environment.bz2 may not contain the same locale as the current system
+ # locale. Unset and source from the current system locale.
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
+ unset LANG
+ unset LC_CTYPE
+ unset LC_NUMERIC
+ unset LC_TIME
+ unset LC_COLLATE
+ unset LC_MONETARY
+ unset LC_MESSAGES
+ unset LC_ALL
+ source "${EROOT%/}/etc/env.d/02locale"
+ [ -n "${LANG}" ] && export LANG
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
+ [ -n "${LC_TIME}" ] && export LC_TIME
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
+ [ -n "${LC_ALL}" ] && export LC_ALL
+ fi
+
+ einfo "You can modify the paths and options passed to initdb by editing:"
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
+ einfo
+ einfo "Information on options that can be passed to initdb are found at:"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then
+ einfo " (none)"
+ else
+ einfo " ${PG_INITDB_OPTS}"
+ fi
+ einfo
+ einfo "Configuration files will be installed to:"
+ einfo " ${PGDATA}"
+ einfo
+ einfo "The database cluster will be created in:"
+ einfo " ${DATA_DIR}"
+ einfo
+ while [ "$correct" != "true" ] ; do
+ einfo "Are you ready to continue? (y/n)"
+ read answer
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
+ correct="true"
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
+ die "Aborting initialization."
+ else
+ echo "Answer not recognized"
+ fi
+ done
+
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
+ eerror "The given directory, '${DATA_DIR}', is not empty."
+ eerror "Modify DATA_DIR to point to an empty directory."
+ die "${DATA_DIR} is not empty."
+ fi
+
+ [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
+ einfo "Checking system parameters..."
+
+ if ! use kernel_linux ; then
+ einfo "Skipped."
+ einfo " Tests not supported on this OS (yet)"
+ else
+ if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
+
+ local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
+ local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
+ local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
+ local SHMMAX=$(sysctl -n kernel.shmmax)
+
+ local SEMMSL_MIN=17
+ local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
+ local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
+ local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
+
+ for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
+ if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
+ eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
+ eerror "You have now several options:"
+ eerror " - Change the mentioned system parameter"
+ eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
+ eerror " value lower than ${PG_MAX_CONNECTIONS}"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
+ eerror "More information can be found here:"
+ eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
+ die "System test failed."
+ fi
+ done
+ einfo "Passed."
+ else
+ ewarn "SKIP_SYSTEM_TESTS set, so skipping."
+ fi
+ fi
+
+ einfo "Creating the data directory ..."
+ if [[ ${EUID} == 0 ]] ; then
+ mkdir -p "${DATA_DIR}"
+ chown -Rf postgres:postgres "${DATA_DIR}"
+ chmod 0700 "${DATA_DIR}"
+ fi
+
+ einfo "Initializing the database ..."
+
+ if [[ ${EUID} == 0 ]] ; then
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
+ else
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
+ fi
+
+ mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
+
+ einfo "The autovacuum function, which was in contrib, has been moved to the main"
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
+ einfo "by default. You can disable it in the cluster's:"
+ einfo " ${PGDATA%/}/postgresql.conf"
+ einfo
+ einfo "The PostgreSQL server, by default, will log events to:"
+ einfo " ${DATA_DIR%/}/postmaster.log"
+ einfo
+ if use prefix ; then
+ einfo "The location of the configuration files have moved to:"
+ einfo " ${PGDATA}"
+ einfo "To start the server:"
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
+ einfo "To stop:"
+ einfo " pg_ctl stop -D ${DATA_DIR}"
+ einfo
+ einfo "Or move the configuration files back:"
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
+ else
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
+ einfo "instead of 'pg_ctl'."
+ fi
+}
+
+src_test() {
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+
+ if [ ${UID} -ne 0 ] ; then
+ emake -j1 check || die "Make check failed. See above for details."
+
+ einfo "If you think other tests besides the regression tests are necessary, please"
+ einfo "submit a bug including a patch for this ebuild to enable them."
+ else
+ ewarn "Tests cannot be run as root. Skipping."
+ ewarn "HINT: FEATURES=\"userpriv\""
+ fi
+}