RFC: Add XML output option to 'dnf5 advisories list' #1524
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add an option to output the list of applicable advisories in the same XML format as the updateinfo.xml file in the repository.
This allows tooling to have a consistent machine readable format for getting what advisories apply to a system. Resorting to parsing text output of commands is (naturally) error prone, and designed for humans to look at rather than machines.
Alternatives for these tools include using the APIs of dnf/yum/other-rpm-package-manager, and keeping up with their evolution. For tooling that supports a wide range of distributions and versions, this can become rather onerous, especially across the many different security/patch management products.
With a documented format, we can help these tools get the correct information both on available updates, and what ones are applicable to particular systems. Using the same format these tools need to be able to parse already avoids the need to get multiple parsers correct.
One issue I have with this code is that the user needs to pass
-q
todnf5
in order to get valid XML onstdout
. Even with that, sometimes you getFedora 40 openh264 (From Cisco) - aarc 100% | 3.1 KiB/s | 990.0 B | 00m00s
and similar. Hints on how to avoid this are welcome - I'd prefer to not have to go via a file on disk.I dislike the
--xml-output
option name, perhaps a--format=[xml|text|morse-code]
? Suggestions welcome.I'd like feedback on if this should be part of core
dnf5
or a plugin. Being part of the core command does mean that third party tools can start relying on it being there rather than needing to also parse text output forever as well.#1523 is related, as it starts documenting the
updateinfo.xml
format.I also intend to backport to https://github.com/rpm-software-management/dnf so this functionality can be added to existing distributions, but wanted feedback here first.
Sample output of
./dnf5/dnf5 -q advisory list --xml-output
on Fedora 40:advisory-list.xml.txt