From bb1a323854cdf9bf2b35153802e8a876035615f8 Mon Sep 17 00:00:00 2001
From: Matthew Harmsen <mharmsen@redhat.com>
Date: Fri, 4 Jan 2013 22:01:07 -0800
Subject: [PATCH] Use tomcatjss 7.1.0 and fix weird errno=0 exception

* TRAC Ticket #469 - Dogtag 10: Fix tomcatjss issue in pki-core.spec and
  dogtag-pki.spec . . .
* TRAC Ticket #468 - pkispawn throws exception
---
 base/common/shared/conf/pki.policy      |  2 +-
 base/deploy/etc/default.cfg             |  2 +-
 base/deploy/scripts/operations          |  2 +-
 base/deploy/src/scriptlets/pkijython.py |  8 +++++-
 specs/dogtag-pki.spec                   | 23 +++++++++++++++--
 specs/pki-core.spec                     | 44 ++++++++++++++++++++++++++++++---
 6 files changed, 71 insertions(+), 10 deletions(-)

diff --git a/base/common/shared/conf/pki.policy b/base/common/shared/conf/pki.policy
index 4ae2de7..52e3d7f 100644
--- a/base/common/shared/conf/pki.policy
+++ b/base/common/shared/conf/pki.policy
@@ -138,7 +138,7 @@ grant codeBase "file:/usr/share/java/tomcat/-" {
         permission java.security.AllPermission;
 };
 
-grant codeBase "file:/usr/share/java/tomcat7jss.jar" {
+grant codeBase "file:/usr/share/java/tomcatjss.jar" {
         permission java.security.AllPermission;
 };
 
diff --git a/base/deploy/etc/default.cfg b/base/deploy/etc/default.cfg
index 238912f..3106ba5 100644
--- a/base/deploy/etc/default.cfg
+++ b/base/deploy/etc/default.cfg
@@ -291,7 +291,7 @@ pki_resteasy_jaxb_provider_jar=%(resteasy_lib)s/resteasy-jaxb-provider.jar
 pki_resteasy_jaxrs_jar=%(resteasy_lib)s/resteasy-jaxrs.jar
 pki_resteasy_jettison_provider_jar=%(resteasy_lib)s/resteasy-jettison-provider.jar
 pki_scannotation_jar=/usr/share/java/scannotation.jar
-pki_tomcatjss_jar=/usr/share/java/tomcat7jss.jar
+pki_tomcatjss_jar=/usr/share/java/tomcatjss.jar
 pki_velocity_jar=/usr/share/java/velocity.jar
 pki_xerces_j2_jar=/usr/share/java/xerces-j2.jar
 pki_xml_commons_apis_jar=/usr/share/java/xml-commons-apis.jar
diff --git a/base/deploy/scripts/operations b/base/deploy/scripts/operations
index 227250d..63a6bdb 100644
--- a/base/deploy/scripts/operations
+++ b/base/deploy/scripts/operations
@@ -1210,7 +1210,7 @@ verify_symlinks()
         [resteasy-jaxrs.jar]=${RESTEASY_LIB}/resteasy-jaxrs.jar
         [resteasy-jettison-provider.jar]=${RESTEASY_LIB}/resteasy-jettison-provider.jar
         [scannotation.jar]=${java_dir}/scannotation.jar
-        [tomcatjss.jar]=${java_dir}/tomcat7jss.jar
+        [tomcatjss.jar]=${java_dir}/tomcatjss.jar
         [velocity.jar]=${java_dir}/velocity.jar
         [xerces-j2.jar]=${java_dir}/xerces-j2.jar
         [xml-commons-apis.jar]=${java_dir}/xml-commons-apis.jar
diff --git a/base/deploy/src/scriptlets/pkijython.py b/base/deploy/src/scriptlets/pkijython.py
index fac352f..a7635c1 100644
--- a/base/deploy/src/scriptlets/pkijython.py
+++ b/base/deploy/src/scriptlets/pkijython.py
@@ -313,7 +313,13 @@ class rest_client:
         try:
             os.makedirs(path)
         except OSError, e:
-            if exc.errno == errno.EEXIST and os.path.isdir(path):
+            if e.errno == 0:
+                # Avoid the following weird python/jython exception:
+                #
+                #     [Errno 0] couldn't make directories: <path>
+                #
+                pass
+            elif e.errno == errno.EEXIST and os.path.isdir(path):
                 pass
             else:
                 raise
diff --git a/specs/dogtag-pki.spec b/specs/dogtag-pki.spec
index 8978482..647f443 100644
--- a/specs/dogtag-pki.spec
+++ b/specs/dogtag-pki.spec
@@ -1,7 +1,7 @@
 Summary:          Dogtag Public Key Infrastructure (PKI) Suite
 Name:             dogtag-pki
 Version:          10.0.0
-Release:          1%{?dist}
+Release:          2%{?dist}
 # The entire source code is GPLv2 except for 'pki-tps' which is LGPLv2
 License:          GPLv2 and LGPLv2
 URL:              http://pki.fedoraproject.org/
@@ -10,6 +10,19 @@ BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:        noarch
 
 # Establish MINIMUM package versions based upon platform
+%if 0%{?rhel} || 0%{?fedora} >= 19
+%define dogtag_pki_theme_version   10.0.0
+%define esc_version                1.1.0
+%define jss_version                4.2.6-28
+%define pki_core_version           10.0.0
+%define pki_kra_version            10.0.0
+%define pki_ocsp_version           10.0.0
+%define pki_ra_version             10.0.0
+%define pki_tks_version            10.0.0
+%define pki_tps_version            10.0.0
+%define pki_console_version        10.0.0
+%define tomcatjss_version          7.1.0
+%else
 %if 0%{?fedora} >= 18
 %define dogtag_pki_theme_version   10.0.0
 %define esc_version                1.1.0
@@ -21,7 +34,7 @@ BuildArch:        noarch
 %define pki_tks_version            10.0.0
 %define pki_tps_version            10.0.0
 %define pki_console_version        10.0.0
-%define tomcatjss_version          7.0.0-3
+%define tomcatjss_version          7.0.0-4
 %else
 %if 0%{?fedora} >= 17
 %define dogtag_pki_theme_version   10.0.0
@@ -63,6 +76,7 @@ BuildArch:        noarch
 %endif
 %endif
 %endif
+%endif
 
 Requires:         apache-commons-codec
 
@@ -187,6 +201,11 @@ rm -rf %{buildroot}
 %doc README
 
 %changelog
+* Fri Jan  4 2013 Matthew Harmsen <mharmsen@redhat.com> 10.0.0-2
+- TRAC Ticket #469 - Dogtag 10: Fix tomcatjss issue in pki-core.spec and
+  dogtag-pki.spec . . .
+- TRAC Ticket #468 - pkispawn throws exception
+
 * Fri Dec 7 2012 Ade Lee <alee@redhat.com> 10.0.0-1
 - Update to official release for rc1
 
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index a0430b5..c26ceb1 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -5,7 +5,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
 Name:             pki-core
 Version:          10.0.0
-Release:          3%{?dist}
+Release:          4%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -36,10 +36,18 @@ BuildRequires:    resteasy >= 2.3.2-1
 
 BuildRequires:    junit
 BuildRequires:    jpackage-utils >= 0:1.7.5-10
+%if 0%{?rhel} || 0%{?fedora} >= 19
+BuildRequires:    jss >= 4.2.6-28
+%else
 BuildRequires:    jss >= 4.2.6-24
+%endif
 BuildRequires:    systemd-units
-BuildRequires:    tomcatjss >= 7.0.0-3
-
+%if 0%{?rhel} || 0%{?fedora} >= 19
+BuildRequires:    tomcatjss >= 7.1.0
+%endif
+%if 0%{?fedora} == 18
+BuildRequires:    tomcatjss >= 7.0.0-4
+%endif
 %if ! 0%{?rhel} && 0%{?fedora} <= 17
 BuildRequires:    tomcatjss >= 6.0.2
 BuildRequires:    selinux-policy-devel >= 3.10.0-151
@@ -135,7 +143,11 @@ Group:            System Environment/Libraries
 Requires:         java >= 1:1.6.0
 Requires:         nss
 Requires:         jpackage-utils >= 0:1.7.5-10
+%if 0%{?rhel} || 0%{?fedora} >= 19
+Requires:         jss >= 4.2.6-28
+%else
 Requires:         jss >= 4.2.6-24
+%endif
 
 Provides:         symkey = %{version}-%{release}
 
@@ -175,7 +187,11 @@ Requires:         xerces-j2
 Requires:         xml-commons-apis
 Requires:         xml-commons-resolver
 Requires:         jpackage-utils >= 0:1.7.5-10
+%if 0%{?rhel} || 0%{?fedora} >= 19
+Requires:         jss >= 4.2.6-28
+%else
 Requires:         jss >= 4.2.6-24
+%endif
 %if  0%{?rhel}
 Requires:         resteasy-base
 %else
@@ -254,7 +270,15 @@ Requires(post):   systemd-units
 Requires(preun):  systemd-units
 Requires(postun): systemd-units
 Requires:         tomcat >= 7.0.27
-Requires:         tomcatjss >= 7.0.0-3
+%if 0%{?rhel} || 0%{?fedora} >= 19
+Requires:         tomcatjss >= 7.1.0
+%endif
+%if 0%{?fedora} == 18
+Requires:         tomcatjss >= 7.0.0-4
+%endif
+%if ! 0%{?rhel} && 0%{?fedora} <= 17
+Requires:         tomcatjss >= 6.0.2
+%endif
 
 %description -n   pki-server
 The PKI Server Framework is required by the following four PKI subsystems:
@@ -479,6 +503,13 @@ cd build
 cd build
 %{__make} install DESTDIR=%{buildroot} INSTALL="install -p"
 
+# Fedora 18:  Substitute 'tomcat7jss.jar' for 'tomcatjss.jar'
+%if 0%{?fedora} == 18
+	sed -i -e 's/grant codeBase "file:\/usr\/share\/java\/tomcatjss.jar" {/grant codeBase "file:\/usr\/share\/java\/tomcat7jss.jar" {/' %{buildroot}%{_datadir}/pki/server/conf/pki.policy
+	sed -i -e 's/pki_tomcatjss_jar=\/usr\/share\/java\/tomcatjss.jar/pki_tomcatjss_jar=\/usr\/share\/java\/tomcat7jss.jar/' %{buildroot}%{_sysconfdir}/pki/default.cfg
+	sed -i -e 's/        \[tomcatjss.jar\]=\${java_dir}\/tomcatjss.jar/        \[tomcatjss.jar\]=\${java_dir}\/tomcat7jss.jar/' %{buildroot}%{_datadir}/pki/scripts/operations
+%endif
+
 # Details:
 #
 #     * https://fedoraproject.org/wiki/Features/var-run-tmpfs
@@ -953,6 +984,11 @@ fi
 
 
 %changelog
+* Fri Jan  4 2013 Matthew Harmsen <mharmsen@redhat.com> 10.0.0-4
+- TRAC Ticket #469 - Dogtag 10: Fix tomcatjss issue in pki-core.spec and
+  dogtag-pki.spec . . .
+- TRAC Ticket #468 - pkispawn throws exception
+
 * Wed Dec 12 2012 Ade Lee <alee@redhat.com> 10.0.0-3
 - Replaced file dependencies with package dependencies
 
-- 
1.7.12.1

