From 8a6a2216d2657de4500bf83dd200e5f924d6df7c Mon Sep 17 00:00:00 2001 From: Damon Kohler Date: Wed, 14 Jun 2017 14:44:16 +0200 Subject: [PATCH] Adds arg to set cartographer version for docker build. (#376) --- Dockerfile.indigo | 8 ++++---- Dockerfile.kinetic | 8 ++++---- scripts/prepare_catkin_workspace.sh | 12 +++++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Dockerfile.indigo b/Dockerfile.indigo index 06c40c7..1de7513 100644 --- a/Dockerfile.indigo +++ b/Dockerfile.indigo @@ -14,6 +14,8 @@ FROM ros:indigo +ARG CARTOGRAPHER_VERSION=master + # First, we invalidate the entire cache if googlecartographer/cartographer has # changed. This file's content changes whenever master changes. See: # http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone @@ -23,10 +25,8 @@ ADD https://api.github.com/repos/googlecartographer/cartographer/git/refs/heads/ # wstool needs the updated rosinstall file to clone the correct repos. COPY cartographer_ros.rosinstall cartographer_ros/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ -# Remove the contents of the cartographer_ros repo and copy in the updated -# files as necessary. -RUN cartographer_ros/scripts/prepare_catkin_workspace.sh && \ - rm -rf catkin_ws/src/cartographer_ros/* +RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ + cartographer_ros/scripts/prepare_catkin_workspace.sh # rosdep needs the updated package.xml files to install the correct debs. COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/ diff --git a/Dockerfile.kinetic b/Dockerfile.kinetic index 51b0f78..e040ba4 100644 --- a/Dockerfile.kinetic +++ b/Dockerfile.kinetic @@ -14,6 +14,8 @@ FROM ros:kinetic +ARG CARTOGRAPHER_VERSION=master + # Xenial's base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* @@ -26,10 +28,8 @@ ADD https://api.github.com/repos/googlecartographer/cartographer/git/refs/heads/ # wstool needs the updated rosinstall file to clone the correct repos. COPY cartographer_ros.rosinstall cartographer_ros/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ -# Remove the contents of the cartographer_ros repo and copy in the updated -# files as necessary. -RUN cartographer_ros/scripts/prepare_catkin_workspace.sh && \ - rm -rf catkin_ws/src/cartographer_ros/* +RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ + cartographer_ros/scripts/prepare_catkin_workspace.sh # rosdep needs the updated package.xml files to install the correct debs. COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/ diff --git a/scripts/prepare_catkin_workspace.sh b/scripts/prepare_catkin_workspace.sh index b89ed5a..7e38d24 100755 --- a/scripts/prepare_catkin_workspace.sh +++ b/scripts/prepare_catkin_workspace.sh @@ -20,10 +20,12 @@ set -o verbose . /opt/ros/${ROS_DISTRO}/setup.sh # Create a new workspace in 'catkin_ws'. -mkdir catkin_ws -cd catkin_ws -wstool init src +mkdir -p catkin_ws/src +cd catkin_ws/src +wstool init # Merge the cartographer_ros.rosinstall file and fetch code for dependencies. -wstool merge -t src ../cartographer_ros/cartographer_ros.rosinstall -wstool update -t src +wstool merge ../../cartographer_ros/cartographer_ros.rosinstall +wstool set cartographer -v ${CARTOGRAPHER_VERSION} -y +wstool remove cartographer_ros +wstool update