Skip to content

Commit

Permalink
add snippet for setting ros APT repository
Browse files Browse the repository at this point in the history
Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
  • Loading branch information
mikaelarguedas committed Jul 17, 2019
1 parent 98b15d8 commit ab34e66
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
template_dependencies = [
'dirmngr',
'gnupg2',
'lsb-release',
]
}@
@(TEMPLATE(
Expand All @@ -33,11 +32,14 @@ template_dependencies = [
upstream_packages=upstream_packages if 'upstream_packages' in locals() else [],
))@
@
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list
@(TEMPLATE(
'snippet/setup_ros_sources.Dockerfile.em',
os_name=os_name,
os_code_name=os_code_name,
rosdistro_name=rosdistro_name,
ros_version=ros_version,
))@

@(TEMPLATE(
'snippet/install_ros_bootstrap_tools.Dockerfile.em',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
template_dependencies = [
'dirmngr',
'gnupg2',
'lsb-release',
]
# add 'python3-pip' to 'template_dependencies' if pip dependencies are declared
if 'pip3_install' in locals():
Expand All @@ -34,12 +33,15 @@ if 'pip3_install' in locals():
packages=template_dependencies,
upstream_packages=upstream_packages if 'upstream_packages' in locals() else [],
))@
@
# setup ros2 keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup sources.list
RUN echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list
@(TEMPLATE(
'snippet/setup_ros_sources.Dockerfile.em',
os_name=os_name,
os_code_name=os_code_name,
ros2distro_name=ros2distro_name,
rosdistro_name='',
ros_version=ros_version,
))@

@(TEMPLATE(
'snippet/install_ros_bootstrap_tools.Dockerfile.em',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ RUN pip3 install -U \
@[ end if]@
@[end if]@

# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116

# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list
@(TEMPLATE(
'snippet/setup_ros_sources.Dockerfile.em',
os_name=os_name,
os_code_name=os_code_name,
rosdistro_name=rosdistro_name,
ros_version='1',
))@

ENV ROS1_DISTRO @rosdistro_name
ENV ROS2_DISTRO @ros2distro_name
Expand Down
62 changes: 62 additions & 0 deletions docker_templates/templates/snippet/setup_ros_sources.Dockerfile.em
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@{
eol_ros_distros = [
# ROS 1
'boxturtle',
'cturtle',
'diamondback',
'electric',
'fuerte',
'groovy',
'hydro',
'indigo',
'jade',
'lunar',
# ROS 2
'ardent',
]
eol_base_images = [
# Ubuntu
'lucid',
'maverick',
'natty',
'oneiric',
'precise',
'quantal',
'raring',
'saucy',
'trusty',
'utopic',
'vivid',
'wily',
'yakkety',
'zesty',
'artful',
'cosmic',
# Debian
'wheezy',
'jessie',
]

if int(ros_version) == 2:
ros_distro_name = ros2distro_name
if int(ros_version) == 1:
ros_distro_name = rosdistro_name

if os_code_name in eol_base_images or ros_distro_name in eol_ros_distros:
repo_url = 'http://snapshots.ros.org/' + str(ros_distro_name) + '/final/' + str(os_name) + '/'
repo_key = 'AD19BAB3CBF125EA'
source_suffix = 'snpashots'
else:
repo_key = 'C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654'
source_suffix = 'latest'

if int(ros_version) == 1:
repo_url = 'http://packages.ros.org/ros/ubuntu'
elif int(ros_version) == 2:
repo_url = 'http://packages.ros.org/ros2/ubuntu'
}@
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys @(repo_key)

# setup sources.list
RUN echo "deb @(repo_url) @(os_code_name) main" > /etc/apt/sources.list.d/ros@(ros_version)-@(source_suffix).list

0 comments on commit ab34e66

Please sign in to comment.