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 NAME prefixed 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