Subject: When %nls/%ssl/%xml macro is set to 0

From: Tomoaki Sato <[email-masked]>
Date: Thu, 03 Nov 2016 21:35:44 +0900 (JST)

Hi,

When %nls macro is set to 0, PostgreSQL 9.6 RPM package build fails.

---
$ rpmbuild -ba -D 'nls 0' SPECS/postgresql-9.6.spec 
(snip)
+ /usr/bin/cp /dev/null pltcl.lst
+ /usr/bin/cp /dev/null plpython.lst
+ cat libpq5-9.6.lang
cat: libpq5-9.6.lang: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.ct9Vwi (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.ct9Vwi (%install)
----

*.lst filename and %endif position for %if %{nls} ... %endif block are
wrong.

Even when %ssl macro is set to 0, it fails.

----
$ rpmbuild -ba -D 'ssl 0' SPECS/postgresql-9.6.spec
+ cp -pr src/tutorial /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
+ cp -pr doc/html /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
+ exit 0
Provides: postgresql-docs postgresql96-docs = 9.6.1-1PGDG.el7.centos postgresql96-docs(x86-64) = 9.6.1-1PGDG.el7.centos
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.4)(64bit) rtld(GNU_HASH)
Processing files: postgresql96-contrib-9.6.1-1PGDG.el7.centos.x86_64
error: File not found: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/lib/sslinfo.so
error: File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/sslinfo*

RPM build errors:
    File not found: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/lib/sslinfo.so
    File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/sslinfo*
----	

sslinfo module isn't excluded from %files list. 

Even when %xml macro is set to 0, it fails.

----
$ rpmbuild -ba -D 'xml 0' SPECS/postgresql-9.6.spec
+ cp -pr src/tutorial /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
+ cp -pr doc/html /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
+ exit 0
Provides: postgresql-docs postgresql96-docs = 9.6.1-1PGDG.el7.centos postgresql96-docs(x86-64) = 9.6.1-1PGDG.el7.centos
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.4)(64bit) rtld(GNU_HASH)
Processing files: postgresql96-contrib-9.6.1-1PGDG.el7.centos.x86_64
error: File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/xml2*

RPM build errors:
    File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/xml2*
----

xml2 module isn't excluded from %files list. 

Send a patch to fix them.

Regards,

----
Tomoaki Sato <[email-masked]>
SRA OSS, Inc. Japan

--- SPECS/postgresql-9.6.spec.orig	2016-11-03 18:16:27.442831332 +0900
+++ SPECS/postgresql-9.6.spec	2016-11-03 19:43:48.188604275 +0900
@@ -781,23 +781,14 @@
 %{__rm} -rf %{buildroot}%{_docdir}/pgsql
 
 # 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
-%{__cp} /dev/null plpython3.lst
-
-# 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
+%{__cp} /dev/null pg_main.lst
+%{__cp} /dev/null pg_libpq5.lst
+%{__cp} /dev/null pg_server.lst
+%{__cp} /dev/null pg_devel.lst
+%{__cp} /dev/null pg_plperl.lst
+%{__cp} /dev/null pg_pltcl.lst
+%{__cp} /dev/null pg_plpython.lst
+%{__cp} /dev/null pg_plpython3.lst
 
 %if %nls
 %find_lang ecpg-%{majorversion}
@@ -833,12 +824,12 @@
 %endif
 %find_lang postgres-%{majorversion}
 %find_lang psql-%{majorversion}
-%endif
 
 cat libpq5-%{majorversion}.lang > pg_libpq5.lst
 cat pg_config-%{majorversion}.lang ecpg-%{majorversion}.lang ecpglib6-%{majorversion}.lang > pg_devel.lst
 cat initdb-%{majorversion}.lang pg_ctl-%{majorversion}.lang psql-%{majorversion}.lang pg_dump-%{majorversion}.lang pg_basebackup-%{majorversion}.lang pg_rewind-%{majorversion}.lang pgscripts-%{majorversion}.lang > pg_main.lst
 cat postgres-%{majorversion}.lang pg_resetxlog-%{majorversion}.lang pg_controldata-%{majorversion}.lang plpgsql-%{majorversion}.lang > pg_server.lst
+%endif
 
 %pre server
 groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
@@ -1111,7 +1102,9 @@
 %{pgbaseinstdir}/lib/postgres_fdw.so
 %{pgbaseinstdir}/lib/refint.so
 %{pgbaseinstdir}/lib/seg.so
+%if %ssl
 %{pgbaseinstdir}/lib/sslinfo.so
+%endif
 %if %selinux
 %{pgbaseinstdir}/lib/sepgsql.so
 %{pgbaseinstdir}/share/contrib/sepgsql.sql
@@ -1164,7 +1157,9 @@
 %{pgbaseinstdir}/share/extension/postgres_fdw*
 %{pgbaseinstdir}/share/extension/refint*
 %{pgbaseinstdir}/share/extension/seg*
+%if %ssl
 %{pgbaseinstdir}/share/extension/sslinfo*
+%endif
 %{pgbaseinstdir}/share/extension/tablefunc*
 %{pgbaseinstdir}/share/extension/tcn*
 %{pgbaseinstdir}/share/extension/timetravel*
@@ -1175,7 +1170,9 @@
 %if %uuid
 %{pgbaseinstdir}/share/extension/uuid-ossp*
 %endif
+%if %xml
 %{pgbaseinstdir}/share/extension/xml2*
+%endif
 %{pgbaseinstdir}/bin/oid2name
 %{pgbaseinstdir}/bin/vacuumlo
 %{pgbaseinstdir}/bin/pg_recvlogical

-- 
Sent via pgsql-pkg-yum mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-pkg-yum

---

From: Devrim Gündüz <[email-masked]>
Date: Sat, 12 Nov 2016 08:13:51 +0300

Hi Tomoaki,

Wow, good catch! I'll apply the patch soon. Should we release a new version, or
just wait for the next minor release? I'm inclined to go with the latter, as I
want to avoid people to restart their instances just for applying this patch.

Regards, Devrim

On Thu, 2016-11-03 at 21:35 +0900, Tomoaki Sato wrote:
> + cp -pr src/tutorial /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
> + cp -pr doc/html /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
> + exit 0
> Provides: postgresql-docs postgresql96-docs = 9.6.1-1PGDG.el7.centos
> postgresql96-docs(x86-64) = 9.6.1-1PGDG.el7.centos
> Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests)
> <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> Requires: /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit)
> libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.4)(64bit) rtld(GNU_HASH)
> error: File not found: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/pgsql-9.6/lib/sslinfo.so
> error: File not found by glob: /home/tom-
> sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-
> 9.6/share/extension/sslinfo*
> 
> 
> RPM build errors:
>     File not found: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/pgsql-9.6/lib/sslinfo.so
>     File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-
> 9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/sslinfo*
> ----    
> 
> + cp -pr src/tutorial /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
> + cp -pr doc/html /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-
> 1PGDG.el7.centos.x86_64/usr/share/doc/postgresql96-docs-9.6.1
> + exit 0
> Provides: postgresql-docs postgresql96-docs = 9.6.1-1PGDG.el7.centos
> postgresql96-docs(x86-64) = 9.6.1-1PGDG.el7.centos
> Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests)
> <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> Requires: /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit)
> libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.4)(64bit) rtld(GNU_HASH)
> error: File not found by glob: /home/tom-
> sato/rpmbuild/BUILDROOT/postgresql96-9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-
> 9.6/share/extension/xml2*
> 
> 
> RPM build errors:
>     File not found by glob: /home/tom-sato/rpmbuild/BUILDROOT/postgresql96-
> 9.6.1-1PGDG.el7.centos.x86_64/usr/pgsql-9.6/share/extension/xml2*
> ----
> 

-- 
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: Devrim Gündüz <[email-masked]>
Date: Sun, 01 Jan 2017 18:04:05 +0300

Hi,

Thanks for the patch. Committed:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commit;h=b7811829fdbf46b0248f8f0f1c3ca471616b7e04

Regards, Devrim