Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if parsed and raw outputs mismatch #5601

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,15 @@ def extract_single_output_text(
if not outputs:
outputs = [{"name": self.name()}]

if len(output_matches) != len(outputs):
# See https://github.com/conda/conda-build/issues/5571
utils.get_logger(__name__).warning(
"Number of parsed outputs does not match detected raw metadata blocks. "
"Identified output block may be wrong! "
"If you are using Jinja conditionals to include or exclude outputs, "
"consider using `skip: true # [condition]` instead."
)

try:
if output_type:
output_tuples = [
Expand All @@ -2250,7 +2259,8 @@ def extract_single_output_text(
except ValueError:
if not self.path and self.meta.get("extra", {}).get("parent_recipe"):
utils.get_logger(__name__).warning(
f"Didn't match any output in raw metadata. Target value was: {output_name}"
"Didn't match any output in raw metadata. Target value was: %s",
output_name,
)
output = ""
else:
Expand Down
19 changes: 19 additions & 0 deletions news/5601-warn-mismatches
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Warn about parsed and raw output block mismatches. This can cause issues with custom build strings, among others. The recommendation is to avoid Jinja flow control to build the output list. Use `skip: true` as necessary. (#5571 via #5601)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Loading