diff options
author | Aaron Swenson <titanofold@gentoo.org> | 2012-06-08 16:29:46 +0000 |
---|---|---|
committer | Aaron Swenson <titanofold@gentoo.org> | 2012-06-08 16:29:46 +0000 |
commit | 39463cf5a8380fd10e680ddf93c8998c8e8eee6d (patch) | |
tree | 6d36e7b31f8b5207c10349e529ad10ee8870e39a /dev-db | |
parent | ppc stable (bug 413815) (diff) | |
download | historical-39463cf5a8380fd10e680ddf93c8998c8e8eee6d.tar.gz historical-39463cf5a8380fd10e680ddf93c8998c8e8eee6d.tar.bz2 historical-39463cf5a8380fd10e680ddf93c8998c8e8eee6d.zip |
Fixing initscripts. awk syntax fix to work in FreeBSD. Search for unix_socket_directory instead of the non-existent unix_socket_path. (Bug 407907 and bug 418057 respectively.)
Package-Manager: portage-2.1.10.49/cvs/Linux x86_64
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/postgresql-server/ChangeLog | 16 | ||||
-rw-r--r-- | dev-db/postgresql-server/Manifest | 19 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-8.3.19-r1.ebuild | 339 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-8.4.12-r1.ebuild | 348 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-9.0.8-r1.ebuild | 342 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-9.1.4-r1.ebuild | 348 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-9.2.0_beta2-r1.ebuild | 357 |
7 files changed, 1767 insertions, 2 deletions
diff --git a/dev-db/postgresql-server/ChangeLog b/dev-db/postgresql-server/ChangeLog index 9e628b451d96..d7defcaf82a5 100644 --- a/dev-db/postgresql-server/ChangeLog +++ b/dev-db/postgresql-server/ChangeLog @@ -1,6 +1,20 @@ # ChangeLog for dev-db/postgresql-server # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.194 2012/06/06 18:27:37 ranger Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.195 2012/06/08 16:29:46 titanofold Exp $ + +*postgresql-server-9.2.0_beta2-r1 (08 Jun 2012) +*postgresql-server-9.1.4-r1 (08 Jun 2012) +*postgresql-server-9.0.8-r1 (08 Jun 2012) +*postgresql-server-8.4.12-r1 (08 Jun 2012) +*postgresql-server-8.3.19-r1 (08 Jun 2012) + + 08 Jun 2012; Aaron W. Swenson <titanofold@gentoo.org> + +postgresql-server-8.3.19-r1.ebuild, +postgresql-server-8.4.12-r1.ebuild, + +postgresql-server-9.0.8-r1.ebuild, +postgresql-server-9.1.4-r1.ebuild, + +postgresql-server-9.2.0_beta2-r1.ebuild: + Fixing initscripts. awk syntax fix to work in FreeBSD. Search for + unix_socket_directory instead of the non-existent unix_socket_path. (Bug + 407907 and bug 418057 respectively.) 06 Jun 2012; Brent Baude <ranger@gentoo.org> postgresql-server-8.3.19.ebuild, postgresql-server-8.4.12.ebuild, postgresql-server-9.0.8.ebuild, diff --git a/dev-db/postgresql-server/Manifest b/dev-db/postgresql-server/Manifest index af30e556e00d..ae22fb5da2e9 100644 --- a/dev-db/postgresql-server/Manifest +++ b/dev-db/postgresql-server/Manifest @@ -1,3 +1,6 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + DIST postgresql-8.3.18.tar.bz2 14563583 RMD160 d276a468f59b4def821b686b5504a549bd0491c3 SHA1 0d832fc9c7dba5de1716921274ce0ca276418070 SHA256 5db4904a8959f09274e1e0ee7f21c354128d5dbb4e946b78391f6bc4723c3746 DIST postgresql-8.3.19.tar.bz2 14570746 RMD160 1611a009386ba6984689fbbf8663c49d405f864c SHA1 bd7fcb188f668d30029f02048b5b5b86b9d3d14e SHA256 986f0d4b7edc633be1d210f27dfd1e47d416b642659e568895218466e50b58d5 DIST postgresql-8.4.11.tar.bz2 14502434 RMD160 85b4be0884ca11855eb0dbc1541403e7baf7c0aa SHA1 ce9581b9f03bd884417b988ec317ce2ed06bb15f SHA256 5bbc9ff1d16282b592600d7c6b9cb1a93049d4aa9a961e3c2c8d5fb13b189c8f @@ -8,8 +11,10 @@ DIST postgresql-9.1.3.tar.bz2 15582454 RMD160 84eb235c090083b78e6a2facf3d7bc5343 DIST postgresql-9.1.4.tar.bz2 15631894 RMD160 ff08ad702c7ffc0172b3f66aa4819d4865f0e77b SHA1 c75fd5696af02a275a104260eac8b3a4abe35682 SHA256 a0795a8eb3ae2d1a2914b63bf143d20182835d90699915ff43567c041d3c9712 DIST postgresql-9.2beta1.tar.bz2 15908141 RMD160 a70e7fe588ca57a08a1ce4593841bf735d69587c SHA1 651195df830777c952e3484fff51366ef0b95151 SHA256 05651ec88af03cc5cec08b091f2381fe8ebdaa87dbc6d193414ff2400084a838 DIST postgresql-9.2beta2.tar.bz2 15937360 RMD160 f9eee5cda2e9387b04237a14a6d8fd9282c19632 SHA1 2102bc75294449362d625b3ae97c4a082a05ac68 SHA256 2a057a5e56a9489d2c4fa450a45ce5f36e4bd21878d1b03e3a856ed4adb8ab4f +DIST postgresql-initscript-2.1.1.tbz2 2604 RMD160 55cd8c44c54115a6a6552d3430028729c7db0469 SHA1 d560a96cce82980e56b88dd21bd1feedc8abec93 SHA256 e7e9f18a48272a6210ef3b433bb910e3ffeffe92f798aaf1ea503ce1fc1f5dfb DIST postgresql-initscript-2.1.tbz2 2603 RMD160 033f7189df6132b8bcca378e000bd2b705463b72 SHA1 4125c76d102ea78cb5cebd4a13021930f131ae02 SHA256 42ee83d0bfd1e1733bbc191b065bc70b2b5966f743f692e5133f6c676c8b1c24 DIST postgresql-initscript-2.2.tbz2 2603 RMD160 f46f4a2f905a6ab8821cdbc895c21d8e4b0fc158 SHA1 801545844009fb56eee67d82a370e039c3bca48b SHA256 033bd93833003b9176e1e3788290e0753b668e17182383f6ae4083ef05ce363b +DIST postgresql-initscript-2.3.tbz2 2611 RMD160 5282ae22ac308fecfde1da9b156c7e4edb9c963f SHA1 30e5f182c1f50d70b60d28c30574e1ac70df98ba SHA256 72a2805048c3027996c41b9d3342ccf56406393bab7086af745d87b5b5edd4a7 DIST postgresql-patches-8.3-r2.tbz2 5501 RMD160 ffd2661f5a4832917d4c28b5a231b6467c04146f SHA1 7514b558a7c6f34d7491bd500fd8c74510d9f0d0 SHA256 adae4c048745de04fd44f0408e8ab85aa5cae283cb3ddc2962e0379905cca73f DIST postgresql-patches-8.4-r2.tbz2 4822 RMD160 cf1ef4d046653c571e9059c6b27dcd5d1b504b26 SHA1 0fb36f6c8d9bb54b1528acd1821f76619f297403 SHA256 9920097ff5243df28788a6f3bdf6cdad38e6c42885f38da84b0f2c8c242954d7 DIST postgresql-patches-9.0-r3.tbz2 4503 RMD160 05d4167c3a48a432ab79cb57fee5e4661d229cc6 SHA1 04d4a820415304ddb27078a75669289647192048 SHA256 2d454575423f0e56f23d540fbc865309d0bee3f80e5e05a7e1d793a7e70763cf @@ -17,14 +22,26 @@ DIST postgresql-patches-9.1-r1.tbz2 4547 RMD160 2cdd98c1f6075a68ef294ceefc94e46f DIST postgresql-patches-9.2beta1.tbz2 4466 RMD160 65a2b3ef46797b0a0a007169ac941e8d92054b8c SHA1 121a0f5fe87dadf58f7ed129dde6c15f379f4eea SHA256 7033657bf66255fda3881ee6797ad0aa920e1910619228206b174065e5e348d2 DIST postgresql-patches-9.2beta2.tbz2 4466 RMD160 65a2b3ef46797b0a0a007169ac941e8d92054b8c SHA1 121a0f5fe87dadf58f7ed129dde6c15f379f4eea SHA256 7033657bf66255fda3881ee6797ad0aa920e1910619228206b174065e5e348d2 EBUILD postgresql-server-8.3.18.ebuild 11524 RMD160 29f616d42942f7ab6ae33b8fae2df755d45972a5 SHA1 c106e21b0df2c4af04b07c1d1822758f99baa594 SHA256 dca6620458fada232452bd305f92b3e83e84b0a98723ab283bd714c56990cca6 +EBUILD postgresql-server-8.3.19-r1.ebuild 11542 RMD160 80267415af19fb61a5565da0642d5be26df22afb SHA1 3235e831ec0d66e2ebb31a444d43a000e965dbb5 SHA256 d08fdb50b72c7f963174dd511821d7cc6e988c9a33b0cdf2787252b448eb074d EBUILD postgresql-server-8.3.19.ebuild 11530 RMD160 57752d4f46ed7cb779d93c6d0b477740f64679bc SHA1 fbe3e69b4e4678558bd55302e1ad74fcdd17dc13 SHA256 c40466b89edfa83b08f7a7651937941ff050b243069b403de73c3f0d7e713f92 EBUILD postgresql-server-8.4.11.ebuild 11819 RMD160 be33f9e6ebc7636f3c76e36dea572b30aeb1fba0 SHA1 00024b4f97ee4bb14b9aa865b4a2255313f81c50 SHA256 3200499f4bdd1d7e6c0c5d74e57a6d2e0b2d3e29dee3291d5204edea481fd385 +EBUILD postgresql-server-8.4.12-r1.ebuild 11837 RMD160 ddd1bcdeea8f8c9ed910921eafcf4068059728b5 SHA1 44342b6d4d2d356959444d54143e1e267a849c49 SHA256 e6ea0cfd393174433cbcce991e584ff7bf32634c6f7ca217633035b2fe061624 EBUILD postgresql-server-8.4.12.ebuild 11825 RMD160 0e7552b894fed4901b35840640dece79c29ad438 SHA1 137927a21d8f39956989fc31db573250d8a0c349 SHA256 1acdc91cb78d40b9797c401250d81578b1a1abfbfd04d6f78253b41f94a0c0a9 EBUILD postgresql-server-9.0.7.ebuild 11419 RMD160 a9feb9c9b72b9453fe6501865a316ccf5c58f066 SHA1 afdee52c50b245b9a88993e3b110afe0cda93df0 SHA256 6e2bf8dd91932a242729b57a59a2e36e4d666eedca7dcacdcd6bb4f12c421f30 +EBUILD postgresql-server-9.0.8-r1.ebuild 11437 RMD160 5fb206c1a7f913465f07295407537a16348af978 SHA1 fabfd2b00bef96e2855daade2d45d06f4720306d SHA256 ddf2630bd9d0d2a0a48e32718fab1e847a8a6b530f5534d0e466fc9d374e2140 EBUILD postgresql-server-9.0.8.ebuild 11425 RMD160 b6a4c1e656edf5eebafb061a11c56be39633a199 SHA1 e62e604be8a68cfe27a991fabd44558ae8f8edef SHA256 847fcf84aa2c45e14cae456f79057b67311164cab8d3f0d7ce0fac08bbfa5765 EBUILD postgresql-server-9.1.3.ebuild 11448 RMD160 5c30a80dbdb35390c81d6875d87364bdac046047 SHA1 53f0824616fc436a759f8aa7f6d8e29fa71c3a9c SHA256 95903bd4399c0dff41733c5426048bfe34e356a44f53cd84b5236436dbd26dc1 +EBUILD postgresql-server-9.1.4-r1.ebuild 11466 RMD160 b622c2a50479f0f864b94f7ce7eef9023283f4a8 SHA1 6c6a8f7a6a89b5f7c9bf847373767884ea3c40ca SHA256 0d913125a0ff13e83e9fbfdd588d290fec9353331b93db5d2a5014f429769a79 EBUILD postgresql-server-9.1.4.ebuild 11454 RMD160 f748bb04ad1eaa3642642db13b1c2d93772f23ce SHA1 b2e9e13ad738763f75e42eabeeee549b53b17ec0 SHA256 d53f7afa2884a740fc4fbda7d04114ab63f8d29f9fdef7e1a25079d49716028b EBUILD postgresql-server-9.2.0_beta1-r1.ebuild 11872 RMD160 29b6c440252cb5fc6f38ff25d61e9545bbe5fbfe SHA1 d6eec6a0d8ef217af91285dff55654386b3d7cae SHA256 3164fb06e1e48a5bafd84ea12cf9ec09423165f54bdad1a42ba61521d0e11a70 +EBUILD postgresql-server-9.2.0_beta2-r1.ebuild 11875 RMD160 e6bed8f3c79200598d7a9cb56ad5c4593b06f0a6 SHA1 4d57c3c55c471386a30eb880ae7b2af59046cfd8 SHA256 27143c6a5cacf828895bba5f85ef5bab8d4f40e514f59d9f4950fba9b5e86c16 EBUILD postgresql-server-9.2.0_beta2.ebuild 11872 RMD160 b2f9a5b62293d5f6d1fff05af11e7fec4ea1a4fd SHA1 f0b7c61366bd69b1a98e06efde125940572c7151 SHA256 846755d87b705cda4602f1315adb7ebe465f9affe141ae918b5e51d0032bb772 -MISC ChangeLog 58036 RMD160 793779a09238e608ca98762b7b88b09d66626ce1 SHA1 00d7b2081920d3d275dc9c39978b69cd75ccbf40 SHA256 3f4cfa0b1e794481f6ca581b0b9145a2297765d4c01cd60ffe0a669711d80b43 +MISC ChangeLog 58692 RMD160 0a7b8724a61745a8c90baadcccefec45c0d5afbb SHA1 ee76141f16dd14f49267826949a27de1ff93d539 SHA256 4582455275b02d3a96ead4e9b447dac1bf0a998e59a7aa9e001371405cef559f MISC metadata.xml 420 RMD160 789f5a0ce45d05125098fd7e74a816cf08f4c39b SHA1 d308d7434a37f12cd320f74ed85e1d3ca7dabc75 SHA256 ac37a5084450a782d02510149d030bd0d4a63164f2ffb7bdda3ddf344606ca62 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.17 (GNU/Linux) + +iF4EAREIAAYFAk/SKIYACgkQVxOqA9G7/aDCoAEAmxKGuLbPBaj2thBa0n2Et7K/ +K1sZor9x3iQr8fyEgdEA/0zdhYa50dUC3YmnnRFjEPD4C03X6wtyREdPXWF+uE5j +=HGd/ +-----END PGP SIGNATURE----- diff --git a/dev-db/postgresql-server/postgresql-server-8.3.19-r1.ebuild b/dev-db/postgresql-server/postgresql-server-8.3.19-r1.ebuild new file mode 100644 index 000000000000..1ab4de461c57 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-8.3.19-r1.ebuild @@ -0,0 +1,339 @@ +# Copyright 1999-2012 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.19-r1.ebuild,v 1.1 2012/06/08 16:29:46 titanofold Exp $ + +EAPI="4" + +WANT_AUTOMAKE="none" +inherit autotools eutils multilib pam prefix user versionator + +SLOT="$(get_version_component_range 1-2)" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" + +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-8.3-r2.tbz2 + http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.1.tbz2" +LICENSE="POSTGRESQL" + +S="${WORKDIR}/postgresql-${PV}" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kernel_linux nls pam perl python selinux tcl uuid xml" + +for lingua in ${LINGUAS} ; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=] + perl? ( >=dev-lang/perl-5.8 ) + 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? ( virtual/pkgconfig )" + +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +# Support /var/run or /run for the socket directory +[[ ! -d /run ]] && RUNDIR=/var + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/darwin.patch" \ + "${WORKDIR}/pg_ctl-exit-status.patch" \ + "${WORKDIR}/server.patch" \ + "${WORKDIR}/SuperH.patch" + + eprefixify src/include/pg_config_manual.h + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c + 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 + + sed -e "s|@RUNDIR@|${RUNDIR}|g" \ + -i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ + die "RUNDIR sed failed" + sed -e "s|@SLOT@|${SLOT}|g" \ + -i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ + die "SLOT sed failed" + + eautoconf +} + +src_configure() { + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ + --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ + $(use_with perl) \ + $(use_with python) \ + $(use_with tcl) \ + $(use_with xml libxml) \ + $(use_with xml libxslt) \ + $(use_with uuid ossp-uuid) \ + "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2); do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd -j1 \ + PGXS=$(${EROOT%/}/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=${EROOT%/}/usr/share/doc/${PF} + 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 + + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/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=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ + NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF} + done + + rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" \ + "${ED}/usr/share/doc/${PF}/html" + rm "${ED}"/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 + docompress /usr/share/postgresql-${SLOT}/man/man1 + + dodoc README HISTORY doc/{README.*,TODO,bug.template} + + dodir /etc/eselect/postgresql/slots/${SLOT} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ + > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} + newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} + + use pam && pamd_mimic system-auth postgresql auth account session + + if use prefix ; then + keepdir ${RUNDIR}/run/postgresql + fperms 0770 ${RUNDIR}/run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}${RUNDIR}/run/postgresql/" + elog + elog "If you have users and/or services that you would like to utilize the" + elog "socket, you must add them to the 'postgres' system group:" + elog " usermod -a -G postgres <user>" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source ${EROOT%/}/etc/env.d/02locale + [[ -n ${LANG} ]] && export LANG + [[ -n ${LC_CTYPE} ]] && export LC_CTYPE + [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC + [[ -n ${LC_TIME} ]] && export LC_TIME + [[ -n ${LC_COLLATE} ]] && export LC_COLLATE + [[ -n ${LC_MONETARY} ]] && export LC_MONETARY + [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES + [[ -n ${LC_ALL} ]] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z ${PG_INITDB_OPTS} ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [[ $correct != "true" ]] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized." + fi + done + + if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo "Tests not supported on this OS (yet)." + else + if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then + ebegin "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" + eerror " 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 + eend + else + ewarn "SKIP_SYSTEM_TESTS is set, so skipping." + fi + fi + + if [[ ${EUID} == 0 ]] ; then + einfo "Creating the data directory ..." + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1. You can enable it in the clusters" + einfo "postgresql.conf." + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo " mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [[ ${UID} != 0 ]] ; then + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \ + emake check \ + PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ + NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} diff --git a/dev-db/postgresql-server/postgresql-server-8.4.12-r1.ebuild b/dev-db/postgresql-server/postgresql-server-8.4.12-r1.ebuild new file mode 100644 index 000000000000..ce6909f5f3c2 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-8.4.12-r1.ebuild @@ -0,0 +1,348 @@ +# Copyright 1999-2012 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.4.12-r1.ebuild,v 1.1 2012/06/08 16:29:46 titanofold Exp $ + +EAPI="4" +PYTHON_DEPEND="python? 2" + +WANT_AUTOMAKE="none" +inherit autotools eutils multilib pam prefix python user versionator + +SLOT="$(get_version_component_range 1-2)" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" + +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-8.4-r2.tbz2 + http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.1.tbz2" +LICENSE="POSTGRESQL" + +S="${WORKDIR}/postgresql-${PV}" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" + +for lingua in ${LINGUAS} ; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] + perl? ( >=dev-lang/perl-5.8 ) + 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? ( virtual/pkgconfig )" + +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +# Support /var/run or /run for the socket directory +[[ ! -d /run ]] && RUNDIR=/var + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + use python && python_set_active_version 2 +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/darwin.patch" \ + "${WORKDIR}/ldflags.patch" \ + "${WORKDIR}/pg_ctl-exit-status.patch" \ + "${WORKDIR}/server.patch" \ + "${WORKDIR}/SuperH.patch" + + eprefixify src/include/pg_config_manual.h + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c + 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 + + sed -e "s|@RUNDIR@|${RUNDIR}|g" \ + -i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ + die "RUNDIR sed failed" + sed -e "s|@SLOT@|${SLOT}|g" \ + -i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ + die "SLOT sed failed" + + eautoconf +} + +src_configure() { + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ + --with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ + --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ + $(use_with perl) \ + $(use_with python) \ + $(use_with tcl) \ + $(use_with xml libxml) \ + $(use_with xml libxslt) \ + $(use_with uuid ossp-uuid) \ + "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd -j1 || 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 + + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake install -C $bd -j1 DESTDIR="${D}" \ + || die "emake install in $bd failed" + done + + rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" \ + "${ED}/usr/share/doc/postgresql-${SLOT}/html" + rm "${ED}"/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} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ + > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}"/postgresql.confd postgresql-${SLOT} \ + || die "Inserting conf.d file failed" + + newinitd "${WORKDIR}"/postgresql.init postgresql-${SLOT} \ + || die "Inserting init.d file failed" + + use pam && pamd_mimic system-auth postgresql auth account session + + if use prefix ; then + keepdir ${RUNDIR}/run/postgresql + fperms 0770 ${RUNDIR}/run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "The time stamp format is 64 bit integers now. If you upgrade from older" + elog "databases, this may force you to either do a dump and reload of enable" + elog "pg_legacytimestamp until you find time to do so. If the database can't start" + elog "please try enabling pg_legacytimestamp and rebuild." + elog + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}${RUNDIR}/run/postgresql/" + elog + elog "If you have users and/or services that you would like to utilize the" + elog "socket, you must add them to the 'postgres' system group:" + elog " usermod -a -G postgres <user>" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [[ -n ${LANG} ]] && export LANG + [[ -n ${LC_CTYPE} ]] && export LC_CTYPE + [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC + [[ -n ${LC_TIME} ]] && export LC_TIME + [[ -n ${LC_COLLATE} ]] && export LC_COLLATE + [[ -n ${LC_MONETARY} ]] && export LC_MONETARY + [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES + [[ -n ${LC_ALL} ]] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z ${PG_INITDB_OPTS} ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [[ $correct != "true" ]] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized" + fi + done + + if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo " Tests not supported on this OS (yet)" + else + 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" + eerror " 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 + ewarn "SKIP_SYSTEM_TESTS set, so skipping." + fi + fi + + if [[ ${EUID} == 0 ]] ; then + einfo "Creating the data directory ..." + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by" + einfo "default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo " mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [[ ${UID} != 0 ]] ; then + emake check || die "Make check failed. See above for details." + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} diff --git a/dev-db/postgresql-server/postgresql-server-9.0.8-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.0.8-r1.ebuild new file mode 100644 index 000000000000..9249e47f6ee6 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-9.0.8-r1.ebuild @@ -0,0 +1,342 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.8-r1.ebuild,v 1.1 2012/06/08 16:29:46 titanofold Exp $ + +EAPI="4" +PYTHON_DEPEND="python? 2" + +WANT_AUTOMAKE="none" +inherit autotools eutils multilib pam prefix python user versionator + +SLOT="$(get_version_component_range 1-2)" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris" + +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-9.0-r3.tbz2 + http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.1.tbz2" +LICENSE="POSTGRESQL" + +S="${WORKDIR}/postgresql-${PV}" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" + +for lingua in ${LINGUAS}; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] + perl? ( >=dev-lang/perl-5.8 ) + 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? ( virtual/pkgconfig )" + +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +# Support /var/run or /run for the socket directory +[[ ! -d /run ]] && RUNDIR=/var + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + use python && python_set_active_version 2 +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/pg_ctl-exit-status.patch" \ + "${WORKDIR}/server.patch" + + eprefixify src/include/pg_config_manual.h + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c + 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 + + sed -e "s|@RUNDIR@|${RUNDIR}|g" \ + -i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ + die "RUNDIR sed failed" + sed -e "s|@SLOT@|${SLOT}|g" \ + -i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ + die "SLOT sed failed" + + eautoconf +} + +src_configure() { + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ + --with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ + --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ + $(use_with perl) \ + $(use_with python) \ + $(use_with tcl) \ + $(use_with xml libxml) \ + $(use_with xml libxslt) \ + $(use_with uuid ossp-uuid) \ + "$(use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2); do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd -j1 || 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 + + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed" + done + + dodir /usr/share/postgresql-${SLOT}/man/man1/ + cp "${S}"/doc/src/sgml/man1/{initdb,pg_controldata,pg_ctl,pg_resetxlog,post{gres,master}}.1 \ + "${ED}"/usr/share/postgresql-${SLOT}/man/man1/ || die + + dodoc README HISTORY doc/{README.*,TODO,bug.template} + + dodir /etc/eselect/postgresql/slots/${SLOT} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ + > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} \ + || die "Inserting conf.d file failed" + + newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} \ + || die "Inserting init.d file failed" + + use pam && pamd_mimic system-auth postgresql auth account session + + if use prefix ; then + keepdir ${RUNDIR}/run/postgresql + fperms 0770 ${RUNDIR}/run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}${RUNDIR}/run/postgresql/" + elog + elog "If you have users and/or services that you would like to utilize the" + elog "socket, you must add them to the 'postgres' system group:" + elog " usermod -a -G postgres <user>" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [[ -n ${LANG} ]] && export LANG + [[ -n ${LC_CTYPE} ]] && export LC_CTYPE + [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC + [[ -n ${LC_TIME} ]] && export LC_TIME + [[ -n ${LC_COLLATE} ]] && export LC_COLLATE + [[ -n ${LC_MONETARY} ]] && export LC_MONETARY + [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES + [[ -n ${LC_ALL} ]] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [[ $correct != "true" ]] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized" + fi + done + + if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo " Tests not supported on this OS (yet)" + else + 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" + eerror " 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 + ewarn "SKIP_SYSTEM_TESTS set, so skipping." + fi + fi + + if [[ ${EUID} == 0 ]] ; then + einfo "Creating the data directory ..." + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres \ + -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D '${DATA_DIR}' -L '${EROOT%/}/usr/share/postgresql-${SLOT}/' ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb \ + -U postgres -D "${DATA_DIR}" \ + -L "${EROOT%/}/usr/share/postgresql-${SLOT}/" ${PG_INITDB_OPTS} + fi + + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo " mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [[ ${UID} != 0 ]] ; then + emake check || die "Make check failed. See above for details." + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} diff --git a/dev-db/postgresql-server/postgresql-server-9.1.4-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.1.4-r1.ebuild new file mode 100644 index 000000000000..35e5222bb665 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-9.1.4-r1.ebuild @@ -0,0 +1,348 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.4-r1.ebuild,v 1.1 2012/06/08 16:29:46 titanofold Exp $ + +EAPI="4" +PYTHON_DEPEND="python? 2" + +WANT_AUTOMAKE="none" +inherit autotools eutils flag-o-matic multilib pam prefix python user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" +S="${WORKDIR}/postgresql-${PV}" + +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-9.1-r1.tbz2 + http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.1.tbz2" +LICENSE="POSTGRESQL" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" + +for lingua in ${LINGUAS}; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] + perl? ( >=dev-lang/perl-5.8 ) + 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? ( virtual/pkgconfig )" +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +# Support /var/run or /run for the socket directory +[[ ! -d /run ]] && RUNDIR=/var + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + use python && python_set_active_version 2 +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/pg_ctl-exit-status.patch" \ + "${WORKDIR}/server.patch" + + eprefixify src/include/pg_config_manual.h + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c + 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 + + sed -e "s|@RUNDIR@|${RUNDIR}|g" \ + -i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ + die "RUNDIR sed failed" + sed -e "s|@SLOT@|${SLOT}|g" \ + -i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ + die "SLOT sed failed" + + eautoconf +} + +src_configure() { + case ${CHOST} in + *-darwin*|*-solaris*) + use nls && append-libs intl + ;; + esac + + local PO="${EPREFIX%/}" + + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${PO}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + $(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="${PO}/usr/share/zoneinfo" \ + --with-includes="${PO}/usr/include/postgresql-${SLOT}/" \ + --with-libraries="${PO}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ + "$(use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2); do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd || 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 + + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake install -C $bd DESTDIR="${D}" || die "emake install in $bd failed" + done + + dodoc README HISTORY doc/{TODO,bug.template} + + dodir /etc/eselect/postgresql/slots/${SLOT} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ + "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || \ + die "Inserting conf failed" + newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || \ + die "Inserting conf failed" + + use pam && pamd_mimic system-auth postgresql auth account session + + if use prefix ; then + keepdir ${RUNDIR}/run/postgresql + fperms 0770 ${RUNDIR}/run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}${RUNDIR}/run/postgresql/" + elog + elog "If you have users and/or services that you would like to utilize the" + elog "socket, you must add them to the 'postgres' system group:" + elog " usermod -a -G postgres <user>" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_prerm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5" + + ebegin "Resuming removal 10 seconds. Control-C to cancel" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [ "$correct" != "true" ] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized" + fi + done + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo " Tests not supported on this OS (yet)" + else + 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" + eerror " 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 + ewarn "SKIP_SYSTEM_TESTS set, so skipping." + fi + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [ ${UID} -ne 0 ] ; then + emake -j1 check || die "Make check failed. See above for details." + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} diff --git a/dev-db/postgresql-server/postgresql-server-9.2.0_beta2-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.2.0_beta2-r1.ebuild new file mode 100644 index 000000000000..677ce35233e1 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-9.2.0_beta2-r1.ebuild @@ -0,0 +1,357 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.2.0_beta2-r1.ebuild,v 1.1 2012/06/08 16:29:46 titanofold Exp $ + +EAPI="4" +PYTHON_DEPEND="python? 2" + +WANT_AUTOMAKE="none" +inherit autotools eutils flag-o-matic multilib pam prefix python user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" + +# Comment the following six lines when not a beta or rc. +MY_PV="${PV//_}" +MY_FILE_PV="${SLOT}$(get_version_component_range 4)" +S="${WORKDIR}/postgresql-${MY_FILE_PV}" +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_FILE_PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-${MY_FILE_PV}.tbz2 + http://dev.gentoo.org/~titanofold/postgresql-initscript-2.3.tbz2" + +# Comment the following four lines when a beta or rc. +#S="${WORKDIR}/postgresql-${PV}" +#SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 +# http://dev.gentoo.org/~titanofold/postgresql-patches-${PV}.tbz2 +# http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.tbz2" + +LICENSE="POSTGRESQL" +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" + +for lingua in ${LINGUAS}; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] + perl? ( >=dev-lang/perl-5.8 ) + 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? ( virtual/pkgconfig )" +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +# Support /var/run or /run for the socket directory +[[ ! -d /run ]] && RUNDIR=/var + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + use python && python_set_active_version 2 +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/server.patch" + + eprefixify src/include/pg_config_manual.h + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c +# 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 + + sed -e "s|@RUNDIR@|${RUNDIR}|g" \ + -i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ + die "RUNDIR sed failed" + sed -e "s|@SLOT@|${SLOT}|g" \ + -i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ + die "SLOT sed failed" + + eautoconf +} + +src_configure() { + case ${CHOST} in + *-darwin*|*-solaris*) + use nls && append-libs intl + ;; + esac + + local PO="${EPREFIX%/}" + + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${PO}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + $(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="${PO}/usr/share/zoneinfo" \ + --with-includes="${PO}/usr/include/postgresql-${SLOT}/" \ + --with-libraries="${PO}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ + "$(use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2); do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd || 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 + + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake install -C $bd DESTDIR="${D}" || die "emake install in $bd failed" + done + + dodoc README HISTORY doc/{TODO,bug.template} + + dodir /etc/eselect/postgresql/slots/${SLOT} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ + "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || \ + die "Inserting conf failed" + newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || \ + die "Inserting conf failed" + + use pam && pamd_mimic system-auth postgresql auth account session + + if use prefix ; then + keepdir ${RUNDIR}/run/postgresql + fperms 0770 ${RUNDIR}/run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}${RUNDIR}/run/postgresql/" + elog + elog "If you have users and/or services that you would like to utilize the" + elog "socket, you must add them to the 'postgres' system group:" + elog " usermod -a -G postgres <user>" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_prerm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5" + + ebegin "Resuming removal 10 seconds. Control-C to cancel" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [ "$correct" != "true" ] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized" + fi + done + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo " Tests not supported on this OS (yet)" + else + 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" + eerror " 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 + ewarn "SKIP_SYSTEM_TESTS set, so skipping." + fi + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [ ${UID} -ne 0 ] ; then + emake check || die "Make check failed. See above for details." + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} |