Skip to content

Commit df2d2e1

Browse files
authored
Update PostGIS to 3.5.1 (#130)
Remove hardcoded Postgres extension version while at it and add an EdgeQL-only version of the package.
1 parent 6449b72 commit df2d2e1

9 files changed

+359
-39
lines changed

edgedbpkg/edgedb_ext/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .base import EdgeDBExtension
1+
from .base import EdgeDBExtension, PGEXT_VERSION_AUTO
22

3-
__all__ = ("EdgeDBExtension",)
3+
__all__ = ("EdgeDBExtension", "PGEXT_VERSION_AUTO")

edgedbpkg/edgedb_ext/base.py

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
+ "/tests/extension-testing/exts.mk"
2525
)
2626

27+
PGEXT_VERSION_AUTO = "auto"
28+
2729

2830
class EdgeDBExtension(packages.BuildSystemMakePackage):
2931
# Populated in resolve() when this is built as top-level package.
3032
bundle_deps: list[packages.BundledPackage] = []
31-
_edb: edgedb.EdgeDB
33+
_edb: edgedb.EdgeDB | None
3234
_pgext: poetry_dep.Dependency
3335

3436
@classmethod
@@ -48,34 +50,62 @@ def resolve(
4850
server_slot, _, version = version.rpartition("!")
4951

5052
if not server_slot:
51-
raise RuntimeError(
52-
"must specify EdgeDB version as epoch, eg 5!1.0"
53-
)
53+
if cls.is_universal():
54+
edb = None
55+
else:
56+
raise RuntimeError(
57+
"must specify EdgeDB version as epoch, eg 5!1.0"
58+
)
59+
else:
60+
edb_ver = poetry_version.Version.parse(server_slot)
61+
if edb_ver.minor is None:
62+
edb_ver = edb_ver.replace(
63+
release=dataclasses.replace(edb_ver.release, minor=0),
64+
)
5465

55-
edb_ver = poetry_version.Version.parse(server_slot)
56-
if edb_ver.minor is None:
57-
edb_ver = edb_ver.replace(
58-
release=dataclasses.replace(edb_ver.release, minor=0),
66+
edb = edgedb.EdgeDB.resolve(
67+
io,
68+
version=f"v{edb_ver}",
69+
is_release=edb_ver.dev is None,
70+
target=target,
5971
)
6072

61-
edb = edgedb.EdgeDB.resolve(
62-
io,
63-
version=f"v{edb_ver}",
64-
is_release=edb_ver.dev is None,
65-
target=target,
66-
)
67-
6873
if requires is None:
6974
requires = []
7075
else:
7176
requires = list(requires)
7277

78+
if name is None:
79+
pkgname = cls.ident.removeprefix("edbext-")
80+
else:
81+
pkgname = str(name)
82+
83+
if edb is not None:
84+
name = packages.canonicalize_name(f"{edb.name_slot}-{pkgname}")
85+
else:
86+
name = packages.canonicalize_name(pkgname)
87+
88+
ext = super().resolve(
89+
io,
90+
name=name,
91+
version=version,
92+
revision=revision,
93+
is_release=is_release,
94+
target=target,
95+
requires=requires,
96+
)
97+
ext._edb = edb
98+
7399
pgext_ver = cls.get_pgext_ver()
100+
if pgext_ver is PGEXT_VERSION_AUTO:
101+
self_ver = ext.version.without_local().without_postrelease()
102+
pgext_ver = self_ver.to_string()
74103

75104
pg_ext: pgext.PostgresCExtension | None
76105
if pgext_ver:
77106
# Find the postgres version
78-
for dep in edb.get_requirements():
107+
reqs = edb.get_requirements() if edb is not None else []
108+
for dep in reqs:
79109
if dep.name == "postgresql-edgedb":
80110
pg = packages.get_bundled_pkg(dep)
81111
break
@@ -102,25 +132,8 @@ def resolve(
102132
else:
103133
pg_ext = None
104134

105-
if name is None:
106-
pkgname = cls.ident.removeprefix("edbext-")
107-
else:
108-
pkgname = str(name)
109-
110-
name = packages.canonicalize_name(f"{edb.name_slot}-{pkgname}")
111-
112-
ext = super().resolve(
113-
io,
114-
name=name,
115-
version=version,
116-
revision=revision,
117-
is_release=is_release,
118-
target=target,
119-
requires=requires,
120-
)
121-
ext._edb = edb
122-
123135
if pg_ext is not None:
136+
ext.add_dependency(pg_ext.to_dependency())
124137
ext.bundle_deps.append(pg_ext)
125138

126139
return ext
@@ -137,6 +150,10 @@ def _get_sources(cls, version: str | None) -> list[packages.BaseSource]:
137150
def get_pgext_ver(cls) -> str | None:
138151
return None
139152

153+
@classmethod
154+
def is_universal(cls) -> bool:
155+
return False
156+
140157
@property
141158
def supports_out_of_tree_builds(self) -> bool:
142159
return False
@@ -171,7 +188,7 @@ def get_make_install_args(self, build: targets.Build) -> packages.Args:
171188
}
172189

173190
def get_root_install_subdir(self, build: targets.Build) -> pathlib.Path:
174-
if build.target.is_portable():
191+
if build.target.is_portable() or self._edb is None:
175192
return pathlib.Path(self.name_slot)
176193
else:
177194
return pathlib.Path(self._edb.name_slot)
@@ -180,7 +197,7 @@ def get_make_install_destdir_subdir(
180197
self,
181198
build: targets.Build,
182199
) -> pathlib.Path:
183-
if build.target.is_portable():
200+
if build.target.is_portable() or self._edb is None:
184201
return pathlib.Path("")
185202
else:
186203
return (

edgedbpkg/edgedb_ext/postgis/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PostGIS(edgedb_ext.EdgeDBExtension):
2525

2626
@classmethod
2727
def get_pgext_ver(cls) -> str | None:
28-
return "3.4.3"
28+
return edgedb_ext.PGEXT_VERSION_AUTO
2929

3030
def get_make_install_destdir_subdir(
3131
self,
@@ -35,3 +35,16 @@ def get_make_install_destdir_subdir(
3535
return build.get_rel_install_prefix(self)
3636
else:
3737
return super().get_make_install_destdir_subdir(build)
38+
39+
40+
# EdgeQL-only version of the above
41+
class PostGISEdgeQL(PostGIS):
42+
ident = "edbext-postgis-edgeql"
43+
44+
@classmethod
45+
def get_pgext_ver(cls) -> str | None:
46+
return None
47+
48+
@classmethod
49+
def is_universal(cls) -> bool:
50+
return True

edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree.patch renamed to edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree-304.patch

File renamed without changes.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
From 24e4e6d4d94a4203e4a50000e25c983467a1c51e Mon Sep 17 00:00:00 2001
2+
From: Elvis Pranskevichus <elvis@edgedb.com>
3+
Date: Thu, 3 Oct 2024 23:12:22 -0700
4+
Subject: [PATCH 4/4] Fix `make install` with gettext disabled
5+
6+
---
7+
configure | 44 +++++++++++++++++++++++++++++++++++++++++++-
8+
configure.ac | 1 +
9+
2 files changed, 44 insertions(+), 1 deletion(-)
10+
11+
diff --git a/configure b/configure
12+
index 7283cb55e..3b9467974 100755
13+
--- a/configure
14+
+++ b/configure
15+
@@ -718,7 +718,6 @@ GMSGFMT
16+
MSGFMT
17+
GETTEXT_MACRO_VERSION
18+
USE_NLS
19+
-MKDIR_P
20+
SET_MAKE
21+
HAVE_SFCGAL
22+
SFCGAL
23+
@@ -840,6 +839,7 @@ build_vendor
24+
build_cpu
25+
build
26+
LIBTOOL
27+
+MKDIR_P
28+
INSTALL_DATA
29+
INSTALL_SCRIPT
30+
INSTALL_PROGRAM
31+
@@ -2741,6 +2741,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
32+
33+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
34+
35+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
36+
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
37+
+if test -z "$MKDIR_P"; then
38+
+ if ${ac_cv_path_mkdir+:} false; then :
39+
+ $as_echo_n "(cached) " >&6
40+
+else
41+
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
42+
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
43+
+do
44+
+ IFS=$as_save_IFS
45+
+ test -z "$as_dir" && as_dir=.
46+
+ for ac_prog in mkdir gmkdir; do
47+
+ for ac_exec_ext in '' $ac_executable_extensions; do
48+
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
49+
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
50+
+ 'mkdir (GNU coreutils) '* | \
51+
+ 'mkdir (coreutils) '* | \
52+
+ 'mkdir (fileutils) '4.1*)
53+
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
54+
+ break 3;;
55+
+ esac
56+
+ done
57+
+ done
58+
+ done
59+
+IFS=$as_save_IFS
60+
+
61+
+fi
62+
+
63+
+ test -d ./--version && rmdir ./--version
64+
+ if test "${ac_cv_path_mkdir+set}" = set; then
65+
+ MKDIR_P="$ac_cv_path_mkdir -p"
66+
+ else
67+
+ # As a last resort, use the slow shell script. Don't cache a
68+
+ # value for MKDIR_P within a source directory, because that will
69+
+ # break other packages using the cache if that directory is
70+
+ # removed, or if the value is a relative name.
71+
+ MKDIR_P="$ac_install_sh -d"
72+
+ fi
73+
+fi
74+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
75+
+$as_echo "$MKDIR_P" >&6; }
76+
+
77+
78+
# _LT_PROG_AR
79+
80+
diff --git a/configure.ac b/configure.ac
81+
index 1ae526f47..1a319e4d6 100644
82+
--- a/configure.ac
83+
+++ b/configure.ac
84+
@@ -27,6 +27,7 @@ AH_TEMPLATE([HAVE_ASPRINTF])
85+
AC_CONFIG_MACRO_DIR([macros])
86+
AC_CONFIG_AUX_DIR([build-aux])
87+
AC_PROG_INSTALL
88+
+AC_PROG_MKDIR_P
89+
90+
dnl Overwrite _LT_PROG_AR
91+
m4_pushdef([_LT_PROG_AR],
92+
--
93+
2.45.2
94+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From 06ea94850d9e74510b5f580fc26cfcd1b5f7103f Mon Sep 17 00:00:00 2001
2+
From: Elvis Pranskevichus <elvis@edgedb.com>
3+
Date: Thu, 3 Oct 2024 17:37:17 -0700
4+
Subject: [PATCH 3/4] Fix building on macOS
5+
6+
topology/Makefile clobbers bindir, which, in turn breaks the
7+
`-bundle_loader` flag set by pgxs.mk.
8+
---
9+
topology/Makefile.in | 14 +++++++-------
10+
1 file changed, 7 insertions(+), 7 deletions(-)
11+
12+
diff --git a/topology/Makefile.in b/topology/Makefile.in
13+
index ef8de4bb9..a322f394b 100644
14+
--- a/topology/Makefile.in
15+
+++ b/topology/Makefile.in
16+
@@ -83,7 +83,7 @@ include $(PGXS)
17+
# Set prefix variables _after_ the include of PGXS
18+
prefix = @prefix@
19+
exec_prefix = @exec_prefix@
20+
-bindir = @bindir@
21+
+my_bindir = @bindir@
22+
23+
# Set PERL _after_ the include of PGXS
24+
PERL=@PERL@
25+
@@ -99,7 +99,7 @@ $(OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a ../postgis_
26+
# so that no prefix is included. This allows us to relocate to a temporary
27+
# directory for regression testing.
28+
ifeq ($(REGRESS),1)
29+
- bindir=/bin
30+
+ my_bindir=/bin
31+
pkglibdir=/lib
32+
datadir=/share
33+
datamoduledir=contrib/postgis
34+
@@ -177,20 +177,20 @@ distclean: clean
35+
rm -f Makefile test/Makefile
36+
37+
installdir:
38+
- mkdir -p $(DESTDIR)$(bindir)
39+
+ mkdir -p $(DESTDIR)$(my_bindir)
40+
41+
install: install-importer install-exporter
42+
43+
install-importer: loader/pgtopo_import | installdir
44+
- $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(bindir)/pgtopo_import"
45+
+ $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(my_bindir)/pgtopo_import"
46+
47+
install-exporter: loader/pgtopo_export | installdir
48+
- $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(bindir)/pgtopo_export"
49+
+ $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(my_bindir)/pgtopo_export"
50+
51+
uninstall: uninstall-importer uninstall-exporter
52+
53+
uninstall-importer:
54+
- rm -f '$(DESTDIR)$(bindir)/pgtopo_import'
55+
+ rm -f '$(DESTDIR)$(my_bindir)/pgtopo_import'
56+
57+
uninstall-exporter:
58+
- rm -f '$(DESTDIR)$(bindir)/pgtopo_export'
59+
+ rm -f '$(DESTDIR)$(my_bindir)/pgtopo_export'
60+
--
61+
2.45.2
62+

edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix.patch renamed to edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix-304.patch

File renamed without changes.

0 commit comments

Comments
 (0)