Merge: postgresql.pg_config: add check to confirm output is correct (#392418)

This commit is contained in:
Maximilian Bosch
2025-03-30 12:32:51 +02:00
committed by GitHub
3 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
- `squid` has been updated to version 7, this release includes multiple breaking changes, like ESI removal.
For more information, [check the release notes](https://github.com/squid-cache/squid/releases/tag/SQUID_7_0_1).
- `postgresql` and `libpq` don't provide `pg_config` by default anymore. Instead, `pg_config` is available via `postgresql.pg_config` or `libpq.pg_config`. This allowed implementing it as a shell script, which can be build for both the build and host systems when cross-compiling. If your build fails to find `pg_config`, add `postgresql.pg_config` or `libpq.pg_config` to `nativeBuildInputs`.
- `postgresql` and `libpq` don't provide `pg_config` by default anymore. Instead, `pg_config` is available via `postgresql.pg_config` or `libpq.pg_config`. This allowed implementing it as a shell script, which can be built for both the build and host systems when cross-compiling. If your build fails to find `pg_config`, add `postgresql.pg_config` or `libpq.pg_config` to `nativeBuildInputs`.
- The [`no-broken-symlinks` hook](https://nixos.org/manual/nixpkgs/unstable/#no-broken-symlinks.sh) was added to catch builds containing dangling or reflexive symlinks, as these are indicative of problems with packaging.
The hook can be disabled by providing `dontCheckForBrokenSymlinks = true;` as an argument to `mkDerivation`.
+7 -1
View File
@@ -366,6 +366,7 @@ let
postPatch = ''
substituteInPlace "src/Makefile.global.in" --subst-var out
substituteInPlace "src/common/config_info.c" --subst-var dev
cat ${./pg_config.env.mk} >> src/common/Makefile
'';
@@ -373,7 +374,12 @@ let
''
moveToOutput "bin/ecpg" "$dev"
moveToOutput "lib/pgxs" "$dev"
''
+ lib.optionalString (stdenv'.buildPlatform.canExecute stdenv'.hostPlatform) ''
mkdir -p "$dev/nix-support"
"$out/bin/pg_config" > "$dev/nix-support/pg_config.expected"
''
+ ''
rm "$out/bin/pg_config"
make -C src/common pg_config.env
install -D src/common/pg_config.env "$dev/nix-support/pg_config.env"
+10
View File
@@ -1,7 +1,9 @@
{
diffutils,
lib,
replaceVarsWith,
runtimeShell,
stdenv,
# PostgreSQL package
finalPackage,
}:
@@ -15,4 +17,12 @@ replaceVarsWith {
inherit runtimeShell;
postgresql-dev = lib.getDev finalPackage;
};
nativeCheckInputs = [
diffutils
];
postCheck = ''
if [ -e ${lib.getDev finalPackage}/nix-support/pg_config.expected ]; then
diff ${lib.getDev finalPackage}/nix-support/pg_config.expected <($out/bin/pg_config)
fi
'';
}