From 9343003c0b7d9e7c3cd60fec6f096515917fe84b Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 24 Dec 2023 04:20:00 +0000 Subject: [PATCH 1/2] postgresqlPackages.pg_repack: 1.4.8 -> 1.5.0 Diff: https://github.com/reorg/pg_repack/compare/ver_1.4.8...ver_1.5.0 --- pkgs/servers/sql/postgresql/ext/pg_repack.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/ext/pg_repack.nix b/pkgs/servers/sql/postgresql/ext/pg_repack.nix index fd07b4e10544..eae95a3ed9d6 100644 --- a/pkgs/servers/sql/postgresql/ext/pg_repack.nix +++ b/pkgs/servers/sql/postgresql/ext/pg_repack.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "pg_repack"; - version = "1.4.8"; + version = "1.5.0"; buildInputs = [ postgresql openssl zlib readline ]; @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { owner = "reorg"; repo = "pg_repack"; rev = "ver_${version}"; - sha256 = "sha256-Et8aMRzG7ez0uy9wG6qsg57/kPPZdUhb+/gFxW86D08="; + sha256 = "sha256-do80phyMxwcRIkYyUt9z02z7byNQhK+pbSaCUmzG+4c="; }; installPhase = '' From 42bb0d0d161b16d1a0c310f36339169634bb7a95 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 24 Dec 2023 04:20:00 +0000 Subject: [PATCH 2/2] postgresqlPackages.pg_repack: add testers --- pkgs/servers/sql/postgresql/ext/pg_repack.nix | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/pkgs/servers/sql/postgresql/ext/pg_repack.nix b/pkgs/servers/sql/postgresql/ext/pg_repack.nix index eae95a3ed9d6..e29918373c77 100644 --- a/pkgs/servers/sql/postgresql/ext/pg_repack.nix +++ b/pkgs/servers/sql/postgresql/ext/pg_repack.nix @@ -1,24 +1,54 @@ -{ lib, stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline }: +{ lib +, stdenv +, fetchFromGitHub +, openssl +, postgresql +, postgresqlTestHook +, readline +, testers +, zlib +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "pg_repack"; version = "1.5.0"; buildInputs = [ postgresql openssl zlib readline ]; src = fetchFromGitHub { - owner = "reorg"; - repo = "pg_repack"; - rev = "ver_${version}"; + owner = "reorg"; + repo = "pg_repack"; + rev = "ver_${finalAttrs.version}"; sha256 = "sha256-do80phyMxwcRIkYyUt9z02z7byNQhK+pbSaCUmzG+4c="; }; installPhase = '' install -D bin/pg_repack -t $out/bin/ install -D lib/pg_repack${postgresql.dlSuffix} -t $out/lib/ - install -D lib/{pg_repack--${version}.sql,pg_repack.control} -t $out/share/postgresql/extension + install -D lib/{pg_repack--${finalAttrs.version}.sql,pg_repack.control} -t $out/share/postgresql/extension ''; + passthru.tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + }; + extension = stdenv.mkDerivation { + name = "plpgsql-check-test"; + dontUnpack = true; + doCheck = true; + buildInputs = [ postgresqlTestHook ]; + nativeCheckInputs = [ (postgresql.withPackages (ps: [ ps.pg_repack ])) ]; + postgresqlTestUserOptions = "LOGIN SUPERUSER"; + failureHook = "postgresqlStop"; + checkPhase = '' + runHook preCheck + psql -a -v ON_ERROR_STOP=1 -c "CREATE EXTENSION pg_repack;" + runHook postCheck + ''; + installPhase = "touch $out"; + }; + }; + meta = with lib; { description = "Reorganize tables in PostgreSQL databases with minimal locks"; longDescription = '' @@ -31,5 +61,6 @@ stdenv.mkDerivation rec { license = licenses.bsd3; maintainers = with maintainers; [ danbst ]; inherit (postgresql.meta) platforms; + mainProgram = "pg_repack"; }; -} +})