RPMSPEC(1)

๐Ÿ’– rpmspec(1) โ€” the RPM Spec Tool, but make it a group chat ๐Ÿ’–

okay so bestie, welcome to rpmspec(1), from the General Commands Manual section of the RPM fam. this is the little tool that lets you peek inside a spec file before anything gets built. it's giving psychic powers but for packages. ๐Ÿ”ฎโœจ


๐ŸŒธ NAME ๐ŸŒธ

rpmspec โ€” RPM Spec Tool. that's it, that's the name, short and iconic.


โœจ SYNOPSIS โœจ

rpmspec {-q|--query} [options] [query-options] SPEC_FILE ...

rpmspec {-P|--parse} [options] SPEC_FILE ...

rpmspec --shell [options] [SPEC_FILE ...]

three whole modes, pick your fighter. ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so rpmspec is a tool for querying a spec file. more specifically (and this is the part people always get confused about, so listen up ๐Ÿซถ) it queries the hypothetical packages that would be created from the given spec file.

which means: querying a spec file with rpmspec is similar to querying a package built from that spec file. but โ€” and I cannot stress this enough โ€” it is not identical. ๐Ÿšจ

with rpmspec you can't query all the fields you can query from a built package. e. g. you can't query BUILDTIME with rpmspec, for obvious reasons (girl, it hasn't been built, there is no build time, be so fr ๐Ÿ˜ญ). you also can't query other fields that get automatically generated during a build of a package, like auto generated dependencies.

so likeโ€ฆ it's the vibes of a package, not the real thing. still so useful though, no cap. ๐Ÿ’–


๐Ÿ‘‘ OPERATIONS ๐Ÿ‘‘

  • -q, --query โ€” query the parsed spec header, similarly to querying packages.
  • -P, --parse โ€” output the parsed spec file to the standard output. that is: conditionals get handled, macros get parsed, and so on. the whole glow-up, printed. โœจ
  • --shell โ€” invoke an interactive shell for inspecting macros, optionally after parsing a spec. mainly useful for troubleshooting. think of it as the little mirror you hold up to your macros to see what they actually look like. ๐Ÿชž

๐Ÿ’œ ARGUMENTS ๐Ÿ’œ

  • SPECFILE โ€” RPM spec file used for building packages with rpmbuild.

๐ŸŽ€ OPTIONS ๐ŸŽ€

See rpm-common(8) for the options common to all operations. (yes bestie, that's the whole section, go read the common one, it's mandatory reading fr fr ๐Ÿ“š)


๐ŸŒˆ QUERY OPTIONS ๐ŸŒˆ

  • --qf QUERYFMT, --queryformat QUERYFMT โ€” specify output format for spec queries. See rpm-queryformat(7) for details.
  • --rpms โ€” operate on the all binary package headers generated from spec.
  • --builtrpms โ€” operate only on the binary package headers of packages which would be built from spec. that means ignoring package headers of packages that won't be built from spec, i. e. ignoring package headers of packages without a file section. (if it has no files, it's not getting built, and we're not looking at it, periodt. ๐Ÿ’…)
  • --srpm โ€” operate on the source package header(s) generated from spec.

โญ ENVIRONMENT โญ

See rpm-common(8). (again!! go read it!! it's right there!! ๐Ÿซถ)


๐Ÿ’€ EXIT STATUS ๐Ÿ’€

on success, 0 is returned, a nonzero failure code otherwise. classic. if it's 0 we celebrate, if it's not 0 we cry. ๐Ÿ˜ญ


๐Ÿ“ EXAMPLES ๐Ÿ“

rpmspec -q rpm.spec

get the list of binary packages which would be generated from the rpm spec file, eg:

rpm-4.11.3-3.fc20.x86_64
rpm-libs-4.11.3-3.fc20.x86_64
rpm-build-libs-4.11.3-3.fc20.x86_64
...

look at all those babies. ๐Ÿฅน


rpmspec -q --qf "%{name}: %{summary}n" rpm.spec

get summary infos for single binary packages generated from the rpm spec file, eg:

rpm: The RPM package management system
rpm-libs: Libraries for manipulating RPM packages
rpm-build-libs: Libraries for building and signing RPM packages
...

format string said %{name}: %{summary}n and honestly? she ate. ๐Ÿฝ๏ธ


rpmspec -q --srpm rpm.spec

get the source package which would be generated from the rpm spec file, eg:

rpm-4.11.3-3.fc20.x86_64

the source package. the origin story. the main character. ๐Ÿ‘‘


rpmspec -P rpm.spec

parse the rpm spec file to standard output, eg:

Summary: The RPM package management system
Name: rpm
Version: 4.14.0
...

just the whole parsed spec, spilling out onto your terminal like it's telling you all the tea. โ˜•


rpmspec --shell

run interactive macro shell for debugging macros, eg:

> %define foo bar
> %foo
bar
> %(date)
Tue Apr 13 03:55:37 PM EEST 2021
> %getncpus
8

okay but the way %(date) just ran a command and %getncpus said 8?? the macros are macro-ing. obsessed. ๐Ÿ”ฅ


rpmspec --shell popt.spec

run interactive macros shell in spec context, eg:

%name
popt
%version
1.18

yes bestie, now the macros know they're inside popt.spec and they're answering accordingly. contextual queen. ๐Ÿฆ‹


๐Ÿงš SEE ALSO ๐Ÿงš

rpmspec --help โ€” as rpm supports customizing the options via popt aliases it's impossible to guarantee that what's described in the manual matches what's available.

^ read that warning twice pls, because fr fr, aliases can change everything and the manual can't pinky-promise it matches your setup. ๐Ÿ™ˆ


and that's the whole page bestie!! she was written by the RPM 6.1.0 girlies and dated 2026-08-20 โ€” mwah, xoxo, go query a spec file, you've got this ๐Ÿ’…๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from