diff --git a/edgedbpkg/edgedb/__init__.py b/edgedbpkg/edgedb/__init__.py index cbe2580..e86fe5a 100644 --- a/edgedbpkg/edgedb/__init__.py +++ b/edgedbpkg/edgedb/__init__.py @@ -1,5 +1,6 @@ from __future__ import annotations from typing import ( + Any, TYPE_CHECKING, ) @@ -18,6 +19,7 @@ from edgedbpkg import postgresql from edgedbpkg.pgext import pgvector +from edgedbpkg.pgext import edb_stat_statements from edgedbpkg import python as python_bundle from edgedbpkg import pyentrypoint from edgedbpkg import libprotobuf_c @@ -76,10 +78,16 @@ class EdgeDB(packages.BundledPythonPackage): "python-edgedb (~= 3.12.0)", "pgext-pgvector (~= 0.6.0)", ], - ">=6.0.dev8898": [ + ">=6.0.dev8898,<6.0.dev9001": [ + "postgresql-edgedb (~= 17.0)", + "python-edgedb (~= 3.12.0)", + "pgext-pgvector (~= 0.7.0)", + ], + ">=6.0.dev9001": [ "postgresql-edgedb (~= 17.0)", "python-edgedb (~= 3.12.0)", "pgext-pgvector (~= 0.7.0)", + "pgext-edb-stat-statements", ], } @@ -136,6 +144,12 @@ class EdgeDB(packages.BundledPythonPackage): libprotobuf_c.LibProtoBufC("1.5.0"), ] + def __init__( + self, version: str | poetry_version.Version, *args: Any, **kwargs: Any + ) -> None: + edb_stat_statements.StatStatements(version=version) + super().__init__(version, *args, **kwargs) + @classmethod def get_vcs_source( cls, io: cleo_io.IO, ref: str | None = None diff --git a/edgedbpkg/pgext/edb_stat_statements/__init__.py b/edgedbpkg/pgext/edb_stat_statements/__init__.py new file mode 100644 index 0000000..d330e91 --- /dev/null +++ b/edgedbpkg/pgext/edb_stat_statements/__init__.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +import shlex + +from metapkg import targets + +from edgedbpkg import pgext + + +class StatStatements(pgext.PostgresCExtension): + title = "edb_stat_statements extension" + ident = "pgext-edb-stat-statements" + description = "Query performance statistics extension" + license_id = "PostgreSQL" + group = "Applications/Databases" + + sources = [] # reuses edgedb-server source, see get_prepare_script + + artifact_build_requirements = [ + "postgresql-edgedb (>=17)", + ] + + def get_prepare_script(self, build: targets.Build) -> str: + source_dir = build.get_source_dir( + build.get_package("edgedb-server"), relative_to="pkgbuild" + ) + sdir = shlex.quote(str(source_dir / "edb_stat_statements")) + return f"test ./ -ef {sdir} || cp -a {sdir}/* ./\n" + + def get_configure_script(self, build: targets.Build) -> str: + return "" + + def get_build_script(self, build: targets.Build) -> str: + pg_build_dir = build.get_build_dir( + build.get_package("postgresql-edgedb"), relative_to="pkgbuild" + ) + ddir = shlex.quote(str(pg_build_dir / "_install")) + args = self.get_make_args(build) + return "\n".join( + [ + self.get_build_command(build, args), + self.get_build_command( + build, args | {"DESTDIR": ddir}, "install" + ), + ] + ) diff --git a/edgedbpkg/pgext/edb_stat_statements/install.list b/edgedbpkg/pgext/edb_stat_statements/install.list new file mode 100644 index 0000000..ab5e03f --- /dev/null +++ b/edgedbpkg/pgext/edb_stat_statements/install.list @@ -0,0 +1,3 @@ +{libdir}/postgresql/*.so +{libdir}/postgresql/*.dylib +{datadir}/postgresql/extension/*