From 51b1e0d63d4fd061176bb407425f41c4f634a7e6 Mon Sep 17 00:00:00 2001
From: Endi Sukma Dewata <edewata@redhat.com>
Date: Thu, 30 Aug 2012 15:21:21 -0500
Subject: [PATCH] Merged Javadoc packages.

The Javadocs for pki-util, pki-java-tools and pki-common have been
merged and packaged into pki-javadoc RPM.

Ticket #295
---
 base/CMakeLists.txt                |   3 ++
 base/common/src/CMakeLists.txt     |  33 ------------
 base/java-tools/src/CMakeLists.txt |  31 -----------
 base/javadoc/CMakeLists.txt        |  40 ++++++++++++++
 base/util/src/CMakeLists.txt       |  27 ----------
 scripts/compose_pki_core_packages  |   3 ++
 specs/pki-core.spec                | 105 +++++++++++--------------------------
 7 files changed, 78 insertions(+), 164 deletions(-)
 create mode 100644 base/javadoc/CMakeLists.txt

diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt
index d8fcecdb6ed10c1ab4ac602f13edbaa838d2e0ef..7340573746f1633f46657c2067aafa711a5aff58 100644
--- a/base/CMakeLists.txt
+++ b/base/CMakeLists.txt
@@ -16,6 +16,9 @@ if (APPLICATION_FLAVOR_PKI_CORE)
     add_subdirectory(ocsp)
     add_subdirectory(tks)
     add_subdirectory(silent)
+    if(WITH_JAVADOC)
+        add_subdirectory(javadoc)
+    endif(WITH_JAVADOC)
 endif (APPLICATION_FLAVOR_PKI_CORE)
 if (APPLICATION_FLAVOR_PKI_RA)
     add_subdirectory(ra)
diff --git a/base/common/src/CMakeLists.txt b/base/common/src/CMakeLists.txt
index f3702d4546723e653381fe9bc982445124a0b35f..fb4f5675ea74de52ea122946d390cb807045071a 100644
--- a/base/common/src/CMakeLists.txt
+++ b/base/common/src/CMakeLists.txt
@@ -219,39 +219,6 @@ install(
 
 set(PKI_CMS_JAR ${CMAKE_BINARY_DIR}/dist/pki-cms.jar CACHE INTERNAL "pki-cms jar file")
 
-if(WITH_JAVADOC)
-    javadoc(pki-common-javadoc
-        DEST
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-common-${APPLICATION_VERSION}
-        SUBPACKAGES
-            com.netscape.certsrv
-            com.netscape.cms
-        CLASSPATH
-            ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
-            ${LDAPJDK_JAR} ${SERVLET_JAR} ${VELOCITY_JAR} ${XALAN_JAR} ${XERCES_JAR}
-            ${JSS_JAR} ${COMMONS_CODEC_JAR} ${COMMONS_HTTPCLIENT_JAR}
-            ${APACHE_COMMONS_LANG_JAR}
-            ${TOMCAT_CATALINA_JAR} ${TOMCAT_UTIL_JAR} ${SYMKEY_JAR}
-            ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR}
-            ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
-        OPTIONS
-            -windowtitle 'pki-common'
-            -doctitle '<h1>pki-common</h1>'
-            -author
-            -use
-            -version
-        DEPENDS
-            pki-cms pki-certsrv
-    )
-
-    install(
-        FILES
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-common-${APPLICATION_VERSION}
-        DESTINATION
-            ${CMAKE_INSTALL_PREFIX}/share/javadoc
-    )
-endif(WITH_JAVADOC)
-
 
 # build pki-tomcat
 javac(pki-tomcat-classes
diff --git a/base/java-tools/src/CMakeLists.txt b/base/java-tools/src/CMakeLists.txt
index a0c50d25b8f872dbd92badbedd7aab418ca36105..c01b425a657e1265f4964b9499d73154ebda8fe3 100644
--- a/base/java-tools/src/CMakeLists.txt
+++ b/base/java-tools/src/CMakeLists.txt
@@ -133,34 +133,3 @@ install(
 )
 
 set(PKI_TOOLS_JAR ${CMAKE_BINARY_DIR}/dist/pki-tools.jar CACHE INTERNAL "pki-tools jar file")
-
-if(WITH_JAVADOC)
-    javadoc(pki-tools-javadoc
-        DEST
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-java-tools-${APPLICATION_VERSION}
-        SUBPACKAGES
-            com.netscape.cmstools
-        CLASSPATH
-            ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR} ${PKI_CERTSRV_JAR}
-            ${XALAN_JAR} ${XERCES_JAR}
-            ${JSS_JAR} ${COMMONS_CODEC_JAR}
-            ${APACHE_COMMONS_CLI_JAR} ${APACHE_COMMONS_LANG_JAR}
-            ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR}
-            ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
-        OPTIONS
-            -windowtitle 'pki-java-tools'
-            -doctitle '<h1>pki-java-tools</h1>'
-            -author
-            -use
-            -version
-        DEPENDS
-            pki-tools
-    )
-
-    install(
-        FILES
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-java-tools-${APPLICATION_VERSION}
-        DESTINATION
-            ${CMAKE_INSTALL_PREFIX}/share/javadoc
-    )
-endif(WITH_JAVADOC)
diff --git a/base/javadoc/CMakeLists.txt b/base/javadoc/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c2d4a8012e75b4509eb9883581ffa82572852d22
--- /dev/null
+++ b/base/javadoc/CMakeLists.txt
@@ -0,0 +1,40 @@
+project(pki-javadoc)
+
+javadoc(pki-javadoc
+    SOURCEPATH
+        ${CMAKE_SOURCE_DIR}/base/util/src
+        ${CMAKE_SOURCE_DIR}/base/common/src
+        ${CMAKE_SOURCE_DIR}/base/java-tools/src
+    DEST
+        ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-${APPLICATION_VERSION}
+    SUBPACKAGES
+        com.netscape.certsrv
+        com.netscape.cms
+        com.netscape.cmstools
+        com.netscape.cmsutil
+    CLASSPATH
+        ${XALAN_JAR} ${XERCES_JAR}
+        ${APACHE_COMMONS_CLI_JAR} ${APACHE_COMMONS_LANG_JAR}
+        ${COMMONS_CODEC_JAR} ${COMMONS_HTTPCLIENT_JAR}
+        ${LDAPJDK_JAR} ${VELOCITY_JAR}
+        ${JSS_JAR} ${SYMKEY_JAR}
+        ${SERVLET_JAR} ${TOMCAT_CATALINA_JAR} ${TOMCAT_UTIL_JAR}
+        ${HTTPCLIENT_JAR} ${HTTPCORE_JAR}
+        ${JAXRS_API_JAR} ${RESTEASY_JAXRS_JAR} ${RESTEASY_ATOM_PROVIDER_JAR}
+        ${PKI_CMSUTIL_JAR} ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_TOOLS_JAR}
+    OPTIONS
+        -windowtitle 'pki-javadoc'
+        -doctitle '<h1>PKI Javadoc</h1>'
+        -author
+        -use
+        -version
+    DEPENDS
+        pki-cmsutil pki-certsrv pki-cms pki-tools
+)
+
+install(
+    FILES
+        ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-${APPLICATION_VERSION}
+    DESTINATION
+        ${CMAKE_INSTALL_PREFIX}/share/javadoc
+)
diff --git a/base/util/src/CMakeLists.txt b/base/util/src/CMakeLists.txt
index af99da4d2003f225fbf4a0a07c39df9365e43945..0f8eb496fb1e0f592776eb01d63442e33b608ba0 100644
--- a/base/util/src/CMakeLists.txt
+++ b/base/util/src/CMakeLists.txt
@@ -130,30 +130,3 @@ install(
 )
 
 set(PKI_CMSUTIL_JAR ${CMAKE_BINARY_DIR}/dist/pki-cmsutil.jar CACHE INTERNAL "pki-cmsutil jar file")
-
-if(WITH_JAVADOC)
-    javadoc(pki-util-javadoc
-        DEST
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-util-${APPLICATION_VERSION}
-        SUBPACKAGES
-            com.netscape.cmsutil
-        CLASSPATH
-            ${APACHE_COMMONS_LANG_JAR} ${LDAPJDK_JAR} ${XALAN_JAR} ${XERCES_JAR}
-            ${JSS_JAR} ${COMMONS_CODEC_JAR}
-        OPTIONS
-            -windowtitle 'pki-util'
-            -doctitle '<h1>dogtag</h1>'
-            -author
-            -use
-            -version
-        DEPENDS
-            pki-cmsutil
-    )
-
-    install(
-        FILES
-            ${CMAKE_CURRENT_BINARY_DIR}/javadoc/pki-util-${APPLICATION_VERSION}
-        DESTINATION
-            ${CMAKE_INSTALL_PREFIX}/share/javadoc
-    )
-endif(WITH_JAVADOC)
diff --git a/scripts/compose_pki_core_packages b/scripts/compose_pki_core_packages
index 628462a2e2b98e97988207db770cad0f29251d66..fa1ed31029999194619aa6d34379a8e7afeae600 100755
--- a/scripts/compose_pki_core_packages
+++ b/scripts/compose_pki_core_packages
@@ -41,6 +41,9 @@ PKI_CORE_VERSION="10.0.0.a1"
 PKI_SPECS_FILE="${PKI_DIR}/specs/${PKI_CORE}.spec"
 PKI_COMPONENT_LIST="test setup symkey util common native-tools java-tools deploy selinux ca kra ocsp tks silent"
 
+if [ "$JAVADOC" = "" ]; then
+    PKI_COMPONENT_LIST="$PKI_COMPONENT_LIST javadoc"
+fi
 
 ##
 ## Establish the TARGET files/directories of the 'pki-core' source/spec files
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index e59f538dd46dd1b5d5d1af3a2a0b32454aa0715c..c556e4ba1eaa29f3f3098e71b8087bca5a4afa5a 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}28%{?prerel}%{?dist}
+Release:          %{?relprefix}29%{?prerel}%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -113,10 +113,7 @@ PKI Core contains ALL top-level java-based Tomcat PKI components:      \
                                                                        \
   * pki-setup                                                          \
   * pki-symkey                                                         \
-  * pki-util-javadoc                                                   \
-  * pki-java-tools-javadoc                                             \
   * pki-base                                                           \
-  * pki-common-javadoc                                                 \
   * pki-tools                                                          \
   * pki-selinux                                                        \
   * pki-server                                                         \
@@ -124,6 +121,7 @@ PKI Core contains ALL top-level java-based Tomcat PKI components:      \
   * pki-kra                                                            \
   * pki-ocsp                                                           \
   * pki-tks                                                            \
+  * pki-javadoc                                                        \
                                                                        \
 which comprise the following corresponding PKI subsystems:             \
                                                                        \
@@ -151,9 +149,7 @@ required ONLY by ALL java-based Tomcat Certificate System instances:   \
                                                                        \
 PKI Core also includes the following components:                       \
                                                                        \
-  * pki-common-javadoc                                                 \
-  * pki-java-tools-javadoc                                             \
-  * pki-util-javadoc                                                   \
+  * pki-javadoc                                                        \
                                                                        \
 Finally, for deployment purposes, Certificate System requires ONE AND  \
 ONLY ONE of the following "Mutually-Exclusive" PKI Theme packages:     \
@@ -214,36 +210,6 @@ This package is a part of the PKI Core used by the Certificate System.
 %{overview}
 
 
-%package -n       pki-util-javadoc
-Summary:          Certificate System - PKI Utility Framework Javadocs
-Group:            Documentation
-
-BuildArch:        noarch
-
-%description -n   pki-util-javadoc
-This documentation pertains exclusively to version %{version} of
-the PKI Utility Framework.
-
-This package is a part of the PKI Core used by the Certificate System.
-
-%{overview}
-
-
-%package -n       pki-java-tools-javadoc
-Summary:          Certificate System - PKI Java-Based Tools Javadocs
-Group:            Documentation
-
-BuildArch:        noarch
-
-%description -n   pki-java-tools-javadoc
-This documentation pertains exclusively to version %{version} of
-the PKI Java-Based Tools.
-
-This package is a part of the PKI Core used by the Certificate System.
-
-%{overview}
-
-
 %package -n       pki-base
 Summary:          Certificate System - PKI Framework
 Group:            System Environment/Base
@@ -298,21 +264,6 @@ This package is a part of the PKI Core used by the Certificate System.
 %{overview}
 
 
-%package -n       pki-common-javadoc
-Summary:          Certificate System - PKI Common Framework Javadocs
-Group:            Documentation
-
-BuildArch:        noarch
-
-%description -n   pki-common-javadoc
-This documentation pertains exclusively to version %{version} of
-the PKI Common Framework.
-
-This package is a part of the PKI Core used by the Certificate System.
-
-%{overview}
-
-
 %package -n       pki-tools
 Summary:          Certificate System - PKI Tools
 Group:            System Environment/Base
@@ -664,6 +615,25 @@ This package is a part of the PKI Core used by the Certificate System.
 %{overview}
 
 
+%package -n       pki-javadoc
+Summary:          Certificate System - PKI Framework Javadocs
+Group:            Documentation
+
+BuildArch:        noarch
+
+Obsoletes:        pki-util-javadoc < %{version}-%{release}
+Obsoletes:        pki-java-tools-javadoc < %{version}-%{release}
+Obsoletes:        pki-common-javadoc < %{version}-%{release}
+
+%description -n   pki-javadoc
+This documentation pertains exclusively to version %{version} of
+the PKI Framework and Tools.
+
+This package is a part of the PKI Core used by the Certificate System.
+
+%{overview}
+
+
 %prep
 
 
@@ -1085,20 +1055,6 @@ fi
 %{_libdir}/symkey/
 
 
-%if %{?_without_javadoc:0}%{!?_without_javadoc:1}
-%files -n pki-util-javadoc
-%defattr(-,root,root,-)
-%{_javadocdir}/pki-util-%{version}/
-%endif
-
-
-%if %{?_without_javadoc:0}%{!?_without_javadoc:1}
-%files -n pki-java-tools-javadoc
-%defattr(-,root,root,-)
-%{_javadocdir}/pki-java-tools-%{version}/
-%endif
-
-
 %files -n pki-base
 %defattr(-,root,root,-)
 %doc base/common/LICENSE
@@ -1110,13 +1066,6 @@ fi
 %{_javadir}/pki/pki-certsrv-%{version}.jar
 %{_javadir}/pki/pki-certsrv.jar
 
-%if %{?_without_javadoc:0}%{!?_without_javadoc:1}
-%files -n pki-common-javadoc
-%defattr(-,root,root,-)
-%{_javadocdir}/pki-common-%{version}/
-%endif
-
-
 %files -n pki-tools
 %defattr(-,root,root,-)
 %doc base/native-tools/LICENSE base/native-tools/doc/README
@@ -1346,7 +1295,17 @@ fi
 %{_datadir}/pki/silent/
 
 
+%if %{?_without_javadoc:0}%{!?_without_javadoc:1}
+%files -n pki-javadoc
+%defattr(-,root,root,-)
+%{_javadocdir}/pki-%{version}/
+%endif
+
+
 %changelog
+* Thu Aug 30 2012 Endi S. Dewata <edewata@redhat.com> 10.0.0-0.29.a1
+- Merged Javadoc packages.
+
 * Thu Aug 30 2012 Endi S. Dewata <edewata@redhat.com> 10.0.0-0.28.a1
 - Added pki-tomcat.jar.
 
-- 
1.7.11.2

