Product SiteDocumentation Site

The files section

Finally, the files section lists the files to go into the binary RPM, along with the defined file attributes. For example:
%files
%defattr(-,root,root)
/usr/bin/jikes
%doc /usr/doc/jikes-%{version}/license.htm
%doc /usr/man/man1/jikes.1*
The files section starts with a %files statement
The %doc macro marks certain files as documentation. This allows the RPM to distinguish the files holding documentation from the other files in the RPM.
Cross Reference
This example skips the install and uninstall script sections, as well as a verification section. There are also no triggers defined in this RPM spec file. All of these topics are covered in Chapter 9, Working with Spec Files and Chapter 10, Advanced RPM Packaging.
Once you have written your spec file, and placed the files in the SOURCES and SPECS directories under /usr/src/redhat, you’ll see files like the following:
$ ls –CF /usr/src/redhat/*
/usr/src/redhat/BUILD:
/usr/src/redhat/RPMS:
athlon/ i386/ i486/ i586/ i686/ noarch/
/usr/src/redhat/SOURCES:
jikes-1.17.tar.gz
/usr/src/redhat/SPECS:
jikes.spec
/usr/src/redhat/SRPMS:
That is, with a clean system and no other RPMs being built, you'll see a spec file in /usr/src/redhat/SPECS and the sources in /usr/src/redhat/SOURCES. In this example, the sources are in a compressed tar archive. (For this, the RPM spec file, jikes.spec needs to have a command in the prep section to extract the files.)
You should now be ready to build an RPM.