conda / conda-build

Commands and tools for building conda packages
https://docs.conda.io/projects/conda-build/
Other
379 stars 420 forks source link

REGR: conda-build 24.7.1 fails on key in `conda_build_config.yaml` that's conditionally defined #5443

Closed h-vetinari closed 4 days ago

h-vetinari commented 1 month ago

As of conda-build 24.7.1, it became impossible to (re)render the recipe for one of our main compiler feedstocks in conda-forge (as of https://github.com/conda-forge/clang-compiler-activation-feedstock/commit/0bf5cc94f372c80ec88840af5f99320e67bbae1b) with an error:

  File "E:\miniforge\envs\builder\Lib\site-packages\conda_smithy\configure_feedstock.py", line 885, in _conda_build_api_render_for_smithy
    metadata_tuples = render_recipe(
                      ^^^^^^^^^^^^^^
  File "E:\miniforge\envs\builder\Lib\site-packages\conda_build\render.py", line 994, in render_recipe
    return distribute_variants(
           ^^^^^^^^^^^^^^^^^^^^
  File "E:\miniforge\envs\builder\Lib\site-packages\conda_build\render.py", line 883, in distribute_variants
    mv.parse_until_resolved(
  File "E:\miniforge\envs\builder\Lib\site-packages\conda_build\metadata.py", line 1364, in parse_until_resolved
    self.parse_again(
  File "E:\miniforge\envs\builder\Lib\site-packages\conda_build\metadata.py", line 1273, in parse_again
    self._get_contents(
  File "E:\miniforge\envs\builder\Lib\site-packages\conda_build\metadata.py", line 2020, in _get_contents
    raise CondaBuildUserError(
conda_build.exceptions.CondaBuildUserError: Failed to render jinja template in E:\conda-forge\clang-compiler-activation-feedstock\recipe\meta.yaml:
'CBUILD' is undefined

If I comment out the use of {{ CBUILD }} in meta.yaml, it's possible to render again, so there's some relationship to that particular key. However, renames of that key (+ usage sites) to C_BUILD, CBUILDD, DBUILD, CBALD or cbuild still failed in the same way, so I don't know what particular combination of factors triggers this.

h-vetinari commented 3 weeks ago

As it turns out, this could be solved by

{% if CBUILD is not defined %}
{% set CBUILD = "dummy" %}
{% endif %}

That's still weird because CBUILD should be specified for all relevant platforms (and it wasn't necessary before).

jakirkham commented 3 weeks ago

Think this would be addressed by PR: https://github.com/conda/conda-build/pull/5458

h-vetinari commented 3 weeks ago

Thanks @jakirkham, that sounds like exactly the same problem indeed

beeankha commented 4 days ago

Closing this issue since https://github.com/conda/conda-build/pull/5458 has been merged! This change will be included in the upcoming 24.9.x release.