From 2b8a6d7d81fa644b40018ea61048dd9c53181b30 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 31 Jul 2013 09:36:50 +0000
Subject: [PATCH] Fix relative to OPENDJ-1063 and OPENDJ-1032 - Fixed the doc's section (doc files are no longer duplicate)(OPENDJ-1032) - Target no longer fails when build path contains spaces (OPENDJ-1063) - Out of concern for clarity, added docFiles to resource/rpm.
---
opendj-sdk/opends/resource/rpm/docFiles | 26 +++++++++++++
opendj-sdk/opends/build.xml | 5 +-
opendj-sdk/opends/resource/rpm/specFile | 23 ++++++++---
opendj-sdk/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java | 31 ++++++++++++---
4 files changed, 70 insertions(+), 15 deletions(-)
diff --git a/opendj-sdk/opends/build.xml b/opendj-sdk/opends/build.xml
index 0f8027b..ecbfc0b 100644
--- a/opendj-sdk/opends/build.xml
+++ b/opendj-sdk/opends/build.xml
@@ -1379,10 +1379,11 @@
</taskdef>
<processFilesForPackages sourceDirName="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" />
<copy file="resource/rpm/files" tofile="${build.dir}/rpm/SOURCES/files" />
+ <copy file="resource/rpm/docFiles" tofile="${build.dir}/rpm/SOURCES/docFiles" />
<replace file="${build.dir}/rpm/SOURCES/files" token="# [[ listFiles ]]" value="${listRPMFiles}" />
- <replace file="${build.dir}/rpm/SPECS/specFile" token="# [[ docsList ]]" value="${listRPMDocFiles}" />
- <replace file="${build.dir}/rpm/SPECS/specFile" token="# [[ installRpmFiles ]]" value="cp -rf ${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}/* . ${line.separator}" />
+ <replace file="${build.dir}/rpm/SOURCES/docFiles" token="# [[ docsList ]]" value="${listRPMDocFiles}" />
+ <replace file="${build.dir}/rpm/SPECS/specFile" token="# [[ installRpmFiles ]]" value="${installRpmFiles}" />
<copy file="resource/rpm/excludedFiles" tofile="${build.dir}/rpm/SOURCES/excludedFiles" />
<replace file="${build.dir}/rpm/SOURCES/excludedFiles" token="# [[ excludedListFiles ]]" value="${excludedRPMFiles}" />
diff --git a/opendj-sdk/opends/resource/rpm/docFiles b/opendj-sdk/opends/resource/rpm/docFiles
new file mode 100644
index 0000000..9d92cef
--- /dev/null
+++ b/opendj-sdk/opends/resource/rpm/docFiles
@@ -0,0 +1,26 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opendj3/legal-notices/CDDLv1_0.txt
+# or http://forgerock.org/license/CDDLv1.0.html.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying information:
+# Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2013 ForgeRock AS
+#
+# [[ docsList ]]
\ No newline at end of file
diff --git a/opendj-sdk/opends/resource/rpm/specFile b/opendj-sdk/opends/resource/rpm/specFile
index bcd6666..f5465ec 100644
--- a/opendj-sdk/opends/resource/rpm/specFile
+++ b/opendj-sdk/opends/resource/rpm/specFile
@@ -71,13 +71,20 @@
# %build
%install
-mkdir -p "$RPM_BUILD_ROOT%{_prefix}"
-cd "$RPM_BUILD_ROOT%{_prefix}"
+mkdir -p "${RPM_BUILD_ROOT}%{_prefix}"
+cd "${RPM_BUILD_ROOT}%{_prefix}"
# [[ installRpmFiles ]]
-# Remove the excluded files. They shouldn't be a part of this package.
-/bin/grep -v '^#' "$RPM_SOURCE_DIR/excludedFiles" | while read excludedFiles
+#Moves the doc files to doc folder
+mkdir -p "%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
+/bin/grep -v '^#' "${RPM_SOURCE_DIR}/docFiles" | while read docFiles
do
- rm -r "$RPM_BUILD_ROOT%{_prefix}$excludedFiles"
+ mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
+done
+
+# Removes the excluded files. They shouldn't be a part of this package.
+/bin/grep -v '^#' "${RPM_SOURCE_DIR}/excludedFiles" | while read excludedFiles
+do
+ rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
done
%clean
@@ -183,12 +190,16 @@
# =========================
%files -f "%{_sourcedir}"/files
%defattr(-,root,root)
-# [[ docsList ]]
+%{_defaultdocdir}/%{name}-%{version}/
# =========================
# Changelog
# =========================
%changelog
+* Wed Jul 31 2013 ForgeRock
+- Fixed the doc's section.
+- Target no longer fails when build path contains spaces.
+
* Thu Jul 18 2013 ForgeRock
- Fixed the sections' order and added a new "clean" section.
- Added '%doc' section.
diff --git a/opendj-sdk/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java b/opendj-sdk/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java
index 169f0c6..1fe9e0e 100644
--- a/opendj-sdk/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java
+++ b/opendj-sdk/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.FileFilter;
+import java.net.URI;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -62,7 +63,7 @@
*/
public String getSourceDirName()
{
- return sourceDirName.replaceAll(" ", "\\\\ ");
+ return sourceDirName;
}
/**
@@ -83,6 +84,7 @@
{
// Process the filtering of the files contained in the given directory.
filterFiles(new File(getSourceDirName()));
+ files.removeAll(docFiles);
// Sorts the list.
Collections.sort(files);
Collections.sort(docFiles);
@@ -92,6 +94,7 @@
formatAsDocList(docFiles));
getProject().setNewProperty("excludedRPMFiles",
formatAsExcludedList(excludedFiles));
+ getProject().setNewProperty("installRpmFiles", getInstallationFiles());
}
catch (Exception e)
{
@@ -101,6 +104,16 @@
}
/**
+ * Returns the installation files for the RPM package.
+ *
+ * @return A string containing the installation files for the RPM package.
+ */
+ private String getInstallationFiles()
+ {
+ return new StringBuilder("cp -rf \"").append(sourceDirName).append("\"/* .")
+ .append(EOL).toString();
+ }
+ /**
* Formats the file list to be supported by RPM.
*
* @param fileList
@@ -157,13 +170,11 @@
final StringBuilder sb = new StringBuilder();
for (final File f : fileList)
{
- // FIXME If directory is mentioned, files are duplicated in doc directory
- // in us/share/opendj{version} and in the package install opt/opendj/
+ // FIXME The folder needs to be copied as well.
if (!f.isDirectory())
{
- sb.append("%doc $RPM_BUILD_ROOT%{_prefix}").append(
- relativeToSourceDirName(f));
- sb.append(EOL);
+ sb.append(
+ relativeToSourceDirName(f)).append(EOL);
}
}
return sb.toString();
@@ -182,7 +193,13 @@
{
final ExcludeFileFilter exFilter = new ExcludeFileFilter();
final DocFileFilter docFilter = new DocFileFilter();
- for (final File f : dir.listFiles())
+
+ // The spaces in path can generate errors. (see OPENDJ-1063)
+ final File fdir =
+ new File(new URI("file:///"
+ + dir.getAbsolutePath().replaceAll(" ", "%20")));
+
+ for (final File f : fdir.listFiles())
{
if (f.isDirectory())
{
--
Gitblit v1.10.0