commit:     2a8cb51bcb1e0abcc645b1d54d381f15be153a7c
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 14 05:35:14 2023 +0000
Commit:     罗百科 <patrick <AT> gentoo <DOT> org>
CommitDate: Tue Feb 14 05:37:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a8cb51b

dev-db/citus: Fix compilation for 11.1.5

Same fix as 11.2.0 just before

Closes: https://bugs.gentoo.org/894234
Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 dev-db/citus/citus-11.1.5.ebuild               |  6 ++
 dev-db/citus/files/citus-11.1.5-redefine.patch | 79 ++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/dev-db/citus/citus-11.1.5.ebuild b/dev-db/citus/citus-11.1.5.ebuild
index 1b91866bc2b8..481138f6c14e 100644
--- a/dev-db/citus/citus-11.1.5.ebuild
+++ b/dev-db/citus/citus-11.1.5.ebuild
@@ -30,6 +30,12 @@ DEPEND="${POSTGRES_DEP}
        "
 RDEPEND="${DEPEND}"
 
+src_prepare() {
+       eapply "${FILESDIR}"/citus-11.1.5-redefine.patch
+
+       postgres-multi_src_prepare
+}
+
 src_configure() {
        postgres-multi_foreach econf
 }

diff --git a/dev-db/citus/files/citus-11.1.5-redefine.patch 
b/dev-db/citus/files/citus-11.1.5-redefine.patch
new file mode 100644
index 000000000000..442dbd86f6a8
--- /dev/null
+++ b/dev-db/citus/files/citus-11.1.5-redefine.patch
@@ -0,0 +1,79 @@
+From 0ff23c07da236225ac7c14736af6b43df5fb8ac8 Mon Sep 17 00:00:00 2001
+From: Jelte Fennema <jelte.fenn...@microsoft.com>
+Date: Fri, 10 Feb 2023 16:02:03 +0100
+Subject: [PATCH] Support compilation and run tests on latest PG versions
+ (#6711)
+
+Postgres got minor updates this starts using the images with the latest
+version for our tests.
+
+These new Postgres versions caused a compilation issue in PG14 and PG13
+due to some function being backported that we had already backported
+ourselves. Due this backport being a static inline function it doesn't
+matter who provides this and there will be no linkage errors when either
+running old Citus packages on new PG versions or the other way around.
+
+(cherry picked from commit 3200187757600180fa2b90a5fdba13cbf8aee8b6)
+---
+ .circleci/config.yml            | 10 +++++-----
+ src/include/pg_version_compat.h | 11 +++++++++++
+ 2 files changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/.circleci/config.yml b/.circleci/config.yml
+index 67428095869..d76688ae316 100644
+--- a/.circleci/config.yml
++++ b/.circleci/config.yml
+@@ -6,19 +6,19 @@ orbs:
+ parameters:
+   image_suffix:
+     type: string
+-    default: '-v186a1be'
++    default: '-vc4b1573'
+   pg13_version:
+     type: string
+-    default: '13.8'
++    default: '13.10'
+   pg14_version:
+     type: string
+-    default: '14.5'
++    default: '14.7'
+   pg15_version:
+     type: string
+-    default: '15.0'
++    default: '15.2'
+   upgrade_pg_versions:
+     type: string
+-    default: '13.8-14.5-15.0'
++    default: '13.10-14.7-15.2'
+   style_checker_tools_version:
+     type: string
+     default: '0.8.18'
+diff --git a/src/include/pg_version_compat.h b/src/include/pg_version_compat.h
+index fcb857c4111..eb81bca43ac 100644
+--- a/src/include/pg_version_compat.h
++++ b/src/include/pg_version_compat.h
+@@ -55,6 +55,14 @@ pg_strtoint64(char *s)
+ }
+ 
+ 
++/*
++ * RelationGetSmgr got backported in 13.10 and 14.7 so redefining it for any
++ * version higher causes compilation errors due to redefining of the function.
++ * We want to use it in all versions. So we backport it ourselves in earlier
++ * versions, and rely on the Postgres provided version in the later versions.
++ */
++#if PG_VERSION_NUM >= PG_VERSION_13 && PG_VERSION_NUM < 130010 \
++      || PG_VERSION_NUM >= PG_VERSION_14 && PG_VERSION_NUM < 140007
+ static inline SMgrRelation
+ RelationGetSmgr(Relation rel)
+ {
+@@ -66,6 +74,9 @@ RelationGetSmgr(Relation rel)
+ }
+ 
+ 
++#endif
++
++
+ #define CREATE_SEQUENCE_COMMAND \
+       "CREATE SEQUENCE IF NOT EXISTS %s AS %s INCREMENT BY " INT64_FORMAT \
+       " MINVALUE " INT64_FORMAT " MAXVALUE " INT64_FORMAT \

Reply via email to