Skip to content

Commit a7cd36f

Browse files
authored
ansible: update gn and ninja for V8 builds (#4233)
Update the versions of `gn` and `ninja` used in the V8 CI for Linux on ppc64le and s390x. Refs: nodejs/node#61681 (comment)
1 parent a54b45c commit a7cd36f

File tree

12 files changed

+128
-35
lines changed

12 files changed

+128
-35
lines changed

ansible/roles/build-test-v8/meta/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# prebuilt binaries for x64 but for ppc64 and s390x we need to compile these
33
# ourselves.
44
dependencies:
5+
- role: ninja-build
6+
when: arch == 'ppc64' or arch == 's390x'
7+
vars:
8+
ninja_dest_dir: "{{ tools_dest_dir }}"
9+
ninja_git_dir: "{{ tools_git_dir }}/ninja"
10+
ninja_user: "{{ tools_user }}"
511
- role: gn
612
when: arch == 'ppc64' or arch == 's390x'
713
vars:

ansible/roles/build-test-v8/tasks/partials/rhel8-ppc64.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
# Install packages for V8 builds.
55
#
66

7-
# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
8-
- name: enable codeready-builder repository
9-
community.general.rhsm_repository:
10-
name: codeready-builder-for-rhel-8-ppc64le-rpms
11-
state: enabled
12-
137
# V8 builds still require Python 2.
148
# rhel_llvm_version and rhel_rust_version from ansible/roles/baselayout/vars/main.yml
159
- name: install packages required to build V8
1610
ansible.builtin.dnf:
17-
name: ['glib2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'ninja-build', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
11+
name: ['glib2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
1812
state: present
1913
notify: package updated
2014

@@ -33,5 +27,5 @@
3327
- name: install dependencies for V8 build tools (Python 3)
3428
ansible.builtin.pip:
3529
executable: pip-3
36-
name: ['filecheck', 'httplib2', 'six']
30+
name: ['filecheck', 'httplib2==0.22.0', 'six']
3731
state: present

ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
# Install packages for V8 builds.
55
#
66

7-
# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
8-
- name: enable codeready-builder repository
9-
community.general.rhsm_repository:
10-
name: codeready-builder-for-rhel-8-s390x-rpms
11-
state: enabled
12-
137
# Older V8 builds still require Python 2.
148
# rhel_llvm_version and rhel_rust_version from ansible/roles/baselayout/vars/main.yml
159
- name: install packages required to build V8
1610
ansible.builtin.dnf:
17-
name: ['GConf2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'ninja-build', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
11+
name: ['GConf2-devel', 'bindgen-cli', 'llvm-toolset-{{rhel_llvm_version}}', 'python2', 'python2-pip', 'rustfmt-{{rhel_rust_version}}']
1812
state: present
1913
notify: package updated
2014

@@ -33,5 +27,5 @@
3327
- name: install dependencies for V8 build tools (Python 3)
3428
ansible.builtin.pip:
3529
executable: pip-3
36-
name: ['filecheck', 'httplib2', 'six']
30+
name: ['filecheck', 'httplib2==0.22.0', 'six']
3731
state: present

ansible/roles/gn/meta/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Building gn requires ninja.
2+
dependencies:
3+
- role: ninja-build
4+
when: arch == 'ppc64' or arch == 's390x'
5+
vars:
6+
ninja_dest_dir: "{{ gn_dest_dir }}"
7+
ninja_git_dir: "{{ tools_git_dir }}/ninja"
8+
ninja_user: "{{ tools_user }}"

ansible/roles/gn/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
ansible.builtin.shell: |
4444
python3 build/gen.py && \
4545
{{ gn_select_compiler }} && \
46-
ninja -C out && \
46+
{{ gn_dest_dir }}/ninja -C out && \
4747
out/gn_unittests
4848
args:
4949
chdir: "{{ gn_git_dir }}"

ansible/roles/gn/tasks/partials/rhel8-ppc64.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

ansible/roles/gn/tasks/partials/rhel8-s390x.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

ansible/roles/gn/vars/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ compiler: {
55
}
66

77
gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}"
8-
gn_version: c0a46c5e8c316010baf1a0eb2d2ee5a86f73e4c2
8+
gn_version: 304bbef6c7e9a86630c12986b99c8654eb7fe648
99

1010
packages: {
11-
'rhel8': 'ninja-build,gcc-toolset-12'
11+
'rhel8': 'gcc-toolset-12'
1212
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
argument_specs:
2+
main:
3+
short_description: The main task for compiling ninja from source.
4+
options:
5+
ninja_dest_dir:
6+
description: The location to place the symlink to the ninja binary.
7+
required: yes
8+
type: "str"
9+
ninja_git_dir:
10+
description: The location to put the git checkout.
11+
required: yes
12+
type: "str"
13+
ninja_user:
14+
default: "{{ server_user|default(omit) }}"
15+
description: The user to install ninja under.
16+
type: "str"
17+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
- name: install ninja 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+
12+
- name: check existing ninja
13+
ansible.builtin.command: "{{ ninja_dest_dir }}/ninja --version"
14+
changed_when: no
15+
failed_when: no
16+
register: ninja_installed_version
17+
18+
# `ninja --version` does not include the 'v' prefix.
19+
- name: check if ninja needs to be rebuilt
20+
ansible.builtin.set_fact:
21+
rebuild_ninja: "{{ not ninja_installed_version.stdout|default('') is search(ninja_version[1:]) }}"
22+
23+
- name: clone/update ninja repository
24+
ansible.builtin.git:
25+
dest: "{{ ninja_git_dir }}"
26+
repo: "{{ ninja_git_repository }}"
27+
version: "{{ ninja_version|default(omit) }}"
28+
become: "{{ ninja_user|default(omit)|bool }}"
29+
become_user: "{{ ninja_user|default(omit) }}"
30+
register: ninja_git
31+
when: rebuild_ninja
32+
33+
- name: clean git checkout
34+
ansible.builtin.shell: git clean -fdX
35+
args:
36+
chdir: "{{ ninja_git_dir }}"
37+
become: "{{ ninja_user|default(omit)|bool }}"
38+
become_user: "{{ ninja_user|default(omit) }}"
39+
when: rebuild_ninja
40+
41+
- name: build ninja
42+
ansible.builtin.shell: |
43+
{{ ninja_select_compiler }} && \
44+
./configure.py --bootstrap
45+
args:
46+
chdir: "{{ ninja_git_dir }}"
47+
become: "{{ ninja_user|default(omit)|bool }}"
48+
become_user: "{{ ninja_user|default(omit) }}"
49+
environment:
50+
CC: gcc
51+
CXX: g++
52+
when: rebuild_ninja
53+
54+
- name: create symlink
55+
ansible.builtin.file:
56+
dest: "{{ ninja_dest_dir }}/ninja"
57+
src: "{{ ninja_git_dir }}/ninja"
58+
state: link
59+
become: "{{ ninja_user|default(omit)|bool }}"
60+
become_user: "{{ ninja_user|default(omit) }}"
61+
when: rebuild_ninja

0 commit comments

Comments
 (0)