annotate dev-db/postgresql-server/postgresql-server-8.3.7.ebuild @ 120:17e88fb0f6f2

fix pgpool shutdown
author holger@hoho.dyndns.org
date Fri, 20 Mar 2009 12:50:28 +0100
parents fc14e6182db4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
103
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
1 # Copyright 1999-2008 Gentoo Foundation
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
2 # Distributed under the terms of the GNU General Public License v2
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
3 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.5.ebuild,v 1.1 2008/12/03 19:27:06 caleb Exp $
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
4
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
5 EAPI="1"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
6
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
7 WANT_AUTOCONF="latest"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
8 WANT_AUTOMAKE="none"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
9 inherit eutils multilib toolchain-funcs versionator autotools
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
10
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
11 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
12
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
13 DESCRIPTION="PostgreSQL server"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
14 HOMEPAGE="http://www.postgresql.org/"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
15 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
16 LICENSE="POSTGRESQL"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
17 SLOT="$(get_version_component_range 1-2)"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
18 IUSE_LINGUAS="
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
19 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
20 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
21 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
22 linguas_tr linguas_zh_CN linguas_zh_TW"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
23 IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
24
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
25 wanted_languages() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
26 for u in ${IUSE_LINGUAS} ; do
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
27 use $u && echo -n "${u#linguas_} "
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
28 done
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
29 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
30
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
31 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
32 perl? ( >=dev-lang/perl-5.6.1-r2 )
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
33 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
34 selinux? ( sec-policy/selinux-postgresql )
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
35 tcl? ( >=dev-lang/tcl-8 )
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
36 uuid? ( dev-libs/ossp-uuid )
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
37 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
38 DEPEND="${RDEPEND}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
39 sys-devel/flex
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
40 xml? ( dev-util/pkgconfig )"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
41 PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
42
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
43 S="${WORKDIR}/postgresql-${PV}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
44
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
45 pkg_setup() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
46 enewgroup postgres 70
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
47 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
48 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
49
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
50 src_unpack() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
51 unpack ${A}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
52 cd "${S}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
53
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
54 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
55 "${FILESDIR}/postgresql-${SLOT}-server.patch"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
56
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
57 if hasq test ${FEATURES}; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
58 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
59 else
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
60 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
61 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
62
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
63 eautoconf
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
64 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
65
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
66 src_compile() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
67 # TODO: test if PPC really cannot work with other CFLAGS settings
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
68 # use ppc && CFLAGS="-pipe -fsigned-char"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
69
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
70 # eval is needed to get along with pg_config quotation of space-rich entities.
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
71 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
72 --disable-thread-safety \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
73 $(use_with perl) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
74 $(use_with python) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
75 $(use_with tcl) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
76 $(use_with xml libxml) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
77 $(use_with xml libxslt) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
78 $(use_with uuid ossp-uuid) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
79 --with-system-tzdata="/usr/share/zoneinfo" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
80 --with-includes="/usr/include/postgresql-${SLOT}/" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
81 "$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
82 || die "configure failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
83
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
84 for bd in . contrib $(use xml && echo contrib/xml2); do
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
85 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
86 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
87 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
88 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
89 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
90 done
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
91 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
92
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
93 src_install() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
94 if use perl ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
95 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
96 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
97 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
98 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
99
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
100 for bd in . contrib $(use xml && echo contrib/xml2) ; do
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
101 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
102 emake install -C $bd -j1 DESTDIR="${D}" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
103 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
104 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
105 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
106 done
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
107
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
108 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
109 rm "${D}"/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
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
110
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
111 dodoc README HISTORY doc/{README.*,TODO,bug.template}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
112
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
113 dodir /etc/eselect/postgresql/slots/${SLOT}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
114 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
115 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
116 postgres_service="postgresql-${SLOT}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
117 __EOF__
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
118
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
119 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
120 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
121
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
122 keepdir /var/run/postgresql
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
123 fperms 0770 /var/run/postgresql
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
124 fowners postgres:postgres /var/run/postgresql
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
125 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
126
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
127 pkg_postinst() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
128 eselect postgresql update
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
129 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
130 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
131
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
132 ewarn "Please note that the standard location of the socket has changed from /tmp"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
133 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
134 ewarn "the socket."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
135 ewarn "This can break applications which have the standard location hard-coded."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
136 ewarn "If such an application links against the libpq, please re-emerge it,"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
137 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
138 ewarn "please file a bug-report."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
139 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
140
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
141 elog "Execute the following command to setup the initial database environment:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
142 elog
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
143 elog "emerge --config =${CATEGORY}/${PF}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
144 elog
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
145 elog "The autovacuum function, which was in contrib, has been moved to the main"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
146 elog "PostgreSQL functions starting with 8.1."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
147 elog "You can enable it in the clusters postgresql.conf."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
148 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
149
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
150 pkg_postrm() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
151 eselect postgresql update
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
152 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
153
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
154 pkg_config() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
155 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
156
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
157 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
158 einfo "More information can be found here:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
159 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
160 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
161 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
162 einfo
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
163 einfo "You can change the directory where the database cluster is being created by setting"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
164 einfo "the PGDATA variable."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
165 einfo
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
166 einfo "PG_INITDB_OPTS is currently set to:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
167 einfo " \"${PG_INITDB_OPTS}\""
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
168 einfo "and the database cluster will be created in:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
169 einfo " \"${PGDATA}\""
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
170 einfo "Are you ready to continue? (Y/n)"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
171 read answer
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
172 [ -z $answer ] && answer=Y
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
173 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
174
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
175 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
176 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
177 die "cluster already exists"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
178 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
179
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
180 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
181 einfo "Checking system parameters..."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
182
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
183 if ! use kernel_linux ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
184 SKIP_SYSTEM_TESTS=yes
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
185 einfo " Tests not supported on this OS (yet)"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
186 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
187
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
188 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
189 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
190
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
191 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
192 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
193 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
194 local SHMMAX=$(sysctl -n kernel.shmmax)
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
195
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
196 local SEMMSL_MIN=17
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
197 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
198 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
199 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
200
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
201 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
202 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
203 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
204 eerror "You have now several options:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
205 eerror " - Change the mentioned system parameter"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
206 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
207 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
208 eerror "More information can be found here:"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
209 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
210 die "system test failed"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
211 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
212 done
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
213 einfo "Passed."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
214 else
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
215 einfo "Skipped."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
216 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
217
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
218 einfo "Creating the data directory ..."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
219 mkdir -p "${PGDATA}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
220 chown -Rf postgres:postgres "${PGDATA}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
221 chmod 0700 "${PGDATA}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
222
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
223 einfo "Initializing the database ..."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
224
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
225 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
226
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
227 einfo
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
228 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
229 einfo
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
230
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
231 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
232 ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
233 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
234 fi
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
235 }
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
236
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
237 src_test() {
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
238 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
239 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
240 emake -j1 check \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
241 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
242 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
243
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
244 einfo "Yes, there are other tests which could be run."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
245 einfo "... and no, we don't plan to add/support them."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
246 einfo "For now, the main regressions tests will suffice."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
247 einfo "If you think other tests are necessary, please submit a"
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
248 einfo "bug including a patch for this ebuild to enable them."
17d134ab73d6 bump postgres to 8.3.6
holger@hoho.dyndns.org
parents:
diff changeset
249 }