Different OSes have a different name for ninja binary. In some of them,
it's called "ninja", in others "ninja-build".
Let's allow both in the very same way we already deal with make x gmake
and start using a NINJA environmnet variable instead of always relying
on "ninja".
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
guests/playbooks/build/jobs/meson-build-job.yml | 4 ++--
guests/playbooks/build/jobs/meson-check-job.yml | 2 +-
guests/playbooks/build/jobs/meson-rpm-job.yml | 2 +-
guests/playbooks/update/tasks/paths.yml | 15 +++++++++++++++
guests/playbooks/update/templates/bashrc.j2 | 1 +
jenkins/jobs/meson.yaml | 8 ++++----
6 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/guests/playbooks/build/jobs/meson-build-job.yml
b/guests/playbooks/build/jobs/meson-build-job.yml
index ddb94b6..0f53680 100644
--- a/guests/playbooks/build/jobs/meson-build-job.yml
+++ b/guests/playbooks/build/jobs/meson-build-job.yml
@@ -10,7 +10,7 @@
mkdir build
cd build
meson .. . --prefix=$VIRT_PREFIX {{ meson_args }}
- ninja
- ninja install
+ $NINJA
+ $NINJA install
when:
- inventory_hostname in machines
diff --git a/guests/playbooks/build/jobs/meson-check-job.yml
b/guests/playbooks/build/jobs/meson-check-job.yml
index cf7a740..ac89cb0 100644
--- a/guests/playbooks/build/jobs/meson-check-job.yml
+++ b/guests/playbooks/build/jobs/meson-check-job.yml
@@ -7,7 +7,7 @@
{{ global_env }}
{{ local_env }}
cd build
- if ! ninja test
+ if ! $NINJA test
then
cat meson-logs/testlog.txt || true
exit 1
diff --git a/guests/playbooks/build/jobs/meson-rpm-job.yml
b/guests/playbooks/build/jobs/meson-rpm-job.yml
index f517214..ed75dfc 100644
--- a/guests/playbooks/build/jobs/meson-rpm-job.yml
+++ b/guests/playbooks/build/jobs/meson-rpm-job.yml
@@ -9,7 +9,7 @@
cd build
{{ strip_buildrequires }}
rm -f meson-dist/*.tar.{{ archive_format }}
- ninja dist
+ $NINJA dist
rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta meson-dist/*.tar.{{
archive_format }}
when:
- inventory_hostname in machines
diff --git a/guests/playbooks/update/tasks/paths.yml
b/guests/playbooks/update/tasks/paths.yml
index 08717ba..9aa8840 100644
--- a/guests/playbooks/update/tasks/paths.yml
+++ b/guests/playbooks/update/tasks/paths.yml
@@ -12,6 +12,8 @@
- gmake
- java
- make
+ - ninja
+ - ninja-build
- su
- name: 'Look for files'
@@ -52,3 +54,16 @@
make: '{{ commands["make"] }}'
when:
- make is undefined
+
+# Prefer ninja-build, fall back to ninja
+- name: 'Export paths'
+ set_fact:
+ ninja: '{{ commands["ninja-build"] }}'
+ when:
+ - commands["ninja-build"] != ''
+
+- name: 'Export paths'
+ set_fact:
+ ninja: '{{ commands["ninja"] }}'
+ when:
+ - ninja is undefined
diff --git a/guests/playbooks/update/templates/bashrc.j2
b/guests/playbooks/update/templates/bashrc.j2
index 794398c..d286615 100644
--- a/guests/playbooks/update/templates/bashrc.j2
+++ b/guests/playbooks/update/templates/bashrc.j2
@@ -1,6 +1,7 @@
export PS1="[\u@\h \w]\$ "
export MAKE="{{ make }}"
+export NINJA="{{ ninja }}"
export PYTHON="{{ ansible_python_interpreter }}"
export MAKEFLAGS="-j{{ install_vcpus|int + 1 }}"
diff --git a/jenkins/jobs/meson.yaml b/jenkins/jobs/meson.yaml
index 102d0a4..4d84978 100644
--- a/jenkins/jobs/meson.yaml
+++ b/jenkins/jobs/meson.yaml
@@ -45,8 +45,8 @@
mkdir build
cd build
meson .. . --prefix=$VIRT_PREFIX {meson_args}
- ninja
- ninja install
+ $NINJA
+ $NINJA install
publishers:
- email:
recipients: '{obj:spam}'
@@ -85,7 +85,7 @@
{global_env}
{local_env}
cd build
- if ! ninja test
+ if ! $NINJA test
then
cat meson-logs/testlog.txt || true
exit 1
@@ -130,7 +130,7 @@
cd build
{strip_buildrequires}
rm -f meson-dist/*.tar.{archive_format}
- ninja dist
+ $NINJA dist
rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta
meson-dist/*.tar.{archive_format}
publishers:
- email:
--
2.23.0