Skip to content

Commit

Permalink
Update to validate detecting multiple packages
Browse files Browse the repository at this point in the history
Also parameterize tests automatically
  • Loading branch information
tfoote committed Feb 3, 2025
1 parent 3885a3f commit b1f6af7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/rocker/rmw_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class RMW(RockerExtension):
rmw_map = {
'cyclonedds': ['ros-${ROS_DISTRO}-rmw-cyclonedds-cpp'],
'fastrtps' : ['ros-${ROS_DISTRO}-rmw-fastrtps-cpp'],
'zenoh' : ['ros-${ROS_DISTRO}-rmw-zenoh-cpp'],
'zenoh' : ['ros-${ROS_DISTRO}-rmw-zenoh-cpp', 'ros-${ROS_DISTRO}-zenoh-vendor'],
# Second dependency not 100% necessary but validates dual package detection in tests.
# TODO(tfoote) Enable connext with license acceptance method
# 'connextdds': ['ros-${ROS_DISTRO}-rmw-connextdds'],
}
Expand Down
17 changes: 10 additions & 7 deletions src/rocker/templates/rmw_snippet.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
@[ if rmw ]@
RUN \
if [ -z "${ROS_DISTRO}" ]; then echo "ROS_DISTRO is unset cannot override RMW" ; exit 1 ; fi ;\
if ! dpkg -l @(' '.join(packages)) | grep -q ^ii ; then \
apt-get update \
&& DEBIAN_FRONTENT=non-interactive apt-get install -qy --no-install-recommends\
@(' '.join(packages)) \
&& apt-get clean ;\
@[for package in packages]@
apt-get update ;\
if ! dpkg -l @(packages) | grep -q ^ii ; then \
DEBIAN_FRONTENT=non-interactive apt-get install -qy --no-install-recommends\
@(package) \
&& apt-get clean ;\
else \
echo "Found rmw packages @(' '.join(packages)) no need to install" ; \
fi
echo "Found rmw package @(package) no need to install" ; \
fi ; \
@[end for]@
echo "Done detecting packages for rmw"
@[ end if ]@

3 changes: 2 additions & 1 deletion test/test_rmw_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from test_extension import plugin_load_parser_correctly

from rocker.rmw_extension import RMW


class rmwExtensionTest(unittest.TestCase):
Expand Down Expand Up @@ -84,7 +85,7 @@ def test_rmw_extension(self):
plugins = list_plugins()
rmw_plugin = plugins['rmw']

rmws_to_test = ['fastrtps', 'cyclonedds', 'zenoh']
rmws_to_test = RMW.rmw_map.keys()

p = rmw_plugin()
self.assertTrue(plugin_load_parser_correctly(rmw_plugin))
Expand Down

0 comments on commit b1f6af7

Please sign in to comment.