Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build edb_stat_statements #124

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/*