From: Marcin Krol Date: Thu, 23 Aug 2018 18:35:16 +0000 (+0000) Subject: - don't hardcode version in sysconfig, var cosmetics X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=d1f67cdbd3e8149376b4e06e28fc0e9c76906724;p=packages%2Fpostgresql.git - don't hardcode version in sysconfig, var cosmetics --- diff --git a/postgresql.spec b/postgresql.spec index b4f6969..04366b4 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -14,8 +14,8 @@ # %define beta %{nil} -%define pgversion 9.5 -%define pgpriority 95 +%define pgsqlversion 9.5 +%define pgsqlpriority 95 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}.14 +Name: postgresql-%{pgsqlversion} +Version: %{pgsqlversion}.14 Release: 1 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 @@ -173,15 +173,15 @@ PostgreSQL może być uruchomiony pod następującymi systemami: Solaris, SunOS, HPUX, AIX, Linux, Irix, FreeBSD i innymi systemami uniksowymi. %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 backend-devel Summary: PostgreSQL backend development header files @@ -572,8 +572,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 @@ -587,11 +587,11 @@ tar zxf %{SOURCE2} -C howto for f in libpq5 pgscripts postgres psql initdb ecpg ecpglib6 \ plpgsql %{?with_perl:plperl} %{?with_python:plpython} \ pg_basebackup pg_config pg_controldata pg_ctl pg_dump pg_resetxlog pg_rewind; 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_resetxlog pg_rewind > main.lang @@ -599,14 +599,14 @@ merge_lang psql initdb \ 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/ # package it...? nah, why bother. %{__rm} -r $RPM_BUILD_ROOT%{pgsqldatadir}/doc/html @@ -621,8 +621,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 @@ -630,7 +630,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 @@ -650,54 +650,54 @@ if [ "$foundold" = "1" ]; then fi %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 %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 @@ -720,8 +720,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 @@ -801,15 +801,15 @@ fi %doc doc/src/sgml/html howto %{_examplesdir}/%{name}-%{version} -%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 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 @@ -851,7 +851,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 @@ -861,7 +861,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 @@ -869,7 +869,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) %{pgsqllibdir}/bin/pltcl_* %attr(755,root,root) %{moduledir}/pltcl.so diff --git a/postgresql.sysconfig b/postgresql.sysconfig index e6bba53..dde9282 100644 --- a/postgresql.sysconfig +++ b/postgresql.sysconfig @@ -9,10 +9,10 @@ # PG_INIT_LOCALE=C # standard setting -PG_DB_CLUSTERS="/var/lib/pgsql/9.5/main" +PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/main" # predictable usage -# PG_DB_CLUSTERS="/var/lib/pgsql/9.5/server1 /var/lib/pgsql/9.5/server2" +# PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/server1 /var/lib/pgsql/@pgsqlversion@/server2" # new database disk arrived -# PG_DB_CLUSTERS="/var/lib/pgsql/9.5/server1 /var/lib/pgsql/9.5/server2 /mnt/pgsql/9.5/server3" +# PG_DB_CLUSTERS="/var/lib/pgsql/@pgsqlversion@/server1 /var/lib/pgsql/@pgsqlversion@/server2 /mnt/pgsql/@pgsqlversion@/server3"