diff --git a/Dockerfile.indigo b/Dockerfile.indigo index 06c40c7c6..1de7513db 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 51b0f788d..e040ba4f8 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 b89ed5ae1..7e38d2475 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