feat(pkg list): fall back group to component-group(s) if a binary RPM is not in any package-group#165
feat(pkg list): fall back group to component-group(s) if a binary RPM is not in any package-group#165liunan-ms wants to merge 2 commits into
group to component-group(s) if a binary RPM is not in any package-group#165Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates azldev pkg list group attribution so packages not belonging to any package-group fall back to their resolved component’s component-group(s), and documents the new behavior.
Changes:
- Add component-group fallback (sorted, comma-joined) for the
groupfield when no package-group match exists, including SRPM rows. - Add tests covering fallback behavior and package-group precedence.
- Update CLI help and documentation to describe the new
groupattribution semantics.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/app/azldev/cmds/pkg/list.go | Implements component-group fallback logic via componentGroupLabel, applies it to RPM and SRPM results, and updates help/comments. |
| internal/app/azldev/cmds/pkg/list_test.go | Adds unit tests validating fallback behavior, sorting/determinism, and package-group precedence, including --rpm-file cases. |
| docs/user/reference/cli/azldev_package_list.md | Documents the updated meaning of the group column in CLI reference output. |
| docs/user/how-to/inspect-package-config.md | Updates the Group column description to include the component-group fallback behavior. |
When a binary RPM is not in any package-group, attribute it to the resolved component's component-group(s) (sorted, comma-joined). SRPM rows from --rpm-file and synthesized -debugsource entries get the same attribution. Update Cobra help, the inspect-package-config how-to, and regenerated CLI reference docs. Tests: adds unit tests covering the component-group baseline (single and multi-membership, sort/join), the package-group override, the --rpm-file path (SRPM and binary RPM both attributed to the component-group), and the -debugsource package-group override over the component-group baseline.
ba62ab4 to
ee4dc12
Compare
|
@liunan-ms Is the group actually getting used for anything? Or is it just a diagnostic data point? (I would hope nothing is relying on it for routing correctness.) |
It's metadata surfaced on |
Given that's the case, I'd recommend that we replace 'group' with |
…entGroups' Replace the single Group field on PackageListResult with two independent sorted []string fields: PackageGroups (every package-group whose 'packages' list contains the package; always empty for SRPM rows) and ComponentGroups (every component-group the resolved component belongs to). Both fields are guaranteed non-nil so JSON output is '[]' instead of 'null'. Updates the table output, JSON schema, CLI help, how-to docs, and unit tests accordingly.
| Each result has two independent group lists. 'packageGroups' is every package-group whose | ||
| 'packages' list contains the package (always empty for SRPM rows). 'componentGroups' is | ||
| every component-group the resolved component belongs to. Both lists are sorted alphabetically | ||
| and are emitted as empty arrays (never null) when there are no memberships.`, |
| groupOf := make(map[string]string) | ||
| // Build an index: pkgName → sorted list of package-group names that contain it. | ||
| // Used by '-a', '--rpm-file', and '-p' modes for the [PackageListResult.PackageGroups] | ||
| // list on each result. A package may appear in multiple package-groups; all are reported. |
| // of package-group names whose 'packages' list contains it. A package may appear in any | ||
| // number of package-groups; the returned slice for each package is sorted alphabetically | ||
| // for stable output. Packages with no package-group membership are omitted (a missing key | ||
| // reads as a nil slice, which is the desired empty-list behavior). |
Currently the
groupfield on eachPackageListResultis the name of the package-group that contains the binary package, or "" if the package isn't in any group. After switching to component-based config, it cannot reflect the component group.This pull request improves how the
groupfield is determined. When a binary RPM is not in any package-group, attribute it to the resolved component's component-group(s) (sorted, comma-joined). SRPM rows from--rpm-fileand synthesized debug package entries get the same attribution. Update Cobra help, the inspect-package-config how-to, and regenerated CLI reference docs.Example output of
azldev pkg list --rpm-file <rpm_source_map.json>: