Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
@
@{
template_dependencies = [
'curl',
'ca-certificates',
'curl',
'dirmngr',
'gnupg2',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
@
@{
template_dependencies = [
'curl',
'ca-certificates',
'curl',
'dirmngr',
'gnupg2',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ FROM $FROM_IMAGE
))@
@{
template_dependencies = [
'ca-certificates',
'curl',
'dirmngr',
'gnupg2',
'lsb-release',
]
# add 'python3-pip' to 'template_dependencies' if pip dependencies are declared
if 'pip3_install' in locals():
Expand All @@ -32,9 +33,7 @@ if 'pip3_install' in locals():
'snippet/setup_ros_sources.Dockerfile.em',
os_name=os_name,
os_code_name=os_code_name,
ros2distro_name='rolling',
rosdistro_name='',
ros_version=ros_version,
ros_distro='rolling',
))@

# setup environment
Expand All @@ -43,7 +42,7 @@ ENV LC_ALL=C.UTF-8

@(TEMPLATE(
'snippet/install_ros_bootstrap_tools.Dockerfile.em',
ros_version=ros_version,
ros_distro='rolling',
))@

@[if 'ros2_repo_packages' in locals()]@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
))@
@{
template_dependencies = [
'ca-certificates',
'cmake',
'curl',
'dirmngr',
'git',
'gnupg2',
'lsb-release',
'wget',
]
# add 'python3-pip' to 'template_dependencies' if pip dependencies are declared
Expand All @@ -42,14 +43,12 @@ if 'pip3_install' in locals():
'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,
ros_distro=ros2distro_name,
))@

@(TEMPLATE(
'snippet/install_ros_bootstrap_tools.Dockerfile.em',
ros_version=ros_version,
ros_distro=ros2distro_name,
))@

# setup environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
))@
@{
template_dependencies = [
'curl',
'ca-certificates',
'curl',
]
# add 'python3-pip' to 'template_dependencies' if pip dependencies are declared
if 'pip3_install' in locals():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ FROM $FROM_IMAGE
))@
@{
template_dependencies = [
'ca-certificates',
'curl',
'dirmngr',
'gnupg2',
'lsb-release',
]
# add 'python3-pip' to 'template_dependencies' if pip dependencies are declared
if 'pip3_install' in locals():
Expand All @@ -32,15 +33,13 @@ if 'pip3_install' in locals():
'snippet/setup_ros_sources.Dockerfile.em',
os_name=os_name,
os_code_name=os_code_name,
ros2distro_name='rolling',
rosdistro_name='',
ros_version=ros_version,
ros_distro='rolling',
testing_repo=True,
))@

@(TEMPLATE(
'snippet/install_ros_bootstrap_tools.Dockerfile.em',
ros_version=ros_version,
ros_distro='rolling',
))@

# setup environment
Expand Down
48 changes: 32 additions & 16 deletions docker_templates/templates/snippet/setup_ros_sources.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ros_version = int(dist_info['distribution_type'][-1])

from docker_templates.eol_distro import isDistroEOL

if isDistroEOL(ros_distro_status=dist_info['distribution_status'], os_distro_name=os_code_name):
is_distro_eol = isDistroEOL(ros_distro_status=dist_info['distribution_status'], os_distro_name=os_code_name)
if is_distro_eol:
repo_url = os.path.join(
'http://snapshots.ros.org',
str(ros_distro),
Expand All @@ -30,27 +31,42 @@ else:
source_suffix = 'testing'
repo_url = f'http://packages.ros.org/ros{apt_suffix}/ubuntu'

# Get the latest tag
r = requests.get('https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest')
tag_name = r.json().get('tag_name')

# Get the latest version and compute the checksum
fetch_url = f"https://github.com/ros-infrastructure/ros-apt-source/releases/download/{tag_name}/ros{apt_suffix}-apt-source_{tag_name}.{os_code_name}_all.deb"
try:
r = requests.get(fetch_url)
hashobj = hashlib.sha256(r.content)
file_256checksum = hashobj.hexdigest()
except Exception as e:
file_256checksum = f"ERROR Failed to compute checksum for {fetch_url} do not accept image. Exception: {e}"

# Temp filename for simplicity of embedding
temp_filename = f"/tmp/ros{apt_suffix}-apt-source.deb"
# Get the latest tag
ros_apt_source_latest = requests.get('https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest')
tag_name = ros_apt_source_latest.json().get('tag_name')

# Get the latest version and compute the checksum
fetch_url = f"https://github.com/ros-infrastructure/ros-apt-source/releases/download/{tag_name}/ros{apt_suffix}-apt-source_{tag_name}.{os_code_name}_all.deb"
try:
ros_apt_source_deb = requests.get(fetch_url)
hashobj = hashlib.sha256(ros_apt_source_deb.content)
file_256checksum = hashobj.hexdigest()
except Exception as e:
file_256checksum = f"ERROR Failed to compute checksum for {fetch_url} do not accept image. Exception: {e}"

# Temp filename for simplicity of embedding
temp_filename = f"/tmp/ros{apt_suffix}-apt-source.deb"
}@

@[if is_distro_eol]@
# setup keys
RUN set -eux; \
key='@(repo_key)'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
mkdir -p /usr/share/keyrings; \
gpg --batch --export "$key" > /usr/share/keyrings/ros@(ros_version)-@(source_suffix)-archive-keyring.gpg; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"

# setup sources.list
RUN echo "deb [ signed-by=/usr/share/keyrings/ros@(ros_version)-@(source_suffix)-archive-keyring.gpg ] @(repo_url) @(os_code_name) main" > /etc/apt/sources.list.d/ros@(ros_version)-@(source_suffix).list
@[else]@
# Setup ROS Apt sources
RUN curl -L -s -o @(temp_filename) @(fetch_url) \
&& echo "@(file_256checksum) @(temp_filename)" | sha256sum --strict --check \
&& apt-get update \
&& apt-get install @(temp_filename) \
&& rm -f @(temp_filename) \
&& rm -rf /var/lib/apt/lists/*
@[end if]@
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
install_requires = [
'empy',
'pyyaml',
'requests',
'rosdistro',
'ros_buildfarm',
]
Expand Down
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[DEFAULT]
Depends: python-argparse, python-collections, python-empy, python-yaml
Depends3: python3-argparse, python3-collections, python3-empy, python3-yaml
Depends3: python3-argparse, python3-collections, python3-empy, python3-requests, python3-yaml
Suite: trusty utopic vivid wily xenial yakkety zesty artful
Setup-Env-Vars: SKIP_PYTHON_MODULES=1