mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
31.36.2013 4fcec30d02669d7853cebc9f423b8a0f2cfb4172
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.
1 files added
3 files modified
85 ■■■■ changed files
opends/build.xml 5 ●●●●● patch | view | raw | blame | history
opends/resource/rpm/docFiles 26 ●●●●● patch | view | raw | blame | history
opends/resource/rpm/specFile 23 ●●●● patch | view | raw | blame | history
opends/src/build-tools/org/opends/build/tools/ProcessFilesForPackages.java 31 ●●●● patch | view | raw | blame | history
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}" />
opends/resource/rpm/docFiles
New file
@@ -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 ]]
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.
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())
      {