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="rpm.org"
name="bash" version="2.05a" release="02test"
copyright="GPL"
url="http://www.gnu.org/software/bash/bash.html">
<source name="%{name}-%{version}.tar.bz2"
size="1434025" md5="c29b50db808003e39558a0f6354f4cad"
path="%{name}-%{version}">
</source>
<buildrequires>
<require name="bash" />
<require name="gcc" />
<require name="make" />
</buildrequires>
<!-- packages -->
<package group="System/Base" autoreqprov="no">
<requires>
<require name="glibc" />
</requires>
<summary>The Bash package contains the bash program.</summary>
<description>%{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>
<package name="bash-doc" group="Documentation/System/Base" autoreqprov="no">
<requires>
<require name="%{name}" />
</requires>
<summary>Documentation for the bash package.</summary>
<description>%{summary}</description>
<pre script="%{name}-doc.pre.sh" />
<files list="%{name}-doc.files.lst" />
</package>
<!-- scripts to create the package -->
<prep script="%{name}.prep.sh">
<setup />
<script>echo &quot;Prep completed&quot;</script>
</prep>
<build script="%{name}.build.sh" />
<install script="%{name}.install.sh" />
<clean script="%{name}.clean.sh" />
<!-- changelog -->
<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>
</changes>
</changelog>
</spec>
Note
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.