It's possible to dump the available / defined macros when authoring a RPM spec file by using:

rpm --showrc or rpm --eval %dump

or including the %dump builtin macro in the spec file itself and examining the output from the RPM build process (the build output contains macro definitions).

In either case, some of the lines are prefixed with "-14" or "-11". The lines without either appear to be the body of multi-line definitions.

What is the significance of the "-14" (or less common "-11") in this output? More importantly I'm interested in knowing where this is documented.

Sample Output:

-14: __autoconf autoconf
-14: __autoheader   autoheader
-14: __automake automake
-11= _target_cpu    x86_64
-11= _target_os linux



RPM macros have an associated level which is the recursion depth.

When returning from a recursive expansion, macros at that level are automatically undefined.

Macros with a level <= 0 are always defined (in some sense global).

Negative valued levels were originally used to mark where macros were defined: from rpm internally, or from reading a configuration file.

In practice, nothing in RPM has ever used or needed the macro level.

But that is what the "-14" means.

Not also the change from ":" to "=" in the --showrc output, which tells which macros were defined or used.

  • There appears to be some correspondence between where the macro is defined and the number. Looks like -1 is used for macros defined in the spec itself, -3 for values defined by tags (e.g. "Release:"), -11 for architecture specific entires and -14 for the rest (presumably from /usr/lib/rpm/macros). Mar 18 '17 at 18:47
  • See also the answer from @msuchy, it provides additional interesting details such as how this plays with the rpm -D switch. Apr 15 '17 at 12:57

I asked on rpm-ecosystem mailing list. See: http://lists.rpm.org/pipermail/rpm-ecosystem/2017-March/000476.html

In case of "rpm --showrc" such a negative number represents the "source" or "location" of the macro definition:

-14 = -13 - 1: the macro is defined in a macro file (e.g. /etc/rpm/macros.*)

-11: the macro is defined in a rpmrc file (e.g. /usr/lib/rpm/rpmrc)

-8 = -7 - 1: the macro is defined on the cmdline (for instance via rpm -D "zzz 42" --showrc)



Best info I could find from looking at source code here, is that, %dump is traversing all macros and prints them using rpmDumpMacroTable

From MacroEntry struct, level member is being printed. As per definition here - it's 'Scoping level' (It's probably related to nesting of macros, but I am just speculating)

I would wait for other's with indepth knowledge to answer/provide more information, as there isn't much documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.