Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNhhL-0000PX-MN for pgsql-pkg-yum@arkaria.postgresql.org; Sun, 01 Jan 2017 15:05:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cNhhK-0007Gn-TF for pgsql-pkg-yum@arkaria.postgresql.org; Sun, 01 Jan 2017 15:05:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cNhhK-0007Gh-Kd for pgsql-pkg-yum@postgresql.org; Sun, 01 Jan 2017 15:05:22 +0000 Received: from ns5.gunduz.org ([107.170.136.15] helo=ns1.gunduz.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cNhhB-0000aL-I1 for pgsql-pkg-yum@postgresql.org; Sun, 01 Jan 2017 15:05:22 +0000 Received: from asus-laptop-03-gunduz-org (unknown [88.248.122.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ns1.gunduz.org (Postfix) with ESMTPSA id 4697A3FCF5; Sun, 1 Jan 2017 15:05:12 +0000 (UTC) Message-ID: <1483283108.3381.42.camel@gunduz.org> Subject: Re: a bunch of potential improvements to the postgresql spec files From: Devrim =?ISO-8859-1?Q?G=FCnd=FCz?= To: Jonathon Nelson , pgsql-pkg-yum@postgresql.org Date: Sun, 01 Jan 2017 18:05:08 +0300 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-6c6pS//2whhOkgpF37Rd" X-Mailer: Evolution 3.22.3 (3.22.3-1.fc25) Mime-Version: 1.0 X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-pkg-yum Precedence: bulk Sender: pgsql-pkg-yum-owner@postgresql.org --=-6c6pS//2whhOkgpF37Rd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jonathon, Thanks for the report. Committed parts of this to spec file: https://git.postgresql.org/gitweb/?p=3Dpgrpms.git;a=3Dcommit;h=3Db7811829fd= bf46b0248f8f0f1c3ca471616b7e04 Regards, Devrim On Fri, 2016-12-02 at 14:06 -0600, Jonathon Nelson wrote: > Please find below a list of various improvements that we've made to the > specfile for PostgreSQL 9.x. >=20 >=20 >=20 > 0. globally replace /usr/sbin with %{_sbindir}, /usr/bin with %{_bindir}, > and /usr/share/man with %{_mandir} >=20 > 1. Remove the redundant use of 0%{?rhel} in tests for RHEL-specific value= s. > Turns: > %if 0%{?rhel} && 0%{rhel} > 6 > into: > %if 0%{rhel} > 6 >=20 > 2. add min version to flex dependency: > BuildRequires: flex >=3D 2.5.31 >=20 > 3. move redundantly specified perl(ExtUtils::MakeMaker) outside of rhel > version tests >=20 > 4. Remove comma (it's not an error, it's just not as aesthetic) from > Requires line(s): >=20 > -Requires(pre):=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/useradd, %{_sbin= dir}/groupadd > +Requires(pre):=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/useradd %{_sbind= ir}/groupadd >=20 > 5. Remove redundant strip of -ffast-math from CFLAGS >=20 > 6. replace hard-coded path for PGENGINE variable with %{pgbaseinstdir}: >=20 > =C2=A0# prep the setup script, including insertion of some values it need= s > =C2=A0sed -e 's|^PGVERSION=3D.*$|PGVERSION=3D%{version}|' \ > -=C2=A0=C2=A0=C2=A0-e 's|^PGENGINE=3D.*$|PGENGINE=3D/usr/pgsql-%{majorver= sion}/bin|' \ > +=C2=A0=C2=A0=C2=A0-e 's|^PGENGINE=3D.*$|PGENGINE=3D%{pgbaseinstdir}/bin|= ' \ > =C2=A0=C2=A0=C2=A0=C2=A0<%{SOURCE17} >postgresql%{packageversion}-setup >=20 > 7. Remove redundant file list init: >=20 > # initialize file lists > %{__cp} /dev/null main.lst > %{__cp} /dev/null libs.lst > %{__cp} /dev/null server.lst > %{__cp} /dev/null devel.lst > %{__cp} /dev/null plperl.lst > %{__cp} /dev/null pltcl.lst > %{__cp} /dev/null plpython.lst >=20 > 8. Replace all repetitive blocks for update-alternatives with for loop > *AND* use %{mandir} and %{bindir} (per item 0): >=20 > %{_sbindir}/update-alternatives --install %{bindir}/psql=C2=A0=C2=A0=C2= =A0pgsql-psql > %{pgbaseinstdir}/bin/psql %{packageversion}0 > %{_sbindir}/update-alternatives --install %{bindir}/clusterdb > pgsql-clusterdb=C2=A0=C2=A0%{pgbaseinstdir}/bin/clusterdb %{packageversio= n}0 > ... > %{_sbindir}/update-alternatives --install %{bindir}/pg_basebackup > pgsql-pg_basebackup=C2=A0=C2=A0=C2=A0=C2=A0%{pgbaseinstdir}/bin/pg_baseba= ckup %{packageversion}0 > ... >=20 > with: >=20 > for i in \ > =C2=A0=C2=A0=C2=A0=C2=A0pgbench pg_test_timing pg_upgrade pg_xlogdump pg_= archivecleanup \ > =C2=A0=C2=A0=C2=A0=C2=A0pg_config pg_isready pg_test_fsync pg_receivexlog= \ > =C2=A0=C2=A0=C2=A0=C2=A0psql clusterdb \ > =C2=A0=C2=A0=C2=A0=C2=A0createdb createlang createuser \ > =C2=A0=C2=A0=C2=A0=C2=A0dropdb droplang dropuser \ > =C2=A0=C2=A0=C2=A0=C2=A0pg_basebackup pg_dump pg_dumpall pg_restore \ > =C2=A0=C2=A0=C2=A0=C2=A0reindexdb vacuumdb; do > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{bindi= r}/${i} > pgsql-${i} %{pgbaseinstdir}/bin/${i} %{packageversion}0 > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{mandi= r}/man1/${i}.1 > pgsql-${i}man=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{pgbaseinstdir}/share/man/man= 1/${i}.1 %{packageversion}0 > done >=20 >=20 > 9. in %post for -server, don't overwrite the symlink for 'postmaster' whi= ch > may be supplied by the OS vendor: >=20 > # N.B. -- manually excluded 'postmaster' from update-alternatives > # so that it doesn't conflict with the native vendor-supplied package > # which does sometimes symlink postmaster to postgres. > # > for i in \ > =C2=A0=C2=A0=C2=A0=C2=A0initdb pg_controldata pg_ctl pg_resetxlog postgre= s; do > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{bindi= r}/${i} > pgsql-${i} %{pgbaseinstdir}/bin/${i} %{packageversion}0 > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{mandi= r}/man1/${i}.1 > pgsql-${i}man=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{pgbaseinstdir}/share/man/man= 1/${i}.1 %{packageversion}0 > done >=20 > # fixup install of postmaster update-alternatives without wrecking > # native OS-install of symlink > if [ "$( readlink /usr/bin/postmaster )" =3D > "/etc/alternatives/pgsql-postmaster" ]; then > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --remove pgsql-po= stmaster > %{pgbaseinstdir}/bin/postmaster > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --remove pgsql-po= stmasterman > %{pgbaseinstdir}/share/man/man1/postmaster.1 > fi >=20 > and a similar block in -server's %postun: >=20 > # N.B. -- manually excluded 'postmaster' from update-alternatives > # so that it doesn't conflict with the native OS-supplied package > # which does sometimes symlink postmaster to postgres. > # > if [ "$1" -eq 0 ] > =C2=A0=C2=A0=C2=A0=C2=A0then > =C2=A0=C2=A0=C2=A0=C2=A0for i in \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0initdb pg_controldata pg_= ctl pg_resetxlog postgres; do > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove pgsql-${i} > %{pgbaseinstdir}/bin/${i} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove pgsql-${i}man > %{pgbaseinstdir}/share/man/man1/${i}.1 > =C2=A0=C2=A0=C2=A0=C2=A0done >=20 > 10. Additional update-alternatives for -contrib and -devel: >=20 > %post devel > for i in ecpg; do > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{bindi= r}/${i} > pgsql-${i} %{pgbaseinstdir}/bin/${i} %{packageversion}0 > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{mandi= r}/man1/${i}.1 > pgsql-${i}man=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{pgbaseinstdir}/share/man/man= 1/${i}.1 %{packageversion}0 > done >=20 > %postun devel > if [ "$1" -eq 0 ] > =C2=A0=C2=A0=C2=A0=C2=A0then > =C2=A0=C2=A0=C2=A0=C2=A0for i in ecpg; do > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove=C2=A0=C2=A0pgsql-${i} > %{pgbaseinstdir}/bin/${i} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove=C2=A0=C2=A0pgsql-${i}man > %{pgbaseinstdir}/share/man/man1/${i}.1 > =C2=A0=C2=A0=C2=A0=C2=A0done > fi >=20 > %post contrib > for i in oid2name vacuumlo pg_recvlogical pg_standby; do > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{bindi= r}/${i} > pgsql-${i} %{pgbaseinstdir}/bin/${i} %{packageversion}0 > =C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-alternatives --install %{mandi= r}/man1/${i}.1 > pgsql-${i}man=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{pgbaseinstdir}/share/man/man= 1/${i}.1 %{packageversion}0 > done >=20 > %postun contrib > if [ "$1" -eq 0 ] > =C2=A0=C2=A0=C2=A0=C2=A0then > =C2=A0=C2=A0=C2=A0=C2=A0for i in oid2name vacuumlo pg_recvlogical pg_stan= dby; do > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove pgsql-${i} > %{pgbaseinstdir}/bin/${i} > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%{_sbindir}/update-altern= atives --remove pgsql-${i}man > %{pgbaseinstdir}/share/man/man1/${i}.1 > =C2=A0=C2=A0=C2=A0=C2=A0done > fi >=20 >=20 >=20 > -- > Jon Nelson > Dyn / Principal Software Engineer --=20 Devrim G=C3=9CND=C3=9CZ EnterpriseDB: http://www.enterprisedb.com PostgreSQL Dan=C4=B1=C5=9Fman=C4=B1/Consultant, Red Hat Certified Engineer Twitter: @DevrimGunduz , @DevrimGunduzTR --=-6c6pS//2whhOkgpF37Rd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJYaRqlAAoJENjDPf6Sz261HpsP/0p2cd1yJVyQB85akEHo+13q 5t57pC9eGPnbCfhVcFCJKqLs7FvAZeig9trNKR8mYmYy5i4GyexosrnWU6SoKd7U fnZuLoUSmbUYFZroKjJ1HcAXOGG1vHpqdTuqFPzO7A2TDwt5Rjrz3L/WxX1ebzNF 3DGXpIgKlRIY0jzOhtOOq5DcapKKgFTMjaM4YX3hDuTQ0oUvnsHjt2IDaZmr+cgt RvpA1NDJFMizXioMarszhUSr+wGvf8i/uSHpI5i+ad5PNs0yruqQ3JOD58ci/E3h rY3tFq3rdYAiKxHWsHYbXa1N+QzUzvcCwI6tXUJQW6m3DBYwXIS1ghvQCSn0PEKA 7jhCWVq8//AYJcLzyax9aN3PjDXOSobNAO64OrAEeAG73qveO3VVwChMpFO2JkDm RHpLXCMGp9eLS539uuypyGQcWOuKBfWsv+5TWhFldQ972jDcB1mzkclivpoZZVAd 4OiUXZfQwX6OHupI5KNO4rj7yYtn98oEEZUvsfQCr27Gys+/EpyHb4r3y+wCnktb aoyMP140um9ZpGYCMkkELYz82l+e5fB4nBeDb4+s/U2nMibd3L3KQr2VZ7JMtXPX pr3CzRqnxE8uqCs1+Tc295rr3qmBZiK/dEQ9mlJ4nbtYX1x+FiBtQLIGUOvJ+XDi i/Bo+xXdGfY3dsU7ZbcF =RNYK -----END PGP SIGNATURE----- --=-6c6pS//2whhOkgpF37Rd--