Skip to content

Commit

Permalink
Adds arg to set cartographer version for docker build. (ros#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
damonkohler authored Jun 14, 2017
1 parent 8140946 commit 8a6a221
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Dockerfile.indigo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.kinetic
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand All @@ -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/
Expand Down
12 changes: 7 additions & 5 deletions scripts/prepare_catkin_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8a6a221

Please sign in to comment.