Skip to content

Commit 46f4b9d

Browse files
authored
Add contrib (#4)
* 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
1 parent 40b9bff commit 46f4b9d

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

src/postgresql/tests/test_postgresql.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ def test_setup_teardown():
1010
def test_fixture(tmp_postgres):
1111
pgdata, con_str = tmp_postgres
1212
postgresql.psql(f'-d "{con_str}" -c "select version()"')
13+
14+
15+
def test_default_extension(tmp_postgres):
16+
pgdata, con_str = tmp_postgres
17+
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION hstore;"')
18+
19+
20+
def test_uuid_ossp_extension(tmp_postgres):
21+
pgdata, con_str = tmp_postgres
22+
postgresql.psql(f'-d "{con_str}" -c \'CREATE EXTENSION "uuid-ossp";\'')
23+
24+
25+
def test_xml2_extension(tmp_postgres):
26+
pgdata, con_str = tmp_postgres
27+
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION xml2;"')

src/tools/install_pg.sh

100644100755
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ else
66
VERSION=13.4
77
fi
88

9-
yum install -y zlib-devel readline-devel
9+
export DEBIAN_FRONTEND=noninteractive
10+
11+
sudo apt update
12+
sudo apt install -y zlib1g-dev libreadline-dev libossp-uuid-dev libxml2-dev libxslt1-dev curl make gcc
1013
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz
1114

1215
tar -xzf postgresql-${VERSION}.tar.gz
1316
cd postgresql-${VERSION}
14-
./configure --prefix=`pwd`/../src/postgresql
15-
make -j 4
16-
make install
17+
./configure --prefix=`pwd`/../src/postgresql --with-ossp-uuid --with-libxml --with-libxslt
18+
make -j 4 world-bin
19+
make install-world-bin
1720
cd ..
1821

src/tools/install_pg_rpm.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
if [[ $1 =~ refs/tags/([0-9]+\.[0-9]+).*$ ]];
2+
then
3+
VERSION=${BASH_REMATCH[1]}
4+
echo "Building ${VERSION}"
5+
else
6+
VERSION=13.4
7+
fi
8+
9+
yum install -y dnf-plugins-core epel-release
10+
yum config-manager --set-enabled powertools
11+
yum install -y zlib-devel readline-devel uuid-devel libxml2-devel libxslt-devel
12+
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz
13+
14+
tar -xzf postgresql-${VERSION}.tar.gz
15+
cd postgresql-${VERSION}
16+
./configure --prefix=`pwd`/../src/postgresql --with-ossp-uuid --with-libxml --with-libxslt
17+
make -j 4 world-bin
18+
make install-world-bin
19+
cd ..
20+

0 commit comments

Comments
 (0)