]> TLD Linux GIT Repositories - packages/postgresql.git/blobdiff - postgresql.spec
- updated to 11.20
[packages/postgresql.git] / postgresql.spec
index b5d0463a16d721024986b2057674aefcb35af837..e99b87ae60c6dba81ee03e702f5deec40382d7ec 100644 (file)
@@ -14,8 +14,8 @@
 #
 
 %define beta %{nil}
-%define pgver 10
-%define pgminver 5
+%define pgsqlversion 11
+%define pgsqlpriority 110
 
 Summary:       PostgreSQL Data Base Management System
 Summary(de.UTF-8):     PostgreSQL Datenbankverwaltungssystem
@@ -27,13 +27,13 @@ Summary(ru.UTF-8):  PostgreSQL - система управления базами
 Summary(tr.UTF-8):     Veri Tabanı Yönetim Sistemi
 Summary(uk.UTF-8):     PostgreSQL - система керування базами даних
 Summary(zh_CN.UTF-8):  PostgreSQL 客户端程序和库文件
-Name:          postgresql%{pgver}
-Version:       %{pgver}.%{pgminver}
-Release:       1.1
+Name:          postgresql-%{pgsqlversion}
+Version:       %{pgsqlversion}.20
+Release:       1
 License:       BSD
 Group:         Applications/Databases
 Source0:       http://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2
-# Source0-md5: a5fe5fdff2d6c28f65601398be0950df
+# Source0-md5: 05666c76d6c2e0fd6cc3b8e604f9c06d
 Source1:       postgresql.init
 Source2:       pgsql-Database-HOWTO-html.tar.gz
 # Source2-md5: 5b656ddf1db41965761f85204a14398e
@@ -42,10 +42,12 @@ Patch0:             postgresql-conf.patch
 Patch1:                postgresql-absolute_dbpaths.patch
 Patch2:                postgresql-ecpg-includedir.patch
 Patch3:                per-version-dirs.patch
-Patch4:                postgresql-disable_horology_test.patch
+Patch4:                postgresql-tests.patch
 Patch5:                postgresql-heimdal.patch
 Patch6:                postgresql-link.patch
-Patch7:                libpgport-pkglibdir.patch
+Patch7:                socket-dir-fixes.patch
+Patch8:                postgresql-autoconf.patch
+Patch9:                postgresql-python3.patch
 URL:           http://www.postgresql.org/
 BuildRequires: autoconf >= 2.69
 BuildRequires: automake
@@ -71,9 +73,9 @@ BuildRequires:        ossp-uuid-devel
 BuildRequires: pam-devel
 %{?with_perl:BuildRequires:    perl-devel}
 %if %{with python}
-BuildRequires: python >= 1:2.3
-BuildRequires: python-devel >= 1:2.3
-BuildRequires: python-modules >= 1:2.3
+BuildRequires: python3
+BuildRequires: python3-devel
+BuildRequires: python3-modules
 %endif
 BuildRequires: readline-devel >= 4.2
 BuildRequires: rpmbuild(macros) >= 1.671
@@ -84,22 +86,22 @@ BuildRequires:      zlib-devel
 Requires(post,preun):  /sbin/chkconfig
 Requires(pre): /bin/id
 Requires(pre): /usr/bin/getgid
-Requires(pre): /usr/sbin/groupadd
-Requires(pre): /usr/sbin/useradd
-Requires(triggerpostun):       /bin/id
-Requires(triggerpostun):       /usr/sbin/usermod
-Requires:      %{name}-clients >= %{version}-%{release}
-Requires:      postgresql-libs = %{version}-%{release}
+Requires(post):        /bin/id
+Requires(post):        /usr/sbin/usermod
+Requires:      %{name}-clients = %{version}-%{release}
+Requires:      %{name}-dirs = %{version}-%{release}
+Requires:      postgresql-libs >= %{version}-%{release}
 Requires:      rc-scripts >= 0.4.3.0
 Requires:      tzdata
+Obsoletes:     postgresql
 Obsoletes:     postgresql-module-plpgsql
 Obsoletes:     postgresql-module-tsearch2
 Obsoletes:     postgresql-server
 Obsoletes:     postgresql-test
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define                pgsqldatadir    %{_datadir}/postgresql/%{pgver}
-%define                pgsqllibdir     %{_libdir}/postgresql/%{pgver}
+%define                pgsqldatadir    %{_datadir}/postgresql/%{pgsqlversion}
+%define                pgsqllibdir     %{_libdir}/postgresql/%{pgsqlversion}
 %define                moduledir       %{pgsqllibdir}/lib
 %define                extensiondir    %{pgsqldatadir}/extension
 
@@ -108,7 +110,7 @@ BuildRoot:  %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 # omitted contribs:
 # spi, test_decoding, worker_spi - examples/tests
 # tsearch2 - old module for compatibility only
-%define        contrib_modules adminpack auth_delay auto_explain bloom btree_gin btree_gist chkpass citext cube dblink dict_int dict_xsyn earthdistance file_fdw fuzzystrmatch hstore %{?with_perl:hstore_plperl} %{?with_python:hstore_plpython} intagg intarray isn lo ltree %{?with_python:ltree_plpython} oid2name pageinspect passwordcheck pg_buffercache pg_freespacemap pg_prewarm pg_standby pg_stat_statements pg_trgm pg_visibility pgcrypto pgrowlocks pgstattuple postgres_fdw seg %{?with_selinux:sepgsql} sslinfo tablefunc tcn tsm_system_rows tsm_system_time unaccent uuid-ossp vacuumlo xml2
+%define        contrib_modules adminpack auth_delay auto_explain bloom btree_gin btree_gist citext cube dblink dict_int dict_xsyn earthdistance file_fdw fuzzystrmatch hstore %{?with_perl:hstore_plperl} %{?with_python:hstore_plpython} intagg intarray isn lo ltree %{?with_python:ltree_plpython} oid2name pageinspect passwordcheck pg_buffercache pg_freespacemap pg_prewarm pg_standby pg_stat_statements pg_trgm pg_visibility pgcrypto pgrowlocks pgstattuple postgres_fdw seg %{?with_selinux:sepgsql} sslinfo tablefunc tcn tsm_system_rows tsm_system_time unaccent uuid-ossp vacuumlo xml2
 
 %description
 PostgreSQL Data Base Management System (formerly known as Postgres,
@@ -172,34 +174,38 @@ PostgreSQL.
 PostgreSQL może być uruchomiony pod następującymi systemami: Solaris,
 SunOS, HPUX, AIX, Linux, Irix, FreeBSD i innymi systemami uniksowymi.
 
-%package -n postgresql-devel
-Summary:       PostgreSQL development header files and libraries
-Summary(de.UTF-8):     PostgreSQL-Entwicklungs-Header-Dateien und Libraries
-Summary(es.UTF-8):     Archivos de inclusión y bibliotecas PostgreSQL
-Summary(fr.UTF-8):     En-têtes et bibliothèques de développement PostgreSQL
-Summary(pl.UTF-8):     PostgreSQL - pliki nagłówkowe i biblioteki
-Summary(pt_BR.UTF-8):  Arquivos de inclusão e bibliotecas para desenvolvimento com o PostgreSQL
-Summary(ru.UTF-8):     PostgreSQL - хедеры и библиотеки разработчика
-Summary(tr.UTF-8):     PostgreSQL başlık dosyaları ve kitaplıklar
-Summary(uk.UTF-8):     PostgreSQL - хедери та бібліотеки програміста
-Group:         Development/Libraries
-Requires:      postgresql-libs = %{version}-%{release}
+%package -n postgresql-common
+Summary:       Common PostgreSQL files and directories
+Summary(pl.UTF-8):     PostgreSQL - wspólne pliki i katalogi
+Group:         Applicataion/Databases
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+
+%description -n postgresql-common
+Common PostgreSQL files and directories.
 
-%description -n postgresql-devel
-This package contains header files and libraries required to compile
-applications that are talking directly to the PostgreSQL backend
-server.
+%description -n postgresql-common -l pl.UTF-8
+PostgreSQL - wspólne pliki i katalogi.
 
-%description -n postgresql-devel -l pl.UTF-8
-Pakiet zawiera nagłówki oraz biblioteki wymagane do kompilacji
-aplikacji łączących się bezpośrednio z serwerem PostgreSQL.
+%package dirs
+Summary:       Common directories for PostgresSQL %{pgsqlversion}
+Summary(pl.UTF-8):     Wspólne pliki i katalogi dla PostgreSQL %{pgsqlversion}
+Group:         Applicataion/Databases
+Requires:      postgresql-common >= %{version}-%{release}
+
+%description dirs
+Common directories for PostgresSQL %{pgsqlversion}
+
+%description dirs -l pl.UTF-8
+Wspólne pliki i katalogi dla PostgreSQL %{pgsqlversion}
 
 %package backend-devel
 Summary:       PostgreSQL backend development header files
 Summary(pl.UTF-8):     PostgreSQL - pliki nagłówkowe dla backendu
 Group:         Development/Libraries
-Requires:      postgresql-devel = %{version}-%{release}
-Requires:      postgresql-libs = %{version}-%{release}
+Requires:      postgresql-devel >= %{version}-%{release}
+Requires:      postgresql-libs >= %{version}-%{release}
+Obsoletes:     postgresql-backend-devel
 
 %description backend-devel
 This package contains header files required to compile functions that
@@ -218,7 +224,9 @@ Summary(ru.UTF-8):  Клиентские программы, необходимы
 Summary(uk.UTF-8):     Клієнтські програми, необхідні для доступу до сервера PostgreSQL
 Group:         Applications/Databases
 Requires:      alternatives
-Requires:      postgresql-libs = %{version}-%{release}
+Requires:      %{name}-dirs = %{version}-%{release}
+Requires:      postgresql-libs >= %{version}-%{release}
+Obsoletes:     postgresql-clients
 
 %description clients
 This package includes only the clients needed to access an PostgreSQL
@@ -236,6 +244,7 @@ poleceń. Serwer znajduje się w głównym pakiecie.
 Summary:       Documentation for PostgreSQL
 Summary(pl.UTF-8):     Dodatkowa dokumantacja dla PostgreSQL
 Group:         Applications/Databases
+Obsoletes:     postgresql-doc
 
 %description doc
 This package includes documentation and HOWTO for programmer, admin
@@ -245,26 +254,14 @@ etc., in HTML format.
 Pakiet ten zawiera dokumentację oraz HOWTO m.in. dla programistów,
 administratorów w formacie HTML.
 
-%package -n postgresql-libs
-Summary:       PostgreSQL libraries
-Summary(es.UTF-8):     Biblioteca compartida del PostgreSQL
-Summary(pl.UTF-8):     Biblioteki dzielone programu PostgreSQL
-Summary(pt_BR.UTF-8):  Biblioteca compartilhada do PostgreSQL
-Summary(zh_CN.UTF-8):  PostgreSQL 客户所需要的共享库
-Group:         Libraries
-
-%description -n postgresql-libs
-PostgreSQL shared libraries.
-
-%description -n postgresql-libs -l pl.UTF-8
-Biblioteki dzielone programu PostgreSQL.
-
 %package ecpg
 Summary:       Embedded SQL in C interface
 Summary(pl.UTF-8):     Interfejs wbudowanego SQL-a w język C
 Group:         Libraries
-Requires:      postgresql-libs = %{version}-%{release}
-Requires:      postgresql-ecpg-libs = %{version}-%{release}
+Requires:      %{name}-dirs = %{version}-%{release}
+Requires:      postgresql-libs >= %{version}-%{release}
+Requires:      postgresql-ecpg-libs >= %{version}-%{release}
+Obsoletes:     postgresql-ecpg
 
 %description ecpg
 Embedded SQL in C interface.
@@ -272,70 +269,12 @@ Embedded SQL in C interface.
 %description ecpg -l pl.UTF-8
 Interfejs wbudowanego SQL-a w język C.
 
-%package -n postgresql-ecpg-libs
-Summary:       PostgreSQL libraries
-Summary(es.UTF-8):     Biblioteca compartida del PostgreSQL
-Summary(pl.UTF-8):     Biblioteki dzielone programu PostgreSQL
-Summary(pt_BR.UTF-8):  Biblioteca compartilhada do PostgreSQL
-Summary(zh_CN.UTF-8):  PostgreSQL 客户所需要的共享库
-Group:         Libraries
-
-%description -n postgresql-ecpg-libs
-PostgreSQL shared libraries.
-
-%description -n postgresql-ecpg-libs -l pl.UTF-8
-Biblioteki dzielone programu PostgreSQL.
-
-%package -n postgresql-ecpg-devel
-Summary:       Embedded SQL in C interface files
-Summary(pl.UTF-8):     Pliki programistyczne interfejsu wbudowanego SQL-a w język C
-Group:         Development/Libraries
-Requires:      postgresql-devel = %{version}-%{release}
-Requires:      postgresql-ecpg-devel = %{version}-%{release}
-
-%description -n postgresql-ecpg-devel
-Embedded SQL in C interface files.
-
-%description -n postgresql-ecpg-devel -l pl.UTF-8
-Pliki programistyczne interfejsu wbudowanego SQL-a w język C.
-
-%package -n postgresql-ecpg-static
-Summary:       PostgreSQL static libraries
-Summary(es.UTF-8):     Bibliotecas estaticas PostgreSQL
-Summary(pl.UTF-8):     Biblioteki statyczne programu PostgreSQL
-Summary(pt_BR.UTF-8):  Bibliotecas estáticas PostgreSQL
-Summary(ru.UTF-8):     Статические библиотеки для программирования с PostgreSQL
-Summary(uk.UTF-8):     Статичні бібліотеки для програмування з PostgreSQL
-Group:         Development/Libraries
-Requires:      postgresql-devel = %{version}-%{release}
-
-%description -n postgresql-ecpg-static
-PostgreSQL static libraries.
-
-%description -n postgresql-ecpg-static -l pl.UTF-8
-Biblioteki statyczne programu PostgreSQL.
-
-%package -n postgresql-static
-Summary:       PostgreSQL static libraries
-Summary(es.UTF-8):     Bibliotecas estaticas PostgreSQL
-Summary(pl.UTF-8):     Biblioteki statyczne programu PostgreSQL
-Summary(pt_BR.UTF-8):  Bibliotecas estáticas PostgreSQL
-Summary(ru.UTF-8):     Статические библиотеки для программирования с PostgreSQL
-Summary(uk.UTF-8):     Статичні бібліотеки для програмування з PostgreSQL
-Group:         Development/Libraries
-Requires:      postgresql-devel = %{version}-%{release}
-
-%description -n postgresql-static
-PostgreSQL static libraries.
-
-%description -n postgresql-static -l pl.UTF-8
-Biblioteki statyczne programu PostgreSQL.
-
 %package module-plperl
 Summary:       PL/perl - PostgreSQL procedural language
 Summary(pl.UTF-8):     PL/perl - język proceduralny bazy danych PostgreSQL
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-plperl
 
 %description module-plperl
 From PostgreSQL documentation:
@@ -370,7 +309,8 @@ Summary:    PL/Python - PostgreSQL procedural language
 Summary(pl.UTF-8):     PL/Python - język proceduralny bazy danych PostgreSQL
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
-%pyrequires_eq python
+%pyrequires_eq python3
+Obsoletes:     postgresql-module-plpython
 
 %description module-plpython
 From PostgreSQL documentation:
@@ -406,6 +346,7 @@ Summary(pl.UTF-8):  PL/Tcl - język proceduralny bazy danych PostgreSQL
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
 Requires:      tcl(Pgtcl)
+Obsoletes:     postgresql-module-pltcl
 
 %description module-pltcl
 From PostgreSQL documentation:
@@ -440,6 +381,7 @@ Summary:    dblink module for PostgreSQL
 Summary(pl.UTF-8):     Moduł dblink dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-dblink
 
 %description module-dblink
 dblink module for PostgreSQL provides functions returning results from
@@ -454,6 +396,7 @@ Summary:    Large Objects module for PostgreSQL
 Summary(pl.UTF-8):     Moduł Large Objects dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-lo
 
 %description module-lo
 Large Objects module for PostgreSQL adds a new data type 'lo', some
@@ -469,6 +412,7 @@ Summary:    Trigram matching for PostgreSQL
 Summary(pl.UTF-8):     Dopasowanie trigramowe dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-pg_trgm
 
 %description module-pg_trgm
 This module provides functions and index classes for determining the
@@ -483,6 +427,7 @@ Summary:    Cryptographic functions for PostgreSQL
 Summary(pl.UTF-8):     Funkcje kryptograficzne dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-pgcrypto
 
 %description module-pgcrypto
 Cryptographic functions for PostgreSQL.
@@ -496,6 +441,7 @@ Summary(pl.UTF-8):  Zewnętrzny moduł bezpieczeństwa PostgreSQL-a wykorzystują
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
 Requires:      libselinux >= 2.1.10
+Obsoletes:     postgresql-module-sepgsql
 
 %description module-sepgsql
 PostgreSQL external security provider using SELinux.
@@ -508,6 +454,7 @@ Summary:    crosstab functions for PostgreSQL
 Summary(pl.UTF-8):     Funkcje crosstab dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-module-tablefunc
 
 %description module-tablefunc
 crosstab functions for PostgreSQL.
@@ -521,6 +468,7 @@ Summary(pl.UTF-8):  Funkcje do obsługi XML-a dla PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
 Requires:      libxml2 >= 1:2.6.23
+Obsoletes:     postgresql-module-xml2
 
 %description module-xml2
 Module with XML functions provides both XPath querying and XSLT
@@ -537,6 +485,7 @@ Summary:    Miscellaneous PostgreSQL contrib modules
 Summary(pl.UTF-8):     Różne moduły dołączone do PostgreSQL-a
 Group:         Applications/Databases
 Requires:      %{name} = %{version}-%{release}
+Obsoletes:     postgresql-contrib
 
 %description contrib
 Miscellaneous PostgreSQL contrib modules.
@@ -554,6 +503,8 @@ Różne moduły dołączone do PostgreSQL-a.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 # force rebuild of bison/flex files
 find src -name \*.l -o -name \*.y | xargs touch
@@ -575,6 +526,7 @@ find src -name \*.l -o -name \*.y | xargs touch
        --datadir=%{pgsqldatadir} \
        --libdir=%{_libdir} \
        --docdir=%{pgsqldatadir}/doc \
+       --localedir=%{_datadir}/locale \
        --disable-rpath \
        --enable-depend \
        %{?with_systemtap:--enable-dtrace} \
@@ -615,10 +567,9 @@ done
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/{rc.d/init.d,sysconfig}} \
-       $RPM_BUILD_ROOT/var/{lib/pgsql,log} \
+       $RPM_BUILD_ROOT/var/{lib/postgresql/%{pgsqlversion},log/{archive,}/postgresql,run/postgresql} \
        $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} \
-       $RPM_BUILD_ROOT%{_mandir} \
-       $RPM_BUILD_ROOT/home/services/postgres
+       $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
 
 install src/tutorial/*.sql $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 
@@ -637,28 +588,26 @@ for mod in %{contrib_modules}; do \
                DESTDIR=$RPM_BUILD_ROOT
 done
 
-touch $RPM_BUILD_ROOT/var/log/pgsql
-
-sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql10
-install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/postgresql10
+sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g; s,@pgsqlversion@,%{pgsqlversion},g;' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql-%{pgsqlversion}
+sed -e 's,@pgsqlversion@,%{pgsqlversion},g;' %{SOURCE3} >$RPM_BUILD_ROOT/etc/sysconfig/postgresql-%{pgsqlversion}
 
 install -d howto
 tar zxf %{SOURCE2} -C howto
 
 %if %{with python}
-%py_comp $RPM_BUILD_ROOT%{py_libdir}
-%py_ocomp $RPM_BUILD_ROOT%{py_libdir}
+%py3_comp $RPM_BUILD_ROOT%{py3_libdir}
+%py3_ocomp $RPM_BUILD_ROOT%{py3_libdir}
 %endif
 
 # find locales
 for f in libpq5 pgscripts postgres psql initdb ecpg ecpglib6 \
        plpgsql %{?with_perl:plperl} %{?with_python:plpython} \
        pg_archivecleanup pg_basebackup pg_config pg_controldata pg_ctl pg_dump pg_resetwal pg_rewind pg_test_fsync pg_test_timing pg_upgrade pg_waldump; do
-       %find_lang $f-%{pgver}
+       %find_lang $f-%{pgsqlversion}
 done
 # merge locales
 merge_lang() {
-       cat $(for f in $@; do echo ${f}-%{pgver}.lang ; done)
+       cat $(for f in $@; do echo ${f}-%{pgsqlversion}.lang ; done)
 }
 merge_lang pgscripts postgres plpgsql \
        pg_basebackup pg_controldata pg_resetwal pg_rewind pg_upgrade pg_test_fsync pg_test_timing pg_waldump > main.lang
@@ -666,25 +615,30 @@ merge_lang psql initdb \
        pg_archivecleanup pg_ctl pg_dump > clients.lang
 
 %if %{with tcl}
-%find_lang pltcl-%{pgver}
+%find_lang pltcl-%{pgsqlversion}
 %endif
 
 %if %{with selinux}
 %{__mv} $RPM_BUILD_ROOT{%{pgsqldatadir}/contrib,%{extensiondir}}/sepgsql.sql
 %endif
 
-cp -p src/pl/plperl/ppport.h $RPM_BUILD_ROOT%{_includedir}/postgresql/%{pgver}/server/
+cp -p src/pl/plperl/ppport.h $RPM_BUILD_ROOT%{_includedir}/postgresql/%{pgsqlversion}/server/
 
 # package it...?  nah, why bother.
 %{__rm} -r $RPM_BUILD_ROOT%{pgsqldatadir}/doc/html
 
+# remove common files provided by PostgreSQL from master branch
+%{__rm} -r $RPM_BUILD_ROOT%{_includedir}/{ecpg*,libpq*,pg_config*,postgres_ext.h,postgresql/internal}
+%{__rm} -r $RPM_BUILD_ROOT{%{_libdir}/{libecpg*,libpg*,libpq*,pkgconfig},%{pgsqllibdir}/bin/pg_config,%{pgsqldatadir}/man/man1/pg_config.1*}
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/locale/*/LC_MESSAGES/{ecpglib*,libpq*,pg_config*}
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %pre
 PG_DB_CLUSTERS=""
-if [ -f /etc/sysconfig/postgresql10 ]; then
-       . /etc/sysconfig/postgresql10
+if [ -f /etc/sysconfig/postgresql-%{pgsqlversion} ]; then
+       . /etc/sysconfig/postgresql-%{pgsqlversion}
        if [ -z "$PG_DB_CLUSTERS" -a -n "$POSTGRES_DATA_DIR" ]; then
                PG_DB_CLUSTERS="$POSTGRES_DATA_DIR"
        fi
@@ -692,7 +646,7 @@ fi
 foundold=0
 for pgdir in $PG_DB_CLUSTERS; do
        if [ -f $pgdir/PG_VERSION ]; then
-               if [ $(cat $pgdir/PG_VERSION) != '%{pgver}' ]; then
+               if [ $(cat $pgdir/PG_VERSION) != '%{pgsqlversion}' ]; then
                        echo "Found database(s) in older, incompatible format in cluster $pgdir."
                        foundold=1
                fi
@@ -710,66 +664,75 @@ if [ "$foundold" = "1" ]; then
        echo
        exit 1
 fi
-%groupadd -g 88 -r postgres
-%useradd -M -o -r -u 88 -d /home/services/postgres -s /bin/sh -g postgres -c "PostgreSQL Server" postgres
 
-%triggerpostun -- %{name} < 7.2-2
+%triggerpostun -- postgresql < 10.5-2
 if [ -n "`/bin/id -u postgres 2>/dev/null`" ]; then
-       /usr/sbin/usermod -d /home/services/postgres postgres
+       /usr/sbin/usermod -d /var/lib/postgresql postgres
 fi
+echo
+echo "This version of PostgreSQL uses new default location for database clusters."
+echo "Please move your existing clusters before starting PostgreSQL so they follow"
+echo "below scheme:"
+echo
+echo "/var/lib/postgresql/<version>/<name>"
+echo
+echo "where <version> means PostgreSQL version like 9.6 or 10 and name is cluster"
+echo "name of your choice. When done, be sure to update /etc/sysconfig/postgresql*"
+echo "files so they reflect your changes."
+echo
 
 %post
-/sbin/chkconfig --add postgresql10
-%service postgresql10 restart "postgresql10 server"
+/sbin/chkconfig --add postgresql-%{pgsqlversion}
+%service postgresql-%{pgsqlversion} restart "postgresql-%{pgsqlversion} server"
 
 %preun
 if [ "$1" = "0" ]; then
-       %service postgresql10 stop
-       /sbin/chkconfig --del postgresql10
+       %service postgresql-%{pgsqlversion} stop
+       /sbin/chkconfig --del postgresql-%{pgsqlversion}
 fi
 
-%post clients
+%posttrans     clients
 update-alternatives \
-       --install %{_bindir}/clusterdb clusterdb %{pgsqllibdir}/bin/clusterdb %{pgver}%{pgminver} \
+       --install %{_bindir}/clusterdb clusterdb %{pgsqllibdir}/bin/clusterdb %{pgsqlpriority} \
        --slave %{_mandir}/man1/clusterdb.1 clusterdb.1 %{pgsqldatadir}/man/man1/clusterdb.1* || :
 update-alternatives \
-       --install %{_bindir}/createdb createdb %{pgsqllibdir}/bin/createdb %{pgver}%{pgminver} \
+       --install %{_bindir}/createdb createdb %{pgsqllibdir}/bin/createdb %{pgsqlpriority} \
        --slave %{_mandir}/man1/createdb.1 createdb.1 %{pgsqldatadir}/man/man1/createdb.1* || :
 update-alternatives \
-       --install %{_bindir}/createuser createuser %{pgsqllibdir}/bin/createuser %{pgver}%{pgminver} \
+       --install %{_bindir}/createuser createuser %{pgsqllibdir}/bin/createuser %{pgsqlpriority} \
        --slave %{_mandir}/man1/createuser.1 createuser.1 %{pgsqldatadir}/man/man1/createuser.1* || :
 update-alternatives \
-       --install %{_bindir}/dropdb dropdb %{pgsqllibdir}/bin/dropdb %{pgver}%{pgminver} \
+       --install %{_bindir}/dropdb dropdb %{pgsqllibdir}/bin/dropdb %{pgsqlpriority} \
        --slave %{_mandir}/man1/dropdb.1 dropdb.1 %{pgsqldatadir}/man/man1/dropdb.1* || :
 update-alternatives \
-       --install %{_bindir}/dropuser dropuser %{pgsqllibdir}/bin/dropuser %{pgver}%{pgminver} \
+       --install %{_bindir}/dropuser dropuser %{pgsqllibdir}/bin/dropuser %{pgsqlpriority} \
        --slave %{_mandir}/man1/dropuser.1 dropuser.1 %{pgsqldatadir}/man/man1/dropuser.1* || :
 update-alternatives \
-       --install %{_bindir}/pg_archivecleanup pg_archivecleanup %{pgsqllibdir}/bin/pg_archivecleanup %{pgver}%{pgminver} \
+       --install %{_bindir}/pg_archivecleanup pg_archivecleanup %{pgsqllibdir}/bin/pg_archivecleanup %{pgsqlpriority} \
        --slave %{_mandir}/man1/pg_archivecleanup.1 pg_archivecleanup.1 %{pgsqldatadir}/man/man1/pg_archivecleanup.1* || :
 update-alternatives \
-       --install %{_bindir}/pg_dump pg_dump %{pgsqllibdir}/bin/pg_dump %{pgver}%{pgminver} \
+       --install %{_bindir}/pg_dump pg_dump %{pgsqllibdir}/bin/pg_dump %{pgsqlpriority} \
        --slave %{_mandir}/man1/pg_dump.1 pg_dump.1 %{pgsqldatadir}/man/man1/pg_dump.1* || :
 update-alternatives \
-       --install %{_bindir}/pg_dumpall pg_dumpall %{pgsqllibdir}/bin/pg_dumpall %{pgver}%{pgminver} \
+       --install %{_bindir}/pg_dumpall pg_dumpall %{pgsqllibdir}/bin/pg_dumpall %{pgsqlpriority} \
        --slave %{_mandir}/man1/pg_dumpall.1 pg_dumpall.1 %{pgsqldatadir}/man/man1/pg_dumpall.1* || :
 update-alternatives \
-       --install %{_bindir}/pg_isready pg_isready %{pgsqllibdir}/bin/pg_isready %{pgver}%{pgminver} \
+       --install %{_bindir}/pg_isready pg_isready %{pgsqllibdir}/bin/pg_isready %{pgsqlpriority} \
        --slave %{_mandir}/man1/pg_isready.1 pg_isready.1 %{pgsqldatadir}/man/man1/pg_isready.1* || :
 update-alternatives \
-       --install %{_bindir}/pg_restore pg_restore %{pgsqllibdir}/bin/pg_restore %{pgver}%{pgminver} \
+       --install %{_bindir}/pg_restore pg_restore %{pgsqllibdir}/bin/pg_restore %{pgsqlpriority} \
        --slave %{_mandir}/man1/pg_restore.1 pg_restore.1 %{pgsqldatadir}/man/man1/pg_restore.1* || :
 update-alternatives \
-       --install %{_bindir}/psql psql %{pgsqllibdir}/bin/psql %{pgver}%{pgminver} \
+       --install %{_bindir}/psql psql %{pgsqllibdir}/bin/psql %{pgsqlpriority} \
        --slave %{_mandir}/man1/psql.1 pgsql.1 %{pgsqldatadir}/man/man1/psql.1* || :
 update-alternatives \
-       --install %{_bindir}/reindexdb reindexdb %{pgsqllibdir}/bin/reindexdb %{pgver}%{pgminver} \
+       --install %{_bindir}/reindexdb reindexdb %{pgsqllibdir}/bin/reindexdb %{pgsqlpriority} \
        --slave %{_mandir}/man1/reindexdb.1 reindexdb.1 %{pgsqldatadir}/man/man1/reindexdb.1* || :
 update-alternatives \
-       --install %{_bindir}/vacuumdb vacuumdb %{pgsqllibdir}/bin/vacuumdb %{pgver}%{pgminver} \
+       --install %{_bindir}/vacuumdb vacuumdb %{pgsqllibdir}/bin/vacuumdb %{pgsqlpriority} \
        --slave %{_mandir}/man1/vacuumdb.1 vacuumdb.1 %{pgsqldatadir}/man/man1/vacuumdb.1* || :
 
-%postun clients
+%postun        clients
 if [ $1 -eq 0 ]; then
        update-alternatives --remove clusterdb %{pgsqllibdir}/bin/clusterdb || :
        update-alternatives --remove createdb %{pgsqllibdir}/bin/createdb || :
@@ -786,26 +749,11 @@ if [ $1 -eq 0 ]; then
        update-alternatives --remove vacuumdb %{pgsqllibdir}/bin/vacuumdb || :
 fi
 
-%post  -n postgresql-devel
-update-alternatives \
-       --install %{_bindir}/pg_config pg_config %{pgsqllibdir}/bin/pg_config %{pgver}%{pgminver} \
-       --slave %{_mandir}/man1/pg_config.1 pg_config.1 %{pgsqldatadir}/man/man1/pg_config.1* || :
-
-%postun        -n postgresql-devel
-       update-alternatives --remove pg_config %{pgsqllibdir}/bin/pg_config || :
-
-
-%post  -n postgresql-libs -p /sbin/ldconfig
-%postun        -n postgresql-libs -p /sbin/ldconfig
-
-%post  -n postgresql-ecpg-libs -p /sbin/ldconfig
-%postun        -n postgresql-ecpg-libs -p /sbin/ldconfig
-
 %files -f main.lang
 %defattr(644,root,root,755)
 %doc COPYRIGHT README HISTORY doc/{bug.template,KNOWN_BUGS,MISSING_FEATURES,TODO}
-%attr(754,root,root) /etc/rc.d/init.d/postgresql10
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postgresql10
+%attr(754,root,root) /etc/rc.d/init.d/postgresql-%{pgsqlversion}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postgresql-%{pgsqlversion}
 
 %attr(755,root,root) %{pgsqllibdir}/bin/initdb
 %attr(755,root,root) %{pgsqllibdir}/bin/pg_basebackup
@@ -818,6 +766,7 @@ update-alternatives \
 %attr(755,root,root) %{pgsqllibdir}/bin/pg_test_fsync
 %attr(755,root,root) %{pgsqllibdir}/bin/pg_test_timing
 %attr(755,root,root) %{pgsqllibdir}/bin/pg_upgrade
+%attr(755,root,root) %{pgsqllibdir}/bin/pg_verify_checksums
 %attr(755,root,root) %{pgsqllibdir}/bin/pg_waldump
 %attr(755,root,root) %{pgsqllibdir}/bin/pgbench
 %attr(755,root,root) %{pgsqllibdir}/bin/postgres
@@ -840,7 +789,6 @@ update-alternatives \
 %{extensiondir}/plpgsql--*.sql
 %{extensiondir}/plpgsql.control
 
-%dir %{pgsqldatadir}
 %{pgsqldatadir}/*.bki
 %{pgsqldatadir}/*.sample
 %{pgsqldatadir}/*.description
@@ -852,10 +800,6 @@ update-alternatives \
 
 %dir %{pgsqldatadir}/contrib
 
-%attr(700,postgres,postgres) /home/services/postgres
-%attr(700,postgres,postgres) %dir /var/lib/pgsql
-%attr(640,postgres,postgres) %config(noreplace) %verify(not md5 mtime size) /var/log/pgsql
-
 %{pgsqldatadir}/man/man1/initdb.1*
 %{pgsqldatadir}/man/man1/pg_basebackup.1*
 %{pgsqldatadir}/man/man1/pg_controldata.1*
@@ -868,88 +812,42 @@ update-alternatives \
 %{pgsqldatadir}/man/man1/pg_test_fsync.1*
 %{pgsqldatadir}/man/man1/pg_test_timing.1*
 %{pgsqldatadir}/man/man1/pg_upgrade.1*
+%{pgsqldatadir}/man/man1/pg_verify_checksums.1*
 %{pgsqldatadir}/man/man1/pgbench.1*
 %{pgsqldatadir}/man/man1/postgres.1*
 %{pgsqldatadir}/man/man1/postmaster.1*
 
+%files dirs
+%defattr(644,root,root,755)
+%dir %{pgsqllibdir}
+%dir %{pgsqllibdir}/bin
+%dir %{pgsqllibdir}/lib
+%dir %{pgsqldatadir}
+%dir %{pgsqldatadir}/man
+%dir %{pgsqldatadir}/man/man1
+%dir %{pgsqldatadir}/man/man3
+%dir %{pgsqldatadir}/man/man7
+%attr(700,postgres,postgres) %dir /var/lib/postgresql/%{pgsqlversion}
+
 %files doc
 %defattr(644,root,root,755)
 %doc doc/src/sgml/html howto
 %{_examplesdir}/%{name}-%{version}
 
-%files -n postgresql-libs -f libpq5-%{pgver}.lang
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libpq.so.*.*
-%attr(755,root,root) %ghost %{_libdir}/libpq.so.5
-
-%files ecpg -f ecpg-%{pgver}.lang
+%files ecpg -f ecpg-%{pgsqlversion}.lang
 %defattr(644,root,root,755)
 %attr(755,root,root) %{pgsqllibdir}/bin/ecpg
 %{pgsqldatadir}/man/man1/ecpg.1*
 
-%files -n postgresql-ecpg-libs -f ecpglib6-%{pgver}.lang
-%attr(755,root,root) %{_libdir}/libecpg.so.*.*
-%attr(755,root,root) %ghost %{_libdir}/libecpg.so.6
-%attr(755,root,root) %{_libdir}/libecpg_compat.so.*.*
-%attr(755,root,root) %ghost %{_libdir}/libecpg_compat.so.3
-%attr(755,root,root) %{_libdir}/libpgtypes.so.*.*
-%attr(755,root,root) %ghost %{_libdir}/libpgtypes.so.3
-
-%files -n postgresql-ecpg-devel
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libecpg.so
-%attr(755,root,root) %{_libdir}/libecpg_compat.so
-%attr(755,root,root) %{_libdir}/libpgtypes.so
-%{_includedir}/ecpg*
-%{_libdir}/pkgconfig/libecpg.pc
-%{_libdir}/pkgconfig/libecpg_compat.pc
-%{_libdir}/pkgconfig/libpgtypes.pc
-
-%files -n postgresql-ecpg-static
-%defattr(644,root,root,755)
-%{_libdir}/libecpg.a
-%{_libdir}/libecpg_compat.a
-%{_libdir}/libpgtypes.a
-
-%files -n postgresql-devel -f pg_config-%{pgver}.lang
-%defattr(644,root,root,755)
-%attr(755,root,root) %{pgsqllibdir}/bin/pg_config
-%attr(755,root,root) %{_libdir}/libpq.so
-%dir %{_includedir}/postgresql
-%{_includedir}/libpq-events.h
-%{_includedir}/libpq-fe.h
-%{_includedir}/pg_config.h
-%{_includedir}/pg_config_ext.h
-%{_includedir}/pg_config_manual.h
-%{_includedir}/pg_config_os.h
-%{_includedir}/postgres_ext.h
-%dir %{_includedir}/postgresql/internal
-%{_includedir}/postgresql/internal/c.h
-%{_includedir}/postgresql/internal/libpq-int.h
-%{_includedir}/postgresql/internal/port.h
-%{_includedir}/postgresql/internal/postgres_fe.h
-%{_includedir}/postgresql/internal/pqexpbuffer.h
-%{_includedir}/postgresql/internal/libpq
-%{_includedir}/libpq
-%{_libdir}/pkgconfig/libpq.pc
-%{pgsqldatadir}/man/man1/pg_config.1*
-
 %files backend-devel
 %defattr(644,root,root,755)
-%dir %{_includedir}/postgresql/%{pgver}
-%{_includedir}/postgresql/%{pgver}/server
+%dir %{_includedir}/postgresql/%{pgsqlversion}
+%{_includedir}/postgresql/%{pgsqlversion}/server
 %dir %{moduledir}/pgxs
 %attr(755,root,root) %{moduledir}/pgxs/config
 %{moduledir}/pgxs/src
 %{pgsqldatadir}/man/man3/SPI_*.3*
 
-%files -n postgresql-static
-%defattr(644,root,root,755)
-%{_libdir}/libpq.a
-%{pgsqllibdir}/lib/libpgcommon.a
-%{pgsqllibdir}/lib/libpgfeutils.a
-%{pgsqllibdir}/lib/libpgport.a
-
 %files clients -f clients.lang
 %defattr(644,root,root,755)
 %attr(755,root,root) %{pgsqllibdir}/bin/clusterdb
@@ -982,7 +880,7 @@ update-alternatives \
 %{pgsqldatadir}/man/man7/*.7*
 
 %if %{with perl}
-%files module-plperl -f plperl-%{pgver}.lang
+%files module-plperl -f plperl-%{pgsqlversion}.lang
 %defattr(644,root,root,755)
 %attr(755,root,root) %{moduledir}/plperl.so
 %{extensiondir}/plperl--*.sql
@@ -992,15 +890,15 @@ update-alternatives \
 %endif
 
 %if %{with python}
-%files module-plpython -f plpython-%{pgver}.lang
+%files module-plpython -f plpython-%{pgsqlversion}.lang
 %defattr(644,root,root,755)
-%attr(755,root,root) %{moduledir}/plpython2.so
+%attr(755,root,root) %{moduledir}/plpython3.so
 %{extensiondir}/plpython*--*.sql
 %{extensiondir}/plpython*.control
 %endif
 
 %if %{with tcl}
-%files module-pltcl -f pltcl-%{pgver}.lang
+%files module-pltcl -f pltcl-%{pgsqlversion}.lang
 %defattr(644,root,root,755)
 %attr(755,root,root) %{moduledir}/pltcl.so
 %{extensiondir}/pltcl*--*.sql
@@ -1064,7 +962,6 @@ update-alternatives \
 %attr(755,root,root) %{moduledir}/bloom.so
 %attr(755,root,root) %{moduledir}/btree_gin.so
 %attr(755,root,root) %{moduledir}/btree_gist.so
-%attr(755,root,root) %{moduledir}/chkpass.so
 %attr(755,root,root) %{moduledir}/citext.so
 %attr(755,root,root) %{moduledir}/cube.so
 %attr(755,root,root) %{moduledir}/earthdistance.so
@@ -1098,8 +995,6 @@ update-alternatives \
 %{extensiondir}/btree_gin.control
 %{extensiondir}/btree_gist--*.sql
 %{extensiondir}/btree_gist.control
-%{extensiondir}/chkpass--*.sql
-%{extensiondir}/chkpass.control
 %{extensiondir}/citext--*.sql
 %{extensiondir}/citext.control
 %{extensiondir}/cube--*.sql
@@ -1164,8 +1059,8 @@ update-alternatives \
 %{extensiondir}/hstore_plperlu.control
 %endif
 %if %{with python}
-%attr(755,root,root) %{moduledir}/hstore_plpython2.so
-%attr(755,root,root) %{moduledir}/ltree_plpython2.so
+%attr(755,root,root) %{moduledir}/hstore_plpython3.so
+%attr(755,root,root) %{moduledir}/ltree_plpython3.so
 %{extensiondir}/hstore_plpythonu--*.sql
 %{extensiondir}/hstore_plpythonu.control
 %{extensiondir}/hstore_plpython2u--*.sql