ChangeLog

# ChangeLog for dev-db/postgresql-server
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.8 2008/06/14 11:49:54 dev-zero Exp $

*postgresql-server-8.3.3 (14 Jun 2008)
*postgresql-server-8.2.9 (14 Jun 2008)
*postgresql-server-8.1.13 (14 Jun 2008)
*postgresql-server-8.0.17 (14 Jun 2008)
*postgresql-server-7.4.21 (14 Jun 2008)

14 Jun 2008; Tiziano Müller
+files/postgresql-7.4.21-autoconf.patch,
+files/postgresql-8.0.15-common.patch, files/postgresql-8.0-common.patch,
+files/postgresql-8.3.1-server.patch, files/postgresql-8.3-server.patch,
+postgresql-server-7.4.21.ebuild, postgresql-server-8.0.15.ebuild,
+postgresql-server-8.0.17.ebuild, +postgresql-server-8.1.13.ebuild,
postgresql-server-8.2.7.ebuild, +postgresql-server-8.2.9.ebuild,
postgresql-server-8.3.1.ebuild, +postgresql-server-8.3.3.ebuild:
Changed home-path for the postgresql from /var/lib to /var/lib/postgresql
(bug #177085). Fixed elog for the location of postgresql.conf (bug
#194701). Change to not install the html-docs since they're provided by
postgresql-docs (bug #225629).

04 Jun 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.7.ebuild, postgresql-server-8.3.1.ebuild:
Added sys-devel/flex as a dependency (bug #221375 thanks to Flameeyes)

04 Jun 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.7.ebuild, postgresql-server-8.3.1.ebuild:
Fixed bug #223189 (thanks to Jose Quinteiro)

20 May 2008; Tiziano Müller
files/postgresql-8.3-server.patch:
Updated patch to directly define -lossp-uuid in contrib/uuid/Makefile
since Makefile.global installed by postgresql-base defines it as empty
(bug #219232)

19 May 2008; Tiziano Müller
postgresql-server-8.3.1.ebuild:
Keyworded for all archs having postgresql keyworded and have ossp-uuid
keyworded

13 May 2008; Tiziano Müller
files/postgresql.init-7.3, files/postgresql.init-7.4,
files/postgresql.init-8.0, files/postgresql.init-8.1,
files/postgresql.init-8.2, files/postgresql.init-8.3:
Added workaround to init.d-files to correctly detect an already running
server...

19 Apr 2008; Tiziano Müller
files/postgresql.init-7.3, files/postgresql.init-7.4,
files/postgresql.init-8.0, files/postgresql.init-8.1,
files/postgresql.init-8.2, files/postgresql.init-8.3,
files/postgresql-8.3-server.patch:
Updated patch for 8.3 (accidentally disabled tsearch2, thanks to Elvis
Pranskevichus). Corrected a bug in init.d scripts.

*postgresql-server-8.3.1 (15 Apr 2008)
*postgresql-server-8.2.7 (15 Apr 2008)
*postgresql-server-8.1.11 (15 Apr 2008)
*postgresql-server-8.0.15 (15 Apr 2008)
*postgresql-server-7.4.19 (15 Apr 2008)
*postgresql-server-7.3.21 (15 Apr 2008)

15 Apr 2008; Tiziano Müller
+files/postgresql.conf-7.3, +files/postgresql.init-7.3,
+files/postgresql-7.3.21-autoconf.patch,
+files/postgresql-7.3-cubeparse.patch,
+files/postgresql-7.3-regress.patch, +files/postgresql-7.3-server.patch,
+files/postgresql.conf-7.4, +files/postgresql.init-7.4,
+files/postgresql-7.4.19-autoconf.patch,
+files/postgresql-7.4-regress.patch, +files/postgresql-7.4-server.patch,
+files/postgresql-7.4-vacuum-delay.patch, +files/postgresql.conf-8.0,
+files/postgresql.init-8.0, +files/postgresql-8.0-common.patch,
+files/postgresql-8.0-server.patch, +files/postgresql.conf-8.1,
+files/postgresql.init-8.1, +files/postgresql-8.1-common.patch,
+files/postgresql-8.1-server.patch, +files/postgresql.conf-8.2,
+files/postgresql.init-8.2, +files/postgresql-8.2-common.patch,
+files/postgresql-8.2-server.patch, +files/postgresql.conf-8.3,
+files/postgresql.init-8.3, +files/postgresql-8.3-common.patch,
+files/postgresql-8.3-server.patch, +metadata.xml,
+postgresql-server-7.3.21.ebuild, +postgresql-server-7.4.19.ebuild,
+postgresql-server-8.0.15.ebuild, +postgresql-server-8.1.11.ebuild,
+postgresql-server-8.2.7.ebuild, +postgresql-server-8.3.1.ebuild:
Moved into the tree. Thanks to Michael Krelin (polyonymous).

10 Apr 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.7.ebuild, postgresql-server-8.3.1.ebuild:
slot-files should be kept in /etc/eselect/postgresql/slots as from now.
Added workaround for paludis for /var/run/postgresql/.keep collision.

07 Apr 2008; Tiziano Müller
postgresql-server-8.3.1.ebuild:
Re-added keywords ~alpha ~hppa ~ia64 ~ppc64 ~sparc (since ossp-uuid has been
keyworded).

07 Apr 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.7.ebuild, postgresql-server-8.3.1.ebuild:
Removed pkg_setup check whether there's an older database cluster installed
because it's pointless now that we have slotting available. Added some more
einfo/ewarns to inform the user how to change the database cluster location.

07 Apr 2008; Tiziano Müller
files/postgresql.conf-7.3, postgresql-server-7.3.21.ebuild,
files/postgresql-7.3-server.patch, files/postgresql.conf-7.4,
postgresql-server-7.4.19.ebuild, files/postgresql-7.4-server.patch,
files/postgresql.conf-8.0, postgresql-server-8.0.15.ebuild,
files/postgresql-8.0-server.patch, files/postgresql.conf-8.1,
postgresql-server-8.1.11.ebuild, files/postgresql-8.1-server.patch,
files/postgresql.conf-8.2, postgresql-server-8.2.7.ebuild,
files/postgresql-8.2-server.patch, files/postgresql.conf-8.3,
postgresql-server-8.3.1.ebuild, files/postgresql-8.3-server.patch:
Removed old digest files. Refactored pkg_config: It now asks the user to
continue and the tests are much saner. Changed the default sockets directory
from /tmp to /var/run/postgresql and added warning for it.

30 Mar 2008; Tiziano Müller
files/postgresql.init-7.3, files/postgresql.conf-7.3,
files/postgresql.init-7.4, files/postgresql.conf-7.4,
files/postgresql.init-8.0, files/postgresql.conf-8.0,
files/postgresql.init-8.1, files/postgresql.conf-8.1,
files/postgresql.init-8.2, files/postgresql.conf-8.2,
files/postgresql.init-8.3, files/postgresql.conf-8.3:
Changed init.d/conf.d scripts to wait until the server started up/shut down
completely. WAIT_FOR_{DISCONNET,CLEANUP,QUIT} should now work independently
of the baselayout-version.

29 Mar 2008; Tiziano Müller
postgresql-server-8.3.1.ebuild, files/postgresql-8.3-server.patch:
Added uuid USE-flag, dependency and modified patch. Had to drop all keywords
besides ~amd64 and ~x86.

27 Mar 2008; Tiziano Müller
postgresql-server-8.3.1.ebuild:
Will now use system's zoneinfo. Added $(use_with xml libxslt).

19 Mar 2008; Tiziano Müller
-postgresql-server-8.2.6.ebuild, +postgresql-server-8.2.7.ebuild,
-postgresql-server-8.3.0.ebuild, +postgresql-server-8.3.1.ebuild:
Version bump.

15 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
files/postgresql-7.4-server.patch, postgresql-server-8.0.15.ebuild,
postgresql-server-8.1.11.ebuild, postgresql-server-8.2.6.ebuild,
postgresql-server-8.3.0.ebuild:
Fixed the patch for 7.4 (accidentally removed pgtcl-support even if
specified. Removed the 'test' USE flag. Removed stalled gnuconfig
inheritance. Added -lpq to the LIBS list for 7.4 since it doesn't build
otherwise.

11 Mar 2008; Tiziano Müller
postgresql-server-8.0.15.ebuild, files/postgresql-8.3-server.patch:
Removed oid2name since installed by postgresql-base.

10 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild:
Disabled horology test since it's too unreliable.

10 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild:
Removed unused sed.

10 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, files/postgresql-7.3-regress.patch,
postgresql-server-7.4.19.ebuild, files/postgresql-7.4-regress.patch,
postgresql-server-8.0.15.ebuild, files/postgresql-8.0-server.patch,
postgresql-server-8.1.11.ebuild, files/postgresql-8.1-server.patch,
postgresql-server-8.2.6.ebuild, files/postgresql-8.2-server.patch,
postgresql-server-8.3.0.ebuild, files/postgresql-8.3-server.patch:
A lot of /usr/lib -> /usr/ fixes. Removed chown and 'su -' lines from the
patches since it makes tests fail when using paludis and a sane workaround
is not possible atm.

10 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild:
Changed some more dependencies on postgresql-libs to postgresql-base

10 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.6.ebuild, postgresql-server-8.3.0.ebuild,
+metadata.xml:
Changed dependency in 7.3 for new postgresql-base package. Added metadata.xml.

07 Mar 2008; Tiziano Müller
postgresql-server-7.3.21.ebuild, postgresql-server-7.4.19.ebuild,
postgresql-server-8.0.15.ebuild, postgresql-server-8.1.11.ebuild,
postgresql-server-8.2.6.ebuild, -postgresql-server-8.3_rc1.ebuild,
+postgresql-server-8.3.0.ebuild:
Version bump to final 8.3.0. Changed dependencies to match postgresql-base
(will likely break people's update scripts since we now block libpq.
Transition will be: 1.put virtual/postgresql-{server,base} in the tree and
let them depend on ||(dev-db/libpq dev-db/postgresql-libs) (respective
dev-db/postgresql and postgresql-server), 2. change all ebuilds in the tree
to depend on virtual/..., 3. people only have to unmerge libpq and
postgresql and merge dev-db/postgresql-{base,server} with _no_
revdep-rebuild run needed.

20 Mar 2007; Tiziano Müller
postgresql-server-7.3.18.ebuild, postgresql-server-7.4.16.ebuild,
postgresql-server-8.0.12.ebuild, postgresql-server-8.1.8.ebuild,
postgresql-server-8.2.3.ebuild:
Added postgresql-docs dependency via doc-USE-flag in PDEPEND.

Manifest

AUX postgresql-7.3-cubeparse.patch 1296 RMD160 9b9c0fcf4d58fb989ae77d9ada4588b1876400a6 SHA1 c128746e9938d7aaa4f2be6521530d07c7e207a8 SHA256 1844950b55509b83f38bfdd113350df7422f96ca4c773def6d38ca2f48fcfada
AUX postgresql-7.3-regress.patch 3294 RMD160 babb74fa25f69bdc5b7a31fc590cc9b8c56b6cb8 SHA1 32be69b830f7fb93b39bba085a240a57b63ce16a SHA256 89f552ebe592677887c086b92c16104b7db47839ad889c3f91546191005d1016
AUX postgresql-7.3-server.patch 2773 RMD160 14db25b2a9f20b6f1e6c87b2aea1879b3c9873f9 SHA1 605a4efee3a05922a4387206f807c68c2625aa9c SHA256 b963985a5c6fadbb79b359549d482ebd108008eaf1755fbc29ff500bd9677b2f
AUX postgresql-7.3.21-autoconf.patch 2141 RMD160 3bff01abeeeb094f04469960d4725c977657fb1c SHA1 aceb7ebafde14fde0efe6eefc68115fd8b4cb95a SHA256 9444af9ac2908f18fc69ef2db6fe78584384a46d28dd4c8af10740f9138796a8
AUX postgresql-7.4-regress.patch 3337 RMD160 dcd1eef99595c5ae070a6778179a1b4611810ad8 SHA1 b58a22970ff3f6c489e55fa6fc1f2a5ba27f1aec SHA256 0679c01c80b0a789789cc5e4b0317e3d8e1ec4acdbe1bd42b63eab37097fa872
AUX postgresql-7.4-server.patch 2811 RMD160 07a11c84497d7ddeaac1266821d2dd4a75f2ea01 SHA1 3d09b0cdffdddd93de0b97b626fc91772342f640 SHA256 d31c37a7821421e289e0dcc57b743e219fe97745053a2750703647f4e2a4bd5c
AUX postgresql-7.4-vacuum-delay.patch 8918 RMD160 dcd4fc4774277b0bf4a2158584c18bae2dc04232 SHA1 fe701fd6ca6cc9519417ab1053ef61a50ca51281 SHA256 7112ea61b84ce5c6974cd74687039f2ef871e0b4b25a34b4394225c2695fc123
AUX postgresql-7.4.19-autoconf.patch 1870 RMD160 92e49d3bc82ebfce6c798b4d56008da5c8f46d33 SHA1 a42d03a9c4d7b5df7a69a3d23c9e527c6d901eba SHA256 dccd9553b9cfdc88ffe98e445e27d1714426b4f1e6f405af438243ba06b93b6e
AUX postgresql-7.4.21-autoconf.patch 1870 RMD160 24606231223419721fa9ee6844c685368564f20c SHA1 50577930b75b4690c510132cce00475d4f3a13ab SHA256 e943c4ef9cb14fa064879c273ef5a064b5ce01b1d6af36057f0807d52eec0396
AUX postgresql-8.0-common.patch 2294 RMD160 bbf24d2f0278618ec8a0eafbcbc1787adf4ff343 SHA1 5e421092c2cb12c1bd1f9639bd1a9bf1120d1ab0 SHA256 53069c1e90fd3ca37704183417e9240eae805aa3ad44533fd83b24640c7765fd
AUX postgresql-8.0-server.patch 6918 RMD160 de96cda82597098fbfb595fac5069164d7e4f30e SHA1 9f5b5e3bff058f75fe5e25e968e96c1c0147cc43 SHA256 5d8ff711ec83eb8660edc129519bd67ae76553fca22ced379439d31938173346
AUX postgresql-8.0.15-common.patch 2294 RMD160 4f0028f6b5e95d74328f2c3981aa558420739181 SHA1 be649bf09bd5082e6e2af58c44cc470456e37780 SHA256 eca25d56bd157a3a7883d4c4305e4e0b7d22b8dd0cbca93da88add24da28b681
AUX postgresql-8.1-common.patch 2290 RMD160 ba1f803b045a8d3f430231b0c22b8817e2eb8cf6 SHA1 facf27b2c396fe9f2347eb4cec3b2714a8587b70 SHA256 f80c8dd5a31b88df330c15de4331db1600ae078a789650ab28d61620f27056f5
AUX postgresql-8.1-server.patch 6862 RMD160 94dc4c22f1f480bf5844f6e654d8a4e0534059eb SHA1 8fbf5d0b4d24b675f6812ff89465527263f51012 SHA256 97f3b3d889af08aeb92e6583dd970763cdc662621e34e13a5298fe9cd5ad4b4d
AUX postgresql-8.2-common.patch 2640 RMD160 b25ba915d5d6ad9c12c1d51426363c196b830923 SHA1 7b946d57bfed34e2e7e1338c3ab3004341d7ab12 SHA256 36ca9cb4f26424c302fdd704b7c1a268e87612afa3006bf008d4594dabe080f8
AUX postgresql-8.2-server.patch 5319 RMD160 9aae5832defd2e43879246e773fd1aada0680716 SHA1 ea726704fc85118c27f511bfd9324b136ced3eb1 SHA256 2687fa5159a34da59e36af4c894f43b2136e8e88c965a682607cb48acb61d8ee
AUX postgresql-8.3-common.patch 2641 RMD160 0822bf1512457e91d5f32f9d192de6f197db9c55 SHA1 e4bdbd5eee1023e8f0b42ef408b34b57495d1e2b SHA256 e416c26d9c3d266b306ddbc0a2b648054739b7ace35e2b4e449fbdaf094bc197
AUX postgresql-8.3-server.patch 66296 RMD160 6acd5dec3b411d0439bab47a344406df25c08b7a SHA1 fca417c169d5de6c2ea036ab80a4ce02665ae881 SHA256 74684e07df2ff15f3c10d4f586cd72fba51c996ab9a97b6aee11f79987fc4de6
AUX postgresql-8.3.1-server.patch 6823 RMD160 f9dcc246eca1251526b94aa81fc8f3d5a02c3b76 SHA1 7ae8c9764d662364392d98f686060e22da2dfa46 SHA256 0e3684ce6bb03f860501819985a295d72c7579e1e94ddd1239086a38c0f4a105
AUX postgresql.conf-7.3 1532 RMD160 fa088eb5742efbce852d6dcff1dba420857aa67e SHA1 22ac6f3632d6baa1a97017f27001951ccf6a224c SHA256 c0e2ae8c22895bde591302234735ceaddcf4c2a4b1e17ed8cee53b66dad32a24
AUX postgresql.conf-7.4 1532 RMD160 8897005145112dc1782174fcac512531a32ce88a SHA1 f7e1e1c6cac39d1c7ecc371c9391214d6a8c8055 SHA256 4084c99ad0fff027876c82375c4d99d1669090398137ef5ed19c8e74cecb6e0c
AUX postgresql.conf-8.0 1532 RMD160 de03805c18ac079b830bcc412c838eb67cbf4f2b SHA1 a7e288d80b0fd24ddf55bdd560f1e8b216b1f540 SHA256 471cd40a0f9100789d238722e5e5efb923dd4f526b564341a5401b3df236721a
AUX postgresql.conf-8.1 1532 RMD160 69ce81cb490d73b1c6fd373ff6d4f76abbaec4f9 SHA1 6120fcbc61cce8da2b02eb5608def3e65a6ff04d SHA256 e28635d2abb43a30fe58d0d35c7266e40cb323c94797b8a98a0b7f2a4caf507d
AUX postgresql.conf-8.2 1532 RMD160 8712059a8898ff65aff6d8dd6287726ebfc7719f SHA1 ca6547ac197a81a84b3de5c6f41d1b824fa6cef4 SHA256 775d1aa953c1d5a82f16e013249c6c29c4907f810536bfc4852eca72a2228780
AUX postgresql.conf-8.3 1532 RMD160 90f201a80549b663fccb3dd90fd507845b27a958 SHA1 7c4f44369064e81b5092491b5327254022e12492 SHA256 7d9814b4bc11c3ca50c0891ac8c57b0793d92d5eb9814d43ef0ef31d0d2eee46
AUX postgresql.init-7.3 3030 RMD160 9d1415fb380e98ceee0f98787eb4382b098bd026 SHA1 921001624a4bf1078e47353bcec455c6f373e143 SHA256 5b68d9efeebf580fc73dc66e67c02e492333862ae461c88318f3a53ac3c83f27
AUX postgresql.init-7.4 3030 RMD160 cd3bc7d664c7915c2aff26f85bed21229ab08257 SHA1 4008e04a96d6b5428a34317e3226d00f7205b7a8 SHA256 24352a912932ba1f2cc986a1bea5057ee81afe1b24b72d1590cd75ccd266029d
AUX postgresql.init-8.0 2985 RMD160 b8de6ed3eea1257208db3547ddc517f1c4ba6741 SHA1 7a13f40bc5d48503d82339ba292001b007b1a6a2 SHA256 15a03eaf147523b93623e42a63ef9497778087776932c1b83cf32da562774002
AUX postgresql.init-8.1 2985 RMD160 7b5de722b8d8cefab543de1c22465135bb2c8014 SHA1 6717f2efffd5ec9c8b702879a1f08843860d8ef5 SHA256 80547d814c9342f06bf2db1f7d4e1b97ee703bc5d2d3457187817840e4885786
AUX postgresql.init-8.2 2985 RMD160 2da04989bf124326a34a7fd718f06bf9fd9beae9 SHA1 eb8e87fa7174563191f2789a2e8bd0147164b75f SHA256 008083715fa7237ae5d87bf05603b8d597d1cfe3c5e34d6995ac67cfe9964924
AUX postgresql.init-8.3 2985 RMD160 62548136f7c06a419927eeaff2d991f9a1aa6528 SHA1 f1fc6f0dd69fa1fc327197856dde28a813ded024 SHA256 99cf6469c0175713252c4de19ade86deb860062fa91c4c74f9397aedb7851c88
DIST postgresql-7.3.21.tar.bz2 9284558 RMD160 f9de4676b4fbe3d96e6d1462b8bc3c05600d6525 SHA1 bdfa3bddc483c6642cc2ee271d076bfaa4c20c92 SHA256 bf44e0ac259e9f6e14ac102f2977496b6996ecea2fd227fbdcea5fa70e342888
DIST postgresql-7.4.19.tar.bz2 10307396 RMD160 c9a1c7dc8e7bf9ce93c3b4f061af0563b1cc2627 SHA1 19c563d47b0d5deeef03b5ca7707c9f1917853ce SHA256 447ac7070aa0a547f17a307e842734fc27e2716cb4a251fa9a810b178d44c389
DIST postgresql-7.4.21.tar.bz2 10282778 RMD160 b4868ac2664353b8cef4c67d59770f357293c865 SHA1 813895863832b5512838b90b2ea2300b74b856f5 SHA256 2c62d112a7addd4333d14101e508d2222a639e1698b8e4958ce1b05138f76932
DIST postgresql-8.0.15.tar.bz2 11253897 RMD160 6aff5c63dce73eea609f0b6e013cd043ae8b7a37 SHA1 66a6fef7749afb91471200005511c04fc1ac2706 SHA256 59408a00db1c73e638a11af10438a827507b7a72b53916d58f2d44c477718714
DIST postgresql-8.0.17.tar.bz2 11234855 RMD160 d22b26b38a91632b8840e9d0b1b96b4ad80eafed SHA1 d1c4530323a81b00a31003dea695875a8f87ff4f SHA256 e425602f60c034ecfd6ffe9b403d863cd99ff6fbc0891a8d59da33258a21a93b
DIST postgresql-8.1.11.tar.bz2 11735420 RMD160 9fb98eadc4f1015205970f26b31b68ea0378bda9 SHA1 73c0f09754fc8e3c7f8d7de49d70244b76927416 SHA256 3e91cdfc1353fa9c6416d9fc8ae9d6ab3171565f00aeb6c882214c2f08a03e2e
DIST postgresql-8.1.13.tar.bz2 11744780 RMD160 fe9fab1b70fa93b4dc0bd19f63a590f75511e79e SHA1 6d4b771aa4011fa3e8aed726f1521b77cd91772a SHA256 a537734da80f85c51ef72dd2d28bb2f64b73f63a727ef53a90211ccac2dcb1d1
DIST postgresql-8.2.7.tar.bz2 12576126 RMD160 96700e91c3b9e733c686b0fe377c7ba661710942 SHA1 0be0dbaa488810ebcba77ac7246180c5b2a9b669 SHA256 39528d1ba50f5abc51569e8b9bdeb47d0d4650d289a2c2e465621864b1ff3584
DIST postgresql-8.2.9.tar.bz2 12558265 RMD160 00fe295d928e77a2dff136795ba846ae3ac08569 SHA1 aeaf0487d031c56518af002f76f779c23baf6391 SHA256 95ea81e0fa00184a63dae960007be95200343b24dec6cdea41bc809db29f22c2
DIST postgresql-8.3.1.tar.bz2 13995572 RMD160 075efb67126f2b308d2a5fe4f9097fdbfbe94c89 SHA1 7397e0d8fd3c420ee845d9ae4995ae347bfaea1d SHA256 7ccf1e5c987920e4d6eb98b8589939e29d3a361d285055d5af35ddd8e1a2d992
DIST postgresql-8.3.3.tar.bz2 14004538 RMD160 8cc31cae862e328c8372245c8f953a1773dcc1f8 SHA1 b933f26a70bef9a5971c0ff2f392e293eed138b2 SHA256 e9406b93794dc4fd15b21e10512d2b694236d79b018d29b9ca86311d5cca2437
EBUILD postgresql-server-7.3.21.ebuild 9021 RMD160 48af14ad1f0f5d9af1ab1bbee786c0c5185f2e1c SHA1 0a594f6bb163070d8a0af2fbd56fdadbaa2ad050 SHA256 52ac83e6038935db6f0edb8c7ee0fae61e68d77061c6b41bc99e155bc2d75321
EBUILD postgresql-server-7.4.19.ebuild 8951 RMD160 eaee743bc8574efe01a8cc30af04c41ed1215628 SHA1 0afad9d1fba84783849f999e17d823a3e3e88906 SHA256 15c7bd6c7d8c404bbd9461262067301dd9606eb0067b065347c03f17c0d9ef09
EBUILD postgresql-server-7.4.21.ebuild 8924 RMD160 de1d0e68b8ffaf453a6848c036e173c42cb456c9 SHA1 6b14b0a92cdc4c43f9c446ba52c5154e2c9996d7 SHA256 74ec07c96dce46f8a23d09ff676d583dd6362694deae001c79bfffb2d1bb017f
EBUILD postgresql-server-8.0.15.ebuild 9150 RMD160 7a732f8c7791976955ec0fcecec06b6b2705482b SHA1 a78f72197c4dc7169ef13e3bb12a6c79a40a46d0 SHA256 597f22ac4c4fe19a9e1fa300c77c7bea56bb6e5630e693a555e5a69df8450cb3
EBUILD postgresql-server-8.0.17.ebuild 9120 RMD160 2db4b6c9d52685277ba0969ac953d10f557cebd4 SHA1 b8fc088e06554cc351d45d9088497c2e47fc8f98 SHA256 6607f91436dec28b28218cabd21eedc24d46769087ae5d8e629c6848d96ed442
EBUILD postgresql-server-8.1.11.ebuild 9268 RMD160 a1039e8ef27793419e2cfb11cd2fb29264ba7f3a SHA1 391677189aa5074f6b12bb427aa0292c8bafa69b SHA256 fdf24b21f596583c90ffdc4ffe9b4b7e9067aa13418dc3b0a884bedb75ddc690
EBUILD postgresql-server-8.1.13.ebuild 9206 RMD160 1d4a8bee7bc396d0f45018ad02e14ee5b8ca633c SHA1 069b65dcbdad0a62db127829b1a69a06176ff056 SHA256 c331589472d7e142fb924235cea063b78923dbda797e392d4c872204510360ea
EBUILD postgresql-server-8.2.7.ebuild 9425 RMD160 28db4996485f7a18561bf6517de6ae619734bf75 SHA1 d46e82da13b7766895c890a0c09e98d53ad0a700 SHA256 701b49087e6632e71d9bcf42ec61df59cd81c692bdc5467c813b39aeca3b2b4d
EBUILD postgresql-server-8.2.9.ebuild 9505 RMD160 55374d201f8f7fcd5c856652216ca5ee6053b5fc SHA1 5d633cb7725758fc4b96053735952b1287fd388f SHA256 3cab96dae890fe4e47b843b43102f58fa328b5f3df84043bbe03c94974700be8
EBUILD postgresql-server-8.3.1.ebuild 9729 RMD160 6d1ea7e0702abe3a950c99e12484d5dc8bbcb3d1 SHA1 2fc164f77f34b025c6be78c051c0579ce5722603 SHA256 a04c163a4418c827b29b4c610d407c1bea2eab0dfa58bf6c56e6c52a0db4bdf8
EBUILD postgresql-server-8.3.3.ebuild 9665 RMD160 c11b3e133aa3f2262eaea9be32523190dc1cd41e SHA1 c81a6700027050723f8be5e4eb7bc36bb9342ed6 SHA256 715dc883693612605971bffff7b3bee607d8b66d8919e972546183e21851e270
MISC ChangeLog 10915 RMD160 0400edb46365f1d68270e09990e8ca9ed98a0673 SHA1 4b55dd40b100d24f2ae508d2ef0b9e11829df9c3 SHA256 74649f13305e87ba0046e8c0f85c0b1abebda2f8bae644cd1676e5411208357e
MISC metadata.xml 164 RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc SHA1 f67b7ac1c5e6e65ef5a19a589d4759c84918f86c SHA256 7e8e8126bc8701c4a42c7dfed8bb755ac6040fe3d0e3f994d888f8b2b4fa7d8b

files

metadata.xml




postgresql

postgresql-server-7.3.21.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.3.21.ebuild,v 1.3 2008/06/04 21:44:07 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_cs linguas_de linguas_es linguas_fr linguas_hr linguas_hu
linguas_pt_BR linguas_ru linguas_sv linguas_tr linguas_zh_CN
linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${PV}-autoconf.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch" \
"${FILESDIR}/postgresql-${SLOT}-cubeparse.patch"

if hasq test ${FEATURES}; then
epatch "${FILESDIR}/postgresql-${SLOT}-regress.patch"
fi

eautoconf
}

src_compile() {

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
--with-libs="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
"CFLAGS='${CFLAGS} $(use xml && pkg-config --cflags libxml-2.0)'" \
"LIBS='${LIBS} $(use xml && pkg-config --libs libxml-2.0) -L/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)'" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb,pgtksh,pgtclsh}.1

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
sed -i \
-e '/test: horology/d' \
src/test/regress/{parallel_schedule,serial_schedule} || die "sed failed"

einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-7.4.19.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.4.19.ebuild,v 1.3 2008/06/04 21:44:07 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_cs linguas_de linguas_es linguas_fr linguas_hr linguas_hu
linguas_it linguas_nb linguas_pt_BR linguas_ru linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${PV}-autoconf.patch" \
"${FILESDIR}/postgresql-${SLOT}-vacuum-delay.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
epatch "${FILESDIR}/postgresql-${SLOT}-regress.patch"
fi

eautoreconf
}

src_compile() {

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
--with-libs="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
"CFLAGS='${CFLAGS} $(use xml && pkg-config --cflags libxml-2.0)'" \
"LIBS='${LIBS} -lpq $(use xml && pkg-config --libs libxml-2.0) -L/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)'" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb,pgtksh,pgtclsh}.1

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-7.4.21.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.4.21.ebuild,v 1.1 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_cs linguas_de linguas_es linguas_fr linguas_hr linguas_hu
linguas_it linguas_nb linguas_pt_BR linguas_ru linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${PV}-autoconf.patch" \
"${FILESDIR}/postgresql-${SLOT}-vacuum-delay.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
epatch "${FILESDIR}/postgresql-${SLOT}-regress.patch"
fi

eautoreconf
}

src_compile() {

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
--with-libs="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
"CFLAGS='${CFLAGS} $(use xml && pkg-config --cflags libxml-2.0)'" \
"LIBS='${LIBS} -lpq $(use xml && pkg-config --libs libxml-2.0) -L/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)'" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake install in $bd failed"
done

rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb,pgtksh,pgtclsh}.1

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.0.15.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.0.15.ebuild,v 1.4 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}.15-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb}.1

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
sed -i \
-e '/test: horology/d' \
src/test/regress/{parallel_schedule,serial_schedule} || die "sed failed"

einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.0.17.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.0.17.ebuild,v 1.1 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done

rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb}.1

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
sed -i \
-e '/test: horology/d' \
src/test/regress/{parallel_schedule,serial_schedule} || die "sed failed"

einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.1.11.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.1.11.ebuild,v 1.3 2008/06/04 21:44:07 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
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

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
elog "The autovacuum function, which was in contrib, has been moved to the main"
elog "PostgreSQL functions starting with 8.1."
elog "You can enable it for all clusters in ${ROOT}/etc/postgresql-${SLOT}/postgresql.conf."
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.1.13.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.1.13.ebuild,v 1.1 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done

rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
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

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
elog "The autovacuum function, which was in contrib, has been moved to the main"
elog "PostgreSQL functions starting with 8.1."
elog "You can enable it in the clusters postgresql.conf."
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.2.7.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.7.ebuild,v 1.4 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
else
echo "all install:" > "${S}/src/test/regress/GNUmakefile"
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
--disable-thread-safety \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2); do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
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

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
elog "The autovacuum function, which was in contrib, has been moved to the main"
elog "PostgreSQL functions starting with 8.1."
elog "You can enable it for all clusters in ${ROOT}/etc/postgresql-${SLOT}/postgresql.conf."
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.2.9.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.9.ebuild,v 1.1 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
else
echo "all install:" > "${S}/src/test/regress/GNUmakefile"
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
--disable-thread-safety \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2); do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done

rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
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

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
elog "The autovacuum function, which was in contrib, has been moved to the main"
elog "PostgreSQL functions starting with 8.1."
elog "You can enable it in the clusters postgresql.conf."
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"

if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
eerror "The given directory \"${PGDATA}\" already contains a database cluster."
die "cluster already exists"
fi

[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."

if ! use kernel_linux ; then
SKIP_SYSTEM_TESTS=yes
einfo " Tests not supported on this OS (yet)"
fi

if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."

local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
local SHMMAX=$(sysctl -n kernel.shmmax)

local SEMMSL_MIN=17
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))

for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
fi
done
einfo "Passed."
else
einfo "Skipped."
fi

einfo "Creating the data directory ..."
mkdir -p "${PGDATA}"
chown -Rf postgres:postgres "${PGDATA}"
chmod 0700 "${PGDATA}"

einfo "Initializing the database ..."

su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"

einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo

if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
fi
}

src_test() {
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -j1 check \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."

einfo "Yes, there are other tests which could be run."
einfo "... and no, we don't plan to add/support them."
einfo "For now, the main regressions tests will suffice."
einfo "If you think other tests are necessary, please submit a"
einfo "bug including a patch for this ebuild to enable them."
}

postgresql-server-8.3.1.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.1.ebuild,v 1.5 2008/06/14 11:49:54 dev-zero Exp $

EAPI="1"

WANT_AUTOCONF="latest"
WANT_AUTOMAKE="none"
inherit eutils multilib toolchain-funcs versionator autotools

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"

DESCRIPTION="PostgreSQL server"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL"
SLOT="$(get_version_component_range 1-2)"
IUSE_LINGUAS="
linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
linguas_tr linguas_zh_CN linguas_zh_TW"
IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"

wanted_languages() {
for u in ${IUSE_LINGUAS} ; do
use $u && echo -n "${u#linguas_} "
done
}

RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
perl? ( >=dev-lang/perl-5.6.1-r2 )
python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
selinux? ( sec-policy/selinux-postgresql )
tcl? ( >=dev-lang/tcl-8 )
uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )"
DEPEND="${RDEPEND}
sys-devel/flex
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"

S="${WORKDIR}/postgresql-${PV}"

pkg_setup() {
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}

src_unpack() {
unpack ${A}
cd "${S}"

epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
"${FILESDIR}/postgresql-${SLOT}.1-server.patch"

if hasq test ${FEATURES}; then
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
else
echo "all install:" > "${S}/src/test/regress/GNUmakefile"
fi

eautoconf
}

src_compile() {
# TODO: test if PPC really cannot work with other CFLAGS settings
# use ppc && CFLAGS="-pipe -fsigned-char"

# eval is needed to get along with pg_config quotation of space-rich entities.
eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
--disable-thread-safety \
$(use_with perl) \
$(use_with python) \
$(use_with tcl) \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with uuid ossp-uuid) \
--with-system-tzdata="/usr/share/zoneinfo" \
--with-includes="/usr/include/postgresql-${SLOT}/" \
"$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
|| die "configure failed"

for bd in . contrib $(use xml && echo contrib/xml2); do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
done
}

src_install() {
if use perl ; then
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
fi

for bd in . contrib $(use xml && echo contrib/xml2) ; do
PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
emake install -C $bd -j1 DESTDIR="${D}" \
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
done
rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/"
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

dodoc README HISTORY doc/{README.*,TODO,bug.template}

dodir /etc/eselect/postgresql/slots/${SLOT}
cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
postgres_ebuilds="\${postgres_ebuilds} ${PF}"
postgres_service="postgresql-${SLOT}"
__EOF__

newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"

# Workaround for paludis
[ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
fperms 0770 /var/run/postgresql
fowners postgres:postgres /var/run/postgresql
}

pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}

ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
ewarn "This can break applications which have the standard location hard-coded."
ewarn "If such an application links against the libpq, please re-emerge it,"
ewarn "if that doesn't help or the application accesses the socket without using libpq,"
ewarn "please file a bug-report."
ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."

elog "Execute the following command to setup the initial database environment:"
elog
elog "emerge --config =${CATEGORY}/${PF}"
elog
elog "The autovacuum function, which was in contrib, has been moved to the main"
elog "PostgreSQL functions starting with 8.1."
elog "You can enable it for all clusters in ${ROOT}/etc/postgresql-${SLOT}/postgresql.conf."
}

pkg_postrm() {
eselect postgresql update
}

pkg_config() {
[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"

einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
einfo
einfo "You can change the directory where the database cluster is being created by setting"
einfo "the PGDATA variable."
einfo
einfo "PG_INITDB_OPTS is currently set to:"
einfo " \"${PG_INITDB_OPTS}\""
einfo "and the database cluster will be created in:"
einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
rea