commit: b02edae84b979b6a303de9a9410a57bfa33386d3 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> AuthorDate: Mon Aug 15 16:52:47 2022 +0000 Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> CommitDate: Mon Aug 15 16:52:47 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b02edae8
dev-db/postgresql: Security bump Vulnerability CVE-2022-2625 addressed by bump to: - 10.22 - 11.17 - 12.12 - 13.8 - 14.5 - 15_beta3 Also, pgbench is installed with -server again. Removed unused eclasses multilib and prefix. Bug: https://bugs.gentoo.org/865255 Closes: https://bugs.gentoo.org/860360 Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org> dev-db/postgresql/Manifest | 6 + .../files/postgresql-13.8-no-server.patch | 144 ++++++++++ .../files/postgresql-14.5-no-server.patch | 146 +++++++++++ .../files/postgresql-15_beta3-no-server.patch | 146 +++++++++++ ...tgresql-9999.ebuild => postgresql-10.22.ebuild} | 285 ++++++++++---------- ...tgresql-9999.ebuild => postgresql-11.17.ebuild} | 289 ++++++++++----------- ...tgresql-9999.ebuild => postgresql-12.12.ebuild} | 289 ++++++++++----------- ...stgresql-9999.ebuild => postgresql-13.8.ebuild} | 273 ++++++++++--------- ...stgresql-9999.ebuild => postgresql-14.5.ebuild} | 266 +++++++++---------- ...esql-9999.ebuild => postgresql-15_beta3.ebuild} | 264 +++++++++---------- dev-db/postgresql/postgresql-9999.ebuild | 7 +- 11 files changed, 1225 insertions(+), 890 deletions(-) diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest index 30f18e1224c6..9728a27e7cda 100644 --- a/dev-db/postgresql/Manifest +++ b/dev-db/postgresql/Manifest @@ -1,16 +1,22 @@ DIST postgresql-10.19.tar.bz2 19261478 BLAKE2B 3ccd44d68980ddb0e394b811af20c213cf89eb8d4374d2c49c9cda5165f222ca849a2db4fe4d521991f15f9cc84ec35bafa91083b9625f2a6729159f490a94c9 SHA512 41b0f5026be7d563e41b54e9ea7199dd466a132d355be0b71a91d41f533d97fbf550eccf2a2ece3d60c5dab5921ebeea3ac4780c18c54b924df52d7423305a22 DIST postgresql-10.20.tar.bz2 19371473 BLAKE2B 24ce3e3dda749375e999206307154e79bf15d20b3cd598ba0b78bf27976241d71e88e6fa4cd459b675bc9a9047e9315321b1535dbb41ed9e558858c2a7e9dd31 SHA512 44cfca541947d58c70593b767d3c2423f20cc6904f3d4cea8f63c1802ccbc569130c4a2a15f1af152285926f6a200e13d59c21584295dafd6f6e74bd38251428 DIST postgresql-10.21.tar.bz2 19409454 BLAKE2B 5e43abaee8156b9eb99360efeb25ba268f93a60ac2c29044d9025c4faa8753d84cb3c0c8cbcd65eb9e0eb094ebf63e0cc1cbd0ef12c0a2faa360754e63ae106a SHA512 1053e15505c0448df491119c9aad1617889b66118628a2155e3ec87e6648b2071a0a54e10d8fbbe00161b2aa86d1a6194d932a8cf5808c626e7972d135bb05c5 +DIST postgresql-10.22.tar.bz2 19455874 BLAKE2B 10a8a894ba6e649abcc68abfd829bd30bca04b6e90f987ae5771fe02474517254ea2b48c7c9f2a899309de7b84aeaf13bac025965a9cc44814727ba257a633d7 SHA512 2e1ea75be7696ffbbb947351a8e8e55aaf067f86ad318308499a6a58797f0bf86227ed33e257e261c5c71ebba2f73ba514ef195a2394b91414ce6a0c3ab62532 DIST postgresql-11.14.tar.bz2 20172910 BLAKE2B a033752fc5fc593c96fe63a258b2cc0d4b896548a366e3fefa8afde1f96ab64aab97eb395b10ae10494709963ed924623279f76f66870c4faee435969400c1b7 SHA512 ab71461ee6fb4cdc5b4240f7ecd8af2497ce6780283fde2abf5951ffdb616bd0c8ed22b26fdfca402a346e663ff77c4d17f3284c9d700e6fd6795b2aec97c9be DIST postgresql-11.15.tar.bz2 20245750 BLAKE2B f6a632606fe4b34b2a44df2c165ccfa6e890b85f4f6048994f781428bbd1de6888a24493fb5d0c231f3f34e6a4e94cfd23078a9afdaf5925d284b4854847d23f SHA512 1eba7bddee1edf034617102c1d61ad0aa1b58927dad63de1d054817966c4c9a1d7d3fa6f6896af3fe5a6880b09a6ec86be298256ee6ecc3705ff2654d3d00c74 DIST postgresql-11.16.tar.bz2 20347100 BLAKE2B 240e86b68ff8833265f10802da2fb847d72e38ac9325fc56bb6864266b2ad98939170038ccdb7044ae16f9fd29e7a9e1d404456d8bc7d53430067d714b9bb563 SHA512 e1b6be0a97e60cdd95cd0ebc756b1de6abf2f33f41f6a80da3dff25483a30146fb6bf750ab787bb5bb4f2a04718946c7429e71f891cbd491001e9f9c2ea8e63c +DIST postgresql-11.17.tar.bz2 20385599 BLAKE2B d145bc0f5e0f277be91bf46868c78c9ce5bb2eebbbd84fbdcdbb1ec115911d124a0a054df783739fb912eeae1322fb7eb58b7b1b8d40a8f81cffe2f24d3dda01 SHA512 35304279c06577eca134581490710db976edeac8cca169d3436fcdce8eebb18159459ea3b5ef403f6a8efe85542726f9960c4ca653da4619e081ce5869866032 DIST postgresql-12.10.tar.bz2 20990621 BLAKE2B a7a56cf75944c558ae9bb9165dfb17b30cc5f7a865961e0a588677e4dd3e53d1fab15a212a21ec12f8e7b669a448d78efa0dfe985fd4902e16485a298c7adc62 SHA512 befedb14320aa033dc55bbb93bbbec4e67d9cfced63be0e4f631c7495a0fbc6fe280bd6d2fb941d7a2e6b2ac570b7f40d8db7f07a192a81bd9cd63c6c244a9c5 DIST postgresql-12.11.tar.bz2 21086745 BLAKE2B 7062d334f3ef3b98f69e709f5de744324c7ce53ea516384902632a454a2ccadfd7bcc0c9ef4d51a685dd7a06e1fdccc292109294517831181c3db30bc2b7be91 SHA512 705e9e1ccf8202062cce61069b5ddb7db5f804dd0736c620640ce5622b9e42fdcbc1417771e77d51aa54beb4562a09b4307f2ff7dec135bd0e31f4941ca36ac8 +DIST postgresql-12.12.tar.bz2 21089064 BLAKE2B 7285dcfc8ed6cf2dbbe29d894dbcef53fad18cbeddbfdb3a43893234a1ee75a9bf5d966968a0c481a8ab15bf8a37400bf6eb4b57a83359501b729e70398e3551 SHA512 eeff79279ac11db04fdddeb2c52ba1ec6b549223b862222540e1f659fbfc3617130699c22694b465bde46b1a4a665c01aef70b68b86d80e58a5657efd019407d DIST postgresql-12.9.tar.bz2 20904260 BLAKE2B fc88d61d369569a3054b889848eaf1405a4f5137cd8c2cf27282115f70853dd4d5d8b4bf0a9fc60c63db936246a0a64077c9bfdb90685d4dfe375558e4519b2b SHA512 11697d8283f5df5a9c74c2406e94d1b6da6df8358ad48f3b773825aab98e8395f9fd4e3fc8b1e6ebad3743c3dadbda8b795d4fe84a447d7913223e136cf2b88f DIST postgresql-13.5.tar.bz2 21186674 BLAKE2B 3e51d6d67bba09fb134cd71c48349674e0cacfaefee299620482c93f0b09edbfead578deb63083686ab691563b088fc0ea60a6281a0bcf9145689fb3ce1ec0f0 SHA512 c76effbca8ee63be48fa3aeb39c7038221848fe83ca2afc4e0904ba8c6a50b89aa2ad37080d4e3be75e9bdc2d6ca6dfefcda334ef55a5e1a8954bb955ce905e5 DIST postgresql-13.6.tar.bz2 21257213 BLAKE2B f5ea95fd9ffc8846e0aaf5bac03b02afa71e62e796bbe40f68af727a2f3c74eddd98cb68427bcc13b87b6fa00a8e2a7b18dd7749318f0a4a32cfdbf9b0e0a873 SHA512 2852726a3031b8d469f1c38f3019af02fc5afe40ec27b22288a29acefd30c63a98806bce88a214d0c2f9177f547b0b5010ad64e70bcbe2c2f1d97a27ae1984f8 DIST postgresql-13.7.tar.bz2 21364433 BLAKE2B 2d8a505f6de4eb31cae415529eeac750a60abafcf45e7fde29043597b385a8150fac55df659f8c2ad200822e8063d388ed606dff9108d4407f9e26b893fa62f4 SHA512 9254f21519c8d4e926f70082503bb5593c91064a3d2a4ea18ac503dfd9aa94751d6f01ce00fca9fec9b2b7af40caf8d0951b661dd8be4d6aa87c1e35b6fa7a41 +DIST postgresql-13.8.tar.bz2 21397381 BLAKE2B eb076382027a175789652a6ae8579d9b9c8856918741e8058456d22f1ef89525cff5fafe863bf615f658bc94b740b00d1268825969e37a7cefed6b5c90f402c5 SHA512 3b39448b291342a5e9b610d410c222aeb85f8acf95632e73e138ae316133af3dadc795a6e706f6447f543cf10df3c786da4f1afa1d91489b50eb77e2d9ed5d84 DIST postgresql-14.1.tar.bz2 21887101 BLAKE2B a496dfd513c52339d1b3cb72773f9611721fd7c5d2a702d6fd71f650a1d41c3d7bf6574eba23671c7f9f11718e007f51f9547949bdc3d7fe1ea2248ebfb8d70b SHA512 4a0bec157d5464bb9e5f5c0eb0efdede55526e03f6f4d660b87d161a47705eb152fa0878960b1581bce42a5ed28a1f457825ea54e8d22e34b5b8eb36473ceefd DIST postgresql-14.2.tar.bz2 21964841 BLAKE2B 6460533a40064404f18642147b949cf7c85d036c45ede478fb9af8919895ee7b09dc78b89ed08a292226911f07cfc9e46d7f2d42e0aaea546c5e97a291d599b9 SHA512 19aeb6528605dbcf5df84048b2eed8f54b202576134d3fe3900bb8f073179c4258d2581acd745887e7e6fa86ebdb5f7b159ffaa0a645d601efee7c5f7730456b DIST postgresql-14.4.tar.bz2 22094218 BLAKE2B 05b65083d826ed2f451b31b29b4b247dfd76b3d24ef05f6be128ee9e58d521d506a3ec4ae4839cbb74d8e217dfae81a95bd97894a778ef3c47b907b85b1fb25e SHA512 dd2f80248684e331d2ffb1e26cd2a285df1fb18710807a0c31aedabf917912ce9267f8ca26318e5371d916c6fe476f8a17886d82d3ff86a974e6f24c19a6aafb +DIST postgresql-14.5.tar.bz2 22132996 BLAKE2B 6d303850ef1e8f9f5d66a53275fc814475646c762b9747a4f0401a472ebaf59be06d6e7c08e9c1c5ad5d3b9dbc3bb3c06d58bae137806e1a437c86bcc8cae501 SHA512 3051c5ab729f6a55952c6108098b022517398b1de64f7fefbdd6c806c7e2eb0637d00f3c98a6203c5bee654656528c4ff3530db5a69470e7888864c77900178a DIST postgresql-15beta2.tar.bz2 23511057 BLAKE2B d1e6d8ce67998d4295587780c2cb75f33b930556e11fd95bbd4d828086f63faed6bbddbb809ebc1fddf0980c83c7cf51e3d37f110d7bb68959dab34f61b5b8c9 SHA512 139bf4f95e2bc8942666009c6680d2b61d8ea2898e9e7eb3a0afb118f0bf6acfac5f21676525cccd82e9ee5c43ad79e07e23a55333e1318426d8b9bc95a4f00d +DIST postgresql-15beta3.tar.bz2 23585136 BLAKE2B cdea196fb62587800f7fceafcbbd781f5636323fc6b205a0e5e0081964f2d08fcb421d0d66f710150dba37f30c2b0e7f7b3119a9a83a0cc573104968b16fc043 SHA512 caf79b889ca1325bcbdce3bbbcb3a0707b8928c8bd7b97f594cfedaedc06826e829a561b2fde73210c1e2596a0201305fa350bb3f12c05783014fc0c8564298a diff --git a/dev-db/postgresql/files/postgresql-13.8-no-server.patch b/dev-db/postgresql/files/postgresql-13.8-no-server.patch new file mode 100644 index 000000000000..295df7087c14 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-13.8-no-server.patch @@ -0,0 +1,144 @@ +--- a/contrib/Makefile ++++ b/contrib/Makefile +@@ -5,56 +5,9 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- adminpack \ +- amcheck \ +- auth_delay \ +- auto_explain \ +- bloom \ +- btree_gin \ +- btree_gist \ +- citext \ +- cube \ +- dblink \ +- dict_int \ +- dict_xsyn \ +- earthdistance \ +- file_fdw \ +- fuzzystrmatch \ +- hstore \ +- intagg \ +- intarray \ +- isn \ +- lo \ +- ltree \ + oid2name \ +- pageinspect \ +- passwordcheck \ +- pg_buffercache \ +- pg_freespacemap \ +- pg_prewarm \ +- pg_standby \ +- pg_stat_statements \ +- pg_trgm \ +- pgcrypto \ +- pgrowlocks \ +- pgstattuple \ +- pg_visibility \ +- postgres_fdw \ +- seg \ +- spi \ +- tablefunc \ +- tcn \ +- test_decoding \ +- tsm_system_rows \ +- tsm_system_time \ +- unaccent \ + vacuumlo + +-ifeq ($(with_openssl),yes) +-SUBDIRS += sslinfo +-else +-ALWAYS_SUBDIRS += sslinfo +-endif + + ifneq ($(with_uuid),no) + SUBDIRS += uuid-ossp +--- a/src/backend/Makefile ++++ b/src/backend/Makefile +@@ -56,7 +56,7 @@ + + ########################################################################## + +-all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP) ++all: generated-headers + + ifneq ($(PORTNAME), cygwin) + ifneq ($(PORTNAME), win32) +@@ -195,23 +195,7 @@ + + ########################################################################## + +-install: all installdirs install-bin +-ifeq ($(PORTNAME), cygwin) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +-ifeq ($(PORTNAME), win32) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +- $(MAKE) -C catalog install-data +- $(MAKE) -C tsearch install-data +- $(MAKE) -C utils install-data +- $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' +- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' +- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' ++install: + + ifeq ($(with_llvm), yes) + install-bin: install-postgres-bitcode +--- a/src/bin/Makefile ++++ b/src/bin/Makefile +@@ -14,21 +14,8 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- initdb \ +- pg_archivecleanup \ +- pg_basebackup \ +- pg_checksums \ + pg_config \ +- pg_controldata \ +- pg_ctl \ + pg_dump \ +- pg_resetwal \ +- pg_rewind \ +- pg_test_fsync \ +- pg_test_timing \ +- pg_upgrade \ +- pg_verifybackup \ +- pg_waldump \ + pgbench \ + psql \ + scripts +--- a/src/Makefile ++++ b/src/Makefile +@@ -15,21 +15,12 @@ + SUBDIRS = \ + common \ + port \ +- timezone \ + backend \ +- backend/utils/mb/conversion_procs \ +- backend/snowball \ + include \ + interfaces \ +- backend/replication/libpqwalreceiver \ +- backend/replication/pgoutput \ + fe_utils \ + bin \ +- pl \ +- makefiles \ +- test/regress \ +- test/isolation \ +- test/perl ++ makefiles + + ifeq ($(with_llvm), yes) + SUBDIRS += backend/jit/llvm diff --git a/dev-db/postgresql/files/postgresql-14.5-no-server.patch b/dev-db/postgresql/files/postgresql-14.5-no-server.patch new file mode 100644 index 000000000000..87bd89b68f19 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-14.5-no-server.patch @@ -0,0 +1,146 @@ +--- a/contrib/Makefile ++++ b/contrib/Makefile +@@ -5,57 +5,9 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- adminpack \ +- amcheck \ +- auth_delay \ +- auto_explain \ +- bloom \ +- btree_gin \ +- btree_gist \ +- citext \ +- cube \ +- dblink \ +- dict_int \ +- dict_xsyn \ +- earthdistance \ +- file_fdw \ +- fuzzystrmatch \ +- hstore \ +- intagg \ +- intarray \ +- isn \ +- lo \ +- ltree \ + oid2name \ +- old_snapshot \ +- pageinspect \ +- passwordcheck \ +- pg_buffercache \ +- pg_freespacemap \ +- pg_prewarm \ +- pg_stat_statements \ +- pg_surgery \ +- pg_trgm \ +- pgcrypto \ +- pgrowlocks \ +- pgstattuple \ +- pg_visibility \ +- postgres_fdw \ +- seg \ +- spi \ +- tablefunc \ +- tcn \ +- test_decoding \ +- tsm_system_rows \ +- tsm_system_time \ +- unaccent \ + vacuumlo + +-ifeq ($(with_ssl),openssl) +-SUBDIRS += sslinfo +-else +-ALWAYS_SUBDIRS += sslinfo +-endif + + ifneq ($(with_uuid),no) + SUBDIRS += uuid-ossp +--- a/src/backend/Makefile ++++ b/src/backend/Makefile +@@ -56,7 +56,7 @@ + + ########################################################################## + +-all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP) ++all: generated-headers + + ifneq ($(PORTNAME), cygwin) + ifneq ($(PORTNAME), win32) +@@ -194,23 +194,7 @@ + + ########################################################################## + +-install: all installdirs install-bin +-ifeq ($(PORTNAME), cygwin) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +-ifeq ($(PORTNAME), win32) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +- $(MAKE) -C catalog install-data +- $(MAKE) -C tsearch install-data +- $(MAKE) -C utils install-data +- $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' +- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' +- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' ++install: + + ifeq ($(with_llvm), yes) + install-bin: install-postgres-bitcode +--- a/src/bin/Makefile ++++ b/src/bin/Makefile +@@ -14,22 +14,8 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- initdb \ +- pg_amcheck \ +- pg_archivecleanup \ +- pg_basebackup \ +- pg_checksums \ + pg_config \ +- pg_controldata \ +- pg_ctl \ + pg_dump \ +- pg_resetwal \ +- pg_rewind \ +- pg_test_fsync \ +- pg_test_timing \ +- pg_upgrade \ +- pg_verifybackup \ +- pg_waldump \ + pgbench \ + psql \ + scripts +--- a/src/Makefile ++++ b/src/Makefile +@@ -15,21 +15,12 @@ + SUBDIRS = \ + common \ + port \ +- timezone \ + backend \ +- backend/utils/mb/conversion_procs \ +- backend/snowball \ + include \ + interfaces \ +- backend/replication/libpqwalreceiver \ +- backend/replication/pgoutput \ + fe_utils \ + bin \ +- pl \ +- makefiles \ +- test/regress \ +- test/isolation \ +- test/perl ++ makefiles + + ifeq ($(with_llvm), yes) + SUBDIRS += backend/jit/llvm diff --git a/dev-db/postgresql/files/postgresql-15_beta3-no-server.patch b/dev-db/postgresql/files/postgresql-15_beta3-no-server.patch new file mode 100644 index 000000000000..9ada0a71d5a0 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-15_beta3-no-server.patch @@ -0,0 +1,146 @@ +--- a/contrib/Makefile ++++ b/contrib/Makefile +@@ -5,59 +5,9 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- adminpack \ +- amcheck \ +- auth_delay \ +- auto_explain \ +- basic_archive \ +- basebackup_to_shell \ +- bloom \ +- btree_gin \ +- btree_gist \ +- citext \ +- cube \ +- dblink \ +- dict_int \ +- dict_xsyn \ +- earthdistance \ +- file_fdw \ +- fuzzystrmatch \ +- hstore \ +- intagg \ +- intarray \ +- isn \ +- lo \ +- ltree \ + oid2name \ +- old_snapshot \ +- pageinspect \ +- passwordcheck \ +- pg_buffercache \ +- pg_freespacemap \ +- pg_prewarm \ +- pg_stat_statements \ +- pg_surgery \ +- pg_trgm \ +- pgrowlocks \ +- pgstattuple \ +- pg_visibility \ +- pg_walinspect \ +- postgres_fdw \ +- seg \ +- spi \ +- tablefunc \ +- tcn \ +- test_decoding \ +- tsm_system_rows \ +- tsm_system_time \ +- unaccent \ + vacuumlo + +-ifeq ($(with_ssl),openssl) +-SUBDIRS += pgcrypto sslinfo +-else +-ALWAYS_SUBDIRS += pgcrypto sslinfo +-endif + + ifneq ($(with_uuid),no) + SUBDIRS += uuid-ossp +--- a/src/backend/Makefile ++++ b/src/backend/Makefile +@@ -56,7 +56,7 @@ + + ########################################################################## + +-all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP) ++all: generated-headers + + ifneq ($(PORTNAME), cygwin) + ifneq ($(PORTNAME), win32) +@@ -194,23 +194,7 @@ + + ########################################################################## + +-install: all installdirs install-bin +-ifeq ($(PORTNAME), cygwin) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +-ifeq ($(PORTNAME), win32) +-ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' +-endif +-endif +- $(MAKE) -C catalog install-data +- $(MAKE) -C tsearch install-data +- $(MAKE) -C utils install-data +- $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' +- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' +- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' ++install: + + ifeq ($(with_llvm), yes) + install-bin: install-postgres-bitcode +--- a/src/bin/Makefile ++++ b/src/bin/Makefile +@@ -14,22 +14,8 @@ + include $(top_builddir)/src/Makefile.global + + SUBDIRS = \ +- initdb \ +- pg_amcheck \ +- pg_archivecleanup \ +- pg_basebackup \ +- pg_checksums \ + pg_config \ +- pg_controldata \ +- pg_ctl \ + pg_dump \ +- pg_resetwal \ +- pg_rewind \ +- pg_test_fsync \ +- pg_test_timing \ +- pg_upgrade \ +- pg_verifybackup \ +- pg_waldump \ + pgbench \ + psql \ + scripts +--- a/src/Makefile ++++ b/src/Makefile +@@ -17,19 +17,11 @@ + port \ + timezone \ + backend \ +- backend/utils/mb/conversion_procs \ +- backend/snowball \ + include \ + interfaces \ +- backend/replication/libpqwalreceiver \ +- backend/replication/pgoutput \ + fe_utils \ + bin \ +- pl \ +- makefiles \ +- test/regress \ +- test/isolation \ +- test/perl ++ makefiles + + ifeq ($(with_llvm), yes) + SUBDIRS += backend/jit/llvm diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-10.22.ebuild similarity index 65% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-10.22.ebuild index cce0a2f8499a..bf8414a03338 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-10.22.ebuild @@ -1,26 +1,28 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info pam python-single-r1 systemd tmpfiles -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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap nls pam perl + python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -29,26 +31,20 @@ CDEPEND=" acct-group/postgres acct-user/postgres sys-apps/less +virtual/libcrypt:= virtual/libintl icu? ( dev-libs/icu:= ) kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap:= ) -llvm? ( - sys-devel/llvm:= - sys-devel/clang:= -) -lz4? ( app-arch/lz4 ) pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) -zstd? ( app-arch/zstd ) " # uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no @@ -73,44 +69,25 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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() { - # still needed as of 2021-08-13 - eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch + # 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\"|" \ @@ -121,12 +98,18 @@ 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 + # https://bugs.gentoo.org/766225 + eapply "${FILESDIR}"/postgresql-10.0-icu68.patch + eapply_user } @@ -150,88 +133,63 @@ src_configure() { [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" fi - local myconf="\ + econf \ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --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 lz4) \ $(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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" - if use alpha; then - myconf+=" --disable-spinlocks" - else - # Should be the default but just in case - myconf+=" --enable-spinlocks" - fi - econf ${myconf} + $(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 - newtmpfiles "${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 @@ -257,74 +215,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,6 +315,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}/" @@ -459,18 +437,17 @@ 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} + if use server && [[ ${UID} -ne 0 ]] ; then 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-11.17.ebuild similarity index 64% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-11.17.ebuild index cce0a2f8499a..f806fd11b70d 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-11.17.ebuild @@ -1,26 +1,29 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) +LLVM_MAX_SLOT=13 -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info llvm pam python-single-r1 systemd tmpfiles -KEYWORDS="" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap llvm nls pam + perl python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -34,21 +37,18 @@ icu? ( dev-libs/icu:= ) kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap:= ) llvm? ( - sys-devel/llvm:= - sys-devel/clang:= + <sys-devel/llvm-14:= + <sys-devel/clang-14:= ) -lz4? ( app-arch/lz4 ) pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) -zstd? ( app-arch/zstd ) " # uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no @@ -73,45 +73,25 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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 llvm && llvm_pkg_setup + + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup use python && python-single-r1_pkg_setup } src_prepare() { - # still needed as of 2021-08-13 - eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch - # Set proper run directory sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ -i src/include/pg_config_manual.h || die @@ -121,8 +101,10 @@ 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 @@ -150,88 +132,64 @@ src_configure() { [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" fi - local myconf="\ + econf \ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --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 lz4) \ $(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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" - if use alpha; then - myconf+=" --disable-spinlocks" - else - # Should be the default but just in case - myconf+=" --enable-spinlocks" - fi - econf ${myconf} + $(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 - newtmpfiles "${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 @@ -257,74 +215,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,6 +315,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}/" @@ -400,9 +378,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 ..." @@ -459,18 +437,17 @@ 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} + if use server && [[ ${UID} -ne 0 ]] ; then 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-12.12.ebuild similarity index 64% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-12.12.ebuild index cce0a2f8499a..389cb9f39c9d 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-12.12.ebuild @@ -1,26 +1,29 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) +LLVM_MAX_SLOT=14 -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info llvm pam python-single-r1 systemd tmpfiles -KEYWORDS="" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap llvm nls pam + perl python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -34,21 +37,18 @@ icu? ( dev-libs/icu:= ) kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap:= ) llvm? ( - sys-devel/llvm:= - sys-devel/clang:= + <sys-devel/llvm-15:= + <sys-devel/clang-15:= ) -lz4? ( app-arch/lz4 ) pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) -zstd? ( app-arch/zstd ) " # uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no @@ -73,45 +73,25 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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 llvm && llvm_pkg_setup + + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup use python && python-single-r1_pkg_setup } src_prepare() { - # still needed as of 2021-08-13 - eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch - # Set proper run directory sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ -i src/include/pg_config_manual.h || die @@ -121,8 +101,10 @@ 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 @@ -150,88 +132,64 @@ src_configure() { [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" fi - local myconf="\ + econf \ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --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 lz4) \ $(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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" - if use alpha; then - myconf+=" --disable-spinlocks" - else - # Should be the default but just in case - myconf+=" --enable-spinlocks" - fi - econf ${myconf} + $(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 - newtmpfiles "${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 @@ -257,74 +215,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,6 +315,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}/" @@ -400,9 +378,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 ..." @@ -459,18 +437,17 @@ 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} + if use server && [[ ${UID} -ne 0 ]] ; then 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-13.8.ebuild similarity index 68% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-13.8.ebuild index cce0a2f8499a..875acbe52592 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-13.8.ebuild @@ -1,26 +1,29 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) +LLVM_MAX_SLOT=14 -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info llvm pam python-single-r1 systemd tmpfiles -KEYWORDS="" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap llvm nls pam + perl python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -34,21 +37,18 @@ icu? ( dev-libs/icu:= ) kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap:= ) llvm? ( - sys-devel/llvm:= - sys-devel/clang:= + <sys-devel/llvm-15:= + <sys-devel/clang-15:= ) -lz4? ( app-arch/lz4 ) pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) -zstd? ( app-arch/zstd ) " # uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no @@ -73,43 +73,25 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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 llvm && llvm_pkg_setup + + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup use python && python-single-r1_pkg_setup } src_prepare() { - # still needed as of 2021-08-13 eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch # Set proper run directory @@ -121,8 +103,10 @@ 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.8-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 @@ -158,25 +142,23 @@ src_configure() { --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ $(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 lz4) \ $(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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" + $(use_enable nls)" if use alpha; then myconf+=" --disable-spinlocks" else @@ -187,51 +169,35 @@ src_configure() { } 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 - newtmpfiles "${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 @@ -257,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,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}/" @@ -400,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 ..." @@ -459,18 +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-14.5.ebuild similarity index 68% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-14.5.ebuild index cce0a2f8499a..6c2b0fe290d3 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-14.5.ebuild @@ -1,26 +1,28 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info pam python-single-r1 systemd tmpfiles -KEYWORDS="" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap llvm lz4 nls pam + perl python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -42,13 +44,11 @@ pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) -zstd? ( app-arch/zstd ) " # uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no @@ -73,45 +73,23 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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() { - # still needed as of 2021-08-13 - eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch - # Set proper run directory sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ -i src/include/pg_config_manual.h || die @@ -121,8 +99,10 @@ 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}-14.5-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 @@ -158,7 +138,6 @@ src_configure() { --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ $(use_enable debug) \ - $(use_enable nls) \ $(use_enable threads thread-safety) \ $(use_with icu) \ $(use_with kerberos gssapi) \ @@ -170,13 +149,13 @@ 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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" + $(use_enable nls)" if use alpha; then myconf+=" --disable-spinlocks" else @@ -187,51 +166,35 @@ src_configure() { } 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 - newtmpfiles "${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 @@ -257,74 +220,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,6 +320,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}/" @@ -400,9 +383,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 ..." @@ -459,18 +442,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-15_beta3.ebuild similarity index 68% copy from dev-db/postgresql/postgresql-9999.ebuild copy to dev-db/postgresql/postgresql-15_beta3.ebuild index cce0a2f8499a..a805f1d90ea9 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-15_beta3.ebuild @@ -1,26 +1,28 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic linux-info pam python-single-r1 systemd tmpfiles KEYWORDS="" -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 ldap llvm +lz4 - nls pam perl python +readline selinux server systemd - ssl static-libs tcl threads uuid xml zlib zstd" +IUSE="debug doc icu kerberos ldap llvm lz4 nls pam + perl python +readline selinux +server systemd ssl static-libs tcl + threads uuid xml zlib zstd" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -42,10 +44,9 @@ pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) readline? ( sys-libs/readline:0= ) +server? ( systemd? ( sys-apps/systemd ) ) ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) -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 ) zstd? ( app-arch/zstd ) @@ -73,45 +74,23 @@ uuid? ( )" DEPEND="${CDEPEND} ->=dev-lang/perl-5.8 -app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.5 -app-text/docbook-xml-dtd:4.5 -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() { - # still needed as of 2021-08-13 - eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch - # Set proper run directory sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ -i src/include/pg_config_manual.h || die @@ -121,8 +100,10 @@ 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}-15_beta3-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 @@ -158,7 +139,6 @@ src_configure() { --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ $(use_enable debug) \ - $(use_enable nls) \ $(use_enable threads thread-safety) \ $(use_with icu) \ $(use_with kerberos gssapi) \ @@ -170,13 +150,14 @@ 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 zstd ) \ - $(use_with systemd) \ - ${uuid_config}" + $(use_with zstd) \ + $(use_enable nls)" if use alpha; then myconf+=" --disable-spinlocks" else @@ -187,51 +168,35 @@ src_configure() { } 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 - newtmpfiles "${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 @@ -257,74 +222,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 + newtmpfiles "${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 && tmpfiles_process ${PN}-${SLOT}.conf + use server && use systemd && tmpfiles_process ${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"; @@ -339,6 +322,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}/" @@ -400,9 +385,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 ..." @@ -459,18 +444,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-9999.ebuild index cce0a2f8499a..92b4cf038a8d 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-9999.ebuild @@ -1,12 +1,11 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8,9,10} ) +PYTHON_COMPAT=( python3_{8,9,10,11} ) -inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \ - systemd tmpfiles +inherit flag-o-matic git-r3 linux-info pam python-single-r1 systemd tmpfiles KEYWORDS=""