Skip to content

Commit 89debe9

Browse files
authored
ansible: fix build dependencies for gn role (#4060)
Install dependencies needed to build `gn` before attempting to build it. Fixes: #4059
1 parent f7351b2 commit 89debe9

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

ansible/roles/gn/tasks/main.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
- name: install gn build dependencies
2+
include_tasks: "{{ v8deps_include }}"
3+
loop_control:
4+
loop_var: v8deps_include
5+
with_first_found:
6+
- files:
7+
- "{{ role_path }}/tasks/partials/{{ os }}-{{ arch }}.yml"
8+
- "{{ role_path }}/tasks/partials/{{ os }}.yml"
9+
- "{{ role_path }}/tasks/partials/{{ os|stripversion }}.yml"
10+
skip: true
11+
112
- name: check existing gn
213
ansible.builtin.command: "{{ gn_dest_dir }}/gn --version"
314
changed_when: no
@@ -19,13 +30,12 @@
1930
ansible.builtin.set_fact:
2031
rebuild_gn: "{{ not gn_installed_version.stdout|default('') is search(gn_git.after[:7]) }}"
2132

22-
# Requires a C++17 compiler. At the moment we're only building on CentOS/RHEL
23-
# so have devtoolset-8 available.
33+
# Requires a C++17 compiler.
2434
- name: build gn
2535
ansible.builtin.shell: |
2636
python3 build/gen.py && \
2737
{{ gn_select_compiler }} && \
28-
{{ gn_dest_dir }}/ninja -C out && \
38+
ninja -C out && \
2939
out/gn_unittests
3040
args:
3141
chdir: "{{ gn_git_dir }}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
2+
- name: enable codeready-builder repository
3+
community.general.rhsm_repository:
4+
name: codeready-builder-for-rhel-8-ppc64le-rpms
5+
state: enabled
6+
7+
- name: run common RHEL 8 tasks
8+
ansible.builtin.include_tasks: rhel8.yml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
2+
- name: enable codeready-builder repository
3+
community.general.rhsm_repository:
4+
name: codeready-builder-for-rhel-8-s390x-rpms
5+
state: enabled
6+
7+
- name: run common RHEL 8 tasks
8+
ansible.builtin.include_tasks: rhel8.yml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# Install gn build dependencies for RHEL 8
3+
4+
- name: install gn build dependencies for {{ os }}-{{ arch }}
5+
package:
6+
name: "{{ package }}"
7+
state: present
8+
use: dnf
9+
loop_control:
10+
loop_var: package
11+
notify: package updated
12+
with_items:
13+
# ansible doesn't like empty lists
14+
- "{{ packages[os+'_'+arch]|default('[]') }}"
15+
- "{{ packages[os]|default('[]') }}"
16+
- "{{ packages[os|stripversion]|default('[]') }}"

ansible/roles/gn/vars/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22

33
compiler: {
4-
'rhel7': '. /opt/rh/devtoolset-8/enable',
5-
'rhel8': '. /opt/rh/gcc-toolset-11/enable'
4+
'rhel8': '. /opt/rh/gcc-toolset-12/enable'
65
}
76

87
gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}"
98
gn_version: 88e8054
9+
10+
packages: {
11+
'rhel8': 'ninja-build,gcc-toolset-12'
12+
}

0 commit comments

Comments
 (0)