The spec file is at the heart of RPM's packaging building process. Similar in concept to a makefile, it contains information required by RPM to build the package, as well as instructions telling RPM how to build it. The spec file also dictates exactly what files are a part of the package, and where they should be installed.
The rpm.spec object represents a parsed specfile to aid extraction of data.
For example
import rpm rpm.addMacro("_topdir","/path/to/topdir") ts=rpm.ts() s=ts.parseSpec("foo.spec") print s.prep()
Macros set using add macro will be used allowing testing of conditional builds