Skip to content
Arno Unkrig edited this page Nov 19, 2020 · 7 revisions

Usage

There are several tools provided by the Redline package which are useful when working with RPM files. This includes a scanner for examining existing RPM files, a programmatic interface for generating RPM packages, and an Ant task that can be imported and invoked from build scripts in order to package deployment files.

Scanner

The scanner tool can be invoked from the command line using the main class org.freecompany.redline.Scanner. From the command line this class accepts as it's single argument a path to a valid RPM file. If the file specified by the providing path does not exist, or if the file in not a valid RPM archive an exception will be thrown. And example of invoking the scanner follows:

java -cp redline.jar org.freecompany.redline.Scanner test.rpm

The scanner is most useful for debugging RPM files and tools as it generates a significant amount of output. For more generalized RPM information the standard RPM tools are recommended.

Builder

The builder is the main entry point for constructing RPM files programmatically. The tool is used by constructing an instance of the org.freecompany.redline.Builder class and adding files and headers to the archive. When the builder is configured a final call will generate the RPM file to a given java.nio.channels.FileChannel.

Ant

Redline can be used to package projects that use the Ant build system. Included in the source and binary distributions is an Ant task that can be used within an Ant build script to construct an RPM distributable. The task can be defined using the antlib namespace convention by binding the namespace antlib:org.redline_rpm and using the namespace prefix to reference the rpm task type.

Ant Task Configuration

Task Attributes

name=...
TODO
epoch=...
TODO
type=...
TODO
architecture=...
TODO
os=...
TODO
version=...
TODO
release=...
TODO
group=...
TODO
host=...
TODO
summary=...
TODO
description=...
TODO
license=...
TODO
packager=...
TODO
distribution=...
TODO
vendor=...
TODO
url=...
TODO
provides=...
TODO
prefixes=...
TODO
destination=...
TODO
preTransScript=...
TODO
preInstallScript=...
TODO
postInstallScript=...
TODO
preUninstallScript=...
TODO
postUninstallScript=...
TODO
postTransScript=...
TODO
sourcePackage=...
TODO
privateKeyRingFile=...
TODO
privateKeyId=...
TODO
privateKeyPassphrase=...
TODO
changeLog=...
TODO

Task Subelements

<zipfileset>ZipFileSet
TODO
<tarfileset>TarFileSet
TODO
<rpmfileset>RpmFileSet
TODO
<ghost>Ghost
TODO
<emptyDir>EmptyDir
TODO
<link>Link
TODO
<depends>Depends
TODO
<provides>Provides
TODO
<conflicts>Conflicts
TODO
<obsoletes>Obsoletes
TODO
<triggerPreIn>TriggerPreIn
TODO
<triggerIn>TriggerIn
TODO
<triggerUn>TriggerUn
TODO
<triggerPostUn>TriggerPostUn
TODO
<builtIn>BuiltIn
TODO

Example

An example of using the build in Ant task follows:

<project name='test' default='rpm' xmlns:redline='antlib:org.redline_rpm'>

<target name='rpm'>
<mkdir dir='rpms'/>

<redline:rpm group='Java Development' name='test' version='1.2.3' destination='rpms'>
  <zipfileset prefix='/usr/share/java' file='test-1.2.3.jar'/>
  <link path='/usr/share/java/test.jar' target='/usr/share/java/test-1.2.3.jar'/>
  <depends name='test-lib' version='1.2.3'/>
</redline:rpm>

</target>

</project>

This build script creates a new RPM file named test-1.2.3-1.noarch.rpm in the rpms directory containing the local file test-1.2.3.jar to be installed into /use/share/java on the installation machine. In addition a symbolic link is included from the packaged file to /usr/share/java/test.jar. The resulting RPM has a dependency on an RPM named test-lib.

Clone this wiki locally