Support dnf5 group list/info in pkg.group_list/group_info (backport of #67975)#69813
Open
ggiesen wants to merge 2 commits into
Open
Support dnf5 group list/info in pkg.group_list/group_info (backport of #67975)#69813ggiesen wants to merge 2 commits into
ggiesen wants to merge 2 commits into
Conversation
…ltstack#67975) Backport of the dnf5 group support from saltstack#67975 to 3006.x, grafted onto the current group functions so the saltstack#60276 multi-word member-group @-fallback is preserved. dnf5 changed the "group list" and "group info" output formats, which the yum/dnf parser did not understand, so the group functions (and pkg.group_installed) returned empty or wrong data on Fedora 41+ and RHEL/AlmaLinux 10. - group_list: parse the dnf5 "group list --hidden" table by tokenizing each row (ID plus the trailing yes/no Installed column) instead of a regex, so a group name that contains or ends in the word "yes"/"no" is not mistaken for the status column, and a row with trailing whitespace is not dropped. - group_info: parse the dnf5 "group info" format, where each package section carries its first member inline after the colon. That inline member is pulled into a dedicated variable rather than mutating the loop's line, blank members are skipped, and section lines are fully stripped on both ends. dnf5 environment and language groups live under a separate "environment" subcommand and are out of scope here, so those keys stay empty on dnf5. Validated end to end against live dnf5 5.4.2.1 on Fedora 44: group_list parses all 157 groups and group_info parses every package with none dropped. Co-authored-by: Greg Oster <oster@fween.ca>
3 tasks
The empty-member guard added in this PR correctly stops a blank line in the dnf/yum "groupinfo" output from being recorded as an empty-string package, so the existing test_group_info expectation no longer includes the leading "" in the gnome-desktop optional list.
twangboy
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Backports the dnf5 group support from #67975 to 3006.x (the oldest supported branch, per the contributing guide), authored by @gregoster. dnf5 changed the
group listandgroup infooutput formats, so on Fedora 41+ and RHEL/AlmaLinux 10pkg.group_list/pkg.group_info(and thereforepkg.group_installed) returned empty or incorrect data -- the underlyingdnf5even rejects the old subcommand:It is grafted onto 3006.x's current group functions rather than cherry-picked, so the #60276 multi-word member-group
@-fallback already present in 3006.x is preserved.It also folds in the three parsing corrections @twangboy raised on #67975:
group_listnow tokenizes each dnf5group list --hiddenrow (the ID plus the trailingyes/noInstalled column) instead of a lazy regex, so a group name that contains or ends in the word "yes"/"no" (e.g.Just (testing) yes) is not mistaken for the status column, and a row with trailing whitespace is no longer dropped.group_infono longer overwrites the loop'slinevariable to carry the dnf5 inline first package; it pulls that member into a dedicated variable, so a header with trailing spaces or localized text cannot blank it out and drop the member..strip().lstrip(string.punctuation).strip()).A blank line inside a section is now skipped rather than recorded as an empty package name.
dnf5 lists environment and language groups under a separate
environmentsubcommand, not undergroup list, so those keys stay empty on dnf5 (the dnf/yum path still fills them). That matches the scope of the original PR, and is noted in a code comment.Validation
Validated end to end against live dnf5 5.4.2.1 on Fedora 44 (podman):
_yum()detects thednf5binary,pkg.group_listparses all 157 groups, andpkg.group_infoparses every package for the sampled groups with none dropped (fordevelopment-tools, 41 parsed == 41 package lines in the rawdnf5 group info). The parser reproduces @gregoster's owntest_67975_dnf5_group_infoexpected output exactly.What issues does this PR fix or reference?
Backports #67975 to 3006.x. Preserves #60276.
Previous Behavior
On dnf5,
pkg.group_list/pkg.group_infofailed to parse the changed output and returned empty or incorrect group data.New Behavior
pkg.group_listandpkg.group_infounderstand the dnf5group list/group infoformats. The yum/dnf path is unchanged.Merge requirements satisfied?
tests/pytests/unit/modules/test_yumpkg.py:test_67975_dnf5_group_info-- dnf5group infoparsing (from @gregoster's test).test_67975_dnf5_group_list-- dnf5group listtable parsing, including a name ending in "yes" and a trailing-whitespace row that a naive regex would drop.test_dnf5_group_info_skips_blank_member_lines-- a blank line in a section is not recorded as an empty package name.Commits signed with GPG?
No