postgresql: move python to 3.x, other tweaks

2021-02-24 Thread Stuart Henderson
Seems a good time to move pgsql to python 3. While there I fixed a
missing flag in pkg-readme and, on reflection (and following feedback
from other developers) there are some cases where pg_upgrade doesn't
work (especially involving extensions) so I have brought back the
@ask-update that I changed from "previous" to "previous - 1".

comments? ok?

Index: Makefile
===
RCS file: /cvs/ports/databases/postgresql/Makefile,v
retrieving revision 1.269
diff -u -p -r1.269 Makefile
--- Makefile23 Feb 2021 19:39:12 -  1.269
+++ Makefile24 Feb 2021 17:45:35 -
@@ -9,6 +9,7 @@ COMMENT-pg_upgrade=Support for upgrading
 
 VERSION=   13.2
 PREV_MAJOR=12
+REVISION=  0
 DISTNAME=  postgresql-${VERSION}
 PKGNAME-main=  postgresql-client-${VERSION}
 PKGNAME-server=postgresql-server-${VERSION}
@@ -48,7 +49,6 @@ USE_GMAKE=Yes
 CONFIGURE_STYLE=gnu
 
 MODULES=   lang/python
-MODPY_VERSION =${MODPY_DEFAULT_VERSION_2}
 MODPY_RUNDEP=  No
 
 CONFIGURE_ENV= ac_cv_path_PYTHON=${MODPY_BIN} \
Index: pkg/PLIST-plpython
===
RCS file: /cvs/ports/databases/postgresql/pkg/PLIST-plpython,v
retrieving revision 1.10
diff -u -p -r1.10 PLIST-plpython
--- pkg/PLIST-plpython  9 Feb 2021 20:01:37 -   1.10
+++ pkg/PLIST-plpython  24 Feb 2021 17:45:35 -
@@ -1,10 +1,10 @@
 @comment $OpenBSD: PLIST-plpython,v 1.10 2021/02/09 20:01:37 sthen Exp $
 include/postgresql/server/plpy_util.h
 include/postgresql/server/plpython.h
-@so lib/postgresql/hstore_plpython2.so
-@so lib/postgresql/jsonb_plpython2.so
-@so lib/postgresql/ltree_plpython2.so
-@so lib/postgresql/plpython2.so
+@so lib/postgresql/hstore_plpython3.so
+@so lib/postgresql/jsonb_plpython3.so
+@so lib/postgresql/ltree_plpython3.so
+@so lib/postgresql/plpython3.so
 share/postgresql/extension/hstore_plpython2u--1.0.sql
 share/postgresql/extension/hstore_plpython2u.control
 share/postgresql/extension/hstore_plpython3u--1.0.sql
@@ -23,7 +23,5 @@ share/postgresql/extension/ltree_plpytho
 share/postgresql/extension/ltree_plpython3u.control
 share/postgresql/extension/ltree_plpythonu--1.0.sql
 share/postgresql/extension/ltree_plpythonu.control
-share/postgresql/extension/plpython2u--1.0.sql
-share/postgresql/extension/plpython2u.control
-share/postgresql/extension/plpythonu--1.0.sql
-share/postgresql/extension/plpythonu.control
+share/postgresql/extension/plpython3u--1.0.sql
+share/postgresql/extension/plpython3u.control
Index: pkg/PLIST-server
===
RCS file: /cvs/ports/databases/postgresql/pkg/PLIST-server,v
retrieving revision 1.41
diff -u -p -r1.41 PLIST-server
--- pkg/PLIST-server9 Feb 2021 20:01:37 -   1.41
+++ pkg/PLIST-server24 Feb 2021 17:45:35 -
@@ -4,9 +4,18 @@
 @conflict postgresql-clients-*
 @conflict postgresql-server-*
 @conflict postgresql-*
-@ask-update postgresql-server-<${PREV_MAJOR} Old version too old for 
pg_upgrade, make sure your database is backed up
+@ask-update postgresql-server-<${V_MAJOR} Updating across a major version - 
data migration needed, see the pkg-readme
+@ask-update postgresql-server-<${PREV_MAJOR} CAUTION! Version before 
${PREV_MAJOR} is too old for pg_upgrade. Make sure your database is backed up
 @newgroup _postgresql:503
 @newuser _postgresql:503:_postgresql:daemon:PostgreSQL 
Manager:/var/postgresql:/bin/sh
+@rcscript ${RCDIR}/postgresql
+@mode 755
+@owner _postgresql
+@group _postgresql
+@sample /var/postgresql/
+@mode
+@owner
+@group
 @bin bin/initdb
 @bin bin/pg_basebackup
 @bin bin/pg_checksums
@@ -950,8 +959,3 @@ share/postgresql/tsearch_data/thesaurus_
 share/postgresql/tsearch_data/turkish.stop
 share/postgresql/tsearch_data/unaccent.rules
 share/postgresql/tsearch_data/xsyn_sample.rules
-@rcscript ${RCDIR}/postgresql
-@mode 755
-@owner _postgresql
-@group _postgresql
-@sample /var/postgresql/
Index: pkg/README-server
===
RCS file: /cvs/ports/databases/postgresql/pkg/README-server,v
retrieving revision 1.32
diff -u -p -r1.32 README-server
--- pkg/README-server   9 Feb 2021 20:01:37 -   1.32
+++ pkg/README-server   24 Feb 2021 17:45:35 -
@@ -168,7 +168,7 @@ faster than a dump and reload, especiall
 
 (The database environment defaults to UTF-8 if your terminal is already
 in a UTF-8 locale; if that is the case and you require an ASCII database
-environment, use "initdb --locale=C /var/postgresql/data [...]").
+environment, use "initdb --locale=C -D /var/postgresql/data [...]").
 
 5) Temporarily support connecting without a password for local users by
editing pg_hba.conf to include "local all postgres trust"



Re: postgresql: move python to 3.x, other tweaks

2021-03-01 Thread Stuart Henderson
On 2021/02/24 17:50, Stuart Henderson wrote:
> Seems a good time to move pgsql to python 3. While there I fixed a
> missing flag in pkg-readme and, on reflection (and following feedback
> from other developers) there are some cases where pg_upgrade doesn't
> work (especially involving extensions) so I have brought back the
> @ask-update that I changed from "previous" to "previous - 1".
> 
> comments? ok?

I've committed the other tweaks as they're trivial, plus a libexecinfo
fix as it was breaking in bulk build, but haven't changed to py3 yet.
Here's an updated diff with the py3 parts.

Index: Makefile
===
RCS file: /cvs/ports/databases/postgresql/Makefile,v
retrieving revision 1.270
diff -u -p -r1.270 Makefile
--- Makefile1 Mar 2021 13:40:08 -   1.270
+++ Makefile1 Mar 2021 13:41:16 -
@@ -9,7 +9,7 @@ COMMENT-pg_upgrade=Support for upgrading
 
 VERSION=   13.2
 PREV_MAJOR=12
-REVISION=  0
+REVISION=  1
 DISTNAME=  postgresql-${VERSION}
 PKGNAME-main=  postgresql-client-${VERSION}
 PKGNAME-server=postgresql-server-${VERSION}
@@ -49,7 +49,6 @@ USE_GMAKE=Yes
 CONFIGURE_STYLE=gnu
 
 MODULES=   lang/python
-MODPY_VERSION= ${MODPY_DEFAULT_VERSION_2}
 MODPY_RUNDEP=  No
 
 CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
Index: pkg/PLIST-plpython
===
RCS file: /cvs/ports/databases/postgresql/pkg/PLIST-plpython,v
retrieving revision 1.10
diff -u -p -r1.10 PLIST-plpython
--- pkg/PLIST-plpython  9 Feb 2021 20:01:37 -   1.10
+++ pkg/PLIST-plpython  1 Mar 2021 13:41:16 -
@@ -1,10 +1,10 @@
 @comment $OpenBSD: PLIST-plpython,v 1.10 2021/02/09 20:01:37 sthen Exp $
 include/postgresql/server/plpy_util.h
 include/postgresql/server/plpython.h
-@so lib/postgresql/hstore_plpython2.so
-@so lib/postgresql/jsonb_plpython2.so
-@so lib/postgresql/ltree_plpython2.so
-@so lib/postgresql/plpython2.so
+@so lib/postgresql/hstore_plpython3.so
+@so lib/postgresql/jsonb_plpython3.so
+@so lib/postgresql/ltree_plpython3.so
+@so lib/postgresql/plpython3.so
 share/postgresql/extension/hstore_plpython2u--1.0.sql
 share/postgresql/extension/hstore_plpython2u.control
 share/postgresql/extension/hstore_plpython3u--1.0.sql
@@ -23,7 +23,5 @@ share/postgresql/extension/ltree_plpytho
 share/postgresql/extension/ltree_plpython3u.control
 share/postgresql/extension/ltree_plpythonu--1.0.sql
 share/postgresql/extension/ltree_plpythonu.control
-share/postgresql/extension/plpython2u--1.0.sql
-share/postgresql/extension/plpython2u.control
-share/postgresql/extension/plpythonu--1.0.sql
-share/postgresql/extension/plpythonu.control
+share/postgresql/extension/plpython3u--1.0.sql
+share/postgresql/extension/plpython3u.control



Re: postgresql: move python to 3.x, other tweaks

2021-03-01 Thread Klemens Nanni
On Mon, Mar 01, 2021 at 01:43:05PM +, Stuart Henderson wrote:
> On 2021/02/24 17:50, Stuart Henderson wrote:
> > Seems a good time to move pgsql to python 3. While there I fixed a
> > missing flag in pkg-readme and, on reflection (and following feedback
> > from other developers) there are some cases where pg_upgrade doesn't
> > work (especially involving extensions) so I have brought back the
> > @ask-update that I changed from "previous" to "previous - 1".
> > 
> > comments? ok?
> 
> I've committed the other tweaks as they're trivial, plus a libexecinfo
> fix as it was breaking in bulk build, but haven't changed to py3 yet.
> Here's an updated diff with the py3 parts.
I'm not a Postgres user on OpenBSD but that looks good to me portwise.

> Index: Makefile
> ===
> RCS file: /cvs/ports/databases/postgresql/Makefile,v
> retrieving revision 1.270
> diff -u -p -r1.270 Makefile
> --- Makefile  1 Mar 2021 13:40:08 -   1.270
> +++ Makefile  1 Mar 2021 13:41:16 -
> @@ -9,7 +9,7 @@ COMMENT-pg_upgrade=Support for upgrading
>  
>  VERSION= 13.2
>  PREV_MAJOR=  12
> -REVISION=0
> +REVISION=1
>  DISTNAME=postgresql-${VERSION}
>  PKGNAME-main=postgresql-client-${VERSION}
>  PKGNAME-server=  postgresql-server-${VERSION}
> @@ -49,7 +49,6 @@ USE_GMAKE=  Yes
>  CONFIGURE_STYLE=gnu
>  
>  MODULES= lang/python
> -MODPY_VERSION=   ${MODPY_DEFAULT_VERSION_2}
>  MODPY_RUNDEP=No
>  
>  CONFIGURE_ENV=   CPPFLAGS="-I${LOCALBASE}/include" \
> Index: pkg/PLIST-plpython
> ===
> RCS file: /cvs/ports/databases/postgresql/pkg/PLIST-plpython,v
> retrieving revision 1.10
> diff -u -p -r1.10 PLIST-plpython
> --- pkg/PLIST-plpython9 Feb 2021 20:01:37 -   1.10
> +++ pkg/PLIST-plpython1 Mar 2021 13:41:16 -
> @@ -1,10 +1,10 @@
>  @comment $OpenBSD: PLIST-plpython,v 1.10 2021/02/09 20:01:37 sthen Exp $
>  include/postgresql/server/plpy_util.h
>  include/postgresql/server/plpython.h
> -@so lib/postgresql/hstore_plpython2.so
> -@so lib/postgresql/jsonb_plpython2.so
> -@so lib/postgresql/ltree_plpython2.so
> -@so lib/postgresql/plpython2.so
> +@so lib/postgresql/hstore_plpython3.so
> +@so lib/postgresql/jsonb_plpython3.so
> +@so lib/postgresql/ltree_plpython3.so
> +@so lib/postgresql/plpython3.so
Should/coulde those use MODPY_MAJOR_VERSION instead of 2/3?

>  share/postgresql/extension/hstore_plpython2u--1.0.sql
>  share/postgresql/extension/hstore_plpython2u.control
>  share/postgresql/extension/hstore_plpython3u--1.0.sql
> @@ -23,7 +23,5 @@ share/postgresql/extension/ltree_plpytho
>  share/postgresql/extension/ltree_plpython3u.control
>  share/postgresql/extension/ltree_plpythonu--1.0.sql
>  share/postgresql/extension/ltree_plpythonu.control
> -share/postgresql/extension/plpython2u--1.0.sql
> -share/postgresql/extension/plpython2u.control
> -share/postgresql/extension/plpythonu--1.0.sql
> -share/postgresql/extension/plpythonu.control
> +share/postgresql/extension/plpython3u--1.0.sql
> +share/postgresql/extension/plpython3u.control
> 



Re: postgresql: move python to 3.x, other tweaks

2021-03-02 Thread Pierre-Emmanuel André
On Mon, Mar 01, 2021 at 01:43:05PM +, Stuart Henderson wrote:
> On 2021/02/24 17:50, Stuart Henderson wrote:
> > Seems a good time to move pgsql to python 3. While there I fixed a
> > missing flag in pkg-readme and, on reflection (and following feedback
> > from other developers) there are some cases where pg_upgrade doesn't
> > work (especially involving extensions) so I have brought back the
> > @ask-update that I changed from "previous" to "previous - 1".
> > 
> > comments? ok?
> 
> I've committed the other tweaks as they're trivial, plus a libexecinfo
> fix as it was breaking in bulk build, but haven't changed to py3 yet.
> Here's an updated diff with the py3 parts.
>

Yes looks good to me.
ok pea@

> Index: Makefile
> ===
> RCS file: /cvs/ports/databases/postgresql/Makefile,v
> retrieving revision 1.270
> diff -u -p -r1.270 Makefile
> --- Makefile  1 Mar 2021 13:40:08 -   1.270
> +++ Makefile  1 Mar 2021 13:41:16 -
> @@ -9,7 +9,7 @@ COMMENT-pg_upgrade=Support for upgrading
>  
>  VERSION= 13.2
>  PREV_MAJOR=  12
> -REVISION=0
> +REVISION=1
>  DISTNAME=postgresql-${VERSION}
>  PKGNAME-main=postgresql-client-${VERSION}
>  PKGNAME-server=  postgresql-server-${VERSION}
> @@ -49,7 +49,6 @@ USE_GMAKE=  Yes
>  CONFIGURE_STYLE=gnu
>  
>  MODULES= lang/python
> -MODPY_VERSION=   ${MODPY_DEFAULT_VERSION_2}
>  MODPY_RUNDEP=No
>  
>  CONFIGURE_ENV=   CPPFLAGS="-I${LOCALBASE}/include" \
> Index: pkg/PLIST-plpython
> ===
> RCS file: /cvs/ports/databases/postgresql/pkg/PLIST-plpython,v
> retrieving revision 1.10
> diff -u -p -r1.10 PLIST-plpython
> --- pkg/PLIST-plpython9 Feb 2021 20:01:37 -   1.10
> +++ pkg/PLIST-plpython1 Mar 2021 13:41:16 -
> @@ -1,10 +1,10 @@
>  @comment $OpenBSD: PLIST-plpython,v 1.10 2021/02/09 20:01:37 sthen Exp $
>  include/postgresql/server/plpy_util.h
>  include/postgresql/server/plpython.h
> -@so lib/postgresql/hstore_plpython2.so
> -@so lib/postgresql/jsonb_plpython2.so
> -@so lib/postgresql/ltree_plpython2.so
> -@so lib/postgresql/plpython2.so
> +@so lib/postgresql/hstore_plpython3.so
> +@so lib/postgresql/jsonb_plpython3.so
> +@so lib/postgresql/ltree_plpython3.so
> +@so lib/postgresql/plpython3.so
>  share/postgresql/extension/hstore_plpython2u--1.0.sql
>  share/postgresql/extension/hstore_plpython2u.control
>  share/postgresql/extension/hstore_plpython3u--1.0.sql
> @@ -23,7 +23,5 @@ share/postgresql/extension/ltree_plpytho
>  share/postgresql/extension/ltree_plpython3u.control
>  share/postgresql/extension/ltree_plpythonu--1.0.sql
>  share/postgresql/extension/ltree_plpythonu.control
> -share/postgresql/extension/plpython2u--1.0.sql
> -share/postgresql/extension/plpython2u.control
> -share/postgresql/extension/plpythonu--1.0.sql
> -share/postgresql/extension/plpythonu.control
> +share/postgresql/extension/plpython3u--1.0.sql
> +share/postgresql/extension/plpython3u.control
>