From 19af2059f27c8fb211bd62654b9f6ee4a7e51eba Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Apr 24 2017 11:22:03 +0000 Subject: spec: spring cleaning - %_pkgdocdir definition, not needed now - define %service_name == postgresql.service - remove duplicate help2man br - don't try to install perl-generators on RHEL - add BR Data::Dumper for perl testsuite - use %_localstatedir for several /var occurrences - use %_datadir instead of hard-wiring it - don't install *.o tutorial files (rhbz#1187514) - use mv instead of cp for rhbz#1250006 work-around - run 'make check' for postgresql-setup tarball Resolves: rhbz#1440729 Version: 9.6.2-3 --- diff --git a/postgresql.spec b/postgresql.spec index 6783ec7..56cbcaf 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -57,9 +57,6 @@ # Turn that off to ensure such files don't get included in RPMs. %global _default_patch_flags --no-backup-if-mismatch -# _pkgdocdir is defined in fc20+, remove once f19 is dead -%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} - # https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_of_Additional_RPM_Macros %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) @@ -67,7 +64,7 @@ Summary: PostgreSQL client programs Name: postgresql %global majorversion 9.6 Version: 9.6.2 -Release: 2%{?dist} +Release: 3%{?dist} # The PostgreSQL license is very similar to other MIT licenses, but the OSI # recognizes it as an independent license, so we do as well. @@ -87,6 +84,7 @@ Url: http://www.postgresql.org/ %global setup_version 5.0 +%global service_name postgresql.service Source0: ftp://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2 # The PDF file is generated by generate-pdf.sh, which see for comments Source1: postgresql-%{version}-US.pdf @@ -98,8 +96,8 @@ Source9: postgresql.tmpfiles.d Source10: postgresql.pam Source11: postgresql-bashprofile -# Temporary location of postgresql-setup. Development git: -# http://fedorapeople.org/cgit/praiskup/public_git/postgresql-setup.git/ + +# git: https://github.com/devexp-db/postgresql-setup Source12: https://github.com/devexp-db/postgresql-setup/releases/download/v%{setup_version}/postgresql-setup-%{setup_version}.tar.gz # Those here are just to enforce packagers check that the tarball was downloaded @@ -116,9 +114,11 @@ Patch5: postgresql-var-run-socket.patch Patch6: postgresql-man.patch Patch7: postgresql-timezonetz-2017-tests.patch -BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk help2man +BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk BuildRequires: perl(ExtUtils::Embed), perl-devel +%if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: perl-generators +%endif BuildRequires: readline-devel zlib-devel BuildRequires: systemd-units util-linux BuildRequires: multilib-rpm-config @@ -299,6 +299,9 @@ Summary: The Perl procedural language for PostgreSQL Group: Applications/Databases Requires: %{name}-server%{?_isa} = %{version}-%{release} Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +%if %runselftest +BuildRequires: perl(Data::Dumper) +%endif %description plperl The postgresql-plperl package contains the PL/Perl procedural language, @@ -539,8 +542,8 @@ unset PYTHON %if %selinux --with-selinux \ %endif - --with-system-tzdata=/usr/share/zoneinfo \ - --datadir=/usr/share/pgsql + --with-system-tzdata=%_datadir/zoneinfo \ + --datadir=%_datadir/pgsql make %{?_smp_mflags} world @@ -549,6 +552,9 @@ sed "s|C=\`pwd\`;|C=%{_libdir}/pgsql/tutorial;|" < src/tutorial/Makefile > src/t make %{?_smp_mflags} -C src/tutorial NO_PGXS=1 all rm -f src/tutorial/GNUmakefile +# The object files shouldn't be copied to rpm bz#1187514 +rm -f src/tutorial/*.o + # run_testsuite WHERE # ------------------- # Run 'make check' in WHERE path. When that command fails, return the logs @@ -636,7 +642,7 @@ cd .. # For some reason, having '%%doc %%{_pkgdocdir}/README.rpm-dist' in %%files # causes FTBFS (at least on RHEL6), see rhbz#1250006. -cp $RPM_BUILD_ROOT/%{_pkgdocdir}/README.rpm-dist ./ +mv $RPM_BUILD_ROOT/%{_pkgdocdir}/README.rpm-dist ./ cat > $RPM_BUILD_ROOT%{_sysconfdir}/postgresql-setup/upgrade/postgresql.conf <>main.lst %post server %if 0%{?systemd_post:1} -%systemd_post postgresql.service +%systemd_post %service_name %else if [ $1 -eq 1 ]; then # Initial installation @@ -866,30 +871,37 @@ fi # Run these because the SysV package being removed won't do them /sbin/chkconfig --del postgresql >/dev/null 2>&1 || : -/bin/systemctl try-restart postgresql.service >/dev/null 2>&1 || : +/bin/systemctl try-restart %service_name >/dev/null 2>&1 || : %preun server %if 0%{?systemd_preun:1} -%systemd_preun postgresql.service +%systemd_preun %service_name %else if [ $1 -eq 0 ]; then # Package removal, not upgrade - /bin/systemctl --no-reload disable postgresql.service >/dev/null 2>&1 || : - /bin/systemctl stop postgresql.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable %service_name >/dev/null 2>&1 || : + /bin/systemctl stop %service_name >/dev/null 2>&1 || : fi %endif %postun server %if 0%{?systemd_postun_with_restart:1} -%systemd_postun_with_restart postgresql.service +%systemd_postun_with_restart %service_name %else /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ]; then # Package upgrade, not uninstall - /bin/systemctl try-restart postgresql.service >/dev/null 2>&1 || : + /bin/systemctl try-restart %service_name >/dev/null 2>&1 || : fi %endif + +%check +%if %runselftest +make -C postgresql-setup-%{setup_version} check +%endif + + %clean # FILES section. @@ -1129,17 +1141,17 @@ fi %{_mandir}/man1/postgresql-setup.* %{_mandir}/man1/postmaster.* %{_tmpfilesdir}/postgresql.conf -%{_unitdir}/postgresql.service -%{_unitdir}/postgresql@.service -%attr(700,postgres,postgres) %dir /var/lib/pgsql -%attr(644,postgres,postgres) %config(noreplace) /var/lib/pgsql/.bash_profile -%attr(700,postgres,postgres) %dir /var/lib/pgsql/backups -%attr(700,postgres,postgres) %dir /var/lib/pgsql/data -%attr(755,postgres,postgres) %dir /var/run/postgresql +%{_unitdir}/*postgresql*.service +%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql +%attr(644,postgres,postgres) %config(noreplace) %{?_localstatedir}/lib/pgsql/.bash_profile +%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/backups +%attr(700,postgres,postgres) %dir %{?_localstatedir}/lib/pgsql/data +%attr(755,postgres,postgres) %dir %{?_localstatedir}/run/postgresql %if %pam %config(noreplace) /etc/pam.d/postgresql %endif + %files devel -f devel.lst %{_bindir}/ecpg %{_bindir}/pg_config @@ -1199,6 +1211,9 @@ fi %endif %changelog +* Fri Apr 07 2017 Pavel Raiskup - 9.6.2-3 +- spring cleanup + * Mon Mar 27 2017 Pavel Raiskup - 9.6.2-2 - rebuild for rhbz#1436006