>From 86ac70b05d94c2e4c0f5d8563ea76e7a68b4efbc Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Tue, 23 Oct 2012 11:28:59 -0400
Subject: [PATCH] changes to remove pki-selinux from f18 build

---
 CMakeLists.txt        |  1 +
 base/CMakeLists.txt   |  4 +++-
 specs/dogtag-pki.spec |  7 ++++++-
 specs/pki-core.spec   | 37 +++++++++++++++++++++++--------------
 specs/pki-ra.spec     |  2 +-
 specs/pki-tps.spec    |  2 +-
 6 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f3dd86daa6a446c0b6a9555082d52ed400ae39d..7e577f7394cad8b22e1bf15e4087b817f57ffe75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@ string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" APPLICATION_VERSION_MINOR ${VE
 string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" APPLICATION_VERSION_PATCH ${VERSION})
 
 option(WITH_JAVADOC "Build with Javadoc" ON)
+option(BUILD_PKI_SELINUX "Build pki-selinux" OFF)
 
 if (BUILD_IPA_PKI_THEME)
     set(APPLICATION_FLAVOR_IPA_PKI_THEME TRUE)
diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt
index c0de97171f39e2b520715a4e04abc7af80f73246..f646cfb608dc03e4b3ac0162cba41837179ad4a5 100644
--- a/base/CMakeLists.txt
+++ b/base/CMakeLists.txt
@@ -10,7 +10,9 @@ if (APPLICATION_FLAVOR_PKI_CORE)
     add_subdirectory(native-tools)
     add_subdirectory(java-tools)
     add_subdirectory(deploy)
-    add_subdirectory(selinux)
+    if(BUILD_PKI_SELINUX)
+        add_subdirectory(selinux)
+    endif(BUILD_PKI_SELINUX)
     add_subdirectory(ca)
     add_subdirectory(kra)
     add_subdirectory(ocsp)
diff --git a/specs/dogtag-pki.spec b/specs/dogtag-pki.spec
index aee169e32983fdfa57330497d1dd1b8fb61693e6..6312ccda4d042247b15d67cfc492c3e22168a2e9 100644
--- a/specs/dogtag-pki.spec
+++ b/specs/dogtag-pki.spec
@@ -98,10 +98,15 @@ Requires:         dogtag-pki-tps-theme >= %{dogtag_pki_theme_version}
 Requires:         pki-ca >= %{pki_core_version}
 Requires:         pki-server >= %{pki_core_version}
 Requires:         pki-tools >= %{pki_core_version}
-Requires:         pki-selinux >= %{pki_core_version}
 Requires:         pki-symkey >= %{pki_core_version}
 Requires:         pki-base >= %{pki_core_version}
 
+%if 0%{?fedora} <= 17
+Requires:         pki-selinux >= %{pki_core_version}
+%else
+Requires:         selinux-policy-base >= 3.11.1-43
+%endif
+
 # Make certain that this 'meta' package requires the latest version(s)
 # of ALL Dogtag PKI core javadocs
 Requires:         pki-javadoc >= %{pki_core_version}
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index 86c93f9783f0c8493ed64db48e941c48d8c49624..c6405ac18626298cdcd186af6d64b1f4afd4cfac 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -14,7 +14,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
 Name:             pki-core
 Version:          10.0.0
-Release:          %{?relprefix}44%{?prerel}%{?dist}
+Release:          %{?relprefix}45%{?prerel}%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -39,9 +39,7 @@ BuildRequires:    nss-devel
 BuildRequires:    openldap-devel
 BuildRequires:    pkgconfig
 BuildRequires:    policycoreutils
-%if 0%{?fedora} >= 18
-BuildRequires:         selinux-policy-devel >= 3.11.1-32
-%else
+%if 0%{?fedora} <= 17
 BuildRequires:         selinux-policy-devel >= 3.10.0-151
 %endif
 BuildRequires:    velocity
@@ -120,7 +118,7 @@ PKI Core contains ALL top-level java-based Tomcat PKI components:      \
   * pki-symkey                                                         \
   * pki-base                                                           \
   * pki-tools                                                          \
-  * pki-selinux                                                        \
+  * pki-selinux (f17 only)                                             \
   * pki-server                                                         \
   * pki-ca                                                             \
   * pki-kra                                                            \
@@ -140,7 +138,7 @@ required by BOTH native-based Apache AND java-based Tomcat             \
 Certificate System instances consisting of the following components:   \
                                                                        \
   * pki-tools                                                          \
-  * pki-selinux                                                        \
+  * pki-selinux (f17 only)                                             \
                                                                        \
 Additionally, PKI Core contains the following fundamental packages     \
 required ONLY by ALL java-based Tomcat Certificate System instances:   \
@@ -306,7 +304,13 @@ Requires:         jython >= 2.2.1
 Requires:         pki-common-theme >= 10.0.0
 Requires:         pki-base = %{version}-%{release}
 Requires:         pki-tools = %{version}-%{release}
+
+%if 0%{?fedora} >= 18
+Requires:         selinux-policy-base >= 3.11.1-43
+%else
 Requires:         pki-selinux = %{version}-%{release}
+%endif
+
 Requires:         velocity
 %if 0%{?fedora} >= 17
 Requires(post):   systemd-units
@@ -355,7 +359,7 @@ The package contains scripts to create and remove PKI subsystems.
 
 %{overview}
 
-
+%if 0%{?fedora} <= 17
 %package -n       pki-selinux
 Summary:          Certificate System - PKI Selinux Policies
 Group:            System Environment/Base
@@ -364,11 +368,8 @@ BuildArch:        noarch
 
 Requires:         policycoreutils
 Requires:         selinux-policy-targeted
-%if 0%{?fedora} >= 18
-Requires:         selinux-policy >= 3.11.1-32
-%else
+Conflicts:        selinux-policy-base >= 3.11.1-43
 Requires:         selinux-policy >= 3.10.0-151
-%endif
 
 %description -n   pki-selinux
 Selinux policies for the PKI components.
@@ -376,7 +377,7 @@ Selinux policies for the PKI components.
 This package is a part of the PKI Core used by the Certificate System.
 
 %{overview}
-
+%endif
 
 %package -n       pki-ca
 Summary:          Certificate System - Certificate Authority
@@ -646,6 +647,9 @@ cd build
 	-DJAVA_LIB_INSTALL_DIR=%{_jnidir} \
 	-DSYSTEMD_LIB_INSTALL_DIR=%{_unitdir} \
 	%{?_without_javadoc:-DWITH_JAVADOC:BOOL=OFF} \
+%if 0%{?fedora} <= 17
+        -DBUILD_PKI_SELINUX:BOOL=ON \
+%endif
 	..
 %{__make} VERBOSE=1 %{?_smp_mflags} all
 %{__make} VERBOSE=1 %{?_smp_mflags} test
@@ -737,6 +741,7 @@ if [ -d /etc/sysconfig/pki/%i ]; then                                        \
 fi                                                                           \
 )
 
+%if 0%{?fedora} <= 17
 %pre -n pki-selinux
 %saveFileContext targeted
 
@@ -757,6 +762,7 @@ if [ $1 = 0 ]; then
      semodule -s targeted -r pki
      %relabel targeted
 fi
+%endif
 
 %if 0%{?rhel} || 0%{?fedora} < 16
 %post -n pki-ca 
@@ -1162,12 +1168,12 @@ fi
 %dir %{_datadir}/pki/server
 %{_datadir}/pki/server/
 
-
+%if 0%{?fedora} <= 17
 %files -n pki-selinux
 %defattr(-,root,root,-)
 %doc base/selinux/LICENSE
 %{_datadir}/selinux/modules/pki.pp
-
+%endif
 
 %files -n pki-ca
 %defattr(-,root,root,-)
@@ -1292,6 +1298,9 @@ fi
 
 
 %changelog
+* Tue Oct 23 2012 Ade Lee <alee@redhat.com> 10.0.0-0.45.b1
+- Remove build of pki-selinux for f18, use system policy instead
+
 * Fri Oct 12 2012 Ade Lee <alee@redhat.com> 10.0.0-0.44.b1
 - Update required tomcatjss version
 - Added net-tools dependency
diff --git a/specs/pki-ra.spec b/specs/pki-ra.spec
index 355935ef13264690f2410fe14e7ccf67ec17be5f..a432e4a925ac6005bf53536a58245e83d9b660c9 100644
--- a/specs/pki-ra.spec
+++ b/specs/pki-ra.spec
@@ -66,7 +66,7 @@ Core package:
 
   * pki-server
   * pki-tools
-  * pki-selinux
+  * pki-selinux (f17 only)
 
 Additionally, Certificate System requires ONE AND ONLY ONE of the following
 "Mutually-Exclusive" PKI Theme packages:
diff --git a/specs/pki-tps.spec b/specs/pki-tps.spec
index c56e6e77bdc24a8c15e8b1870a21605445a0fb61..653a85b157fd4e4f144975210ec94f8641f7d1e0 100644
--- a/specs/pki-tps.spec
+++ b/specs/pki-tps.spec
@@ -79,7 +79,7 @@ PKI Core package:                                                         \
                                                                           \
   * pki-server                                                            \
   * pki-tools                                                             \
-  * pki-selinux                                                           \
+  * pki-selinux (f17 only)                                                \
                                                                           \
 Additionally, Certificate System requires ONE AND ONLY ONE of the         \
 following "Mutually-Exclusive" PKI Theme packages:                        \
-- 
1.7.11.4

