RPM-MACROFILE(5)
π RPM-MACROFILE(5) π
okay bestie, gather round, because we're talking about the rpm macro file format β and this is genuinely one of those "iykyk" little file formats that runs the whole show behind the scenes. it's giving quiet luxury. it's in the File Formats Manual section. let's go π
β¨ SYNOPSIS β¨
%NAME[([OPTS]) BODY
π DESCRIPTION π
so. rpm macro files are the little homes where you define rpm-macros(7) in the global macro context. and there are two main character reasons you'd ever touch one:
- helping with packaging work π«Ά
- configuring rpm behavior βοΈ
a pre-determined set of macro files gets read when the rpm library initializes, exactly how rpm-config(5) describes it. but plot twist β you can also load them by hand using the %load macro, separately. no cap.
now the format itself? adorable and simple:
- the macro
NAMEprefixed with% - then whitespace
- then the macro body
- each new definition separated with a newline
the syntax is exactly the same as when you're using %define. literally identical. so if you wanna know the deets, go read rpm-macros(7), bestie, it's all there.
a trailing \ means line continuation β but ok here's the cute part: you can omit it inside macro bodies that are wrapped in a %{macro:...} block. generous queen behavior tbh.
also, lines that start with # or that consist solely of whitespace? ignored. bye. not invited. π«
β οΈ big one, listen up: reading a macro file is always fully declarative. no macros are ever expanded when reading a macro file. periodt. don't come for me expecting expansion, it's not happening.
π EXAMPLES π
π Example 1. Simple macro
%mytool /usr/bin/mytool-with-annoying-name
π¦ Example 2. Multiline macro with a preceding comment
# Trailing %{nil} is handy for ensuring a newline at the end
%mycmd %{mytool} \
--one \
--with \
--too \
--many arguments \
%{nil}
π Example 3. Multiline parametric Lua macro:
%myhelper() %{lua:
function dostuff(arg)
return 'do stuff to '..arg
end
print(dostuff(arg[1]))
}
π SEE ALSO π
rpm-config(5) Β· rpmbuild-config(5) Β· rpm-macros(7)
okay that's the whole vibe check, bestie β you now know the rpm macro file format better than half the people shipping packages fr fr. this was RPM 6.1.0, dated 2026-08-20, and honestly? iconic. go define something cute. πβ¨ππ¦πΈ
π¦ where this page comes from
- ubuntu stonking: rpm 6.1.0-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms