From a6aaf40a53ea1e550e99c787c07a60a0255149cd Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 23 Aug 2018 18:39:26 +0000 Subject: [PATCH] - don't hardcode version in sysconfig, var cosmetics --- postgresql.spec | 94 ++++++++++++++++++++++---------------------- postgresql.sysconfig | 6 +-- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/postgresql.spec b/postgresql.spec index 637739f..5163b5e 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -14,8 +14,8 @@ # %define beta %{nil} -%define pgversion 10 -%define pgpriority 100 +%define pgsqlversion 10 +%define pgsqlpriority 100 Summary: PostgreSQL Data Base Management System Summary(de.UTF-8): PostgreSQL Datenbankverwaltungssystem @@ -27,8 +27,8 @@ 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-%{pgversion} -Version: %{pgversion}.5 +Name: postgresql-%{pgsqlversion} +Version: %{pgsqlversion}.5 Release: 2 License: BSD Group: Applications/Databases @@ -98,8 +98,8 @@ Obsoletes: postgresql-server Obsoletes: postgresql-test BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -%define pgsqldatadir %{_datadir}/postgresql/%{pgversion} -%define pgsqllibdir %{_libdir}/postgresql/%{pgversion} +%define pgsqldatadir %{_datadir}/postgresql/%{pgsqlversion} +%define pgsqllibdir %{_libdir}/postgresql/%{pgsqlversion} %define moduledir %{pgsqllibdir}/lib %define extensiondir %{pgsqldatadir}/extension @@ -186,15 +186,15 @@ Common PostgreSQL files and directories. PostgreSQL - wspólne pliki i katalogi. %package dirs -Summary: Common directories for PostgresSQL %{pgversion} -Summary(pl.UTF-8): Wspólne pliki i katalogi dla PostgreSQL %{pgversion} +Summary: Common directories for PostgresSQL %{pgsqlversion} +Summary(pl.UTF-8): Wspólne pliki i katalogi dla PostgreSQL %{pgsqlversion} Group: Applicataion/Databases %description dirs -Common directories for PostgresSQL %{pgversion} +Common directories for PostgresSQL %{pgsqlversion} %description dirs -l pl.UTF-8 -Wspólne pliki i katalogi dla PostgreSQL %{pgversion} +Wspólne pliki i katalogi dla PostgreSQL %{pgsqlversion} %package -n postgresql-devel Summary: PostgreSQL development header files and libraries @@ -682,8 +682,8 @@ done touch $RPM_BUILD_ROOT/var/log/pgsql -sed -e 's,@pgsqlbindir@,%{pgsqllibdir}/bin,g; s,@pgsqlversion@,%{pgversion},g;' %{SOURCE1} >$RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql-%{pgversion} -install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/postgresql-%{pgversion} +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 @@ -697,11 +697,11 @@ tar zxf %{SOURCE2} -C howto 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-%{pgversion} + %find_lang $f-%{pgsqlversion} done # merge locales merge_lang() { - cat $(for f in $@; do echo ${f}-%{pgversion}.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 @@ -709,14 +709,14 @@ merge_lang psql initdb \ pg_archivecleanup pg_ctl pg_dump > clients.lang %if %{with tcl} -%find_lang pltcl-%{pgversion} +%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/%{pgversion}/server/ +cp -p src/pl/plperl/ppport.h $RPM_BUILD_ROOT%{_includedir}/postgresql/%{pgsqlversion}/server/ %{__mv} $RPM_BUILD_ROOT{%{pgsqllibdir}/bin,%{_bindir}}/pg_config %{__mv} $RPM_BUILD_ROOT{%{pgsqldatadir}/man,%{_mandir}}/man1/pg_config.1 @@ -729,8 +729,8 @@ rm -rf $RPM_BUILD_ROOT %pre PG_DB_CLUSTERS="" -if [ -f /etc/sysconfig/postgresql-%{pgversion} ]; then - . /etc/sysconfig/postgresql-%{pgversion} +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 @@ -738,7 +738,7 @@ fi foundold=0 for pgdir in $PG_DB_CLUSTERS; do if [ -f $pgdir/PG_VERSION ]; then - if [ $(cat $pgdir/PG_VERSION) != '%{pgversion}' ]; then + if [ $(cat $pgdir/PG_VERSION) != '%{pgsqlversion}' ]; then echo "Found database(s) in older, incompatible format in cluster $pgdir." foundold=1 fi @@ -774,13 +774,13 @@ echo "files so they reflect your changes." echo %post -/sbin/chkconfig --add postgresql-%{pgversion} -%service postgresql-%{pgversion} restart "postgresql-%{pgversion} server" +/sbin/chkconfig --add postgresql-%{pgsqlversion} +%service postgresql-%{pgsqlversion} restart "postgresql-%{pgsqlversion} server" %preun if [ "$1" = "0" ]; then - %service postgresql-%{pgversion} stop - /sbin/chkconfig --del postgresql-%{pgversion} + %service postgresql-%{pgsqlversion} stop + /sbin/chkconfig --del postgresql-%{pgsqlversion} fi %pre -n postgresql-common @@ -789,43 +789,43 @@ fi %posttrans clients update-alternatives \ - --install %{_bindir}/clusterdb clusterdb %{pgsqllibdir}/bin/clusterdb %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --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 %{pgpriority} \ + --install %{_bindir}/vacuumdb vacuumdb %{pgsqllibdir}/bin/vacuumdb %{pgsqlpriority} \ --slave %{_mandir}/man1/vacuumdb.1 vacuumdb.1 %{pgsqldatadir}/man/man1/vacuumdb.1* || : %postun clients @@ -857,8 +857,8 @@ fi %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/postgresql-%{pgversion} -%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postgresql-%{pgversion} +%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 @@ -945,17 +945,17 @@ fi %doc doc/src/sgml/html howto %{_examplesdir}/%{name}-%{version} -%files -n postgresql-libs -f libpq5-%{pgversion}.lang +%files -n postgresql-libs -f libpq5-%{pgsqlversion}.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-%{pgversion}.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-%{pgversion}.lang +%files -n postgresql-ecpg-libs -f ecpglib6-%{pgsqlversion}.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.*.* @@ -979,7 +979,7 @@ fi %{_libdir}/libecpg_compat.a %{_libdir}/libpgtypes.a -%files -n postgresql-devel -f pg_config-%{pgversion}.lang +%files -n postgresql-devel -f pg_config-%{pgsqlversion}.lang %defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/pg_config %attr(755,root,root) %{_libdir}/libpq.so @@ -1004,8 +1004,8 @@ fi %files backend-devel %defattr(644,root,root,755) -%dir %{_includedir}/postgresql/%{pgversion} -%{_includedir}/postgresql/%{pgversion}/server +%dir %{_includedir}/postgresql/%{pgsqlversion} +%{_includedir}/postgresql/%{pgsqlversion}/server %dir %{moduledir}/pgxs %attr(755,root,root) %{moduledir}/pgxs/config %{moduledir}/pgxs/src @@ -1050,7 +1050,7 @@ fi %{pgsqldatadir}/man/man7/*.7* %if %{with perl} -%files module-plperl -f plperl-%{pgversion}.lang +%files module-plperl -f plperl-%{pgsqlversion}.lang %defattr(644,root,root,755) %attr(755,root,root) %{moduledir}/plperl.so %{extensiondir}/plperl--*.sql @@ -1060,7 +1060,7 @@ fi %endif %if %{with python} -%files module-plpython -f plpython-%{pgversion}.lang +%files module-plpython -f plpython-%{pgsqlversion}.lang %defattr(644,root,root,755) %attr(755,root,root) %{moduledir}/plpython2.so %{extensiondir}/plpython*--*.sql @@ -1068,7 +1068,7 @@ fi %endif %if %{with tcl} -%files module-pltcl -f pltcl-%{pgversion}.lang +%files module-pltcl -f pltcl-%{pgsqlversion}.lang %defattr(644,root,root,755) %attr(755,root,root) %{moduledir}/pltcl.so %{extensiondir}/pltcl*--*.sql diff --git a/postgresql.sysconfig b/postgresql.sysconfig index 7ff63d2..dde9282 100644 --- a/postgresql.sysconfig +++ b/postgresql.sysconfig @@ -9,10 +9,10 @@ # PG_INIT_LOCALE=C # standard setting -PG_DB_CLUSTERS="/var/lib/pgsql/10/main" +PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/main" # predictable usage -# PG_DB_CLUSTERS="/var/lib/pgsql/10/server1 /var/lib/pgsql/10/server2" +# PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/server1 /var/lib/pgsql/@pgsqlversion@/server2" # new database disk arrived -# PG_DB_CLUSTERS="/var/lib/pgsql/10/server1 /var/lib/pgsql/10/server2 /mnt/pgsql/10/server3" +# PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/server1 /var/lib/pgsql/@pgsqlversion@/server2 /mnt/pgsql/@pgsqlversion@/server3" -- 2.46.0