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 withrpmbuild.
๐ 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. Seerpm-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
- 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