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

Don't check build for circular dependencies when cross compiling #4248

Merged
merged 3 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 10 additions & 4 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,20 @@ def _get_all_dependencies(metadata, envs=('host', 'build', 'run')):
return reqs


def check_circular_dependencies(render_order):
def check_circular_dependencies(render_order, config=None):
if config and config.host_subdir != config.build_subdir:
# When cross compiling build dependencies are already built
# and cannot come from the recipe as subpackages
envs = ('host', 'run')
else:
envs = ('build', 'host', 'run')
pairs = []
for idx, m in enumerate(render_order.values()):
for other_m in list(render_order.values())[idx + 1:]:
if (any(m.name() == dep or dep.startswith(m.name() + ' ')
for dep in _get_all_dependencies(other_m)) and
for dep in _get_all_dependencies(other_m, envs=envs)) and
any(other_m.name() == dep or dep.startswith(other_m.name() + ' ')
for dep in _get_all_dependencies(m))):
for dep in _get_all_dependencies(m, envs=envs))):
pairs.append((m.name(), other_m.name()))
if pairs:
error = "Circular dependencies in recipe: \n"
Expand Down Expand Up @@ -2084,7 +2090,7 @@ def get_output_metadata_set(self, permit_undefined_jinja=False,

# format here is {output_dict: metadata_object}
render_order = toposort(out_metadata_map)
check_circular_dependencies(render_order)
check_circular_dependencies(render_order, config=self.config)
conda_packages = OrderedDict()
non_conda_packages = []

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target_platform:
- linux-32
cross_target_platform:
- linux-32
36 changes: 36 additions & 0 deletions tests/test-recipes/split-packages/_circular_deps_cross/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% set name = "gcc_impl" %}
{% set version = "7.5.0" %}

package:
name: gcc_compilers
version: {{ version }}

build:
number: 0

outputs:
- name: gcc_impl_{{ cross_target_platform }}
requirements:
build:
- gcc_impl_{{ target_platform }} # [build_platform != target_platform]
- gxx_impl_{{ target_platform }} # [build_platform != target_platform]
- gcc_impl_{{ cross_target_platform }} # [build_platform != target_platform]
- gxx_impl_{{ cross_target_platform }} # [build_platform != target_platform]
- sysroot_{{ cross_target_platform }}
host:
- sysroot_{{ cross_target_platform }}
run:
- sysroot_{{ cross_target_platform }}

- name: gxx_impl_{{ cross_target_platform }}
requirements:
build:
- gcc_impl_{{ target_platform }} # [build_platform != target_platform]
- gxx_impl_{{ target_platform }} # [build_platform != target_platform]
- gcc_impl_{{ cross_target_platform }} # [build_platform != target_platform]
- gxx_impl_{{ cross_target_platform }} # [build_platform != target_platform]
- sysroot_{{ cross_target_platform }}
host:
- sysroot_{{ cross_target_platform }}
run:
- sysroot_{{ cross_target_platform }}
6 changes: 6 additions & 0 deletions tests/test_subpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ def test_inherit_build_number(testing_config):
assert int(m.meta['build']['number']) == 1, "build number should have been inherited as '1'"


def test_circular_deps_cross(testing_config):
recipe = os.path.join(subpackage_dir, '_circular_deps_cross')
# check that this does not raise an exception
ms = api.render(recipe, config=testing_config)


@pytest.mark.slow
def test_loops_do_not_remove_earlier_packages(testing_config):
recipe = os.path.join(subpackage_dir, '_xgboost_example')
Expand Down