Skip to content

Add JSON output to dnf check-upgrade command #2481

@erffy

Description

@erffy

Currently, dnf check-update produces output that is complex and difficult to parse programmatically. For example:

dnf check-update --refresh -yq | tail -n +2 | grep -E 'x86_64|i686|noarch|aarch64' | awk '{print $1, $2}'

This produces output like:

<package>.<arch> <new version>.<fedora version>

The output often includes extra information and requires multiple filtering and formatting steps to make it usable in scripts.

By comparison, apt list --upgradable produces structured and consistent output:

<package>/<repo> <new version> <arch> [upgradable from: <old version>]

Proposed improvement

Add an option (e.g., --simple-output or --upgradable) for dnf check-update that outputs only:

  • Package name
  • Old version
  • New version

For example:

<package name> <old version> => <new version>

This should be consistent and machine-readable, similar to Pacman’s output, making it much easier to parse for automation and scripting.

Additional notes

  • dnf5 already supports JSON output for some commands. Extending this feature to check-update would be a natural fit.
  • A simple flag like --upgradable or --simple-output would significantly improve usability for developers and maintainers of automated tools.

Also I'm using Arch Linux, I requesting this feature because I'm maintaining a project, see zig-waybar-contrib. This will be good if added.

Metadata

Metadata

Assignees

Labels

Priority: LOWRFERequest For Enhancement (as opposed to a bug)TriagedSomeone on the DNF 5 team has read the issue and determined the next steps to take

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions