feat(overlays): add spec-remove-subpackage overlay#132
Open
reubeno wants to merge 2 commits intomicrosoft:mainfrom
Open
feat(overlays): add spec-remove-subpackage overlay#132reubeno wants to merge 2 commits intomicrosoft:mainfrom
reubeno wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Adds a new overlay type that removes every section in a spec belonging to a given sub-package (its %package preamble plus any %description, %files, %post, %postun, etc. sections targeting it). This avoids having to author one spec-remove-section overlay per section just to drop a single sub-package, and removes the risk of missing scriptlets that upstream may add later. The overlay requires the 'package' field and fails if the spec contains no sections matching the indicated sub-package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new spec-remove-subpackage overlay type to remove an entire RPM sub-package from a spec (its %package preamble plus any sub-package-scoped sections), along with docs, schema updates, and test coverage to validate the behavior.
Changes:
- Extend overlay type enums in the JSON schema and generated schema snapshots to include
spec-remove-subpackage. - Implement
Spec.RemoveSubpackage()and refactor section-removal logic to use shared range-collection helpers. - Wire the new overlay into config validation and overlay application, and add unit tests + documentation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/azldev.schema.json | Adds spec-remove-subpackage to the overlay type enum in the schema. |
| scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap | Updates generated-schema snapshot to include the new overlay type. |
| scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap | Updates container snapshot to include the new overlay type. |
| internal/rpm/spec/edit.go | Refactors removal logic and adds RemoveSubpackage() + shared section range helpers. |
| internal/rpm/spec/edit_test.go | Adds spec-level tests covering sub-package removal and error cases. |
| internal/projectconfig/overlay.go | Adds new overlay type constant, schema enum, validation, and ModifiesSpec inclusion. |
| internal/projectconfig/overlay_test.go | Adds validation tests and updates ModifiesSpec test list. |
| internal/app/azldev/core/sources/overlays.go | Applies the new overlay type by calling RemoveSubpackage(). |
| internal/app/azldev/core/sources/overlays_test.go | Adds integration-style tests for applying the overlay to spec contents. |
| docs/user/reference/config/overlays.md | Documents the new overlay type, usage, and its %if/%endif limitation. |
- collectSectionRanges: add defensive EOF fallback so a section that runs to EOF without a trailing SectionEndTarget is still collected. Today this is unreachable (Visit always emits the trailing SectionEndTarget), but it restores parity with the prior RemoveSection implementation and decouples this helper from a Visit invariant. - RemoveSection: clarify in the doc comment that all matching sections are removed, not just the first. In valid specs the identity pair is unique so this is invisible, but the explicit semantics matter for specs that lexically duplicate a section across mutually-exclusive %if/%else branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Adds a new overlay type that removes every section in a spec belonging to a given sub-package (its %package preamble plus any %description, %files, %post, %postun, etc. sections targeting it). This avoids having to author one spec-remove-section overlay per section just to drop a single sub-package, and removes the risk of missing scriptlets that upstream may add later.
The overlay requires the 'package' field and fails if the spec contains no sections matching the indicated sub-package.
Example:
Resolves #22