RPMSPEC(8)
π NAME π
rpmspec β the RPM Spec Tool, aka the little icon who lets you interrogate a spec file before anything even gets built. This whole page is rpmspec(8), and yes, she ate π
β¨ SYNOPSIS β¨
π QUERYING SPEC FILES
rpmspec {-q|--query} [select-options] [query-options] SPEC_FILE ...
π PARSING SPEC FILES TO STDOUT
rpmspec {-P|--parse} SPEC_FILE ...
π INVOKING MACRO SHELL
rpmspec {βshell} [SPEC_FILE ...]
π DESCRIPTION π
okay so bestie, rpmspec is a tool for querying a spec file. More specifically, it queries the hypothetical packages that would be created from the given spec file. So like β querying a spec file with rpmspec is basically the same vibe as querying a package built from that spec file. But it's not identical, and that distinction is doing a lot of work here, fr fr.
With rpmspec you can't query all the fields you can query from a built package. For example, you can't query BUILDTIME with rpmspec, for obvious reasons (girl, the build hasn't happened yet π). You also can't query other fields that get automatically generated during a build of a package, like auto-generated dependencies. Those just don't exist at spec-query time, periodt.
π§Ί select-options
[--rpms] [--srpm]
π query-options
[--qf,--queryformat QUERYFMT] [--target TARGET_PLATFORM]
π QUERY OPTIONS π
The general form of an rpm spec query command is:
rpm {-q|--query} [select-options] [query-options]
You get to pick the format the info prints in, and honestly that's the fun part. To do it, you use the
--qf|--queryformat QUERYFMT
option, followed by the QUERYFMT format string. See rpm(8) for details. (Yes, go read your other manual too, she's worth it π«Ά)
π SELECT OPTIONS π
--rpmsβ operate on the all binary package headers generated from spec. All of them, no crumbs left behind β¨--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 there's no file section, she's not invited to the party π--srpmβ operate on the source package header(s) generated from spec. The source package gets its moment too π
π EXAMPLES π
Get list of binary packages which would be generated from the rpm spec file:
$ rpmspec -q rpm.spec
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
...
Get summary infos for single binary packages generated from the rpm spec file:
$ rpmspec -q --qf "%{name}: %{summary}\n" rpm.spec
rpm: The RPM package management system
rpm-libs: Libraries for manipulating RPM packages
rpm-build-libs: Libraries for building and signing RPM packages
...
Get the source package which would be generated from the rpm spec file:
$ rpmspec -q --srpm rpm.spec
rpm-4.11.3-3.fc20.x86_64
Parse the rpm spec file to stdout:
$ rpmspec -P rpm.spec
Summary: The RPM package management system
Name: rpm
Version: 4.14.0
...
Run interactive macro shell for debugging macros:
$ rpmspec --shell
> %define foo bar
> %foo
bar
> %(date)
Tue Apr 13 03:55:37 PM EEST 2021
> %getncpus
8
Run interactive macros shell in spec context:
$ rpmspec --shell popt.spec
%name
popt
%version
1.18
π¦ 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. so like, lowkey always double-check with--help, bestie π
http://www.rpm.org/ <URL:http://www.rpm.org/>
π AUTHORS π
- Marc Ewing <marc@redhat.com>
- Jeff Johnson <jbj@redhat.com>
- Erik Troan <ewt@redhat.com>
- Panu Matilainen <pmatilai@redhat.com>
and that's the whole page, angel π« β this iconic little doc is dated 29 October 2010 and lives in the RPMSPEC(8) section of your friendly neighbourhood manual set. go query something cute π
π¦ where this page comes from
- debian trixie: rpm 4.20.1+dfsg-3 Β· GPL-2.0-or-later
- nixpkgs unstable: rpm 4.20.1
- opensuse-leap 16.0: rpm 4.20.1-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: rpm 4.20.1-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: rpm 4.20.1-160000.4.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: rpm 4.20.1-160000.4.1 Β· GPL-2.0-or-later
- ubuntu questing: rpm 4.20.1+dfsg-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms