Skip to content

Commit 171a4ee

Browse files
samroseyvan-sraka
authored andcommitted
fix: rebase on develop and fix code api changes from nixpkgs
1 parent d7efba9 commit 171a4ee

File tree

10 files changed

+51
-112
lines changed

10 files changed

+51
-112
lines changed

nix/cargo-pgrx/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
lib,
3-
darwin,
3+
apple-sdk_11,
44
fetchCrate,
55
openssl,
66
pkg-config,
@@ -36,7 +36,7 @@ let
3636
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
3737
buildInputs =
3838
lib.optionals stdenv.hostPlatform.isLinux [ openssl ]
39-
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
39+
++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ];
4040

4141
OPENSSL_DIR = "${openssl.dev}";
4242
OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";

nix/checks.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
perSystem =
44
{
5-
lib,
65
self',
76
system,
87
pkgs,

nix/ext/plv8.nix

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# to nixpkgs
1010
clang,
1111
xcbuild,
12-
darwin,
12+
apple-sdk_11,
1313
patchelf,
1414
}:
1515
let
@@ -50,8 +50,7 @@ stdenv.mkDerivation (finalAttrs: {
5050
postgresql
5151
]
5252
++ lib.optionals stdenv.isDarwin [
53-
darwin.apple_sdk.frameworks.CoreFoundation
54-
darwin.apple_sdk.frameworks.Kerberos
53+
apple-sdk_11
5554
];
5655

5756
buildFlags = [ "all" ];
@@ -77,10 +76,8 @@ stdenv.mkDerivation (finalAttrs: {
7776
"-lpq"
7877
"-lpgcommon"
7978
"-lpgport"
80-
"-F${darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks"
8179
"-framework"
8280
"CoreFoundation"
83-
"-F${darwin.apple_sdk.frameworks.Kerberos}/Library/Frameworks"
8481
"-framework"
8582
"Kerberos"
8683
"-undefined"

nix/ext/postgis.nix

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,9 @@ let
4848
"postgis_topology"
4949
];
5050

51-
<<<<<<< HEAD
5251
sqlExtensions = [
5352
"address_standardizer_data_us"
5453
"postgis_tiger_geocoder"
55-
=======
56-
src = fetchurl {
57-
url = "https://download.osgeo.org/postgis/source/postgis-${version}.tar.gz";
58-
sha256 = "sha256-UHJKDd5JrcJT5Z4CTYsY/va+ToU0GUPG1eHhuXTkP84=";
59-
};
60-
61-
buildInputs = [
62-
libxml2
63-
postgresql
64-
geos
65-
proj
66-
gdal
67-
json_c
68-
protobufc
69-
pcre2.dev
70-
sfcgal
71-
]
72-
++ lib.optional stdenv.isDarwin libiconv;
73-
nativeBuildInputs = [
74-
perl
75-
pkg-config
76-
>>>>>>> 4847adac (chore: update fmt)
7754
];
7855

7956
# Build function for individual versions

nix/ext/tests/lib.py

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def assert_version_matches(self, expected_version: str):
9393
AssertionError: If the installed version does not match the expected version
9494
"""
9595
installed_version = self.get_installed_version()
96-
assert (
97-
installed_version == expected_version
98-
), f"Expected version {expected_version}, but found {installed_version}"
96+
assert installed_version == expected_version, (
97+
f"Expected version {expected_version}, but found {installed_version}"
98+
)
9999

100100
def check_upgrade_path(self, pg_version: str):
101101
"""Test the complete upgrade path for a PostgreSQL version.
@@ -181,37 +181,6 @@ def check_switch_extension_with_background_worker(
181181
self.vm.succeed(f"switch_{self.extension_name}_version {last_version}")
182182
# Check that we are using the last version now
183183
ext_version = self.vm.succeed(f"readlink -f {extension_lib_path}").strip()
184-
assert ext_version.endswith(
185-
f"{last_version}.so"
186-
), f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
187-
188-
def check_pg_regress(self, pg_regress: Path, pg_version: str, test_name: str):
189-
"""Run pg_regress tests for the extension on a given PostgreSQL version.
190-
191-
Args:
192-
pg_regress: Path to the pg_regress binary
193-
pg_version: PostgreSQL version to test (e.g., "14", "15")
194-
test_name: SQL test file to run with pg_regress
195-
"""
196-
sql_file = self.sql_test_dir / "sql" / f"{test_name}.sql"
197-
if not sql_file.exists():
198-
# check if we have a postgres version specific sql file
199-
test_name = f"z_{pg_version}_{test_name}"
200-
sql_file = self.sql_test_dir / "sql" / f"{test_name}.sql"
201-
if not sql_file.exists():
202-
print(f"Skipping pg_regress test for {pg_version}, no sql file found")
203-
return
204-
try:
205-
print(
206-
self.vm.succeed(
207-
f"""sudo -u postgres {pg_regress} --inputdir={self.sql_test_dir} --debug --use-existing --dbname=postgres --outputdir=/tmp/regression_output_{pg_version} "{test_name}" """
208-
)
209-
)
210-
except:
211-
print("Error running pg_regress, diff:")
212-
print(
213-
self.vm.succeed(
214-
f"cat /tmp/regression_output_{pg_version}/regression.diffs"
215-
)
216-
)
217-
raise
184+
assert ext_version.endswith(f"{self.extension_name}-{last_version}.so"), (
185+
f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
186+
)

nix/ext/wrappers/default.nix

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pkg-config,
88
postgresql,
99
buildEnv,
10-
darwin,
10+
apple-sdk_11,
1111
rust-bin,
1212
git,
1313
}:
@@ -37,17 +37,13 @@ let
3737
cargo
3838
git
3939
];
40-
buildInputs =
41-
[
42-
openssl
43-
postgresql
44-
]
45-
++ lib.optionals stdenv.isDarwin [
46-
darwin.apple_sdk.frameworks.CoreFoundation
47-
darwin.apple_sdk.frameworks.CoreServices
48-
darwin.apple_sdk.frameworks.Security
49-
darwin.apple_sdk.frameworks.SystemConfiguration
50-
];
40+
buildInputs = [
41+
openssl
42+
postgresql
43+
]
44+
++ lib.optionals stdenv.isDarwin [
45+
apple-sdk_11
46+
];
5147

5248
NIX_LDFLAGS = "-L${postgresql}/lib -lpq";
5349

nix/overlays/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
cargo-pgrx = final.callPackage ../cargo-pgrx/default.nix {
2121
inherit (final) lib;
22-
inherit (final) darwin;
22+
inherit (final) apple-sdk_11;
2323
inherit (final) fetchCrate;
2424
inherit (final) openssl;
2525
inherit (final) pkg-config;

nix/packages/packer.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ buildGoModule rec {
3333
nativeBuildInputs = [ installShellFiles ];
3434

3535
buildInputs = lib.optionals pkgs.stdenv.isDarwin [
36-
pkgs.darwin.apple_sdk.frameworks.IOKit
37-
pkgs.darwin.apple_sdk.frameworks.Security
36+
pkgs.apple-sdk_11
3837
];
3938

4039
postInstall = ''

nix/postgresql/generic.nix

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ let
77
stdenv,
88
lib,
99
fetchurl,
10-
fetchpatch,
1110
makeWrapper,
1211
glibc,
1312
zlib,
@@ -115,7 +114,7 @@ let
115114
zlib
116115
readline
117116
openssl
118-
(libxml2.override { python = python3; })
117+
(libxml2.override { python3 = python3; })
119118
icu
120119
]
121120
++ lib.optionals (olderThan "13") [ libxcrypt ]
@@ -192,20 +191,21 @@ let
192191
locale = "${if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc}/bin/locale";
193192
})
194193
]
195-
++ lib.optionals (olderThan "17") [
196-
# back port changes related to tzdata release 2024b
197-
(fetchpatch ({
198-
url = "https://github.com/postgres/postgres/commit/b27622c90869aab63cfe22159a459c57768b0fa4.patch";
199-
hash = "sha256-7G+BkJULhyx6nlMEjClcr2PJg6awgymZHr2JgGhXanA=";
200-
excludes = [ "doc/*" ];
201-
}))
202-
# back port changes related to tzdata release 2025a
203-
(fetchpatch ({
204-
url = "https://github.com/postgres/postgres/commit/aac0384975ff1129557cd2158fab4656f933cdc8.patch";
205-
hash = "sha256-4Aua4QJhCS9B0zegQ9I6Us5QfX7GuRUilnkmOpSTUUw=";
206-
excludes = [ "doc/*" ];
207-
}))
208-
]
194+
# tzdata patches temporarily removed due to conflicts with PostgreSQL 15.14
195+
# ++ lib.optionals (olderThan "17") [
196+
# # back port changes related to tzdata release 2024b
197+
# (fetchpatch ({
198+
# url = "https://github.com/postgres/postgres/commit/b27622c90869aab63cfe22159a459c57768b0fa4.patch";
199+
# hash = "sha256-7G+BkJULhyx6nlMEjClcr2PJg6awgymZHr2JgGhXanA=";
200+
# excludes = [ "doc/*" ];
201+
# }))
202+
# # back port changes related to tzdata release 2025a
203+
# (fetchpatch ({
204+
# url = "https://github.com/postgres/postgres/commit/aac0384975ff1129557cd2158fab4656f933cdc8.patch";
205+
# hash = "sha256-4Aua4QJhCS9B0zegQ9I6Us5QfX7GuRUilnkmOpSTUUw=";
206+
# excludes = [ "doc/*" ];
207+
# }))
208+
# ]
209209
++ lib.optionals stdenv'.hostPlatform.isMusl (
210210
# Using fetchurl instead of fetchpatch on purpose: https://github.com/NixOS/nixpkgs/issues/240141
211211
map fetchurl (lib.attrValues muslPatches)

testinfra/test_ami_nix.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,9 @@ def is_healthy(ssh) -> bool:
421421
def test_postgrest_is_running(host):
422422
"""Check if postgrest service is running using our SSH connection."""
423423
result = run_ssh_command(host["ssh"], "systemctl is-active postgrest")
424-
assert (
425-
result["succeeded"] and result["stdout"].strip() == "active"
426-
), "PostgREST service is not running"
424+
assert result["succeeded"] and result["stdout"].strip() == "active", (
425+
"PostgREST service is not running"
426+
)
427427

428428

429429
def test_postgrest_responds_to_requests(host):
@@ -546,9 +546,9 @@ def test_postgresql_version(host):
546546
if version_match:
547547
major_version = int(version_match.group(1))
548548
print(f"PostgreSQL major version: {major_version}")
549-
assert (
550-
major_version >= 14
551-
), f"PostgreSQL version {major_version} is less than 14"
549+
assert major_version >= 14, (
550+
f"PostgreSQL version {major_version} is less than 14"
551+
)
552552
else:
553553
assert False, "Could not parse PostgreSQL version number"
554554
else:
@@ -578,9 +578,9 @@ def test_libpq5_version(host):
578578
if version_match:
579579
major_version = int(version_match.group(1))
580580
print(f"libpq5 major version: {major_version}")
581-
assert (
582-
major_version >= 14
583-
), f"libpq5 version {major_version} is less than 14"
581+
assert major_version >= 14, (
582+
f"libpq5 version {major_version} is less than 14"
583+
)
584584
else:
585585
print("Could not parse libpq5 version from dpkg output")
586586
else:
@@ -613,9 +613,9 @@ def test_libpq5_version(host):
613613
if version_match:
614614
major_version = int(version_match.group(1))
615615
print(f"psql/libpq major version: {major_version}")
616-
assert (
617-
major_version >= 14
618-
), f"psql/libpq version {major_version} is less than 14"
616+
assert major_version >= 14, (
617+
f"psql/libpq version {major_version} is less than 14"
618+
)
619619
else:
620620
print("Could not parse psql version")
621621

@@ -776,7 +776,9 @@ def test_postgrest_read_only_session_attrs(host):
776776
print(
777777
f"\nFound 'session is not read-only' errors in PostgREST logs:\n{result['stdout']}"
778778
)
779-
assert False, "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
779+
assert False, (
780+
"PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
781+
)
780782
else:
781783
print("\nNo 'session is not read-only' errors found in PostgREST logs")
782784

0 commit comments

Comments
 (0)