From: Jason Boyer <jboyer@equinoxOLI.org>
Date: Fri, 25 Mar 2022 17:45:13 +0000 (-0400)
Subject: Switch to pgtap installed from packages
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=216499bba55ce20cb9ba50a3bf440d0929e7dd8f;p=working%2Frandom.git

Switch to pgtap installed from packages

Uses dpkg-query to find the version of postgresql currently
installed and then installs that version of pgtap.

Signed-off-by: Jason Boyer <jboyer@equinoxOLI.org>
---

diff --git a/installer/stretch/eg_stretch_installer.sh b/installer/stretch/eg_stretch_installer.sh
index 4c6be8dd3..3f45c02f1 100755
--- a/installer/stretch/eg_stretch_installer.sh
+++ b/installer/stretch/eg_stretch_installer.sh
@@ -908,13 +908,12 @@ function evergreen_db_create {
     echo Return Value = $?
 
     echo Installing pgtap
-    PG_TAP_VER="1.2.0"
-    wget -N http://api.pgxn.org/dist/pgtap/$PG_TAP_VER/pgtap-$PG_TAP_VER.zip \
-    && unzip pgtap-$PG_TAP_VER.zip \
-    && cd pgtap-$PG_TAP_VER \
-    && make \
-    && make installcheck \
-    && make install
+
+    # output the name of the currently installed pg server dev package, then
+    # throw away everything up to and including the last '-' to get the correct pg version
+    PGVERS=`dpkg-query --showformat="\\${binary:Package}" --show 'postgresql-server-dev-*'`
+    apt-get install postgresql-${PGVERS##*-}-pgtap
+
     echo 'CREATE EXTENSION pgtap;' | su - postgres -c "psql evergreen"
 
     echo End of Create Evergreen Database =~-._