Hello,

I think I might have a solution for you. In our team, we are using a small utility called pkgname (see attachment).

On Tue, Nov 23, 2021 at 1:33 AM Matthew Miller <mattdm@fedoraproject.org> wrote:
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@fedoraproject.org>
Fedora Project Leader
_______________________________________________
packaging mailing list -- packaging@lists.fedoraproject.org
To unsubscribe send an email to packaging-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure