12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Building RPM Packages 141%filesThe list of files installed by the RPM package. These are the files associated withthe package in the RPM database and listed when the rpm -ql command is run. When listing files, be sure to use macros such as %{name} and%{version} when possible.Use the %defattr macro to set the default file permissions for the files installed.For most packages it should be%defattr(-,root,root,-)The fields inside the parentheses stand for the file permissions, owner, group, anddirectory permissions. A dash for the file and directory permissions causes thepermissions of the files and directories inside the BuildRoot to be retained. Thismacro is usually listed first under the %files section for easy readability.To mark files as special file types, include the following macros before the filename:%doc for documentation files, %config for configuration files,%config(noreplace) for configuration files that should not be replaced whenupgrading the package.5If a directory is listed, place the %dir macro in front of it.If a specific file needs different attributes, they can be listed with the %attrmacro in front of the filename in the list such as:%attr(0644,root,root)%config(noreplace) /etc/sysconfig/%{name}%changelogMacros for special directories should be used in case their locations change ordiffer on different versions of the operating system. This prevents files from beinginstalled in the wrong location should a special directory such as the man pagedirectory change locations. It also helps the files stay FHS-compliant. Thesemacros include %{_bindir} for the system bin directory, %{_mandir} for the manpage directory, %{_datadir} for the share directory, and %{_defaultdocdir} forthe documentation directory.Every time the package is built, a changelog entry should be added to the specfile in the format shown in Listing 5.9. Even if the rebuild is for the same versionwith a different release number, a changelog entry should be added to describewhy the rebuild occurred. The entries should be as specific as possible. Forexample, instead of random bug fixes, the entry should include informationsuch as fixed traceback error when log file doesn’t exist so the administratorcan determine whether the update is necessary or whether the update willfix a program he is having with the software. If a bug tracking system is used forthe software, include the bug number with the changelog entry.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!