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

Add an option to export build time dependencies as run_constrained keys and pin strictly #2404

Closed
183amir opened this issue Sep 26, 2017 · 3 comments · Fixed by #2715
Closed
Labels
locked [bot] locked due to inactivity

Comments

@183amir
Copy link
Contributor

183amir commented Sep 26, 2017

Following the discussion here: #2001 (comment), I am proposing to add the following feature to conda build.
Currently, there is an option in conda build recipes which allows you to pin all the packages that were used during build time as runtime dependencies. See original pull request here: #741

For example a recipe like:

package:
  name: bob-devel

build:
  pin_depends: strict

requirements:
  run:
    - curl 7.52.1

will have the following index.json

{
  "depends": [
    "curl 7.52.1 0",
    "openssl 1.0.2l 0",
    "zlib 1.2.8 3",
  ],
  "name": "bob-devel",
}

where openssl and zlib are dependencies of curl. Note that everything is pinned strictly and normally dependencies of zlib and openssl get pinned strictly too but I did not put it in the example above.

I propose a very similar functionality to be added for run_constrained keys as well.
For example for the following recipe:

package:
  name: bob-devel

build:
  pin_constrains: strict

run_constrained:
  - curl 7.52.1

we get this:

{
  "constrains": [
    "curl 7.52.1 0",
    "openssl 1.0.2l 0",
    "zlib 1.2.8 3",
  ],
  "name": "bob-devel",
}
@183amir
Copy link
Contributor Author

183amir commented Feb 27, 2018

I was thinking maybe instead of this, we can have a jinja function to help me do this. Something like:

package:
  name: bob-devel
  version: 2018.02.21

requirements:
  host:
    - curl 7.55.1
  run_constrained:
  {% for package in packages('host', all=True) %}
    - {{ pin_compatible(package, exact=True) }}
  {% endfor %}

Would render to:

package:
    name: bob-devel
    version: 2018.02.21
requirements:
    host:
        - ca-certificates 2017.08.26 h1d4fec5_0
        - libgcc-ng 7.2.0 h7cc24e2_2
        - openssl 1.0.2n hb7f436b_0
        - curl 7.55.1 h78862de_4
        - libssh2 1.8.0 h9cfc8f7_4
        - zlib 1.2.11 ha838bed_2
    run_constrained:
        - ca-certificates 2017.08.26 h1d4fec5_0
        - libgcc-ng 7.2.0 h7cc24e2_2
        - openssl 1.0.2n hb7f436b_0
        - curl 7.55.1 h78862de_4
        - libssh2 1.8.0 h9cfc8f7_4
        - zlib 1.2.11 ha838bed_2

@msarahan
Copy link
Contributor

For that, you'd need to add a new jinja2 function to the context. See these two bits to see how pin_compatible works:

https://github.com/conda/conda-build/blob/master/conda_build/jinja_context.py#L192
https://github.com/conda/conda-build/blob/master/conda_build/jinja_context.py#L454

If you put up a PR, I can help on it. Otherwise, this can go in the backlog, and I'm not sure when I'll get to it.

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants