Skip to content

How to reference relative to $PREFIX in license_file? #1521

@mfansler

Description

@mfansler

In Conda Forge R recipes, we follow a standard practice of capturing a copy of the shared license file found in r-base. For example, in schema v0, if an R package has License: MIT + file LICENSE then we translate this to:

about:
  license: MIT
  license_family: MIT
  license_file: 
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/MIT
    - LICENSE

where LICENSE is found in the source directory (included in original tarball).

Error Observed

We now have some recipes attempting to use the new v1 schema, but it is unclear how to translate the {{ environ["PREFIX"] }}. For example, on r-easy.utils PR, trying the translating according to #260, we have

Syntax

- ${{ env.get("PREFIX") }}/lib/R/share/licenses/MIT

Result

2025-03-28T17:36:22.8752900Z Adding in variants from /opt/conda/conda_build_config.yaml
2025-03-28T17:36:22.8756439Z Adding in variants from /home/conda/staged-recipes-copy/.ci_support/linux64.yaml
2025-03-28T17:36:22.9167221Z 
2025-03-28T17:36:22.9170697Z  ╭─ Finding outputs from recipe
2025-03-28T17:36:22.9172446Z  │ Loading variant config file: "/tmp/tmp32hrtiq5"
2025-03-28T17:36:22.9277483Z  │
2025-03-28T17:36:22.9280300Z  ╰─────────────────── (took 0 seconds)
2025-03-28T17:36:22.9285709Z Error:   × Failed to parse recipe
2025-03-28T17:36:22.9288071Z 
2025-03-28T17:36:22.9288350Z Error: 
2025-03-28T17:36:22.9288772Z   × failed to render Jinja expression: invalid operation: Environment variable
2025-03-28T17:36:22.9289177Z   │ PREFIX not found (in <string>:1)
2025-03-28T17:36:22.9289578Z     ╭─[staged-recipes-copy/recipes/r-easy.utils/recipe.yaml:53:7]
2025-03-28T17:36:22.9289899Z  52 │   license_file:
2025-03-28T17:36:22.9290235Z  53 │     - ${{ env.get("PREFIX") }}/lib/R/share/licenses/MIT
2025-03-28T17:36:22.9290642Z     ·       ────────────────────────┬────────────────────────
2025-03-28T17:36:22.9291041Z     ·                               ╰── invalid operation: Environment variable PREFIX not found
2025-03-28T17:36:22.9291595Z  54 │     - LICENSE
2025-03-28T17:36:22.9291837Z     ╰────

Possibly Related

Maybe related to #1439, which observed PREFIX as undefined.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions