Switch to pgtap installed from packages
authorJason Boyer <jboyer@equinoxOLI.org>
Fri, 25 Mar 2022 17:45:13 +0000 (13:45 -0400)
committerJason Boyer <jboyer@equinoxOLI.org>
Fri, 25 Mar 2022 17:45:13 +0000 (13:45 -0400)
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>
installer/stretch/eg_stretch_installer.sh

index 4c6be8d..3f45c02 100755 (executable)
@@ -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 =~-._