postgresql.pg_config: add check to confirm output is correct

This is only tested on native builds against the output of the original
pg_config, which should be enough.

+17 -1
+7 -1
pkgs/servers/sql/postgresql/generic.nix
··· 366 366 367 367 postPatch = '' 368 368 substituteInPlace "src/Makefile.global.in" --subst-var out 369 + substituteInPlace "src/common/config_info.c" --subst-var dev 369 370 cat ${./pg_config.env.mk} >> src/common/Makefile 370 371 ''; 371 372 ··· 373 374 '' 374 375 moveToOutput "bin/ecpg" "$dev" 375 376 moveToOutput "lib/pgxs" "$dev" 376 - 377 + '' 378 + + lib.optionalString (stdenv'.buildPlatform.canExecute stdenv'.hostPlatform) '' 379 + mkdir -p "$dev/nix-support" 380 + "$out/bin/pg_config" > "$dev/nix-support/pg_config.expected" 381 + '' 382 + + '' 377 383 rm "$out/bin/pg_config" 378 384 make -C src/common pg_config.env 379 385 install -D src/common/pg_config.env "$dev/nix-support/pg_config.env"
+10
pkgs/servers/sql/postgresql/pg_config.nix
··· 1 1 { 2 + diffutils, 2 3 lib, 3 4 replaceVarsWith, 4 5 runtimeShell, 6 + stdenv, 5 7 # PostgreSQL package 6 8 finalPackage, 7 9 }: ··· 15 17 inherit runtimeShell; 16 18 postgresql-dev = lib.getDev finalPackage; 17 19 }; 20 + nativeCheckInputs = [ 21 + diffutils 22 + ]; 23 + postCheck = '' 24 + if [ -e ${lib.getDev finalPackage}/nix-support/pg_config.expected ]; then 25 + diff ${lib.getDev finalPackage}/nix-support/pg_config.expected <($out/bin/pg_config) 26 + fi 27 + ''; 18 28 }