Skip to content

Support dnf5 group list/info in pkg.group_list/group_info (backport of #67975)#69813

Open
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-67975-dnf5-groups-3006
Open

Support dnf5 group list/info in pkg.group_list/group_info (backport of #67975)#69813
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-67975-dnf5-groups-3006

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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 list and group info output formats, so on Fedora 41+ and RHEL/AlmaLinux 10 pkg.group_list / pkg.group_info (and therefore pkg.group_installed) returned empty or incorrect data -- the underlying dnf5 even rejects the old subcommand:

Unknown argument "grouplist" for command "dnf5"

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_list now tokenizes each dnf5 group list --hidden row (the ID plus the trailing yes/no Installed 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_info no longer overwrites the loop's line variable 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.
  • Section lines are fully stripped on both ends (.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 environment subcommand, not under group 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 the dnf5 binary, pkg.group_list parses all 157 groups, and pkg.group_info parses every package for the sampled groups with none dropped (for development-tools, 41 parsed == 41 package lines in the raw dnf5 group info). The parser reproduces @gregoster's own test_67975_dnf5_group_info expected 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_info failed to parse the changed output and returned empty or incorrect group data.

New Behavior

pkg.group_list and pkg.group_info understand the dnf5 group list / group info formats. The yum/dnf path is unchanged.

Merge requirements satisfied?

  • Docs
  • Changelog
  • Tests written/updated

tests/pytests/unit/modules/test_yumpkg.py:

  • test_67975_dnf5_group_info -- dnf5 group info parsing (from @gregoster's test).
  • test_67975_dnf5_group_list -- dnf5 group list table 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

…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>
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants