Product SiteDocumentation Site

Spec file-specific macros

Most of the pre-defined RPM macros hold directory paths or architecture information. RPM also includes a set of useful macros that you can use to help debug problematic spec files and well as perform common tasks in spec files. Table 10-5 lists these debugging and special spec file macros.
Table 10-5 Special spec-file macros
Macro
Usage
%dump
Prints out macro values
%{echo:message}
Prints message to stderr
%{error:message}
Prints message to stderr and returns BADSPEC
%{expand:expression}
Like eval, expands expression
%{F:file_exp}
Expands file_exp to a file name
%global name value
Defines a global macro
%{P:patch_exp}
Expands patch_exp to a patch file name
%{S:source_exp}
Expands source_exp to a source file name
%trace
Toggles the printing of debugging information
%{uncompress:filename}
Tests if file filename is compressed. If so, uncompresses and includes in the given context. If not compressed, calls cat to include file in given context.
%undefine macro
Undefines the given macro
%{warn:message}
Prints message to stderr
Note
To see the current list of macros, put a %dump at the start of your spec file.