[Pki-devel] pki-core spec file cleanup for rhel8

Troy Dawson tdawson at redhat.com
Tue Nov 7 17:56:24 UTC 2017


Hi,
The RHEL8 building, using packages from Fedora 27 and 28 has begun.
This is still not public knowledge, please do not discuss it with
non-redhat personell.

Just so you know, the goal of the rhel8 builds to that the rhel8
packages should be as identical as possible to their fedora 27 or 28
counterparts.

We have several packages that have bad %if statements, causing them to
either not build in rhel8, or work differently than their Fedora
counterparts.  pki-core is one of those packages.

So, I went through the pki-core spec file, removing %if cruft, and
updating %if fedora's and %if rhel's to what we've used on other
fedora spec files.

I am attaching the spec file diff.

How would ya'll feel about making this a pull request.

Troy Dawson
-------------- next part --------------
diff --git a/pki-core.spec b/pki-core.spec
index c447360..01ab9aa 100644
--- a/pki-core.spec
+++ b/pki-core.spec
@@ -2,10 +2,10 @@
 %{!?__python2: %global __python2 /usr/bin/python2}
 %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 
-%if 0%{?rhel} || 0%{?fedora} < 24
-%global with_python3 0
-%else
+%if 0%{?fedora} || 0%{?rhel} > 7
 %global with_python3 1
+%else
+%global with_python3 0
 %endif
 
 %if 0%{?rhel}
@@ -24,27 +24,22 @@
 %define java_home /usr/lib/jvm/jre-1.8.0-openjdk
 
 # Tomcat
-%if 0%{?fedora} >= 23
+%if 0%{?fedora} || 0%{?rhel} > 7
 %define with_tomcat7 0
 %define with_tomcat8 1
 %else
-# 0%{?rhel} || 0%{?fedora} <= 22
+# %if 0%{?rhel} && 0%{?rhel} <= 7
 %define with_tomcat7 1
 %define with_tomcat8 0
 %endif
 
 # RESTEasy
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 %define jaxrs_api_jar /usr/share/java/resteasy-base/jaxrs-api.jar
 %define resteasy_lib /usr/share/java/resteasy-base
 %else
-%if 0%{?fedora} >= 24
 %define jaxrs_api_jar /usr/share/java/jboss-jaxrs-2.0-api.jar
 %define resteasy_lib /usr/share/java/resteasy
-%else
-%define jaxrs_api_jar /usr/share/java/resteasy/jaxrs-api.jar
-%define resteasy_lib /usr/share/java/resteasy
-%endif
 %endif
 
 # Dogtag
@@ -72,13 +67,13 @@
 Name:             pki-core
 %if 0%{?rhel}
 Version:                10.5.1
-%define redhat_release  1
+%define redhat_release  2
 %define redhat_stage    0
 #%define default_release %{redhat_release}.%{redhat_stage}
 %define default_release %{redhat_release}
 %else
 Version:                10.5.1
-%define fedora_release  1
+%define fedora_release  2
 %define fedora_stage    0
 #%define default_release %{fedora_release}.%{fedora_stage}
 %define default_release %{fedora_release}
@@ -109,21 +104,13 @@ BuildRequires:    apache-commons-io
 BuildRequires:    apache-commons-lang
 BuildRequires:    jakarta-commons-httpclient
 BuildRequires:    slf4j
-%if ! 0%{?rhel}
+%if 0%{?fedora} || 0%{?rhel} > 7
 BuildRequires:    slf4j-jdk14
 %endif
 BuildRequires:    nspr-devel
-%if 0%{?rhel}
-BuildRequires:    nss-devel >= 3.28.3
-%else
-%if 0%{?fedora} >= 25
 BuildRequires:    nss-devel >= 3.28.3
-%else
-BuildRequires:    nss-devel >= 3.27.0
-%endif
-%endif
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 BuildRequires:    nuxwdog-client-java >= 1.0.1-11
 %else
 BuildRequires:    nuxwdog-client-java >= 1.0.3
@@ -138,7 +125,7 @@ BuildRequires:    velocity
 BuildRequires:    xalan-j2
 BuildRequires:    xerces-j2
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 # 'resteasy-base' is a subset of the complete set of
 # 'resteasy' packages and consists of what is needed to
 # support the PKI Restful interface on RHEL platforms
@@ -149,7 +136,6 @@ BuildRequires:    resteasy-base-jaxrs >= 3.0.6-1
 BuildRequires:    resteasy-base-jaxrs-api >= 3.0.6-1
 BuildRequires:    resteasy-base-jackson-provider >= 3.0.6-1
 %else
-%if 0%{?fedora} >= 24
 BuildRequires:    jboss-annotations-1.2-api
 BuildRequires:    jboss-jaxrs-2.0-api
 BuildRequires:    jboss-logging
@@ -158,35 +144,16 @@ BuildRequires:    resteasy-client >= 3.0.17-1
 BuildRequires:    resteasy-jaxb-provider >= 3.0.17-1
 BuildRequires:    resteasy-core >= 3.0.17-1
 BuildRequires:    resteasy-jackson-provider >= 3.0.17-1
-%else
-%if 0%{?fedora} >= 22
-# Starting from Fedora 22, resteasy packages were split into
-# subpackages.
-BuildRequires:    resteasy-atom-provider >= 3.0.6-7
-BuildRequires:    resteasy-client >= 3.0.6-7
-BuildRequires:    resteasy-jaxb-provider >= 3.0.6-7
-BuildRequires:    resteasy-core >= 3.0.6-7
-BuildRequires:    resteasy-jaxrs-api >= 3.0.6-7
-BuildRequires:    resteasy-jackson-provider >= 3.0.6-7
-%else
-BuildRequires:    resteasy >= 3.0.6-2
-%endif
-%endif
 %endif
 
-%if ! 0%{?rhel}
+%if 0%{?fedora} || 0%{?rhel} > 7
 BuildRequires:    pylint
-%if 0%{?fedora} >= 24
 BuildRequires:    python-flake8 >= 2.5.4
 BuildRequires:    python3-flake8 >= 2.5.4
 # python-flake8 2.5.4 package should require pyflakes >= 1.2.3
 BuildRequires:    pyflakes >= 1.2.3
 # python3-flake8 2.5.4 package should require python3-pyflakes >= 1.2.3
 BuildRequires:    python3-pyflakes >= 1.2.3
-%else
-BuildRequires:    python-flake8
-BuildRequires:    python3-flake8
-%endif
 %endif
 
 BuildRequires:    python2-cryptography
@@ -195,31 +162,20 @@ BuildRequires:    python-requests >= 2.6.0
 BuildRequires:    python-six
 BuildRequires:    libselinux-python
 BuildRequires:    policycoreutils-python
-%if 0%{?fedora} >= 23
+%if 0%{?fedora} || 0%{?rhel} > 7
 BuildRequires:    policycoreutils-python-utils
 %endif
 BuildRequires:    python-ldap
 BuildRequires:    junit
 BuildRequires:    jpackage-utils >= 0:1.7.5-10
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 BuildRequires:    jss >= 4.4.0-10
-%else
-%if 0%{?fedora} >= 25
-BuildRequires:    jss >= 4.4.2-7
-%else
-BuildRequires:    jss >= 4.2.6-44
-%endif
-%endif
-BuildRequires:    systemd-units
-%if 0%{?rhel}
 BuildRequires:    tomcatjss >= 7.2.1-4
 %else
-%if 0%{?fedora} >= 25
+BuildRequires:    jss >= 4.4.2-7
 BuildRequires:    tomcatjss >= 7.2.3
-%else
-BuildRequires:    tomcatjss >= 7.1.3
-%endif
 %endif
+BuildRequires:    systemd-units
 
 %if 0%{?with_python3}
 BuildRequires:  python3-cryptography
@@ -244,7 +200,7 @@ BuildRequires:    systemd
 BuildRequires:    zlib
 BuildRequires:    zlib-devel
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 # NOTE:  In the future, as a part of its path, this URL will contain a release
 #        directory which consists of the fixed number of the upstream release
 #        upon which this tarball was originally based.
@@ -350,31 +306,20 @@ Summary:          Symmetric Key JNI Package
 Group:            System Environment/Libraries
 
 Requires:         java-1.8.0-openjdk-headless
-%if 0%{?rhel}
-Requires:         nss >= 3.28.3
-%else
-%if 0%{?fedora} >= 25
-Requires:         nss >= 3.28.3
-%else
-Requires:         nss >= 3.27.0
-%endif
-%endif
 Requires:         jpackage-utils >= 0:1.7.5-10
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:         jss >= 4.4.0-10
+Requires:         nss >= 3.28.3
 %else
-%if 0%{?fedora} >= 25
 Requires:         jss >= 4.4.2-7
-%else
-Requires:         jss >= 4.2.6-44
-%endif
+Requires:         nss >= 3.28.3
 %endif
 
 Provides:         symkey = %{version}-%{release}
 
 Obsoletes:        symkey < %{version}-%{release}
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 ## Because RHCS 9.0 does not run on RHEL 7.3+, obsolete all
 ## RHCS 9.0 packages that can be replaced by RHCS 9.1 packages:
 # pki-console
@@ -415,14 +360,10 @@ Obsoletes:        pki-util < %{version}-%{release}
 
 Conflicts:        freeipa-server < 3.0.0
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:         nss >= 3.28.3
 %else
-%if 0%{?fedora} >= 25
 Requires:         nss >= 3.28.3
-%else
-Requires:         nss >= 3.27.0
-%endif
 %endif
 Requires:         python2-cryptography
 Requires:         python-nss
@@ -449,24 +390,20 @@ Requires:         apache-commons-lang
 Requires:         apache-commons-logging
 Requires:         jakarta-commons-httpclient
 Requires:         slf4j
-%if ! 0%{?rhel}
+%if 0%{?fedora} || 0%{?rhel} > 7
 Requires:         slf4j-jdk14
 %endif
 Requires:         javassist
 Requires:         jpackage-utils >= 0:1.7.5-10
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:         jss >= 4.4.0-10
 %else
-%if 0%{?fedora} >= 25
 Requires:         jss >= 4.4.2-7
-%else
-Requires:         jss >= 4.2.6-44
-%endif
 %endif
 Requires:         ldapjdk >= 4.19-5
 Requires:         pki-base = %{version}-%{release}
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 # 'resteasy-base' is a subset of the complete set of
 # 'resteasy' packages and consists of what is needed to
 # support the PKI Restful interface on RHEL platforms
@@ -477,26 +414,11 @@ Requires:    resteasy-base-jaxrs >= 3.0.6-1
 Requires:    resteasy-base-jaxrs-api >= 3.0.6-1
 Requires:    resteasy-base-jackson-provider >= 3.0.6-1
 %else
-%if 0%{?fedora} >= 24
 Requires:    resteasy-atom-provider >= 3.0.17-1
 Requires:    resteasy-client >= 3.0.17-1
 Requires:    resteasy-jaxb-provider >= 3.0.17-1
 Requires:    resteasy-core >= 3.0.17-1
 Requires:    resteasy-jackson-provider >= 3.0.17-1
-%else
-%if 0%{?fedora} >= 22
-# Starting from Fedora 22, resteasy packages were split into
-# subpackages.
-Requires:    resteasy-atom-provider >= 3.0.6-7
-Requires:    resteasy-client >= 3.0.6-7
-Requires:    resteasy-jaxb-provider >= 3.0.6-7
-Requires:    resteasy-core >= 3.0.6-7
-Requires:    resteasy-jaxrs-api >= 3.0.6-7
-Requires:    resteasy-jackson-provider >= 3.0.6-7
-%else
-Requires:         resteasy >= 3.0.6-2
-%endif
-%endif
 %endif
 
 Requires:         xalan-j2
@@ -549,25 +471,13 @@ Obsoletes:        pki-native-tools < %{version}-%{release}
 Obsoletes:        pki-java-tools < %{version}-%{release}
 
 Requires:         openldap-clients
-%if 0%{?rhel}
-Requires:         nss-tools >= 3.28.3
-%else
-%if 0%{?fedora} >= 25
 Requires:         nss-tools >= 3.28.3
-%else
-Requires:         nss-tools >= 3.27.0
-%endif
-%endif
 Requires:         java-1.8.0-openjdk-headless
 Requires:         pki-base = %{version}-%{release}
 Requires:         pki-base-java = %{version}-%{release}
 Requires:         jpackage-utils >= 0:1.7.5-10
-%if 0%{?fedora} >= 23
+%if 0%{?fedora} || 0%{?rhel} > 7
 Requires:         tomcat-servlet-3.1-api
-%else
-%if 0%{?fedora} >= 22
-Requires:         tomcat-servlet-3.0-api >= 7.0.68
-%endif
 %endif
 
 %description -n   pki-tools
@@ -599,7 +509,7 @@ Requires:         java-1.8.0-openjdk-headless
 Requires:         hostname
 Requires:         net-tools
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:    nuxwdog-client-java >= 1.0.1-11
 %else
 Requires:    nuxwdog-client-java >= 1.0.3
@@ -616,26 +526,20 @@ Requires:         python-ldap
 Requires:         python-lxml
 Requires:         libselinux-python
 Requires:         policycoreutils-python
-%if 0%{?fedora} >= 23
+%if 0%{?fedora} || 0%{?rhel} > 7
 Requires:         policycoreutils-python-utils
 %endif
 
 Requires:         selinux-policy-targeted >= 3.13.1-159
 Obsoletes:        pki-selinux
 
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:         tomcat >= 7.0.69
 %else
 Requires:         tomcat >= 7.0.68
-%if 0%{?fedora} >= 23
 Requires:         tomcat-el-3.0-api
 Requires:         tomcat-jsp-2.3-api
 Requires:         tomcat-servlet-3.1-api
-%else
-Requires:         tomcat-el-2.2-api >= 7.0.68
-Requires:         tomcat-jsp-2.2-api >= 7.0.68
-Requires:         tomcat-servlet-3.0-api >= 7.0.68
-%endif
 %endif
 
 Requires:         velocity
@@ -643,14 +547,10 @@ Requires(post):   systemd-units
 Requires(preun):  systemd-units
 Requires(postun): systemd-units
 Requires(pre):    shadow-utils
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 Requires:         tomcatjss >= 7.2.1-4
 %else
-%if 0%{?fedora} >= 25
 Requires:         tomcatjss >= 7.2.3
-%else
-Requires:         tomcatjss >= 7.1.3
-%endif
 %endif
 
 %if 0%{?rhel}
@@ -851,15 +751,8 @@ Requires(postun): systemd-units
 # additional runtime requirements needed to run native 'tpsclient'
 # REMINDER:  Revisit these once 'tpsclient' is rewritten as a Java app
 
-%if 0%{?rhel}
 Requires:         nss-tools >= 3.28.3
-%else
-%if 0%{?fedora} >= 25
 Requires:         nss-tools >= 3.28.3
-%else
-Requires:         nss-tools >= 3.27.0
-%endif
-%endif
 Requires:         openldap-clients
 %if 0%{?package_fedora_packages} || 0%{?package_rhel_packages}
 Requires:         pki-symkey = %{version}-%{release}
@@ -974,7 +867,7 @@ ln -s %{_datadir}/pki/java-tools/KRATool.cfg %{buildroot}%{_datadir}/pki/java-to
 ln -s %{_mandir}/man1/KRATool.1.gz %{buildroot}%{_mandir}/man1/DRMTool.1.gz
 
 # Customize system upgrade scripts in /usr/share/pki/upgrade
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 
 # merge newer upgrade scripts into 10.3.3 for RHEL
 /bin/rm -rf %{buildroot}%{_datadir}/pki/upgrade/10.3.4
@@ -989,7 +882,7 @@ ln -s %{_mandir}/man1/KRATool.1.gz %{buildroot}%{_mandir}/man1/DRMTool.1.gz
 %endif
 
 # Customize client library links in /usr/share/pki/lib
-%if 0%{?fedora} >= 24
+%if 0%{?fedora} || 0%{?rhel} > 7
     rm -f %{buildroot}%{_datadir}/pki/lib/scannotation.jar
     rm -f %{buildroot}%{_datadir}/pki/lib/resteasy-jaxrs-api.jar
     rm -f %{buildroot}%{_datadir}/pki/lib/resteasy-jaxrs-jandex.jar
@@ -1015,7 +908,7 @@ fi
 %if %{with server}
 
 # Customize server upgrade scripts in /usr/share/pki/server/upgrade
-%if 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 
 # merge newer upgrade scripts into 10.3.3 for RHEL
 mv %{buildroot}%{_datadir}/pki/server/upgrade/10.3.5/01-FixServerLibrary \
@@ -1041,7 +934,7 @@ mv %{buildroot}%{_datadir}/pki/server/upgrade/10.4.6/01-UpdateKeepAliveTimeout \
 %endif
 
 # Customize server library links in /usr/share/pki/server/common/lib
-%if 0%{?fedora} >= 24
+%if 0%{?fedora} || 0%{?rhel} > 7
     rm -f %{buildroot}%{_datadir}/pki/server/common/lib/scannotation.jar
     rm -f %{buildroot}%{_datadir}/pki/server/common/lib/resteasy-jaxrs-api.jar
     ln -sf %{jaxrs_api_jar} %{buildroot}%{_datadir}/pki/server/common/lib/jboss-jaxrs-2.0-api.jar
@@ -1069,7 +962,7 @@ fi
 
 %endif
 
-%if ! 0%{?rhel}
+%if 0%{?fedora} || 0%{?rhel} > 7
 # Scanning the python code with pylint.
 %{__python2} ../pylint-build-scan.py rpm --prefix %{buildroot}
 if [ $? -ne 0 ]; then
@@ -1104,7 +997,7 @@ fi
 %{__mkdir_p} %{buildroot}%{_localstatedir}/log/pki
 %{__mkdir_p} %{buildroot}%{_sharedstatedir}/pki
 
-%if ! 0%{?rhel}
+%if 0%{?rhel} && 0%{?rhel} <= 7
 %pretrans -n pki-base -p <lua>
 function test(a)
     if posix.stat(a) then
@@ -1444,6 +1337,9 @@ fi
 %endif # %{with server}
 
 %changelog
+* Tue Nov 07 2017 Troy Dawson <tdawson at redhat.com> - 10.5.1-2
+- Cleanup spec file conditionals
+
 * Thu Nov  2 2017 Dogtag Team <pki-devel at redhat.com> 10.5.1-1
 - Re-base Dogtag to 10.5.1
 


More information about the Pki-devel mailing list