From: "Aaron W. Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/, dev-db/postgresql/files/
Date: Sat, 14 Nov 2020 13:59:31 +0000 (UTC) [thread overview]
Message-ID: <1605362350.734742ccd7c2a901d5fb30975c0c7d27c6482cc2.titanofold@gentoo> (raw)
commit: 734742ccd7c2a901d5fb30975c0c7d27c6482cc2
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 14 13:50:18 2020 +0000
Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Nov 14 13:59:10 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=734742cc
dev-db/postgresql: Version Bumps
Bump to:
- 13.1
- 12.5
- 11.10
- 10.15
- 9.6.20
- 9.5.24
Fixes CVE-2020-25695, CVE-2020-25694, and CVE-2020-25696.
Pg 10+ includes a patch to fix building wit ICU 68.
Bug: https://bugs.gentoo.org/753257
Bug: https://bugs.gentoo.org/754363
Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org>
dev-db/postgresql/Manifest | 6 +
.../postgresql/files/postgresql-10.0-icu68.patch | 12 +
...tgresql-9999.ebuild => postgresql-10.15.ebuild} | 259 ++++++++++----------
...tgresql-9999.ebuild => postgresql-11.10.ebuild} | 259 ++++++++++----------
...stgresql-9999.ebuild => postgresql-12.5.ebuild} | 259 ++++++++++----------
...stgresql-9999.ebuild => postgresql-13.1.ebuild} | 265 ++++++++++-----------
...gresql-9999.ebuild => postgresql-9.5.24.ebuild} | 252 ++++++++++----------
...gresql-9999.ebuild => postgresql-9.6.20.ebuild} | 241 ++++++++++---------
dev-db/postgresql/postgresql-9999.ebuild | 5 +
9 files changed, 794 insertions(+), 764 deletions(-)
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest
index d712757a743..47dbd153fd0 100644
--- a/dev-db/postgresql/Manifest
+++ b/dev-db/postgresql/Manifest
@@ -1,6 +1,12 @@
DIST postgresql-10.14.tar.bz2 19042154 BLAKE2B addddf00179190780bd30ed97cf6881670d18fda77062cdb5dc7cc161c64c3d5522db288902d0612db30fc6fcc1b619c7a102887ed438e27739e936bf5659425 SHA512 eecd2aa8df7e4779606ec547b7bf0207ebb2be10a4b332f06c3b72116f0619fe27fb651f2fd4504c73b740ab7f92468919244a615d460bb9c35085174a0dbc78
+DIST postgresql-10.15.tar.bz2 19089779 BLAKE2B 3b1b30fca0253122aa20eb3fc0cac0b022379b0f0daded46d3295e76167c0063698226198bc905bed5b689a71f4dd2bab5795861207767c2091f037a2b0e9663 SHA512 88fe322a8691692f8c1b8ca7f7a5a035c399c1d2a0e6276b60863f2c0cb8e4857b041d7364641e0738438aee0836688e712b9c176ac454ee98386dfd18754636
+DIST postgresql-11.10.tar.bz2 20003842 BLAKE2B 21446b5e9202c84dad4d6c768f16aab539e656d0a836121343ca4051269845a9ef06859ea37dab09030467336599eb1b72175115d61ca965ed74b7c2fed9ffbf SHA512 0cc0e9b0f76e00727dc699ea59a45d760d37d91ec736a62cbc9bda3e38eb1ef1565e4e399dd3ae96bad87f866e56e364f916de7740d8be6e1cfc2bf654dfbb68
DIST postgresql-11.9.tar.bz2 19959019 BLAKE2B 655d1c9e6eebde19402a4c220ee674c589641c5b6f4e6298c8c06d3330069178952455f5af58f90b9af196ba9c8fd03db0ccd70b8bc49335e465f0ed537eaf59 SHA512 2c5c2f51aa01f02af4aa0849441767383e30fef69dd52efa442892f39d2456bfa8bf01f633a265e00eca0745e792609d2c1d33f77d8f29a02f5f374c84f2bf6e
DIST postgresql-12.4.tar.bz2 20669776 BLAKE2B fb3f865a8a5e5280e7cc5da43f8658029170cd15dae8cc5fb1e741a122ea1f13418ac7743ec417ab4436976bc0ce12753fc8a301200143c975e8739d59816fa7 SHA512 36daf10878ca153370829178786dd6ee366ab4d4d6dc9c527536740fdb14b688ae4c33f850eb4243a7667d23f87e4bfd1ddee0755447ad4f3996e423e391c2f3
+DIST postgresql-12.5.tar.bz2 20729654 BLAKE2B 7f7458346a0823d155f5caea0061aa14048d6f3cac27b1ea23dba03b02a39f39314ad1d44e589520d5e287004ffd32e042fea99ebfeda24b2cc23867b402d336 SHA512 9895bcb1bb26206500666ab4441e663ef83702d428b85a6ff177a4eaf44b0ae06b35d5c4da2672ccb4ec18296649af95bf2f0aed526afaa6a216a8c2d2c5627e
DIST postgresql-13.0.tar.bz2 20999465 BLAKE2B c2c6475ad3c1c79afac1bc181ae3f9b74c097f9679bf562a0f1b4e16f426c9b0235aec476582ef548d14987a9232b938f2920446a8d5a8aa08ae5752f40481f2 SHA512 1fde89487c3e50a7a07e1d42fba60d415645ea89c5d4c5c7fcc93fbd5330feca7ec991d5b274f6ab757d5d04667ca1a7efdf4eaaa760add19d2e02437465f8f5
+DIST postgresql-13.1.tar.bz2 21034192 BLAKE2B 609ac10f87da800754223c7f7d6b02efa3ed1308a5d27cc793c937be983f4041576e20de3b2efe514e3f61dc863e6212ec01d73adb93f6bcc373a596b2946675 SHA512 b7bd378db1dcb74ebcd5fffba03b82d8117d182029e4caca48eef62d8bcdbeef2c2e10f18eef0cdafb9d7acf21aa164d040e56687709f97b08c51540a786eeca
DIST postgresql-9.5.23.tar.bz2 17682366 BLAKE2B 74713d6483ae1ad3d2dfc4b1ac9d30a6785ff34f61b735924f2d469861516ad5160cbfda9c09b96adf264237b6f3ad8fd6ddeef60b6af6b5b63d6c1a36fb9354 SHA512 b7a1e936a0043b57b3ece79610855820d2ea6a86e4a4be0c4c8358bf3e1ef8fa88bc60106d6b865d86231d16b5e3c098b4dbd93125a125b3cc5d468ffea64db1
+DIST postgresql-9.5.24.tar.bz2 17881872 BLAKE2B b86019c4616142a0f5a8db3d00422e16181650d1e1ba755bf6453b76e50b3feff75d7319839ee6f28949d743e46bbdaea32fa3d51f39dd4b4439c88943665d6d SHA512 6e649cd31f2761e2d070d8028b59a690ad76ff3d83a3aa982c4b222c8ea2927fda5e8f473330526673e27ad4b3cc99e8c66810e097c3dfc6517571405c6aede3
DIST postgresql-9.6.19.tar.bz2 18880036 BLAKE2B ad9c5684e2c0fb276589560f7dbe01241b5caf763f5a20991244ad7b473397576c9530658eb91e085e8416156b0ac81750f08ed85d5e5a689321891d10b6e114 SHA512 4d8d4a0e4645d71683a5fccb9cd88917e1870ba139f102e0ea82da9c8d1ad669f029e0feb6d409e2016dfd247229ec7daf04f7f2de3ab6c5b4053834ac244a26
+DIST postgresql-9.6.20.tar.bz2 18944478 BLAKE2B 46c7b27ca60f967f71984d6b747c3054ae6ef4acdcbcd14cfbe3c1ede32a9303b99911e521ed0aa2ba6f899c0d8b9ec03e4e6804379ea6e2371a696f32a6f867 SHA512 6d247e5640a515fa6e6a4c68a992c83aeb19e35924b8e3d21191b3289200766588d1426c5863a13bfc4a11944da3202df9efebc94460d16454c29e5a79384c75
diff --git a/dev-db/postgresql/files/postgresql-10.0-icu68.patch b/dev-db/postgresql/files/postgresql-10.0-icu68.patch
new file mode 100644
index 00000000000..789e47f746a
--- /dev/null
+++ b/dev-db/postgresql/files/postgresql-10.0-icu68.patch
@@ -0,0 +1,12 @@
+diff -rupN a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
+--- a/src/backend/commands/collationcmds.c 2020-11-07 08:03:24.122756440 +0300
++++ b/src/backend/commands/collationcmds.c 2020-11-07 08:04:18.168901199 +0300
+@@ -464,7 +464,7 @@ get_icu_language_tag(const char *localen
+ UErrorCode status;
+
+ status = U_ZERO_ERROR;
+- uloc_toLanguageTag(localename, buf, sizeof(buf), TRUE, &status);
++ uloc_toLanguageTag(localename, buf, sizeof(buf), true, &status);
+ if (U_FAILURE(status))
+ ereport(ERROR,
+ (errmsg("could not convert locale name \"%s\" to language tag: %s",
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-10.15.ebuild
similarity index 69%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-10.15.ebuild
index 1ca6f1f03d0..ccd03770937 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-10.15.ebuild
@@ -3,23 +3,25 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~ppc-macos ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
+IUSE="debug doc icu kerberos kernel_linux ldap libressl nls pam perl
+ python +readline selinux +server systemd ssl static-libs tcl
threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -33,21 +35,16 @@ virtual/libintl
icu? ( dev-libs/icu:= )
kerberos? ( virtual/krb5 )
ldap? ( net-nds/openldap )
-llvm? (
- sys-devel/llvm:=
- sys-devel/clang:=
-)
pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
readline? ( sys-libs/readline:0= )
+server? ( systemd? ( sys-apps/systemd ) )
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,42 +73,26 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
src_prepare() {
+ # Work around PPC{,64} compilation bug where bool is already defined
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
+
# Set proper run directory
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
-i src/include/pg_config_manual.h || die
@@ -121,12 +102,17 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch"
+
if use pam ; then
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
die 'PGSQL_PAM_SERVICE rename failed.'
fi
+ # https://bugs.gentoo.org/753257
+ eapply "${FILESDIR}"/postgresql-10.0-icu68.patch
+
eapply_user
}
@@ -162,71 +148,54 @@ src_configure() {
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
$(use_with icu) \
$(use_with kerberos gssapi) \
$(use_with ldap) \
- $(use_with llvm) \
$(use_with pam) \
$(use_with perl) \
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
+ $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- dodoc README HISTORY doc/TODO
-
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
+ dodoc README HISTORY doc/{TODO,bug.template}
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ serverman=(
+ initdb
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
+ pg_{test_{fsync,timing},upgrade,waldump}
+ post{gres,master}
+ )
+ for m in ${serverman[@]} ; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -252,74 +221,92 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
- fi
-}
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
-pkg_preinst() {
- # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
- # postgresql.eselect module, but they're handled within this ebuild
- # now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
- local canonicalise
- if type -p realpath > /dev/null; then
- canonicalise=realpath
- elif type -p readlink > /dev/null; then
- canonicalise='readlink -f'
- else
- # can't die, subshell
- die "No readlink nor realpath found, cannot canonicalise"
- fi
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
- local l
- # First remove any symlinks in /usr/bin that may have been created
- # by the old eselect
- for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ # Make slot specific links to programs
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}"
done
- # Then move the symlinks created by the ebuild to their proper place.
- for l in "${ED}"/usr/bin/*tmp ; do
- mv "${l}" "${l%tmp}" \
- || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
- done
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
+ fi
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then
+ ewarn "If your system is using 'pg_stat_statements' and you are running a"
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute"
+ ewarn "the following command after upgrading:"
+ ewarn
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;"
+ fi
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +321,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -454,13 +443,17 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
emake check
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-11.10.ebuild
similarity index 68%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-11.10.ebuild
index 1ca6f1f03d0..2c2d6218bcb 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-11.10.ebuild
@@ -3,23 +3,25 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam
+ perl python +readline selinux +server systemd ssl static-libs tcl
threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -41,13 +43,12 @@ pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
readline? ( sys-libs/readline:0= )
+server? ( systemd? ( sys-apps/systemd ) )
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,37 +77,18 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
@@ -121,12 +103,17 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch"
+
if use pam ; then
- sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
die 'PGSQL_PAM_SERVICE rename failed.'
fi
+ # https://bugs.gentoo.org/753257
+ eapply "${FILESDIR}"/postgresql-10.0-icu68.patch
+
eapply_user
}
@@ -162,7 +149,6 @@ src_configure() {
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
$(use_with icu) \
$(use_with kerberos gssapi) \
@@ -173,60 +159,45 @@ src_configure() {
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
+ $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
-
- dodoc README HISTORY doc/TODO
-
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+ dodoc README HISTORY doc/{TODO,bug.template}
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ serverman=(
+ initdb
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
+ pg_{test_{fsync,timing},upgrade,waldump}
+ post{gres,master}
+ )
+ for m in ${serverman[@]} ; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -252,74 +223,92 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
- fi
-}
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
-pkg_preinst() {
- # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
- # postgresql.eselect module, but they're handled within this ebuild
- # now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
- local canonicalise
- if type -p realpath > /dev/null; then
- canonicalise=realpath
- elif type -p readlink > /dev/null; then
- canonicalise='readlink -f'
- else
- # can't die, subshell
- die "No readlink nor realpath found, cannot canonicalise"
- fi
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
- local l
- # First remove any symlinks in /usr/bin that may have been created
- # by the old eselect
- for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ # Make slot specific links to programs
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}"
done
- # Then move the symlinks created by the ebuild to their proper place.
- for l in "${ED}"/usr/bin/*tmp ; do
- mv "${l}" "${l%tmp}" \
- || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
- done
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
+ fi
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then
+ ewarn "If your system is using 'pg_stat_statements' and you are running a"
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute"
+ ewarn "the following command after upgrading:"
+ ewarn
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;"
+ fi
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +323,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -395,9 +386,9 @@ pkg_config() {
einfo "Creating the data directory ..."
if [[ ${EUID} == 0 ]] ; then
- mkdir -p "${DATA_DIR}"
- chown -Rf postgres:postgres "${DATA_DIR}"
- chmod 0700 "${DATA_DIR}"
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs"
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR"
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown"
fi
einfo "Initializing the database ..."
@@ -454,13 +445,17 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
emake check
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-12.5.ebuild
similarity index 68%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-12.5.ebuild
index 1ca6f1f03d0..d1b15a8f310 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-12.5.ebuild
@@ -3,23 +3,25 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam
+ perl python +readline selinux +server systemd ssl static-libs tcl
threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -41,13 +43,12 @@ pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
readline? ( sys-libs/readline:0= )
+server? ( systemd? ( sys-apps/systemd ) )
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,37 +77,18 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
@@ -121,12 +103,17 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch"
+
if use pam ; then
- sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
die 'PGSQL_PAM_SERVICE rename failed.'
fi
+ # https://bugs.gentoo.org/753257
+ eapply "${FILESDIR}"/postgresql-10.0-icu68.patch
+
eapply_user
}
@@ -162,7 +149,6 @@ src_configure() {
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
$(use_with icu) \
$(use_with kerberos gssapi) \
@@ -173,60 +159,45 @@ src_configure() {
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
+ $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
-
- dodoc README HISTORY doc/TODO
-
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+ dodoc README HISTORY
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ serverman=(
+ initdb
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
+ pg_{test_{fsync,timing},upgrade,waldump}
+ post{gres,master}
+ )
+ for m in ${serverman[@]} ; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -252,74 +223,92 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
- fi
-}
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
-pkg_preinst() {
- # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
- # postgresql.eselect module, but they're handled within this ebuild
- # now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
- local canonicalise
- if type -p realpath > /dev/null; then
- canonicalise=realpath
- elif type -p readlink > /dev/null; then
- canonicalise='readlink -f'
- else
- # can't die, subshell
- die "No readlink nor realpath found, cannot canonicalise"
- fi
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
- local l
- # First remove any symlinks in /usr/bin that may have been created
- # by the old eselect
- for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ # Make slot specific links to programs
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}"
done
- # Then move the symlinks created by the ebuild to their proper place.
- for l in "${ED}"/usr/bin/*tmp ; do
- mv "${l}" "${l%tmp}" \
- || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
- done
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
+ fi
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then
+ ewarn "If your system is using 'pg_stat_statements' and you are running a"
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute"
+ ewarn "the following command after upgrading:"
+ ewarn
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;"
+ fi
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +323,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -395,9 +386,9 @@ pkg_config() {
einfo "Creating the data directory ..."
if [[ ${EUID} == 0 ]] ; then
- mkdir -p "${DATA_DIR}"
- chown -Rf postgres:postgres "${DATA_DIR}"
- chmod 0700 "${DATA_DIR}"
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs"
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR"
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown"
fi
einfo "Initializing the database ..."
@@ -454,13 +445,17 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
emake check
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-13.1.ebuild
similarity index 67%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-13.1.ebuild
index 1ca6f1f03d0..d40e0d61ff5 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-13.1.ebuild
@@ -3,23 +3,25 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam
+ perl python +readline selinux +server systemd ssl static-libs tcl
threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -41,13 +43,12 @@ pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
readline? ( sys-libs/readline:0= )
+server? ( systemd? ( sys-apps/systemd ) )
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,37 +77,18 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
@@ -121,12 +103,17 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-13_beta1-no-server.patch"
+
if use pam ; then
- sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
die 'PGSQL_PAM_SERVICE rename failed.'
fi
+ # https://bugs.gentoo.org/753257
+ eapply "${FILESDIR}"/postgresql-10.0-icu68.patch
+
eapply_user
}
@@ -162,7 +149,6 @@ src_configure() {
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
$(use_with icu) \
$(use_with kerberos gssapi) \
@@ -173,60 +159,45 @@ src_configure() {
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
+ $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- dodoc README HISTORY doc/TODO
+ dodoc README HISTORY
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ serverman=(
+ initdb
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
+ pg_{test_{fsync,timing},upgrade,waldump}
+ post{gres,master}
+ )
+ for m in ${serverman[@]} ; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -252,74 +223,92 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
- fi
-}
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
-pkg_preinst() {
- # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
- # postgresql.eselect module, but they're handled within this ebuild
- # now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
- local canonicalise
- if type -p realpath > /dev/null; then
- canonicalise=realpath
- elif type -p readlink > /dev/null; then
- canonicalise='readlink -f'
- else
- # can't die, subshell
- die "No readlink nor realpath found, cannot canonicalise"
- fi
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
- local l
- # First remove any symlinks in /usr/bin that may have been created
- # by the old eselect
- for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ # Make slot specific links to programs
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}"
done
- # Then move the symlinks created by the ebuild to their proper place.
- for l in "${ED}"/usr/bin/*tmp ; do
- mv "${l}" "${l%tmp}" \
- || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
- done
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
+ fi
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then
+ ewarn "If your system is using 'pg_stat_statements' and you are running a"
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute"
+ ewarn "the following command after upgrading:"
+ ewarn
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;"
+ fi
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +323,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -395,9 +386,9 @@ pkg_config() {
einfo "Creating the data directory ..."
if [[ ${EUID} == 0 ]] ; then
- mkdir -p "${DATA_DIR}"
- chown -Rf postgres:postgres "${DATA_DIR}"
- chmod 0700 "${DATA_DIR}"
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs"
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR"
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown"
fi
einfo "Initializing the database ..."
@@ -454,13 +445,21 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage.
+ local old_ctype=${LC_CTYPE}
+ export LC_CTYPE=${LC_COLLATE}
emake check
-
+ export LC_CTYPE=${old_ctype}
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.5.24.ebuild
similarity index 71%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.5.24.ebuild
index 1ca6f1f03d0..acc5e9779fd 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.5.24.ebuild
@@ -3,24 +3,23 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~ppc-macos ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1-2)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+SRC_URI="https://ftp.postgresql.org/pub/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
- threads uuid xml zlib"
+IUSE="debug doc kerberos kernel_linux ldap libressl nls pam perl
+ -pg-legacytimestamp python +readline selinux +server systemd ssl
+ static-libs tcl threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -30,13 +29,8 @@ acct-group/postgres
acct-user/postgres
sys-apps/less
virtual/libintl
-icu? ( dev-libs/icu:= )
kerberos? ( virtual/krb5 )
ldap? ( net-nds/openldap )
-llvm? (
- sys-devel/llvm:=
- sys-devel/clang:=
-)
pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
@@ -45,9 +39,7 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,42 +68,26 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
src_prepare() {
+ # Work around PPC{,64} compilation bug where bool is already defined
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
+
# Set proper run directory
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
-i src/include/pg_config_manual.h || die
@@ -121,6 +97,8 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch"
+
if use pam ; then
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
@@ -161,72 +139,48 @@ src_configure() {
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
+ $(use_enable !pg-legacytimestamp integer-datetimes) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
- $(use_with icu) \
$(use_with kerberos gssapi) \
$(use_with ldap) \
- $(use_with llvm) \
$(use_with pam) \
$(use_with perl) \
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
-
- dodoc README HISTORY doc/TODO
-
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+ dodoc README HISTORY doc/{TODO,bug.template}
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -238,7 +192,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -252,22 +206,68 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.2" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -282,7 +282,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -293,33 +295,40 @@ pkg_preinst() {
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
+ if use alpha && use server ; then
+ ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms."
+ ewarn "As a result, performance will be extremely degraded."
+ fi
+
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +343,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -429,11 +440,9 @@ pkg_config() {
einfo "by default. You can disable it in the cluster's:"
einfo " ${PGDATA%/}/postgresql.conf"
einfo
- if ! use systemd; then
- einfo "The PostgreSQL server, by default, will log events to:"
- einfo " ${DATA_DIR%/}/postmaster.log"
- einfo
- fi
+ 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}"
@@ -444,9 +453,6 @@ pkg_config() {
einfo
einfo "Or move the configuration files back:"
einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
- elif use systemd; then
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
- einfo "instead of 'pg_ctl'."
else
einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
einfo "instead of 'pg_ctl'."
@@ -454,13 +460,17 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
emake check
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.6.20.ebuild
similarity index 72%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.6.20.ebuild
index 1ca6f1f03d0..b36d51b81ce 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.6.20.ebuild
@@ -3,24 +3,26 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
-inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
- systemd
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd
-KEYWORDS=""
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="9999"
+SLOT=$(ver_cut 1-2)
-EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
HOMEPAGE="https://www.postgresql.org/"
-IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl
- python +readline selinux server systemd ssl static-libs tcl
- threads uuid xml zlib"
+IUSE="debug doc kerberos kernel_linux ldap libressl nls pam perl
+ -pg-legacytimestamp python +readline selinux +server systemd ssl
+ static-libs tcl threads uuid xml zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
@@ -30,13 +32,8 @@ acct-group/postgres
acct-user/postgres
sys-apps/less
virtual/libintl
-icu? ( dev-libs/icu:= )
kerberos? ( virtual/krb5 )
ldap? ( net-nds/openldap )
-llvm? (
- sys-devel/llvm:=
- sys-devel/clang:=
-)
pam? ( sys-libs/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
@@ -45,9 +42,8 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-systemd? ( sys-apps/systemd )
+server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
@@ -76,42 +72,26 @@ uuid? (
)"
DEPEND="${CDEPEND}
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
+
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- if ! use server; then
- elog "You are using a live ebuild that uses the current source code as it is"
- elog "available from PostgreSQL's Git repository at emerge time. Given such,"
- elog "the GNU Makefiles may be altered by upstream without notice and the"
- elog "documentation for this live version is not readily available"
- elog "online. Ergo, the ebuild maintainers will not support building a"
- elog "client-only and/or document-free version."
- ewarn "Building server anyway."
- fi
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
use python && python-single-r1_pkg_setup
}
src_prepare() {
+ # Work around PPC{,64} compilation bug where bool is already defined
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
+
# Set proper run directory
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
-i src/include/pg_config_manual.h || die
@@ -121,6 +101,8 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch"
+
if use pam ; then
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
-i src/backend/libpq/auth.c || \
@@ -161,72 +143,49 @@ src_configure() {
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
+ $(use_enable !pg-legacytimestamp integer-datetimes) \
$(use_enable debug) \
- $(use_enable nls) \
$(use_enable threads thread-safety) \
- $(use_with icu) \
$(use_with kerberos gssapi) \
$(use_with ldap) \
- $(use_with llvm) \
$(use_with pam) \
$(use_with perl) \
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
+ $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
- $(use_with systemd) \
- ${uuid_config}
+ $(use_enable nls)
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
-
- dodoc README HISTORY doc/TODO
-
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- # Don't delete libpg{port,common}.a (Bug #571046). They're always
- # needed by extensions utilizing PGXS.
- use static-libs || \
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
- -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+ dodoc README HISTORY doc/{TODO,bug.template}
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6-r1" | \
- systemd_newunit - ${PN}-${SLOT}.service
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -238,7 +197,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -252,22 +211,68 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 1775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always
+ # needed by extensions utilizing PGXS.
+ use static-libs || \
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \
+ -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -282,7 +287,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -293,33 +300,35 @@ pkg_preinst() {
}
pkg_postinst() {
- use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT}/usr/share/doc/${PF}/html"
- elog
- elog "The default location of the Unix-domain socket is:"
- elog " ${EROOT}/run/postgresql/"
- elog
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
- elog "so that it contains your preferred locale, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ elog
+ elog "Official documentation:"
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
+ elog
+ elog "The default location of the Unix-domain socket is:"
+ elog " ${EROOT}/run/postgresql/"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -334,6 +343,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/"
@@ -454,13 +465,17 @@ pkg_config() {
}
src_test() {
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${UID} -ne 0 ]] ; then
emake check
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. Enable "userpriv" in FEATURES.'
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
+ [[ ${UID} -eq 0 ]] || \
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
+
ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild
index 1ca6f1f03d0..9b9884bf901 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9999.ebuild
@@ -455,7 +455,12 @@ pkg_config() {
src_test() {
if [[ ${UID} -ne 0 ]] ; then
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage.
+ local old_ctype=${LC_CTYPE}
+ export LC_CTYPE=${LC_COLLATE}
emake check
+ export LC_CTYPE=${old_ctype}
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."
next reply other threads:[~2020-11-14 13:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-14 13:59 Aaron W. Swenson [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-27 5:53 [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/, dev-db/postgresql/files/ Patrick Lauer
2024-02-04 5:02 Aaron W. Swenson
2024-02-02 14:05 Patrick Lauer
2021-09-23 20:51 Aaron W. Swenson
2021-02-21 14:21 Aaron W. Swenson
2018-06-13 11:19 Aaron Swenson
2018-03-22 16:16 Aaron Swenson
2018-02-11 23:11 Thomas Deutschmann
2018-02-10 18:38 Aaron Swenson
2017-10-07 20:20 Aaron Swenson
2017-08-10 15:03 Aaron Swenson
2016-10-28 16:15 Aaron Swenson
2015-09-06 12:49 Aaron Swenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1605362350.734742ccd7c2a901d5fb30975c0c7d27c6482cc2.titanofold@gentoo \
--to=titanofold@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox