From 4d03e46b035c10605b50909bf31f53ea3343eeec Mon Sep 17 00:00:00 2001
From: Craig Ringer <craig.ringer@2ndquadrant.com>
Date: Mon, 16 Nov 2020 12:04:42 +0800
Subject: [PATCH v1] Enable TAP tests and package TAP postgres modules for EL-7
 and EL-8

All RHEL had TAP tests disabled since commit 511834297 "Disable tap tests on
RHEL 7". This claimed that "Red Hat does not ship with the necessary deps",
they were only present on CentOS. The same commit added a dependency for
perl-Test-Simple, suggesting the issue may have related to Test::More, which is
part of Test::Simple, but it's not too clear.

Investigation of the current state by Jehan-Guillaume de Rorthais shows that
RHEL 7 (at least 7.8) does have Test::More at least if requested via the
preferred Perl module Provides syntax 'perl(Test::More)' per [1].

Accordingly, re-enable building with --enable-tap-tests on RHEL7. In the
process switch to the Perl module Provides syntax for modules 'perl(IPC::Run)'
and 'perl(Test::More)' instead of naming the rpm packages they are part of,
'perl-IPC-Run' and 'perl-Test-Simple' respectively. And merge the requirements
for Fedora and RHEL 7/8, since there's no apparent reason they should be
separate.

[1] https://www.postgresql.org/message-id/20201112113632.627b8749@firost
---
 .../postgresql-10/master/postgresql-10.spec        | 14 +++++---------
 .../postgresql-11/master/postgresql-11.spec        | 14 +++++---------
 .../postgresql-12/master/postgresql-12.spec        | 14 +++++---------
 .../postgresql-13/master/postgresql-13.spec        | 14 +++++---------
 .../postgresql-14/main/postgresql-14.spec          | 14 +++++---------
 5 files changed, 25 insertions(+), 45 deletions(-)

diff --git a/rpm/redhat/master/non-common/postgresql-10/master/postgresql-10.spec b/rpm/redhat/master/non-common/postgresql-10/master/postgresql-10.spec
index a5b6a015a..501e3884f 100644
--- a/rpm/redhat/master/non-common/postgresql-10/master/postgresql-10.spec
+++ b/rpm/redhat/master/non-common/postgresql-10/master/postgresql-10.spec
@@ -12,7 +12,7 @@
 %{!?kerbdir:%global kerbdir "/usr"}
 %{!?disablepgfts:%global disablepgfts 0}
 
-%if 0%{?rhel} || 0%{?suse_version} >= 1315
+%if (0%{?rhel} && 0%{?rhel} <= 6) || 0%{?suse_version} >= 1315
 %{!?enabletaptests:%global enabletaptests 0}
 %else
 %{!?enabletaptests:%global enabletaptests 1}
@@ -367,17 +367,13 @@ Requires:	libicu-devel
 %endif
 
 %if %enabletaptests
-%if 0%{?suse_version} && 0%{?suse_version} >= 1315
+%if 0%{?suse_version}
 Requires:	perl-IPC-Run
 BuildRequires:	perl-IPC-Run
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 7
-Requires:	perl-Test-Simple
-BuildRequires:	perl-Test-Simple
-%endif
-%if 0%{?fedora}
-Requires:	perl-IPC-Run
-BuildRequires:	perl-IPC-Run
+%if 0%{?rhel} || 0%{?fedora}
+Requires:	perl(Test::More) perl(IPC::Run)
+BuildRequires:	perl(Test::More) perl(IPC::Run)
 %endif
 %endif
 
diff --git a/rpm/redhat/master/non-common/postgresql-11/master/postgresql-11.spec b/rpm/redhat/master/non-common/postgresql-11/master/postgresql-11.spec
index 4246532c7..63d59e3ed 100644
--- a/rpm/redhat/master/non-common/postgresql-11/master/postgresql-11.spec
+++ b/rpm/redhat/master/non-common/postgresql-11/master/postgresql-11.spec
@@ -11,7 +11,7 @@
 %{!?kerbdir:%global kerbdir "/usr"}
 %{!?disablepgfts:%global disablepgfts 0}
 
-%if 0%{?rhel} || 0%{?suse_version} >= 1315
+%if (0%{?rhel} && 0%{?rhel} <= 6) || 0%{?suse_version} >= 1315
 %{!?enabletaptests:%global enabletaptests 0}
 %else
 %{!?enabletaptests:%global enabletaptests 1}
@@ -416,17 +416,13 @@ Requires:	libicu-devel
 %endif
 
 %if %enabletaptests
-%if 0%{?suse_version} && 0%{?suse_version} >= 1315
+%if 0%{?suse_version}
 Requires:	perl-IPC-Run
 BuildRequires:	perl-IPC-Run
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 7
-Requires:	perl-Test-Simple
-BuildRequires:	perl-Test-Simple
-%endif
-%if 0%{?fedora}
-Requires:	perl-IPC-Run
-BuildRequires:	perl-IPC-Run
+%if 0%{?rhel} || 0%{?fedora}
+Requires:	perl(Test::More) perl(IPC::Run)
+BuildRequires:	perl(Test::More) perl(IPC::Run)
 %endif
 %endif
 
diff --git a/rpm/redhat/master/non-common/postgresql-12/master/postgresql-12.spec b/rpm/redhat/master/non-common/postgresql-12/master/postgresql-12.spec
index be62e1f9e..0617cef71 100644
--- a/rpm/redhat/master/non-common/postgresql-12/master/postgresql-12.spec
+++ b/rpm/redhat/master/non-common/postgresql-12/master/postgresql-12.spec
@@ -12,7 +12,7 @@
 %{!?kerbdir:%global kerbdir "/usr"}
 %{!?disablepgfts:%global disablepgfts 0}
 
-%if 0%{?rhel} || 0%{?suse_version} >= 1315
+%if (0%{?rhel} && 0%{?rhel} <= 6) || 0%{?suse_version} >= 1315
 %{!?enabletaptests:%global enabletaptests 0}
 %else
 %{!?enabletaptests:%global enabletaptests 1}
@@ -417,17 +417,13 @@ Requires:	libicu-devel
 %endif
 
 %if %enabletaptests
-%if 0%{?suse_version} && 0%{?suse_version} >= 1315
+%if 0%{?suse_version}
 Requires:	perl-IPC-Run
 BuildRequires:	perl-IPC-Run
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 7
-Requires:	perl-Test-Simple
-BuildRequires:	perl-Test-Simple
-%endif
-%if 0%{?fedora}
-Requires:	perl-IPC-Run
-BuildRequires:	perl-IPC-Run
+%if 0%{?rhel} || 0%{?fedora}
+Requires:	perl(Test::More) perl(IPC::Run)
+BuildRequires:	perl(Test::More) perl(IPC::Run)
 %endif
 %endif
 
diff --git a/rpm/redhat/master/non-common/postgresql-13/master/postgresql-13.spec b/rpm/redhat/master/non-common/postgresql-13/master/postgresql-13.spec
index 7f284a5f2..49afff9fa 100644
--- a/rpm/redhat/master/non-common/postgresql-13/master/postgresql-13.spec
+++ b/rpm/redhat/master/non-common/postgresql-13/master/postgresql-13.spec
@@ -12,7 +12,7 @@
 %{!?kerbdir:%global kerbdir "/usr"}
 %{!?disablepgfts:%global disablepgfts 0}
 
-%if 0%{?rhel} || 0%{?suse_version} >= 1315
+%if (0%{?rhel} && 0%{?rhel} <= 6) || 0%{?suse_version} >= 1315
 %{!?enabletaptests:%global enabletaptests 0}
 %else
 %{!?enabletaptests:%global enabletaptests 1}
@@ -386,17 +386,13 @@ Requires:	libicu-devel
 %endif
 
 %if %enabletaptests
-%if 0%{?suse_version} && 0%{?suse_version} >= 1315
+%if 0%{?suse_version}
 Requires:	perl-IPC-Run
 BuildRequires:	perl-IPC-Run
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 7
-Requires:	perl-Test-Simple
-BuildRequires:	perl-Test-Simple
-%endif
-%if 0%{?fedora}
-Requires:	perl-IPC-Run
-BuildRequires:	perl-IPC-Run
+%if 0%{?rhel} || 0%{?fedora}
+Requires:	perl(Test::More) perl(IPC::Run)
+BuildRequires:	perl(Test::More) perl(IPC::Run)
 %endif
 %endif
 
diff --git a/rpm/redhat/master/non-common/postgresql-14/main/postgresql-14.spec b/rpm/redhat/master/non-common/postgresql-14/main/postgresql-14.spec
index 644df2ebe..fbab2e44a 100644
--- a/rpm/redhat/master/non-common/postgresql-14/main/postgresql-14.spec
+++ b/rpm/redhat/master/non-common/postgresql-14/main/postgresql-14.spec
@@ -14,7 +14,7 @@
 %{!?kerbdir:%global kerbdir "/usr"}
 %{!?disablepgfts:%global disablepgfts 0}
 
-%if 0%{?rhel} || 0%{?suse_version} >= 1315
+%if (0%{?rhel} && 0%{?rhel} <= 6) || 0%{?suse_version} >= 1315
 %{!?enabletaptests:%global enabletaptests 0}
 %else
 %{!?enabletaptests:%global enabletaptests 1}
@@ -388,17 +388,13 @@ Requires:	libicu-devel
 %endif
 
 %if %enabletaptests
-%if 0%{?suse_version} && 0%{?suse_version} >= 1315
+%if 0%{?suse_version}
 Requires:	perl-IPC-Run
 BuildRequires:	perl-IPC-Run
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 7
-Requires:	perl-Test-Simple
-BuildRequires:	perl-Test-Simple
-%endif
-%if 0%{?fedora}
-Requires:	perl-IPC-Run
-BuildRequires:	perl-IPC-Run
+%if 0%{?rhel} || 0%{?fedora}
+Requires:	perl(Test::More) perl(IPC::Run)
+BuildRequires:	perl(Test::More) perl(IPC::Run)
 %endif
 %endif
 
-- 
2.26.2

