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. :)
On Mon, Nov 22, 2021 at 03:54:16PM -0500, Matthew Miller wrote:
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. :)
And, ugh:
$ dnf repoquery --installed --source --qf '%{name}\n' [...] Command line error: argument --qf/--queryformat: not allowed with argument -s/--source
On Mon, Nov 22, 2021 at 11:23 PM Matthew Miller mattdm@fedoraproject.org wrote:
On Mon, Nov 22, 2021 at 03:54:16PM -0500, Matthew Miller wrote:
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. :)
And, ugh:
$ dnf repoquery --installed --source --qf '%{name}\n' [...] Command line error: argument --qf/--queryformat: not allowed with argument -s/--source
I think this should do the trick?
$ dnf --disablerepo="*" --enablerepo="*-source" repoquery --queryformat="%{name}"
This assumes a Fedora-like repository split where all source RPMs are in "-source" repositories.
-- 真実はいつも一つ!/ Always, there's only one truth!
On Tue, Nov 23, 2021 at 04:24:11AM -0500, Neal Gompa wrote:
I think this should do the trick?
$ dnf --disablerepo="*" --enablerepo="*-source" repoquery --queryformat="%{name}"
This assumes a Fedora-like repository split where all source RPMs are in "-source" repositories.
Ah but I want installed packages...
On Mon, Nov 22, 2021 at 9:55 PM Matthew Miller mattdm@fedoraproject.org wrote:
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. :)
When in doubt, dnf's repoquery is usually more powerful than rpmquery (even if its arguments are somewhat opaque at times): $ dnf repoquery --installed --qf "%{source_name}" Gives you the list of source package names for all installed packages.
Fabio
On Mon, Nov 22, 2021 at 10:01:14PM +0100, Fabio Valentini wrote:
When in doubt, dnf's repoquery is usually more powerful than rpmquery (even if its arguments are somewhat opaque at times): $ dnf repoquery --installed --qf "%{source_name}" Gives you the list of source package names for all installed packages.
Ah-ha! That's perfect, thanks. Let me add `dnf repoquery --querytags` to my box of tricks!
Thanks!
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
Do not bother with yum or dnf, they pull information from the rpm database and burn cycles on unnecessary metadata updates from updstreams.
On Mon, Nov 22, 2021 at 3:55 PM Matthew Miller mattdm@fedoraproject.org wrote:
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. :)
-- 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.... Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
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.)
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.... Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
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
On Tue, Nov 23, 2021 at 09:43:30AM +0100, Petr Pisar wrote:
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:
IIRC this is now only valid for regular RPMs. RPMs build as part of modularity can have a hyphen in the "stream" part (which is included in the release).
I do not know if we have any actual case, but in theory it is the case.
Pierre
V Tue, Nov 23, 2021 at 09:53:34AM +0100, Pierre-Yves Chibon napsal(a):
On Tue, Nov 23, 2021 at 09:43:30AM +0100, Petr Pisar wrote:
The hyphen separator is forbidden inside release and version parts. Thus the solution is parse the file name from the end. Example:
IIRC this is now only valid for regular RPMs. RPMs build as part of modularity can have a hyphen in the "stream" part (which is included in the release).
I think that contemporary MBS replaces hyphens with underscores.
-- Petr
Am Mo., 22. Nov. 2021 um 21:56 Uhr schrieb Matthew Miller mattdm@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
On Tue, Nov 23, 2021 at 3:37 AM Thomas Moschny thomas.moschny@gmail.com wrote:
Am Mo., 22. Nov. 2021 um 21:56 Uhr schrieb Matthew Miller mattdm@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.
packaging@lists.fedoraproject.org