git: a45ed18ebabb - main - www/hs-postgrest: Added an option for support database connection poolers

Li-Wen Hsu lwhsu at FreeBSD.org
Sat Jun 19 09:55:42 UTC 2021


The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a45ed18ebabb5a37a5b3552bb1acda8d6f285721

commit a45ed18ebabb5a37a5b3552bb1acda8d6f285721
Author:     Dmitry Wagin <dmitry.wagin at ya.ru>
AuthorDate: 2021-06-02 11:45:46 +0000
Commit:     Li-Wen Hsu <lwhsu at FreeBSD.org>
CommitDate: 2021-06-19 09:54:12 +0000

    www/hs-postgrest: Added an option for support database connection poolers
    
    Small cleanups included
    
    PR:             255969
---
 www/hs-postgrest/Makefile                          | 33 +++++++++++++---------
 ...l__deps_hasql-1.4.2_library_Hasql_Private_IO.hs | 13 +++++++++
 www/hs-postgrest/files/postgrest.in                |  1 +
 www/hs-postgrest/pkg-plist                         |  2 --
 4 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/www/hs-postgrest/Makefile b/www/hs-postgrest/Makefile
index d61a89e1d6a8..6e6bf7b1f5ce 100644
--- a/www/hs-postgrest/Makefile
+++ b/www/hs-postgrest/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	postgrest
 PORTVERSION=	7.0.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	www databases haskell
 
 MAINTAINER=	dmitry.wagin at ya.ru
@@ -14,6 +14,7 @@ ONLY_FOR_ARCHS=	amd64 i386
 BUILD_DEPENDS=	pg_config:databases/postgresql${PGSQL_DEFAULT}-client
 
 USES=		cabal pgsql
+USE_RC_SUBR=	postgrest
 
 USE_CABAL=	HTTP-4000.3.14_1 \
 		HUnit-1.6.0.0 \
@@ -82,6 +83,7 @@ USE_CABAL=	HTTP-4000.3.14_1 \
 		free-5.1.3 \
 		generics-sop-0.5.1.0 \
 		gitrev-1.3.1 \
+		happy-1.19.12 \
 		hashable-1.3.0.0_1 \
 		hashtables-1.2.3.4 \
 		haskell-src-exts-1.23.0 \
@@ -91,6 +93,7 @@ USE_CABAL=	HTTP-4000.3.14_1 \
 		hasql-transaction-1.0.0.1 \
 		heredoc-0.2.0.0 \
 		hourglass-0.2.12 \
+		hsc2hs-0.68.7 \
 		http-date-0.0.8 \
 		http-media-0.8.0.0_3 \
 		http-types-0.12.3 \
@@ -191,29 +194,33 @@ USE_CABAL=	HTTP-4000.3.14_1 \
 		warp-3.3.11 \
 		word8-0.1.3 \
 		x509-1.7.5_1 \
-		zlib-0.6.2.1_1 \
-		\
-		happy-1.19.12 \
-		hsc2hs-0.68.7
+		zlib-0.6.2.1_1
+
+SKIP_CABAL_PLIST=	yes
 
 POSTGREST_USER?=	postgrest
 POSTGREST_GROUP?=	postgrest
 
+SUB_FILES=	default.conf
+SUB_LIST=	ETCDIR=${ETCDIR} \
+		POSTGREST_GROUP=${POSTGREST_GROUP} \
+		POSTGREST_USER=${POSTGREST_USER}
+
 USERS=		${POSTGREST_USER}
 GROUPS=		${POSTGREST_GROUP}
 
-SUB_FILES=	default.conf
-SUB_LIST=	ETCDIR=${ETCDIR} \
-		POSTGREST_USER=${POSTGREST_USER} \
-		POSTGREST_GROUP=${POSTGREST_GROUP}
+PLIST_FILES=	"@sample ${ETCDIR}/default.conf.sample" \
+		sbin/postgrest
 
 PLIST_SUB=	ETCDIR=${ETCDIR} \
-		POSTGREST_USER=${POSTGREST_USER} \
-		POSTGREST_GROUP=${POSTGREST_GROUP}
+		POSTGREST_GROUP=${POSTGREST_GROUP} \
+		POSTGREST_USER=${POSTGREST_USER}
 
-USE_RC_SUBR=	postgrest
+OPTIONS_DEFINE=		POOLER
+OPTIONS_DEFAULT=	POOLER
 
-SKIP_CABAL_PLIST=	yes
+POOLER_DESC=		Connection pooler support (disable usage of prepared statements)
+POOLER_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-__cabal__deps_hasql-1.4.2_library_Hasql_Private_IO.hs
 
 do-install:
 	@${MKDIR} ${STAGEDIR}${ETCDIR}
diff --git a/www/hs-postgrest/files/extra-patch-__cabal__deps_hasql-1.4.2_library_Hasql_Private_IO.hs b/www/hs-postgrest/files/extra-patch-__cabal__deps_hasql-1.4.2_library_Hasql_Private_IO.hs
new file mode 100644
index 000000000000..a5639d5199ba
--- /dev/null
+++ b/www/hs-postgrest/files/extra-patch-__cabal__deps_hasql-1.4.2_library_Hasql_Private_IO.hs
@@ -0,0 +1,13 @@
+--- _cabal_deps/hasql-1.4.2/library/Hasql/Private/IO.hs.orig	2020-03-21 17:55:07 UTC
++++ _cabal_deps/hasql-1.4.2/library/Hasql/Private/IO.hs
+@@ -157,9 +157,7 @@ sendParametricStatement ::
+   IO (Either CommandError ())
+ sendParametricStatement connection integerDatetimes registry template encoder prepared params =
+   {-# SCC "sendParametricStatement" #-} 
+-  if prepared
+-    then sendPreparedParametricStatement connection registry integerDatetimes template encoder params
+-    else sendUnpreparedParametricStatement connection integerDatetimes template encoder params
++  sendUnpreparedParametricStatement connection integerDatetimes template encoder params
+ 
+ {-# INLINE sendNonparametricStatement #-}
+ sendNonparametricStatement :: LibPQ.Connection -> ByteString -> IO (Either CommandError ())
diff --git a/www/hs-postgrest/files/postgrest.in b/www/hs-postgrest/files/postgrest.in
index 7dac382dd80a..7ad89ce8615a 100644
--- a/www/hs-postgrest/files/postgrest.in
+++ b/www/hs-postgrest/files/postgrest.in
@@ -2,6 +2,7 @@
 
 # PROVIDE: postgrest
 # REQUIRE: LOGIN
+# BEFORE: nginx
 # KEYWORD: shutdown
 #
 # Add postgrest_enable="YES" to /etc/rc.conf to enable PostgREST:
diff --git a/www/hs-postgrest/pkg-plist b/www/hs-postgrest/pkg-plist
deleted file mode 100644
index 57a62545511d..000000000000
--- a/www/hs-postgrest/pkg-plist
+++ /dev/null
@@ -1,2 +0,0 @@
-sbin/postgrest
- at sample %%ETCDIR%%/default.conf.sample


More information about the dev-commits-ports-main mailing list