Product SiteDocumentation Site

9.7.3. Defining new macros

In addition to the built-in macros, you can define your own to make it easier to manage your packages. Define a new spec file macro with the following syntax:
%define macro_name value
For example:
%define major 2
%define minor 2
%define patchlevel 7
You can then use a macro with the %macro_name or %{macro_name} syntax. For example:
Version: %{major}.%{minor}.%{patchlevel}
You can also expand the results of running shell commands using a %(command) syntax with parenthesis instead of curly braces. For example:
%define today %(date)