Support pkg removal in variant with -name syntax - #1402
Open
jrray wants to merge 4 commits into
Open
Conversation
Confirm that a variant entry like { foo: "" } — a valid package
name with an empty value — is treated as a new package requirement
(not a var) when the key is absent from build.options.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: J Robert Ray <jrray@imageworks.com>
A variant entry like `{ "-foo": "" }` removes the package option
named `foo` from the build environment for that variant, even if
`foo` appears in `build.options`. The leading `-` is stripped and
the remainder is validated as a package name; invalid names produce
an error at parse time.
The removal is exposed via a new `Variant::removed_requirements()`
trait method (default: empty). `opts_for_variant` in both
`BuildSpec` and `RecipeBuildSpec` now filter out removed options
before returning the opt list.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: J Robert Ray <jrray@imageworks.com>
Document the new variant key syntax that removes a package request inherited from build.options for a single variant. Add examples to both the user guide and the v0 API reference next to existing variant option patterns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: J Robert Ray <jrray@imageworks.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Allow variant entries prefixed with '-' to remove any existing
build option from build.options, not only package options.
This enables disabling var requests with keys like
{ "-debug": "" }.
Update variant parsing to validate removal keys as option names,
add test coverage for var removal, and update user/reference docs
with examples that remove both pkg and var options.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: J Robert Ray <jrray@imageworks.com>
Collaborator
Author
|
@rydrman does this pass the smell test for you? We have a use case where a package has a lot of variants and the owner wants to remove a package dependency from one of the variants. This feature makes doing this less error-prone because the removal is explicit in the one variant and it is less likely that you forget to add the dependency back in any new variants or cut-and-paste a variant without realizing you've copied a variant that is missing a dependency you wanted. |
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.
Variants can now remove inherited requests from build.options by prefixing the variant key with '-'. For example, { "-foo": "" } drops a package request and { "-debug": "" } drops a var request for that variant while leaving other variants unchanged.
This also keeps variant-specific additions working as before, including unconstrained package requests like { new-dep: "" }.
Implementation details: