Skip to content

Commit

Permalink
Add contrib (#4)
Browse files Browse the repository at this point in the history
* feat: add compile contrib

* feat: add checks - create extension: hstore, uuid-ossp, xml2

* fix: minor changes

* fix: use apt-get

* fix: use sudo for apt-get
  • Loading branch information
LevZaplatin authored Dec 28, 2021
1 parent 40b9bff commit 46f4b9d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/postgresql/tests/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ def test_setup_teardown():
def test_fixture(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c "select version()"')


def test_default_extension(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION hstore;"')


def test_uuid_ossp_extension(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c \'CREATE EXTENSION "uuid-ossp";\'')


def test_xml2_extension(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION xml2;"')
11 changes: 7 additions & 4 deletions src/tools/install_pg.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ else
VERSION=13.4
fi

yum install -y zlib-devel readline-devel
export DEBIAN_FRONTEND=noninteractive

sudo apt update
sudo apt install -y zlib1g-dev libreadline-dev libossp-uuid-dev libxml2-dev libxslt1-dev curl make gcc
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz

tar -xzf postgresql-${VERSION}.tar.gz
cd postgresql-${VERSION}
./configure --prefix=`pwd`/../src/postgresql
make -j 4
make install
./configure --prefix=`pwd`/../src/postgresql --with-ossp-uuid --with-libxml --with-libxslt
make -j 4 world-bin
make install-world-bin
cd ..

20 changes: 20 additions & 0 deletions src/tools/install_pg_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if [[ $1 =~ refs/tags/([0-9]+\.[0-9]+).*$ ]];
then
VERSION=${BASH_REMATCH[1]}
echo "Building ${VERSION}"
else
VERSION=13.4
fi

yum install -y dnf-plugins-core epel-release
yum config-manager --set-enabled powertools
yum install -y zlib-devel readline-devel uuid-devel libxml2-devel libxslt-devel
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz

tar -xzf postgresql-${VERSION}.tar.gz
cd postgresql-${VERSION}
./configure --prefix=`pwd`/../src/postgresql --with-ossp-uuid --with-libxml --with-libxslt
make -j 4 world-bin
make install-world-bin
cd ..

0 comments on commit 46f4b9d

Please sign in to comment.