Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional

public Class Rpm

extends Task
Class Inheritance
Imports
java.io.BufferedOutputStream, .File, .IOException, .OutputStream, .PrintStream, java.nio.file.Files, java.util.Map, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.Execute, .ExecuteStreamHandler, .LogOutputStream, .LogStreamHandler, .PumpStreamHandler, org.apache.tools.ant.taskdefs.condition.Os, org.apache.tools.ant.types.Commandline, .Path, org.apache.tools.ant.util.FileUtils

Invokes the rpm tool to build a Linux installation file.

Field Summary

Modifier and TypeField and Description
private boolean
cleanBuildDir

clean BUILD directory

private String
command

the rpm command to use

private File
error

the file to direct standard error from the command

private boolean
failOnError

Halt on error return value from rpm build.

private File
output

the file to direct standard output from the command

private static final String
private static final String
private static final String
private boolean
quiet

Don't show output of RPM build command on console.

private boolean
removeSource

remove sources

private boolean
removeSpec

remove spec file

private String
rpmBuildCommand

The executable to use for building the packages.

private String
specFile

the spec file

private File
topDir

the rpm top dir

Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Rpm()

Method Summary

Modifier and TypeMethod and Description
public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task
protected Execute

Returns:

the execute object.
getExecute
(Commandline
the command line to use.
toExecute
,
ExecuteStreamHandler
the stream handler to use.
streamhandler
)

Get the execute object.

protected String

Returns:

the command used to build RPM's
guessRpmBuildCommand
()

Checks whether rpmbuild is on the PATH and returns the absolute path to it - falls back to rpm otherwise.

public void
setCleanBuildDir(boolean
a boolean value.
cbd
)

Flag (optional, default=false) to remove the generated files in the BUILD directory

public void
setCommand(String
the command to use.
c
)

What command to issue to the rpm build tool; optional.

public void
setError(File
the file to save error output to.
error
)

Optional file to save stderr to

public void
setFailOnError(boolean
true if it should halt, otherwise false. The default is false.
value
)

If true, stop the build process when the rpmbuild command exits with an error status.

public void
setOutput(File
the file to save stdout to.
output
)

Optional file to save stdout to.

public void
setQuiet(boolean
false if output should be logged, otherwise true. The default is false.
value
)

If true, output from the RPM build command will only be logged to DEBUG.

public void
setRemoveSource(boolean
a boolean value.
rs
)

Flag (optional, default=false) to remove the sources after the build.

public void
setRemoveSpec(boolean
a boolean value.
rs
)

Flag (optional, default=false) to remove the spec file from SPECS

public void
setRpmBuildCommand(String
the rpm build executable
c
)

The executable to run when building; optional.

public void
setSpecFile(String
the spec file name to use.
sf
)

The name of the spec File to use; required.

public void
setTopDir(File
the directory containing the normal RPM directories.
td
)

The directory which will have the expected subdirectories, SPECS, SOURCES, BUILD, SRPMS; optional.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

cleanBuildDirback to summary
private boolean cleanBuildDir

clean BUILD directory

commandback to summary
private String command

the rpm command to use

errorback to summary
private File error

the file to direct standard error from the command

failOnErrorback to summary
private boolean failOnError

Halt on error return value from rpm build.

outputback to summary
private File output

the file to direct standard output from the command

PATH1back to summary
private static final String PATH1
PATH2back to summary
private static final String PATH2
PATH3back to summary
private static final String PATH3
quietback to summary
private boolean quiet

Don't show output of RPM build command on console. This does not affect the printing of output and error messages to files.

removeSourceback to summary
private boolean removeSource

remove sources

removeSpecback to summary
private boolean removeSpec

remove spec file

rpmBuildCommandback to summary
private String rpmBuildCommand

The executable to use for building the packages.

Since
Ant 1.6
specFileback to summary
private String specFile

the spec file

topDirback to summary
private File topDir

the rpm top dir

Constructor Detail

Rpmback to summary
public Rpm()

Method Detail

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task

Annotations
@Override
Exceptions
BuildException:
is there is a problem in the task execution.
getExecuteback to summary
protected Execute getExecute(Commandline toExecute, ExecuteStreamHandler streamhandler)

Get the execute object.

Parameters
toExecute:Commandline

the command line to use.

streamhandler:ExecuteStreamHandler

the stream handler to use.

Returns:Execute

the execute object.

Since
Ant 1.6.3
guessRpmBuildCommandback to summary
protected String guessRpmBuildCommand()

Checks whether rpmbuild is on the PATH and returns the absolute path to it - falls back to rpm otherwise.

Returns:String

the command used to build RPM's

Since
1.6
setCleanBuildDirback to summary
public void setCleanBuildDir(boolean cbd)

Flag (optional, default=false) to remove the generated files in the BUILD directory

Parameters
cbd:boolean

a boolean value.

setCommandback to summary
public void setCommand(String c)

What command to issue to the rpm build tool; optional. The default is "-bb"

Parameters
c:String

the command to use.

setErrorback to summary
public void setError(File error)

Optional file to save stderr to

Parameters
error:File

the file to save error output to.

setFailOnErrorback to summary
public void setFailOnError(boolean value)

If true, stop the build process when the rpmbuild command exits with an error status.

Parameters
value:boolean

true if it should halt, otherwise false. The default is false.

Since
Ant 1.6.3
setOutputback to summary
public void setOutput(File output)

Optional file to save stdout to.

Parameters
output:File

the file to save stdout to.

setQuietback to summary
public void setQuiet(boolean value)

If true, output from the RPM build command will only be logged to DEBUG.

Parameters
value:boolean

false if output should be logged, otherwise true. The default is false.

Since
Ant 1.6.3
setRemoveSourceback to summary
public void setRemoveSource(boolean rs)

Flag (optional, default=false) to remove the sources after the build. See the --rmsource option of rpmbuild.

Parameters
rs:boolean

a boolean value.

setRemoveSpecback to summary
public void setRemoveSpec(boolean rs)

Flag (optional, default=false) to remove the spec file from SPECS

Parameters
rs:boolean

a boolean value.

setRpmBuildCommandback to summary
public void setRpmBuildCommand(String c)

The executable to run when building; optional. The default is rpmbuild.

Parameters
c:String

the rpm build executable

Since
Ant 1.6
setSpecFileback to summary
public void setSpecFile(String sf)

The name of the spec File to use; required.

Parameters
sf:String

the spec file name to use.

setTopDirback to summary
public void setTopDir(File td)

The directory which will have the expected subdirectories, SPECS, SOURCES, BUILD, SRPMS; optional. If this isn't specified, the baseDir value is used

Parameters
td:File

the directory containing the normal RPM directories.