`dnf data` generic export interface

It is kind of hard to memorize all the query commands dnf accrued over time. Because it is a command line tool, the underlying data model is not really clear, so what do you think about this interface to export the data from dnf for external processing?

$ dnf data
usage: dnf data [command]

   table     operate with data tables
   tables    list available data tables

$ dnf data tables

$ dnf data table
usage: dnf data table [options] <table> [columns]

$ dnf data table updates
name | old | new
dnf  | 1.0 | 1.1

$ dnf data table --csv updates name,new
1 Like

I don’t memorise them at all usually. I just pull up the man page and search it to see what I need:

$ apropos dnf
debuginfo-install (1) - redirecting to DNF debuginfo-install Plugin
dnf (8)              - DNF Command Reference
dnf-builddep (8)     - DNF builddep Plugin
dnf-changelog (8)    - DNF changelog Plugin
dnf-config-manager (8) - DNF config-manager Plugin
dnf-copr (8)         - DNF copr Plugin
dnf-debug (8)        - DNF debug Plugin
dnf-debuginfo-install (8) - DNF debuginfo-install Plugin
dnf-download (8)     - DNF download Plugin
dnf-generate_completion_cache (8) - DNF generate_completion_cache Plugin
dnf-groups-manager (8) - DNF groups-manager Plugin
dnf-needs-restarting (8) - DNF needs_restarting Plugin
dnf-offline-distrosync (8) - DNF system-upgrade Plugin
dnf-offline-upgrade (8) - DNF system-upgrade Plugin
dnf-repoclosure (8)  - DNF repoclosure Plugin
dnf-repodiff (8)     - DNF repodiff Plugin
dnf-repograph (8)    - DNF repograph Plugin
dnf-repomanage (8)   - DNF repomanage Plugin
dnf-reposync (8)     - DNF reposync Plugin
dnf-rpmconf (8)      - DNF rpmconf Plugin
dnf-system-upgrade (8) - DNF system-upgrade Plugin
dnf-tracer (8)       - DNF tracer Plugin
dnf-transaction-json (5) - DNF Stored Transaction JSON
dnf-utils (1)        - classic YUM utilities implemented as CLI shims on top of DNF
dnf-versionlock (8)  - DNF versionlock Plugin
dnf.conf (5)         - DNF Configuration Reference
dnf.modularity (7)   - Modularity in DNF
find-repos-of-install (1) - classic YUM utilities implemented as CLI shims on top of DNF
needs-restarting (1) - redirecting to DNF needs-restarting Plugin
repo-graph (1)       - redirecting to DNF repograph Plugin
repoclosure (1)      - redirecting to DNF repoclosure Plugin
repodiff (1)         - redirecting to DNF repodiff Plugin
repomanage (1)       - redirecting to DNF repomanage Plugin
repoquery (1)        - classic YUM utilities implemented as CLI shims on top of DNF
reposync (1)         - redirecting to DNF reposync Plugin
repotrack (1)        - classic YUM utilities implemented as CLI shims on top of DNF
yum-builddep (1)     - redirecting to DNF builddep Plugin
yum-changelog (1)    - redirecting to DNF changelog Plugin
yum-config-manager (1) - redirecting to DNF config-manager Plugin
yum-copr (8)         - redirecting to DNF copr Plugin
yum-debug-dump (1)   - redirecting to DNF debug Plugin
yum-debug-restore (1) - redirecting to DNF debug Plugin
yum-groups-manager (1) - redirecting to DNF groups-manager Plugin
yum-utils (1)        - classic YUM utilities implemented as CLI shims on top of DNF
yum-versionlock (8)  - redirecting to DNF versionlock Plugin
yum-versionlock.conf (5) - redirecting to DNF versionlock Plugin
yum2dnf (8)          - Changes in DNF compared to YUM
yumdownloader (1)    - redirecting to DNF download Plugin

and then, whatever man page I think is needed:

man repoquery

What use case is the export interface meant to address?

An easy way to getting raw data about updates and info about installed packages. docs/DNF-API.md · master · Anatoli Babenia / dnf-go-gui · GitLab

dnf only knows about update versions, not about all the other bits that live on Bodhi. So, you’ll also need to incorporate that. Here’s an example:

I’m quite happy to use the different tools to get the info I need, but yeh, if you want one tool to do it all, feel free to write it :slight_smile:

dnfdragora may be worth looking at to see which of your use cases it already serves?

And what are those bits?

dnf data will allow to introspect what dnf doesn’t know. Right now figuring this out is a way too much complicated and time consuming. Need either to ask here or scan through entire man.

Ah, I see… this is an update of Programmatically get update list, yeah?

Have you looked at using libdnf instead of the dnf plugin API?

Yes, still not solved that one. I don’t know how to uselibdnf from Go.

Information about updates, karma, comments, and so on. There are tools that use the API:

I didn’t think about that in the “social” context of dnf. For the start, just a generic interface to dump its internal database and dynamic “views” would be fine. If dnf will learn how to access bodhi data for whatever purpose, the interface can be used to explore that as well.

Generic export interface also helps to automatically figure out data structure changes between versions.