annotate dev-db/postgresql-server/postgresql-server-8.4.1.ebuild @ 166:aec49d51a27b

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