From 8b260ac27fab9dcbc0b7dc1a0717ba7ee9938ba8 Mon Sep 17 00:00:00 2001 From: Manato Hirabayashi <3022416+manato@users.noreply.github.com> Date: Wed, 28 Jun 2023 17:52:29 +0900 Subject: [PATCH] feat(andible): add conditions to skip building libraries if working directories exist (#32) * feat: add conditions to skip building libraries if working directories exist Signed-off-by: Manato HIRABAYASHI * style(pre-commit): autofix --------- Signed-off-by: Manato HIRABAYASHI Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Akihito Ohsato --- ansible/roles/ros2/tasks/main.yaml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 00bac52..bcf68f2 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -87,6 +87,11 @@ path: "{{ source_build_dir }}" state: directory +- name: Check Boost build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/boost_1_74_0" + register: boost_build_dir_exist + - name: Build and install Boost block: - name: "{{ block_name }}: Download and extract source" @@ -101,6 +106,12 @@ become: true vars: block_name: Boost + when: not boost_build_dir_exist.stat.exists + +- name: Check PCL build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/pcl" + register: pcl_build_dir_exist - name: Build and install PCL block: @@ -128,6 +139,12 @@ become: true vars: block_name: PCL + when: not pcl_build_dir_exist.stat.exists + +- name: Check fmt build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/fmt-8.1.1" + register: fmt_build_dir_exist - name: Build and install fmt block: @@ -153,6 +170,12 @@ become: true vars: block_name: fmt + when: not fmt_build_dir_exist.stat.exists + +- name: Check Range-v3 build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/range-v3" + register: range_v3_build_dir_exist - name: Build and install Range-v3 block: @@ -179,6 +202,12 @@ become: true vars: block_name: Range-v3 + when: not range_v3_build_dir_exist.stat.exists + +- name: Check OpenCV build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/jetson-containers" + register: opencv_build_dir_exist - name: Build and install OpenCV block: @@ -199,6 +228,12 @@ become: true vars: block_name: OpenCV + when: not opencv_build_dir_exist.stat.exists + +- name: Check YAML build directory existence + ansible.builtin.stat: + path: "{{ source_build_dir }}/yaml-cpp" + register: yaml_cpp_build_dir_exist - name: Build and install YAML block: @@ -224,6 +259,7 @@ become: true vars: block_name: YAML + when: not yaml_cpp_build_dir_exist.stat.exists - name: Upgrade CMake block: @@ -281,6 +317,11 @@ vars: block_name: update GCC +- name: Check ROS build directory existence + ansible.builtin.stat: + path: /opt/ros/{{ ros_distro }} + register: ros_build_dir_exist + - name: Build ROS block: - set_fact: @@ -385,6 +426,7 @@ become: true vars: block_name: Build ROS + when: not ros_build_dir_exist.stat.exists - name: Downgrade GCC as version 11 is too high for old CUDA version that is used in L4T block: @@ -415,3 +457,4 @@ marker: "# {mark} ros2" block: | source {{ ros_base_dir }}/install/setup.bash + when: not ros_build_dir_exist.stat.exists