All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.mojo.rpm.HelpMojo Maven / Gradle / Ivy

Go to download

Maven plugin which assembles files into an RPM package for installation on various target UNIX systems.

There is a newer version: 2.3.0
Show newest version
package org.codehaus.mojo.rpm;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * Display help information on rpm-maven-plugin.
Call
  mvn rpm:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details. * * @version generated on Wed Jul 08 20:45:50 CDT 2009 * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.5) * @goal help * @requiresProject false */ public class HelpMojo extends AbstractMojo { /** * If true, display all settable properties for each goal. * * @parameter expression="${detail}" default-value="false" */ private boolean detail; /** * The name of the goal for which to show help. If unspecified, all goals will be displayed. * * @parameter expression="${goal}" */ private java.lang.String goal; /** * The maximum length of a display line, should be positive. * * @parameter expression="${lineLength}" default-value="80" */ private int lineLength; /** * The number of spaces per indentation level, should be positive. * * @parameter expression="${indentSize}" default-value="2" */ private int indentSize; /** {@inheritDoc} */ public void execute() throws MojoExecutionException { if ( lineLength <= 0 ) { getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); lineLength = 80; } if ( indentSize <= 0 ) { getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); indentSize = 2; } StringBuffer sb = new StringBuffer(); append( sb, "org.codehaus.mojo:rpm-maven-plugin:2.0-beta-3", 0 ); append( sb, "", 0 ); append( sb, "RPM Maven Plugin", 0 ); append( sb, "Maven plugin which assembles files into an RPM package for installation on various target UNIX systems.", 1 ); append( sb, "", 0 ); if ( goal == null || goal.length() <= 0 ) { append( sb, "This plugin has 3 goals:", 0 ); append( sb, "", 0 ); } if ( goal == null || goal.length() <= 0 || "attached-rpm".equals( goal ) ) { append( sb, "rpm:attached-rpm", 0 ); append( sb, "Construct the RPM file and attaches it as a secondary artifact.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "changelogFile", 2 ); append( sb, "The changelog file. If the file does not exist, it is ignored.", 3 ); append( sb, "", 0 ); append( sb, "classifier", 2 ); append( sb, "The classifier for the rpm secondary artifact.", 3 ); append( sb, "", 0 ); append( sb, "clean", 2 ); append( sb, "The clean script.", 3 ); append( sb, "", 0 ); append( sb, "cleanScript", 2 ); append( sb, "The location of the clean script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "conflicts", 2 ); append( sb, "The list of conflicts for this package.", 3 ); append( sb, "", 0 ); append( sb, "copyright", 2 ); append( sb, "The one-line copyright information.", 3 ); append( sb, "", 0 ); append( sb, "defaultDirmode", 2 ); append( sb, "The default directory mode (octal string) to assign to directories when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultFilemode", 2 ); append( sb, "The default file mode (octal string) to assign to files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultGroupname", 2 ); append( sb, "The default group name for files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultUsername", 2 ); append( sb, "The default user name for files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defineStatements", 2 ); append( sb, "A list of %define arguments", 3 ); append( sb, "", 0 ); append( sb, "description", 2 ); append( sb, "The long description of the package.", 3 ); append( sb, "", 0 ); append( sb, "distribution", 2 ); append( sb, "The distribution containing this package.", 3 ); append( sb, "", 0 ); append( sb, "group", 2 ); append( sb, "The package group for the package.", 3 ); append( sb, "", 0 ); append( sb, "icon", 2 ); append( sb, "An icon for the package.", 3 ); append( sb, "", 0 ); append( sb, "install", 2 ); append( sb, "The installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "installScript", 2 ); append( sb, "The location of the installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "keyname", 2 ); append( sb, "Set to a key name to sign the package using GPG. Note that due to RPM limitations, this always requires input from the terminal even if the key has no passphrase.", 3 ); append( sb, "", 0 ); append( sb, "mappings", 2 ); append( sb, "The list of file mappings.", 3 ); append( sb, "", 0 ); append( sb, "name", 2 ); append( sb, "The name portion of the output file name.", 3 ); append( sb, "", 0 ); append( sb, "needarch", 2 ); append( sb, "The target architecture for the rpm. The default value is noarch.\nFor passivity purposes, a value of true or false will indicate whether the architecture of the build machine will be used. Any other value (such as x86_64) will set the architecture of the rpm to x86_64.\n\nThis can also be used in conjunction with Source targetArchitecture to flex the contents of the rpm based on the architecture.\n", 3 ); append( sb, "", 0 ); append( sb, "obsoletes", 2 ); append( sb, "The list of obsoletes for this package.", 3 ); append( sb, "", 0 ); append( sb, "packager", 2 ); append( sb, "The name of the person or group creating the package.", 3 ); append( sb, "", 0 ); append( sb, "postinstall", 2 ); append( sb, "The post-installation script.", 3 ); append( sb, "", 0 ); append( sb, "postinstallScript", 2 ); append( sb, "The location of the post-installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "postremove", 2 ); append( sb, "The post-removal script.", 3 ); append( sb, "", 0 ); append( sb, "postremoveScript", 2 ); append( sb, "The location of the post-removal script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "prefix", 2 ); append( sb, "The relocation prefix for this package.", 3 ); append( sb, "", 0 ); append( sb, "preinstall", 2 ); append( sb, "The pre-installation script.", 3 ); append( sb, "", 0 ); append( sb, "preinstallScript", 2 ); append( sb, "The location of the pre-installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "preremove", 2 ); append( sb, "The pre-removal script.", 3 ); append( sb, "", 0 ); append( sb, "preremoveScript", 2 ); append( sb, "The location of the pre-removal script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "prereqs", 2 ); append( sb, "The list of prerequisites for this package.", 3 ); append( sb, "", 0 ); append( sb, "projversion", 2 ); append( sb, "The version portion of the RPM file name.", 3 ); append( sb, "", 0 ); append( sb, "provides", 2 ); append( sb, "The list of virtual packages provided by this package.", 3 ); append( sb, "", 0 ); append( sb, "release", 2 ); append( sb, "The release portion of the RPM file name.\nBeginning with 2.0-beta-2, this is an optional parameter. By default, the release will be generated from the modifier portion of the project version using the following rules:\n\n-\tIf no modifier exists, the release will be 1.\n-\tIf the modifier ends with SNAPSHOT, the timestamp (in UTC) of the build will be appended to end.\n-\tAll instances of \'-\' in the modifier will be replaced with \'_\'.\n-\tIf a modifier exists and does not end with SNAPSHOT, \'_1\' will be appended to end.\n\n\n", 3 ); append( sb, "", 0 ); append( sb, "requires", 2 ); append( sb, "The list of requirements for this package.", 3 ); append( sb, "", 0 ); append( sb, "summary", 2 ); append( sb, "The one-line description of the package.", 3 ); append( sb, "", 0 ); append( sb, "targetOS", 2 ); append( sb, "The target os for building the RPM. By default, this will be populated to Os.OS_NAME.\nThis can be used in conjunction with Source targetOSName to flex the contents of the rpm based on operating system.\n", 3 ); append( sb, "", 0 ); append( sb, "targetVendor", 2 ); append( sb, "The target vendor for building the RPM. By default, this will be populated to the result of rpm -E %{_host_vendor}.", 3 ); append( sb, "", 0 ); append( sb, "url", 2 ); append( sb, "A URL for the vendor.", 3 ); append( sb, "", 0 ); append( sb, "vendor", 2 ); append( sb, "The vendor supplying the package.", 3 ); append( sb, "", 0 ); append( sb, "verify", 2 ); append( sb, "The verification script.", 3 ); append( sb, "", 0 ); append( sb, "verifyScript", 2 ); append( sb, "The location of the verification script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "workarea", 2 ); append( sb, "The area for RPM to use for building the package.\nBeginning with release 2.0-beta-3, sub-directories will be created within the workarea for each execution of the plugin within a life cycle.\nThe pattern will be workarea/name[-classifier].\nThe classifier portion is only applicable for the attached-rpm goal.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) { append( sb, "rpm:help", 0 ); append( sb, "Display help information on rpm-maven-plugin.\nCall\n\u00a0\u00a0mvn\u00a0rpm:help\u00a0-Ddetail=true\u00a0-Dgoal=\nto display parameter details.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "detail (Default: false)", 2 ); append( sb, "If true, display all settable properties for each goal.", 3 ); append( sb, "", 0 ); append( sb, "goal", 2 ); append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); append( sb, "", 0 ); append( sb, "indentSize (Default: 2)", 2 ); append( sb, "The number of spaces per indentation level, should be positive.", 3 ); append( sb, "", 0 ); append( sb, "lineLength (Default: 80)", 2 ); append( sb, "The maximum length of a display line, should be positive.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "rpm".equals( goal ) ) { append( sb, "rpm:rpm", 0 ); append( sb, "Construct the RPM file.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "changelogFile", 2 ); append( sb, "The changelog file. If the file does not exist, it is ignored.", 3 ); append( sb, "", 0 ); append( sb, "clean", 2 ); append( sb, "The clean script.", 3 ); append( sb, "", 0 ); append( sb, "cleanScript", 2 ); append( sb, "The location of the clean script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "conflicts", 2 ); append( sb, "The list of conflicts for this package.", 3 ); append( sb, "", 0 ); append( sb, "copyright", 2 ); append( sb, "The one-line copyright information.", 3 ); append( sb, "", 0 ); append( sb, "defaultDirmode", 2 ); append( sb, "The default directory mode (octal string) to assign to directories when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultFilemode", 2 ); append( sb, "The default file mode (octal string) to assign to files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultGroupname", 2 ); append( sb, "The default group name for files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defaultUsername", 2 ); append( sb, "The default user name for files when installed.\nOnly applicable to a Mapping if filemode, username, AND groupname are NOT populated.", 3 ); append( sb, "", 0 ); append( sb, "defineStatements", 2 ); append( sb, "A list of %define arguments", 3 ); append( sb, "", 0 ); append( sb, "description", 2 ); append( sb, "The long description of the package.", 3 ); append( sb, "", 0 ); append( sb, "distribution", 2 ); append( sb, "The distribution containing this package.", 3 ); append( sb, "", 0 ); append( sb, "group", 2 ); append( sb, "The package group for the package.", 3 ); append( sb, "", 0 ); append( sb, "icon", 2 ); append( sb, "An icon for the package.", 3 ); append( sb, "", 0 ); append( sb, "install", 2 ); append( sb, "The installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "installScript", 2 ); append( sb, "The location of the installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "keyname", 2 ); append( sb, "Set to a key name to sign the package using GPG. Note that due to RPM limitations, this always requires input from the terminal even if the key has no passphrase.", 3 ); append( sb, "", 0 ); append( sb, "mappings", 2 ); append( sb, "The list of file mappings.", 3 ); append( sb, "", 0 ); append( sb, "name", 2 ); append( sb, "The name portion of the output file name.", 3 ); append( sb, "", 0 ); append( sb, "needarch", 2 ); append( sb, "The target architecture for the rpm. The default value is noarch.\nFor passivity purposes, a value of true or false will indicate whether the architecture of the build machine will be used. Any other value (such as x86_64) will set the architecture of the rpm to x86_64.\n\nThis can also be used in conjunction with Source targetArchitecture to flex the contents of the rpm based on the architecture.\n", 3 ); append( sb, "", 0 ); append( sb, "obsoletes", 2 ); append( sb, "The list of obsoletes for this package.", 3 ); append( sb, "", 0 ); append( sb, "packager", 2 ); append( sb, "The name of the person or group creating the package.", 3 ); append( sb, "", 0 ); append( sb, "postinstall", 2 ); append( sb, "The post-installation script.", 3 ); append( sb, "", 0 ); append( sb, "postinstallScript", 2 ); append( sb, "The location of the post-installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "postremove", 2 ); append( sb, "The post-removal script.", 3 ); append( sb, "", 0 ); append( sb, "postremoveScript", 2 ); append( sb, "The location of the post-removal script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "prefix", 2 ); append( sb, "The relocation prefix for this package.", 3 ); append( sb, "", 0 ); append( sb, "preinstall", 2 ); append( sb, "The pre-installation script.", 3 ); append( sb, "", 0 ); append( sb, "preinstallScript", 2 ); append( sb, "The location of the pre-installation script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "preremove", 2 ); append( sb, "The pre-removal script.", 3 ); append( sb, "", 0 ); append( sb, "preremoveScript", 2 ); append( sb, "The location of the pre-removal script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "prereqs", 2 ); append( sb, "The list of prerequisites for this package.", 3 ); append( sb, "", 0 ); append( sb, "projversion", 2 ); append( sb, "The version portion of the RPM file name.", 3 ); append( sb, "", 0 ); append( sb, "provides", 2 ); append( sb, "The list of virtual packages provided by this package.", 3 ); append( sb, "", 0 ); append( sb, "release", 2 ); append( sb, "The release portion of the RPM file name.\nBeginning with 2.0-beta-2, this is an optional parameter. By default, the release will be generated from the modifier portion of the project version using the following rules:\n\n-\tIf no modifier exists, the release will be 1.\n-\tIf the modifier ends with SNAPSHOT, the timestamp (in UTC) of the build will be appended to end.\n-\tAll instances of \'-\' in the modifier will be replaced with \'_\'.\n-\tIf a modifier exists and does not end with SNAPSHOT, \'_1\' will be appended to end.\n\n\n", 3 ); append( sb, "", 0 ); append( sb, "requires", 2 ); append( sb, "The list of requirements for this package.", 3 ); append( sb, "", 0 ); append( sb, "summary", 2 ); append( sb, "The one-line description of the package.", 3 ); append( sb, "", 0 ); append( sb, "targetOS", 2 ); append( sb, "The target os for building the RPM. By default, this will be populated to Os.OS_NAME.\nThis can be used in conjunction with Source targetOSName to flex the contents of the rpm based on operating system.\n", 3 ); append( sb, "", 0 ); append( sb, "targetVendor", 2 ); append( sb, "The target vendor for building the RPM. By default, this will be populated to the result of rpm -E %{_host_vendor}.", 3 ); append( sb, "", 0 ); append( sb, "url", 2 ); append( sb, "A URL for the vendor.", 3 ); append( sb, "", 0 ); append( sb, "vendor", 2 ); append( sb, "The vendor supplying the package.", 3 ); append( sb, "", 0 ); append( sb, "verify", 2 ); append( sb, "The verification script.", 3 ); append( sb, "", 0 ); append( sb, "verifyScript", 2 ); append( sb, "The location of the verification script.\nBeginning with release 2.0-beta-3, a File which does not exist is ignored.\n", 3 ); append( sb, "", 0 ); append( sb, "workarea", 2 ); append( sb, "The area for RPM to use for building the package.\nBeginning with release 2.0-beta-3, sub-directories will be created within the workarea for each execution of the plugin within a life cycle.\nThe pattern will be workarea/name[-classifier].\nThe classifier portion is only applicable for the attached-rpm goal.\n", 3 ); append( sb, "", 0 ); } } if ( getLog().isInfoEnabled() ) { getLog().info( sb.toString() ); } } /** *

Repeat a String n times to form a new string.

* * @param str String to repeat * @param repeat number of times to repeat str * @return String with repeated String * @throws NegativeArraySizeException if repeat < 0 * @throws NullPointerException if str is null */ private static String repeat( String str, int repeat ) { StringBuffer buffer = new StringBuffer( repeat * str.length() ); for ( int i = 0; i < repeat; i++ ) { buffer.append( str ); } return buffer.toString(); } /** * Append a description to the buffer by respecting the indentSize and lineLength parameters. * Note: The last character is always a new line. * * @param sb The buffer to append the description, not null. * @param description The description, not null. * @param indent The base indentation level of each line, must not be negative. */ private void append( StringBuffer sb, String description, int indent ) { for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) { sb.append( it.next().toString() ).append( '\n' ); } } /** * Splits the specified text into lines of convenient display length. * * @param text The text to split into lines, must not be null. * @param indent The base indentation level of each line, must not be negative. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. * @return The sequence of display lines, never null. * @throws NegativeArraySizeException if indent < 0 */ private static List toLines( String text, int indent, int indentSize, int lineLength ) { List lines = new ArrayList(); String ind = repeat( "\t", indent ); String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); for ( int i = 0; i < plainLines.length; i++ ) { toLines( lines, ind + plainLines[i], indentSize, lineLength ); } return lines; } /** * Adds the specified line to the output sequence, performing line wrapping if necessary. * * @param lines The sequence of display lines, must not be null. * @param line The line to add, must not be null. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. */ private static void toLines( List lines, String line, int indentSize, int lineLength ) { int lineIndent = getIndentLevel( line ); StringBuffer buf = new StringBuffer( 256 ); String[] tokens = line.split( " +" ); for ( int i = 0; i < tokens.length; i++ ) { String token = tokens[i]; if ( i > 0 ) { if ( buf.length() + token.length() >= lineLength ) { lines.add( buf.toString() ); buf.setLength( 0 ); buf.append( repeat( " ", lineIndent * indentSize ) ); } else { buf.append( ' ' ); } } for ( int j = 0; j < token.length(); j++ ) { char c = token.charAt( j ); if ( c == '\t' ) { buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); } else if ( c == '\u00A0' ) { buf.append( ' ' ); } else { buf.append( c ); } } } lines.add( buf.toString() ); } /** * Gets the indentation level of the specified line. * * @param line The line whose indentation level should be retrieved, must not be null. * @return The indentation level of the line. */ private static int getIndentLevel( String line ) { int level = 0; for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) { level++; } for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) { if ( line.charAt( i ) == '\t' ) { level++; break; } } return level; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy