annotate dev-db/postgresql-server/postgresql-server-9.0.2.ebuild @ 269:c982d5c6f5eb

bump postgres to 9.0.2
author holger
date Tue, 28 Dec 2010 21:29:38 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
269
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
1 # Copyright 1999-2010 Gentoo Foundation
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
2 # Distributed under the terms of the GNU General Public License v2
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
3 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.1.ebuild,v 1.1 2010/10/06 14:58:10 patrick Exp $
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
4
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
5 EAPI="2"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
6 PYTHON_DEPEND="python? 2"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
7
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
8 # weird test failures.
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
9 RESTRICT="test"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
10
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
11 WANT_AUTOMAKE="none"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
12 inherit autotools eutils multilib python versionator
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
13
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
14 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
15
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
16 DESCRIPTION="PostgreSQL server"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
17 HOMEPAGE="http://www.postgresql.org/"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
18
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
19 MY_PV=${PV/_/}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
20 SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
21 S=${WORKDIR}/postgresql-${MY_PV}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
22
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
23 LICENSE="POSTGRESQL"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
24 SLOT="$(get_version_component_range 1-2)"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
25 LINGUAS="af cs de es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
26 IUSE="doc kernel_linux nls perl pg_legacytimestamp python selinux tcl uuid xml"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
27
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
28 for lingua in ${LINGUAS}; do
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
29 IUSE+=" linguas_${lingua}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
30 done
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
31
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
32 wanted_languages() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
33 local enable_langs
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
34
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
35 for lingua in ${LINGUAS} ; do
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
36 use linguas_${lingua} && enable_langs+="${lingua} "
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
37 done
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
38
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
39 echo -n ${enable_langs}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
40 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
41
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
42 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pg_legacytimestamp=,nls=]
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
43 perl? ( >=dev-lang/perl-5.6.1-r2 )
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
44 python? ( dev-python/egenix-mx-base )
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
45 selinux? ( sec-policy/selinux-postgresql )
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
46 tcl? ( >=dev-lang/tcl-8 )
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
47 uuid? ( dev-libs/ossp-uuid )
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
48 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
49 DEPEND="${RDEPEND}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
50 sys-devel/flex
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
51 xml? ( dev-util/pkgconfig )"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
52 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
53
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
54 pkg_setup() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
55 enewgroup postgres 70
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
56 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
57
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
58 if use python; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
59 python_set_active_version 2
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
60 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
61 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
62
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
63 src_prepare() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
64 epatch "${FILESDIR}/postgresql-${SLOT}-common.3.patch" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
65 "${FILESDIR}/postgresql-${SLOT}-server.3.patch"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
66
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
67 if use test; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
68 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
69 else
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
70 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
71 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
72
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
73 eautoconf
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
74 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
75
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
76 src_configure() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
77 # eval is needed to get along with pg_config quotation of space-rich entities.
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
78 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
79 --disable-thread-safety \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
80 $(use_with perl) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
81 $(use_with python) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
82 $(use_with tcl) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
83 $(use_with xml libxml) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
84 $(use_with xml libxslt) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
85 $(use_with uuid ossp-uuid) \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
86 --with-system-tzdata="/usr/share/zoneinfo" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
87 --with-includes="/usr/include/postgresql-${SLOT}/" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
88 --with-libraries="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
89 "$(use_enable nls nls "$(wanted_languages)")"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
90 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
91
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
92 src_compile() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
93 local bd
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
94 for bd in . contrib $(use xml && echo contrib/xml2); do
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
95 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
96 emake -C $bd -j1 || die "emake in $bd failed"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
97 done
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
98 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
99
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
100 src_install() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
101 if use perl ; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
102 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
103 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
104 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
105 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
106
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
107 for bd in . contrib $(use xml && echo contrib/xml2) ; do
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
108 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
109 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
110 done
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
111
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
112 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
113 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
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
114
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
115 dodoc README HISTORY doc/{README.*,TODO,bug.template}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
116
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
117 dodir /etc/eselect/postgresql/slots/${SLOT}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
118 cat > "${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
119 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
120 postgres_service="postgresql-${SLOT}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
121 __EOF__
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
122
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
123 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
124 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
125
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
126 keepdir /var/run/postgresql
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
127 fperms 0770 /var/run/postgresql
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
128 fowners postgres:postgres /var/run/postgresql
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
129 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
130
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
131 pkg_postinst() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
132 eselect postgresql update
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
133 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
134 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
135
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
136 ewarn "Please note that the standard location of the socket has changed from /tmp to"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
137 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
138 ewarn "socket. This can break applications which have the standard location"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
139 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
140 ewarn "it. If that doesn't help or the application accesses the socket without using"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
141 ewarn "libpq, please file a bug-report."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
142 ewarn
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
143 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
144 ewarn "original location."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
145 ewarn
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
146
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
147 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
148 elog "contains your preferred locale and character encoding in:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
149 elog
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
150 elog " /etc/conf.d/postgresql-${SLOT}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
151 elog
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
152 elog "Then, execute the following command to setup the initial database environment:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
153 elog
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
154 elog " emerge --config =${CATEGORY}/${PF}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
155 elog
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
156 elog "The autovacuum function, which was in contrib, has been moved to the main"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
157 elog "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
158 elog "default. You can disable it in the cluster's postgresql.conf."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
159 elog
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
160 elog "The timestamp format is 64 bit integers now. If you upgrade from older"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
161 elog "databases, this may force you to either do a dump and reload or enable"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
162 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
163 elog "please try enabling pg_legacytimestamp and rebuild."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
164 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
165
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
166 pkg_postrm() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
167 eselect postgresql update
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
168 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
169
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
170 pkg_config() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
171 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
172 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
173
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
174 # environment.bz2 may not contain the same locale as the current system
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
175 # locale. Unset and source from the current system locale.
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
176 if [ -f /etc/env.d/02locale ]; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
177 unset LANG
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
178 unset LC_CTYPE
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
179 unset LC_NUMERIC
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
180 unset LC_TIME
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
181 unset LC_COLLATE
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
182 unset LC_MONETARY
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
183 unset LC_MESSAGES
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
184 unset LC_ALL
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
185 source /etc/env.d/02locale
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
186 [ -n "${LANG}" ] && export LANG
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
187 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
188 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
189 [ -n "${LC_TIME}" ] && export LC_TIME
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
190 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
191 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
192 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
193 [ -n "${LC_ALL}" ] && export LC_ALL
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
194 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
195
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
196 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
197 einfo "More information can be found here:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
198 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
199 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
200 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
201 einfo "variable."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
202 einfo
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
203 einfo "You can change the directory where the database cluster is being created by"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
204 einfo "setting the PGDATA variable."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
205 einfo
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
206 einfo "PG_INITDB_OPTS is currently set to:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
207 einfo " \"${PG_INITDB_OPTS}\""
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
208 einfo "and the database cluster will be created in:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
209 einfo " \"${PGDATA}\""
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
210 einfo "Are you ready to continue? (Y/n)"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
211 read answer
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
212 [ -z $answer ] && answer=Y
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
213 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
214
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
215 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
216 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
217 die "cluster already exists"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
218 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
219
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
220 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
221 einfo "Checking system parameters..."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
222
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
223 if ! use kernel_linux ; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
224 SKIP_SYSTEM_TESTS=yes
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
225 einfo " Tests not supported on this OS (yet)"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
226 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
227
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
228 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
229 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
230
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
231 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
232 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
233 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
234 local SHMMAX=$(sysctl -n kernel.shmmax)
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
235
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
236 local SEMMSL_MIN=17
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
237 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
238 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
239 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
240
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
241 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
242 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
243 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
244 eerror "You have now several options:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
245 eerror " - Change the mentioned system parameter"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
246 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
247 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
248 eerror "More information can be found here:"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
249 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
250 die "System test failed."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
251 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
252 done
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
253 einfo "Passed."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
254 else
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
255 einfo "Skipped."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
256 fi
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
257
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
258 einfo "Creating the data directory ..."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
259 mkdir -p "${PGDATA}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
260 chown -Rf postgres:postgres "${PGDATA}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
261 chmod 0700 "${PGDATA}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
262
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
263 einfo "Initializing the database ..."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
264
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
265 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
266
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
267 einfo
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
268 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
269 einfo "instead of 'pg_ctl'."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
270 einfo
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
271 }
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
272
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
273 src_test() {
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
274 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
275 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
276 emake -j1 check || die "Make check failed. See above for details."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
277
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
278 einfo "Yes, there are other tests which could be run."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
279 einfo "... and no, we don't plan to add/support them."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
280 einfo "For now, the main regressions tests will suffice. If you think other tests are"
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
281 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
c982d5c6f5eb bump postgres to 9.0.2
holger
parents:
diff changeset
282 }