Ask Your Question
2

repoquery format as "dnf list --installed"

asked 2018-05-02 08:21:07 -0600

abitrolly gravatar image

dnf list gives the output like this:

$ dnf list --installed
Installed Packages
CharLS.x86_64                               1.0-16.fc28                 @fedora 
GConf2.x86_64                               3.2.6-20.fc28               @fedora 
GeoIP.x86_64                                1.6.12-3.fc28               @fedora 
GeoIP-GeoLite-data.noarch                   2018.04-1.fc28              @fedora 
...

While dnf repoquery outputs this:

$ dnf repoquery --installed
CharLS-0:1.0-16.fc28.x86_64
GConf2-0:3.2.6-20.fc28.x86_64
GeoIP-0:1.6.12-3.fc28.x86_64
GeoIP-GeoLite-data-0:2018.04-1.fc28.noarch
...

How to use --qf flag for dnf repoquery to get the same nicely formatted output as dnf list?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2018-05-03 10:40:45 -0600

ozeszty gravatar image

updated 2018-05-03 10:44:15 -0600

Looking at http://dnf.readthedocs.io/en/latest/command_ref.html#repoquery-command-label and http://rpm.org/user_doc/query_format.html you need something like:

dnf repoquery --installed --queryformat '%45{name} %{arch}\t%20{evr} %{reponame}'

which will print

CharLS                                        x86_64    1.0-16.fc28          @System
Coin3                                         x86_64    3.1.3-22.fc28        @System
GConf2                                        x86_64    3.2.6-20.fc28        @System
GeoIP                                         x86_64    1.6.12-3.fc28        @System
GeoIP-GeoLite-data                            noarch    2018.04-1.fc28       @System 
edit flag offensive delete link more

Comments

Looks like it is impossible to concatenate %{name} and %{arch} in one column.

abitrolly gravatar imageabitrolly ( 2018-05-03 11:17:41 -0600 )edit

Yeah, at least there's no obvious way (not everything printf can works here). You can work around it by moving %{name}.%{arch} to last "column" or aligning name to the right (with - before 45), but the question is why do you need exact clone of dnf list output? dnf list has some options and can be further limited with package names e.g. dnf list installed geoip*.

ozeszty gravatar imageozeszty ( 2018-05-03 12:39:09 -0600 )edit

Just want to check that getting the exact output is impossible with common formatting tools.Thanks for confirming.

abitrolly gravatar imageabitrolly ( 2018-05-03 22:47:11 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-05-02 08:21:07 -0600

Seen: 413 times

Last updated: May 03 '18