V Mon, Nov 22, 2021 at 07:32:26PM -0500, Matthew Miller napsal(a):
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.
The hyphen separator is forbidden inside release and version parts. Thus the
solution is parse the file name from the end. Example:
$ rpm -q --qf '%{sourcerpm}\n' perl-Module-CoreList
perl-Module-CoreList-5.20211120-1.fc34.src.rpm
$ rpm -q --qf '%{sourcerpm}\n' perl-Module-CoreList | sed -e
's/-[^-]*-[^-]*$//'
perl-Module-CoreList
-- Petr