From 4fcec30d02669d7853cebc9f423b8a0f2cfb4172 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.

---
 opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java b/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java
index 169f0c6..1fe9e0e 100644
--- a/opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java
+++ b/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