annotate dev-db/postgresql-server/postgresql-server-8.4.0.ebuild @ 149:0f0eee037856

zeromq-1.0.0 is final
author holger
date Mon, 20 Jul 2009 00:12:50 +0200
parents fb0267e87240
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
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
84 for bd in . contrib $(use xml && echo contrib/xml2); do
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
85 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
86 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
87 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
88 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
89 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
90 done
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
91 }
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
92
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
93 src_install() {
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
94 if use perl ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
95 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
96 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
97 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
98 fi
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
99
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
100 for bd in . contrib $(use xml && echo contrib/xml2) ; do
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
101 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
102 emake install -C $bd -j1 DESTDIR="${D}" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
103 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
104 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
105 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
106 done
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
107
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
108 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
fb0267e87240 new import of postgres-8.4.0
holger
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
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
110
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
111 dodoc README HISTORY doc/{README.*,TODO,bug.template}
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 dodir /etc/eselect/postgresql/slots/${SLOT}
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
114 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
115 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
116 postgres_service="postgresql-${SLOT}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
117 __EOF__
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
118
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
119 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
120 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
121
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
122 keepdir /var/run/postgresql
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
123 fperms 0770 /var/run/postgresql
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
124 fowners postgres:postgres /var/run/postgresql
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
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
127 pkg_postinst() {
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
128 eselect postgresql update
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
129 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
130 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
131
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
132 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
133 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
134 ewarn "the socket."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
135 ewarn "This can break applications which have the standard location hard-coded."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
136 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
137 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
138 ewarn "please file a bug-report."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
139 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
140
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
141 elog "Execute the following command to setup the initial database environment:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
142 elog
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
143 elog "emerge --config =${CATEGORY}/${PF}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
144 elog
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
145 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
146 elog "PostgreSQL functions starting with 8.1."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
147 elog "You can enable it in the clusters postgresql.conf."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
148 }
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
149
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
150 pkg_postrm() {
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
151 eselect postgresql update
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
152 }
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
153
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
154 pkg_config() {
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
155 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
156
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
157 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
158 einfo "More information can be found here:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
159 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
160 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
161 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
162 einfo
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
163 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
164 einfo "the PGDATA variable."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
165 einfo
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
166 einfo "PG_INITDB_OPTS is currently set to:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
167 einfo " \"${PG_INITDB_OPTS}\""
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
168 einfo "and the database cluster will be created in:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
169 einfo " \"${PGDATA}\""
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
170 einfo "Are you ready to continue? (Y/n)"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
171 read answer
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
172 [ -z $answer ] && answer=Y
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
173 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
174
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
175 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
176 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
177 die "cluster already exists"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
178 fi
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
179
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
180 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
181 einfo "Checking system parameters..."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
182
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
183 if ! use kernel_linux ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
184 SKIP_SYSTEM_TESTS=yes
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
185 einfo " Tests not supported on this OS (yet)"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
186 fi
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
187
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
188 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
189 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
190
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
191 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
192 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
193 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
194 local SHMMAX=$(sysctl -n kernel.shmmax)
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
195
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
196 local SEMMSL_MIN=17
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
197 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
198 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
199 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
200
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
201 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
202 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
203 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
204 eerror "You have now several options:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
205 eerror " - Change the mentioned system parameter"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
206 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
207 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
208 eerror "More information can be found here:"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
209 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
210 die "system test failed"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
211 fi
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
212 done
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
213 einfo "Passed."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
214 else
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
215 einfo "Skipped."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
216 fi
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
217
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
218 einfo "Creating the data directory ..."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
219 mkdir -p "${PGDATA}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
220 chown -Rf postgres:postgres "${PGDATA}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
221 chmod 0700 "${PGDATA}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
222
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
223 einfo "Initializing the database ..."
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 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
226
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
227 einfo
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
228 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
229 einfo
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 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
232 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
233 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
234 fi
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
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
237 src_test() {
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
238 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
239 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
240 emake -j1 check \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
241 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
242 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
243
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
244 einfo "Yes, there are other tests which could be run."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
245 einfo "... and no, we don't plan to add/support them."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
246 einfo "For now, the main regressions tests will suffice."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
247 einfo "If you think other tests are necessary, please submit a"
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
248 einfo "bug including a patch for this ebuild to enable them."
fb0267e87240 new import of postgres-8.4.0
holger
parents:
diff changeset
249 }