Skip to content

Commit 0f388c4

Browse files
samroseyvan-sraka
authored andcommitted
fix: rebase on develop and fix code api changes from nixpkgs
1 parent 2c10725 commit 0f388c4

File tree

10 files changed

+45
-104
lines changed

10 files changed

+45
-104
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
@@ -84,9 +84,9 @@ def assert_version_matches(self, expected_version: str):
8484
AssertionError: If the installed version does not match the expected version
8585
"""
8686
installed_version = self.get_installed_version()
87-
assert (
88-
installed_version == expected_version
89-
), f"Expected version {expected_version}, but found {installed_version}"
87+
assert installed_version == expected_version, (
88+
f"Expected version {expected_version}, but found {installed_version}"
89+
)
9090

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

nix/ext/wrappers/default.nix

Lines changed: 2 additions & 4 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
}:
@@ -42,9 +42,7 @@ let
4242
postgresql
4343
]
4444
++ lib.optionals stdenv.isDarwin [
45-
darwin.apple_sdk.frameworks.CoreFoundation
46-
darwin.apple_sdk.frameworks.Security
47-
darwin.apple_sdk.frameworks.SystemConfiguration
45+
apple-sdk_11
4846
];
4947

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

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
@@ -427,9 +427,9 @@ def is_healthy(ssh) -> bool:
427427
def test_postgrest_is_running(host):
428428
"""Check if postgrest service is running using our SSH connection."""
429429
result = run_ssh_command(host["ssh"], "systemctl is-active postgrest")
430-
assert (
431-
result["succeeded"] and result["stdout"].strip() == "active"
432-
), "PostgREST service is not running"
430+
assert result["succeeded"] and result["stdout"].strip() == "active", (
431+
"PostgREST service is not running"
432+
)
433433

434434

435435
def test_postgrest_responds_to_requests(host):
@@ -571,9 +571,9 @@ def test_postgresql_version(host):
571571
if version_match:
572572
major_version = int(version_match.group(1))
573573
print(f"PostgreSQL major version: {major_version}")
574-
assert (
575-
major_version >= 14
576-
), f"PostgreSQL version {major_version} is less than 14"
574+
assert major_version >= 14, (
575+
f"PostgreSQL version {major_version} is less than 14"
576+
)
577577
else:
578578
assert False, "Could not parse PostgreSQL version number"
579579
else:
@@ -603,9 +603,9 @@ def test_libpq5_version(host):
603603
if version_match:
604604
major_version = int(version_match.group(1))
605605
print(f"libpq5 major version: {major_version}")
606-
assert (
607-
major_version >= 14
608-
), f"libpq5 version {major_version} is less than 14"
606+
assert major_version >= 14, (
607+
f"libpq5 version {major_version} is less than 14"
608+
)
609609
else:
610610
print("Could not parse libpq5 version from dpkg output")
611611
else:
@@ -638,9 +638,9 @@ def test_libpq5_version(host):
638638
if version_match:
639639
major_version = int(version_match.group(1))
640640
print(f"psql/libpq major version: {major_version}")
641-
assert (
642-
major_version >= 14
643-
), f"psql/libpq version {major_version} is less than 14"
641+
assert major_version >= 14, (
642+
f"psql/libpq version {major_version} is less than 14"
643+
)
644644
else:
645645
print("Could not parse psql version")
646646

@@ -801,7 +801,9 @@ def test_postgrest_read_only_session_attrs(host):
801801
print(
802802
f"\nFound 'session is not read-only' errors in PostgREST logs:\n{result['stdout']}"
803803
)
804-
assert False, "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
804+
assert False, (
805+
"PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
806+
)
805807
else:
806808
print("\nNo 'session is not read-only' errors found in PostgREST logs")
807809

0 commit comments

Comments
 (0)