Product SiteDocumentation Site

9.8. Creating XML Spec Files

RPM spec files are text files containing structured information. It is a natural progression to write RPM spec files using XML. The tool rpmxmlbuild will build an RPM package from an XML-formatted spec file.
For example, Listing 10-1 holds a spec file in XML format.
Listing 10-1: An XML spec file.
<?xml version="1.0"?>
<spec distribution="RPM Test" vendor=""
name="bash" version="2.05a" release="02test"
<source name="%{name}-%{version}.tar.bz2"
size="1434025" md5="c29b50db808003e39558a0f6354f4cad"
<require name="bash" />
<require name="gcc" />
<require name="make" />
<!-- packages -->
<package group="System/Base" autoreqprov="no">
<require name="glibc" />
<summary>The Bash package contains the bash program.</summary>
Bash is the Bourne-Again SHell, which is a widely used command interpreter
on Unix systems. Bash is a program that reads from standard input, the
keyboard. A user types something and the program will evaluate what he has
typed and do something with it, like running a program.</description>
<files list="%{name}.files.lst" />
<package name="bash-doc" group="Documentation/System/Base" autoreqprov="no">
<require name="%{name}" />
<summary>Documentation for the bash package.</summary>
<pre script="%{name}" />
<files list="%{name}-doc.files.lst" />
<!-- scripts to create the package -->
<prep script="%{name}">
<setup />
<script>echo &quot;Prep completed&quot;</script>
<build script="%{name}" />
<install script="%{name}" />
<clean script="%{name}" />
<!-- changelog -->
<changes date="Mon Aug 26 2002" version="2.05a-02test"
author="" author-email="">
<change>Added setup macro to extract files</change>
<change>Initial version ready for jbj</change>
XML spec files are a very experimental feature. Future releases of RPM will likely provide more support for XML spec files. The format will likely change.