rpmspec
Extract information from RPM spec files
TLDR
List binary packages which would be generated from a RPM spec file
List all options for --queryformat
Get summary information for single binary packages generated from a RPM spec file
Get the source package which would be generated from a RPM spec file
Parse a RPM spec file to stdout
SYNOPSIS
rpmspec [options]
PARAMETERS
-q, --query
Query information about the spec file.
-l, --list
List all files in the spec file.
-p, --preprocess
Preprocess the spec file (expand macros).
-c, --check
Check the spec file for errors.
-D, --define 'MACRO=value'
Define a macro for use in the spec file.
-E, --eval 'EXPRESSION'
Evaluate an expression.
--parse
Parse the spec file (same as -c).
--showrc
Show the RPM configuration.
--macros
List all defined macros.
--srpm
Treat the input as a source RPM file.
--short-circuit
Skip parsing the spec file body.
DESCRIPTION
The `rpmspec` command is a utility used for parsing, analyzing, and extracting information from RPM specification files (`.spec` files). These files contain the instructions for building RPM packages, including source code locations, build dependencies, installation paths, and package metadata. `rpmspec` allows developers to inspect these files without needing to perform a full build process.
Using `rpmspec`, you can extract details like the package name, version, release number, summary, description, license, build requirements, and runtime dependencies. It is frequently used in scripts or automated processes to validate spec file contents or generate reports. It can verify syntax, check dependencies, or perform other validation steps on spec files. This utility helps ensure the integrity and correctness of RPM packages before they are built and distributed. It can be useful during package creation, during testing and analysis or in automated workflows.
USAGE EXAMPLES
- Check a spec file for errors:
rpmspec -c mypackage.spec
- List all files in a spec file:
rpmspec -l mypackage.spec
- Preprocess a spec file:
rpmspec -p mypackage.spec
- Show RPM configuration:
rpmspec --showrc
- Define a macro and use it:
rpmspec -D 'version=1.2.3' -E '%{version}' mypackage.spec
HISTORY
The `rpmspec` command is part of the RPM Package Manager (RPM) suite. RPM was originally developed by Red Hat in 1997, aiming to provide a standardized package format and management system for Linux distributions. `rpmspec` has evolved alongside RPM, with improvements and bug fixes made over time to enhance its parsing and validation capabilities. Initially designed to inspect Red Hat packages, it has since become a standard tool across various RPM-based Linux distributions.