Merge "Change default value for venv_wheel_build_enable"

This commit is contained in:
Zuul 2022-09-24 20:05:32 +00:00 committed by Gerrit Code Review
commit 83998be6b8
2 changed files with 19 additions and 6 deletions

View File

@ -116,7 +116,9 @@ venv_wheels_rebuild: no
# If the package concerned is built from a tarball, rather
# than from a git source or pypi, then this may be best to
# set to false.
venv_wheel_build_enable: "{{ venv_build_host != inventory_hostname }}"
# Default: Enabled when more then 1 host with same arch/distro
# is in play
venv_wheel_build_enable: "{{ _venv_wheel_build_enable }}"
# Set the host where the wheels will be built.
# If this host is not the same as the target host, then

View File

@ -56,17 +56,28 @@ venv_build_targets: |-
{% endfor %}
{{ targets }}
_venv_wheels_first_play_hosts: |
{% set first_hosts = {} %}
_venv_wheels_play_hosts: |
{% set wheel_groups = {} %}
{% for host in ansible_play_hosts %}
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
{% set distro = hostvars[host]['ansible_facts']['distribution_version'] %}
{% set distro_arch = [distro, arch] | join('_') %}
{% if distro_arch not in first_hosts %}
{% set _ = first_hosts.update({distro_arch: host}) %}
{% if distro_arch not in wheel_groups %}
{% set _ = wheel_groups.update({distro_arch: [host]}) %}
{% else %}
{% set _ = wheel_groups[distro_arch].append(host) %}
{% endif %}
{% endfor %}
{{ first_hosts.values() }}
{{ wheel_groups }}
_venv_wheels_first_play_hosts: |
{% set first_hosts = [] %}
{% for distro_arch_hosts in _venv_wheels_play_hosts.values() %}
{% set _ = first_hosts.append(distro_arch_hosts | first) %}
{% endfor %}
{{ first_hosts }}
_venv_wheel_build_enable: "{{ (_venv_wheels_play_hosts[ansible_facts['distribution_version'] ~ '_' ~ ansible_facts['architecture']] | length > 1) | bool }}"
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"