rpm 宏定义


Custom RPM macros configuration file for building RPM packages

as a non-root user.


Author: Mike A. Harris


This is a copy of my own personal RPM configuration which I use

on my workstation for building and testing packages for Red Hat Linux.

There are many different possibilities on how to configure RPM, so

feel free to tweak however you desire. Make sure to create any

directories that are referenced prior to using. RPM will automatically

create some of them if missing, but not all of them. Which ones it

auto-creates is only known by the extraterrestrial aliens that have

created RPM.


For ANY help with anything related to RPM development, packaging,

or customization, please join the Red Hat RPM mailing list by sending

an email message to: rpm-list-request@redhat.com with the word

"subscribe" in the Subject: line.


Any suggestions/comments/ for improvements to this setup appreciated.

%_signature gpg
%_gpg_name T. E. Pickering

%_topdir defines the top directory to be used for RPM building purposes

By defaultROOT of the buildsystem

%_topdir %(echo $HOME)/rpmbuild

%_sourcedir is where the source code tarballs, patches, etc. will be

placed after you do an "rpm -ivh somepackage.1.0-1.src.rpm"

#%_sourcedir %{_topdir}/SOURCES/cpan
%_sourcedir %{_topdir}/SOURCES/%{name}-%{version}

%_specdir is where the specfile gets placed when installing a src.rpm. I

prefer the specfile to be in the same directory as the source tarballs, etc.

%_specdir %{_sourcedir}

%_tmppath is where temporary scripts are placed during the RPM build

process as well as the %_buildroot where %install normally dumps files

prior to packaging up the final binary RPM's.

%_tmppath %{_topdir}/tmp

%_builddir is where source code tarballs are decompressed, and patches then

applied when building an RPM package

%_builddir %{_topdir}/BUILD

%_buildroot is where files get placed during the %install section of spec

file processing prior to final packaging into rpms. This is oddly named

and probably should have been called "%_installroot" back when it was

initially added to RPM. Alas, it was not. ;o)

%_buildroot %{_tmppath}/%{name}-%{version}-root

%_rpmdir is where binary RPM packages are put after being built.

%_rpmdir %{_topdir}/RPMS

%_srcrpmdir is where src.rpm packages are put after being built.

%_srcrpmdir %{_topdir}/SRPMS

%_rpmfilename defines the naming convention of the produced RPM packages,

and should not be modified. It is listed here because I am overriding

RPM's default behaviour of dropping binary RPM's each in their own

separate subdirectories. I hate that. Grrr.

%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

Customized tags for local builds

%packager is the info that will appear in the "Packager:" field in the

RPM header on built packages. By default I have it read your username

and hostname. This should be customized appropriately.

%packager Joe Blow

%packager T. E. Pickering
%distribution The MMTO RPM Shack

GNU GPG config below

#%_signature gpg
#%_gpg_name Joe Blow
#%_gpg_path %(echo $HOME)/.gnupg

The following will try to create any missing directories required above

(Not implemented yet)

This entry was posted in 系统管理. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.