From 158ef2dbf1f38843d501e1ecbbaf2fc7f01fa70e Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 21 Nov 2023 10:22:01 +0100 Subject: [PATCH] Use distribution_major_version for all distros except Ubuntu That is a follow-up patch for Rocky, that as EL derivative also follows naming convention, where distribution_version contains also minor version, while we need to build only against major versions of distros. With that the only distro we need to use distro version for is Ubuntu. Change-Id: I62f69bc31ed04ab65a167d07de44067fcaa74a66 --- vars/main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vars/main.yml b/vars/main.yml index 3d2f1bb..1e89670 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -46,10 +46,10 @@ venv_build_targets: |- {% set targets = {} %} {% for item in ((groups[venv_build_group] | default([])) | reverse) %} {% set distro = (hostvars[item]['ansible_facts']['distribution'] | lower) | replace(' ', '_') %} - {% if distro == 'debian' or distro == 'centos' %} - {% set distro_ver = hostvars[item]['ansible_facts']['distribution_major_version'] %} - {% else %} + {% if distro == 'ubuntu' %} {% set distro_ver = hostvars[item]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %} + {% else %} + {% set distro_ver = hostvars[item]['ansible_facts']['distribution_major_version'] %} {% endif %} {% set arch = hostvars[item]['ansible_facts']['architecture'] %} {% set distro_arch = [distro, distro_ver, arch] | join('-') %} @@ -64,10 +64,10 @@ _venv_wheels_play_hosts: |- {% for host in ansible_play_hosts %} {% set arch = hostvars[host]['ansible_facts']['architecture'] %} {% set distro = (hostvars[host]['ansible_facts']['distribution'] | lower) | replace(' ', '_') %} - {% if distro == 'debian' or distro == 'centos' %} - {% set distro_ver = hostvars[host]['ansible_facts']['distribution_major_version'] %} - {% else %} + {% if distro == 'ubuntu' %} {% set distro_ver = hostvars[host]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %} + {% else %} + {% set distro_ver = hostvars[host]['ansible_facts']['distribution_major_version'] %} {% endif %} {% set distro_arch = [distro, distro_ver, arch] | join('-') %} {% if distro_arch not in wheel_groups %} @@ -89,9 +89,9 @@ _venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | _venv_build_dist: >- - {{ (ansible_facts['distribution'] | lower == 'debian' or ansible_facts['distribution'] | lower == 'centos') | ternary( - ansible_facts['distribution_major_version'], - ansible_facts['distribution_version'].split('.')[:2] | join('.') + {{ (ansible_facts['distribution'] | lower == 'ubuntu') | ternary( + ansible_facts['distribution_version'].split('.')[:2] | join('.'), + ansible_facts['distribution_major_version'] ) }} _venv_build_dist_arch: >-