Looking for a way to extract certain data elements from
rpm
package query, I read its man
page and came across the following blurb:
QUERY OPTIONS
The general form of an rpm query command is
rpm {-q|--query} [select-options] [query-options]
You may specify the format that package information should be printed in. To do this, you use the
--qf|--queryformat QUERYFMT
option, followed by the QUERYFMT format string.
Based on the above, expecting that the query format string is supposed to work as stated, I devised the following command and got the following result:
$ rpm -q -i --qf "%{changelogtext}" xyz
Name : xyz
... blah-blah ...
Summary : Blah blah
Description :
xyz is ...
- Update to blah blah[me@localhost]$
It appears as if query format is not honored in a sense that the default query output is still present, followed by changelog text. Although it is possible to add to the query format string an indicator of where the changelog text begins, it is still a major inconvenience to get rid of the default output that precedes it.
Is there a way to enforce query format string and get rid of the default output, in a single rpm
command, without having to resort to additional parsing of the output?
Chahgelog text is only a single example. The goal is to obtain values of arbitrary tags supported by rpm
queries.
Asked by Satoro Inikei
(26 rep)
Jul 22, 2024, 05:41 PM