Advanced Parameters
The parameters described in this page are parameters which enable advanced RPM features. Before using these parameters, it is highly recommended that you read Maximum RPM to gain an understanding of what these parameters do.
RPM Package Dependency Management
These parameters relate to the dependencies between RPM packages, not to the dependencies required to build the RPM package contents.
There are six RPM spec file tags related to dependency management:
provides
defines a virtual package which is provided by the package being builtrequires
identifies a package that is required to be installed for the package being built to operate correctlyrequiresPre
identifies a package that is required to be installed for the pre-installation scriptlet of the package being built to operate correctly. Packages that are listed here are installed before the pre-installation scriptlet of the package being built is run. Corresponds to theRequires(pre)
tag in the spec file.requiresPost
identifies a package that is required to be installed for the post-installation scriptlet of the package being built to operate correctly. Packages that are listed here are installed before the post-installation scriptlet of the package being built is run. Corresponds to theRequires(post)
tag in the spec file.requiresPreun
identifies a package that is required to be installed for the pre-removal scriptlet of the package being built to operate correctly. Corresponds to theRequires(preun)
tag in the spec file.conflicts
identifies a package which must not be installed if the package being built is installed
All of these tags can appear multiple times in the spec file. To configure these tags in the plugin configuration, specify an element for each instance of the tag in the spec file; the content of the element is the exact text to be placed in the spec file. Please be careful to ensure that version comparison specifications such as <
and >
are properly specified in the XML file. Here is an example:
<provides> <provide>dump</provide> </provides> <requires> <require>trash-truck > 1.0</require> </requires> <requires> <require>road</require> </requires> <requiresPre> <require>excavator</require> </requiresPre> <requiresPost> <require>bulldozer</require> </requiresPost> <requiresPreun> <require>environment-util = 2.0</require> </requiresPreun> <conflicts> <conflict>incinerator</conflict> </conflicts>
RPM Build Dependency Management
These parameters relate to the dependencies required to build the RPM package contents.
There is one RPM spec file tag related to build dependency management:
buildRequires
identifies a package that is required to be installed for the package being built to build correctly; i.e. it provides some tools needed during the building of the package, or some RPM macros that must be present when adding the scriptlets into the RPM package.
This tag can appear multiple times in the spec file. To configure this tag in the plugin configuration, specify an element for each instance of the tag in the spec file; the content of the element is the exact text to be placed in the spec file. Please be careful to ensure that version comparison specifications such as <
and >
are properly specified in the XML file. Here is an example:
<buildRequires> <buildRequire>ruby > 1.8</buildRequire> </buildRequires>
Relocation
If you specify the prefix/prefixes
parameter to the RPM plugin, you can create a package that can be installed in a user-specified location. Before doing this, read and understand Maximum RPM Chapter 15 since there are a number of kinks and quirks that must be addressed.
Scripts
There are a number of scripts that can be included in the RPM package which are executed as part of the installation, removal, or verification of the package.
Each of the scripts can be configured as a Scriptlet, which allows the content of the script to be provided either as a String or File. If both parameters are specified for a script, the external file will be ignored. Before writing scripts for RPM packages, understand the script docs in Maximum RPM since the operation of the scripts must be done correctly or major problems can occur while installing or removing the package.
Script files can be filtered by setting <filter
> to true while inline scripts can be filtered together with the pom.
Here are examples of passing the content of the script in the pom (using <script
>) and in a file (using <scriptFile
>) and enabling filtering for preinstall.sh script:
<prepareScriptlet> <script>echo "preparing ${project.name}"</script> </prepareScriptlet> <preinstallScriptlet> <scriptFile>/src/main/bin/preinstall.sh</scriptFile> <fileEncoding>utf-8</fileEncoding> <filter>true</filter> </preinstallScriptlet>
prepareScriptlet
This script specifies commands to prepare the build. It corresponds to the %prep
tag in the spec file.
preinstallScriptlet
This script is run before the package is installed. It corresponds to the %pre
tag in the spec file.
installScriptlet
This script is run as a part of installing the package. It corresponds to the %install
tag in the spec file.
postinstallScriptlet
This script is run after the package is installed. It corresponds to the %post
tag in the spec file.
preremoveScriptlet
This script is run before the package is removed. It corresponds to the %preun
tag in the spec file.
postremoveScriptlet
This script is run after the package is removed. It corresponds to the %postun
tag in the spec file.
verifyScriptlet
This script is run when the package is being verified. It corresponds to the %verifyScript
tag in the spec file.
cleanScriptlet
This script is run after the package is installed to clean up installation files. It corresponds to the %clean
tag in the spec file.
pretransScriptlet
This script is run at the beginning of the transaction. It corresponds to the %pretrans
tag in the spec file.
posttransScriptlet
This script is run at the end of the transaction. It corresponds to the %posttrans
tag in the spec file.
Triggers
Triggers are scripts which can be included in an RPM package to execute based on the action of other packages in a system. Before writing triggers for RPM packages, understand the triggers in the RPM documentation since the operation of the scripts must be done correctly or major problems can occur while installing or removing other packages.
Signatures
RPM packages may be signed using GPG or PGP. Currently the plugin only supports generating GPG signatures.
keyname
This parameter sets the name of the GPG key used to sign the package, and also turns on the signature. Setting this parameter is equivalent to defining the %_gpg_name
macro and adding the --sign
option to rpmbuild
.
keyPassphrase
This parameter sets the passphrase for the key to sign the rpm. The use of this attribute requires expect to be available on the PATH.