On Mon, Nov 22, 2021 at 04:46:05PM -0500, Nico Kadel-Garcia wrote:
To get the list of installed RPMs:
rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n'
For matching SRPMs?
rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' |
LANG=C sort | while read name; do echo "$name.rpm: `rpm -qi
$name | grep '^Source RPM'`"; done
This doesn't work, and also seems unnecessarily complicated. (Why not just
use `--qf '%{sourcerpm}` as in my original question?)
But in any case, it doesn't solve my problem, as it just gives filenames,
and there's no way to know when a name ends and a version starts, as they
both use - as a separator.
Do not bother with yum or dnf, they pull information from the rpm
database and burn cycles on unnecessary metadata updates from
updstreams.
rpm would be a tiny bit faster, if it could tell this. But it seems to not
have an easy way. And in fact if you use `dnf repoquery --installed`, it
is smart enough to just work from what's there locally. (You can use -C if
you want, but you don't have to.)
--
Matthew Miller
<mattdm(a)fedoraproject.org>
Fedora Project Leader