conda-forge / conda-smithy

The tool for managing conda-forge feedstocks.
https://conda-forge.org/
BSD 3-Clause "New" or "Revised" License
150 stars 176 forks source link

rerendering readme fails for v1 recipes and c stdlib #2085

Open beckermr opened 14 hours ago

beckermr commented 14 hours ago

I am seeing rerendering errors w/ v1 recipes and c stdlib:

https://github.com/conda-forge/conda-forge-webservices/actions/runs/11281760262/job/31377731285

cc @wolfv

beckermr commented 14 hours ago
Error:   × Failed to parse recipe

Error:   × Parsing: failed to render Jinja expression: undefined value: No stdlib
  │ found for language: c
  │ You should add `c_stdlib` to your variant config file. (in <string>:1)
    ╭─[35:7]
 34 │     - ${{ compiler('c') }}
 35 │     - ${{ stdlib("c") }}
    ·       ─────────┬────────
    ·                ╰─┤ undefined value: No stdlib found for language: c
    ·                  │ You should add `c_stdlib` to your variant config file.
 36 │     - ${{ compiler('cxx') }}
    ╰────

Traceback (most recent call last):
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 2030, in render_readme
    metas = rattler_render(
            ^^^^^^^^^^^^^^^
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/rattler_build_conda_compat/render.py", line 284, in render
    metadata_tuples = render_recipe(
                      ^^^^^^^^^^^^^^
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/rattler_build_conda_compat/render.py", line 247, in render_recipe
    recipes = metadata.render_recipes(variants)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/rattler_build_conda_compat/render.py", line 156, in render_recipes
    raise e
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/rattler_build_conda_compat/render.py", line 148, in render_recipes
    subprocess.run(run_args, check=True, stdout=outfile, env=os.environ)
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['rattler-build', 'build', '--render-only', '--recipe', '/tmp/tmp6ufwlh5b/sourmash-minimal-feedstock/recipe', '--target-platform', 'linux-64', '--build-platform', 'linux-64']' returned non-zero exit status 1.
luizirber commented 14 hours ago

I opened this one in rattler-build https://github.com/prefix-dev/rattler-build/issues/1109

I'm the maintainer for the failing feedstock 😅

beckermr commented 14 hours ago

I think we need guidance on how to convert the conda_build_config.yaml file to a variants.yaml file. in order for it to render properly.

wolfv commented 14 hours ago

I am unsure if this is related to the conda_build_config.yaml file in the repository. It happens when trying to render the README data. The function talks about an "exclusive_config_file". Do you know what that is @beckermr?

The other renders look fine!

wolfv commented 14 hours ago

The problem is that we need any variant file that defines the c_stdlib to something. We could pass the one that fits best the current platform, or a random one etc.

@h-vetinari do you know what conda-build does when the c_stdlib is not defined? Just ignore?

beckermr commented 13 hours ago

I am not sure the rerender here would even work though. Don't you have to convert the conda build config to a variants.yaml @wolfv?

h-vetinari commented 12 hours ago

@h-vetinari do you know what conda-build does when the c_stdlib is not defined? Just ignore?

If the c_stdlib key is not defined, conda-build ends up looking for a c_linux-64 dependency[^1] and falls over.

[^1]: suitably modified for other platforms of course

h-vetinari commented 11 hours ago

The problem is that we need any variant file that defines the c_stdlib to something. We could pass the one that fits best the current platform, or a random one etc.

This is a general problem for the linter. Often we need to introduce stuff like

{% if foo undefined %}
{% set foo = "bar" %}
{% endif %}

in meta.yaml, for the sole reason that the linter does not read any of the variant configs (and would fall over on an undefined value of foo), even if foo is defined in all of them.

I think the only conceptually clean solution would be to run the linter for specific variant configs, e.g. one per target (to avoid an enormous multiplier if there are other build matrix multipliers like python version etc.), e.g. the first of the .ci_support/linux_64_... files when sorted alphabetically (and so on for other platforms). That would still be roughly a factor 6 more linting work though... 😑

beckermr commented 11 hours ago

I'd consult the source code before speculating on a solution and what is or is not currently done. This issue does not involve the linter.

h-vetinari commented 10 hours ago

Sure the rendering (subject of this issue) has nothing to do with the linter. I was talking about a larger point where we run into a very similar situation with the linter w.r.t. the "which variant config to take" question.

wolfv commented 7 hours ago

OK, back to the topic: the problem in that particular recipe was that the skip condition was <py310 which is a variable that we are not defining (and not going to define).

The new syntax is match(python, "<3.10") and with that fixed, things work like a charm. I also verified that the right value from the conda_build_config.yaml is being pulled in.

beckermr commented 1 hour ago

Do we need to add a lint and/or hint for that?