/*
* 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
* 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/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2008 Sun Microsystems, Inc.
* Portions Copyright 2012 Delta-Victor Consultants
* Portions Copyright 2013 ForgeRock AS
*/
/**
* Generates an RPM spec file.
*/
{
private boolean overwrite;
/**
* Sets the top directory for the rpm build.
*
* @param topDir
* File representing top directory for rpm build directory
*/
{
}
/**
* Sets the prefix for the RPM.
*
* @param prefix
* Used for package relocation
*/
{
}
/**
* Sets the short description for the RPM.
*
* @param productName
* The RPM short description
*/
{
this.productName = productName;
}
/**
* Sets the application name for the RPM.
*
* @param shortName
* The RPM application name
*/
{
}
/**
* Sets the reference URL for the RPM.
*
* @param referenceURL
* The RPM reference URL
*/
{
this.referenceURL = referenceURL;
}
/**
* Sets the name of the source directory.
*
* @param sourceDirName
* name of the source directory.
*/
{
this.sourceDirName = sourceDirName;
}
/**
* Sets the RPM spec file that will be generated.
*
* @param dest
* The spec file
*/
{
}
/**
* Sets the version number.
*
* @param version
* The version number
*/
{
}
/**
* Sets the release number.
*
* @param release
* The release number
*/
{
}
/**
* Indicates when true that an existing destination file will be overwritten.
*
* @param o
* boolean where true means overwrite
*/
public void setOverwrite(boolean o)
{
this.overwrite = o;
}
/**
* {@inheritDoc}
*/
{
try
{
{
+ " does not exist");
}
if (!topDir.isDirectory())
{
}
{
if (this.overwrite)
{
}
else
{
}
}
sb = new StringBuilder();
// Generate the package information
// If VERSION_QUALIFIER is empty, need to remove '.' char.
{
}
+ EOL);
+ EOL);
+ EOL);
+ EOL);
+ EOL);
+ EOL);
+ EOL);
+ EOL);
+ EOL);
sb.append(" if [ -f %{_prefix}/config/buildinfo ] && [ \"$(ls -A %{_prefix}/config/archived-configs)\" ]" + EOL);
sb.append(" [[ `java -version 2>&1 | /bin/sed 's/java version \"\\(.*\\)\\.\\(.*\\)\\.\\(.*\\)\\_\\(.*\\)\\.*\"/\\1\\2\\3\\4/; 1q'` < 16022 ]] && echo \"WARNING - For best server performance, use at least Java 1.6.0_22, which includes a major security fix for TLS.\""
+ EOL);
sb.append(" if [ -f %{_prefix}/config/buildinfo ] && [ \"$(ls -A %{_prefix}/config/archived-configs)\" ]" + EOL);
// Starts the upgrade. The new files are automatically imported
// by rpm manager, which compares files between last & actual version.
// Copies / deletes files depending of new package.
+ EOL);
+ EOL);
sb.append(" if [ -f %{_prefix}/config/buildinfo ] && [ \"$(ls -A %{_prefix}/config/archived-configs)\" ]" + EOL);
{
}
// In order to handle upgrades, we need to start
// with the contents of the rootDir rather than
// the actual directory, because the
// rootDir has the OpenDJ version number included
// into it
{
}
// flush the spec file.
destWriter.close();
}
catch (Exception e)
{
// Don't leave a malformed file laying around. Delete
// it so it will be forced to be regenerated.
{
}
e.printStackTrace();
+ e.getMessage());
}
}
{
if (source.isDirectory())
{
{
}
}
else
{
}
}
/**
* A file filter for the rpm. Excludes all '.bat', '.exe' and '.app' files.
*/
{
/** {@inheritDoc} */
{
if (file.isDirectory()
.endsWith(".bat")))
{
return false;
}
{
{
return false;
}
}
return true;
}
}
}