Skip to content

Commit

Permalink
Build edb_stat_statements (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix authored Nov 22, 2024
1 parent 01c8c57 commit c052832
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
16 changes: 15 additions & 1 deletion edgedbpkg/edgedb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations
from typing import (
Any,
TYPE_CHECKING,
)

Expand All @@ -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
Expand Down Expand Up @@ -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",
],
}

Expand Down Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions edgedbpkg/pgext/edb_stat_statements/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
),
]
)
3 changes: 3 additions & 0 deletions edgedbpkg/pgext/edb_stat_statements/install.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{libdir}/postgresql/*.so
{libdir}/postgresql/*.dylib
{datadir}/postgresql/extension/*

0 comments on commit c052832

Please sign in to comment.