Skip to content

feat(overlays): add spec-remove-subpackage overlay#132

Merged
reubeno merged 1 commit into
microsoft:mainfrom
reubeno:remove-subpackage-overlay
May 1, 2026
Merged

feat(overlays): add spec-remove-subpackage overlay#132
reubeno merged 1 commit into
microsoft:mainfrom
reubeno:remove-subpackage-overlay

Conversation

@reubeno

@reubeno reubeno commented Apr 29, 2026

Copy link
Copy Markdown
Member

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:

[[components.mypackage.overlays]]
type = "spec-remove-subpackage"
package = "gui"
description = "Drop the gui sub-package; not shipped in Azure Linux"

Resolves #22

Copilot AI review requested due to automatic review settings April 29, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/rpm/spec/edit.go
Comment thread internal/rpm/spec/edit.go

@Tonisal-byte Tonisal-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@liunan-ms

Copy link
Copy Markdown
Contributor

Looks good to me. Verified by running azldev comp render -p <package-name> with a spec-remove-subpackage overlay

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>
Copilot AI review requested due to automatic review settings May 1, 2026 16:55
@reubeno
reubeno force-pushed the remove-subpackage-overlay branch from 6cd0416 to f51a8b9 Compare May 1, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@reubeno
reubeno merged commit e2b6359 into microsoft:main May 1, 2026
19 checks passed
@reubeno
reubeno deleted the remove-subpackage-overlay branch May 1, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

need a way to completely disable/remove entire subpackages

4 participants