On Tue, Nov 23, 2021 at 3:37 AM Thomas Moschny <thomas.moschny(a)gmail.com> wrote:
Am Mo., 22. Nov. 2021 um 21:56 Uhr schrieb Matthew Miller
<mattdm(a)fedoraproject.org>:
>
> rpm -qa --qf '%{sourcerpm}\n'
>
> gives me a list of source RPM names, but it's in filename format. I don't
> want to have to try to parse that to figure out the actual source package
> base name (i.e. the dist-git name). Is there something I'm missing? Probably
> there is. :)
Parsing NVR is easy if done right-to-left:
rpm -qa --qf '%{sourcerpm}\n' | rev | cut -d- -f3- | rev
Regards,
Thomas
Outguessing the relation between SRPM's and RPM's is a bit of a
crapshoot. The "libldb" SRPM, for example, generates "libldb",
"libldb-devel", "python-ldb-devel-common", and python3-ldb-devel. I
personally find generating the full map between RPMs and SRPMs to be
useful.
Does this work for you?
rpm -qa --qf '%{name}\t%{sourcerpm}\n' | LANG=C sort
I always LANG=C sort because I loathe and despise interminging mixed
case names for things.